You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmdParseFailure <- liftIO $ buildTextCmd "bare-command" v
224
+
$ set cbSigners [mkEd25519Signer' sender00 []]
225
+
$ set cbTTL defaultMaxTTL
226
+
$ set cbCreationTime iot
227
+
$ set cbChainId cid
228
+
$ set cbRPC (mkExec "(+ 1" (mkKeySetData "sender00" [sender00]))
229
+
$ defaultCmd
230
+
-- Why does pact just return 'mzero' here...
231
+
sendExpect [cmdParseFailure] (=="Validation of command at position 0 failed: Pact parsing error: Failed reading: mzero")
232
+
233
+
cmdInvalidPayloadHash <- liftIO $do
234
+
bareCmd <- buildTextCmd "bare-command" v
235
+
$ set cbSigners [mkEd25519Signer' sender00 []]
236
+
$ set cbTTL defaultMaxTTL
237
+
$ set cbCreationTime iot
238
+
$ set cbChainId cid
239
+
$ set cbRPC (mkExec "(+ 1 2)" (mkKeySetData "sender00" [sender00]))
240
+
$ defaultCmd
241
+
pure$ bareCmd
242
+
{ _cmdHash =Pact.hash "fakehash"
243
+
}
244
+
sendExpect [cmdInvalidPayloadHash] (=="Validation of command at position 0 failed: Command failed validation: The hash of the payload was invalid.")
245
+
246
+
cmdSignersSigsLengthMismatch1 <- liftIO $do
247
+
bareCmd <- buildTextCmd "bare-command" v
248
+
$ set cbSigners [mkEd25519Signer' sender00 []]
249
+
$ set cbTTL defaultMaxTTL
250
+
$ set cbCreationTime iot
251
+
$ set cbChainId cid
252
+
$ set cbRPC (mkExec "(+ 1 2)" (mkKeySetData "sender00" [sender00]))
253
+
$ defaultCmd
254
+
pure$ bareCmd
255
+
{ _cmdSigs =[]
256
+
}
257
+
sendExpect [cmdSignersSigsLengthMismatch1] (=="Validation of command at position 0 failed: Command failed validation: The number of signers and signatures do not match. Number of signers: 1. Number of signatures: 0.")
258
+
259
+
cmdSignersSigsLengthMismatch2 <- liftIO $do
260
+
bareCmd <- buildTextCmd "bare-command" v
261
+
$ set cbSigners []
262
+
$ set cbTTL defaultMaxTTL
263
+
$ set cbCreationTime iot
264
+
$ set cbChainId cid
265
+
$ set cbRPC (mkExec "(+ 1 2)" (mkKeySetData "sender00" [sender00]))
266
+
$ defaultCmd
267
+
pure$ bareCmd
268
+
{ -- This is an invalid ED25519 signature, but length signers == length signatures is checked first
269
+
_cmdSigs = [ED25519Sig"fakeSig"]
270
+
}
271
+
sendExpect [cmdSignersSigsLengthMismatch2] (=="Validation of command at position 0 failed: Command failed validation: The number of signers and signatures do not match. Number of signers: 0. Number of signatures: 1.")
272
+
273
+
-- TODO: It's hard to test for invalid schemes, because it's baked into
274
+
-- chainwebversion.
275
+
276
+
-- TODO: It's hard to test for an invalid WebAuthn signer prefix, because it's
277
+
-- baked into chainweb version.
278
+
279
+
cmdInvalidUserSig <- liftIO $do
280
+
bareCmd <- buildTextCmd "bare-command" v
281
+
$ set cbSigners [mkEd25519Signer' sender00 []]
282
+
$ set cbTTL defaultMaxTTL
283
+
$ set cbCreationTime iot
284
+
$ set cbChainId cid
285
+
$ set cbRPC (mkExec "(+ 1 2)" (mkKeySetData "sender00" [sender00]))
286
+
$ defaultCmd
287
+
pure$ bareCmd
288
+
{ _cmdSigs = [ED25519Sig"fakeSig"]
289
+
}
290
+
sendExpect [cmdInvalidUserSig] (=="Validation of command at position 0 failed: Command failed validation: The signature at position 0 is invalid: failed to parse ed25519 signature: invalid bytestring size.")
291
+
292
+
cmdGood <- liftIO $ buildTextCmd "good-command" v
293
+
$ set cbSigners [mkEd25519Signer' sender00 []]
294
+
$ set cbTTL defaultMaxTTL
295
+
$ set cbCreationTime iot
296
+
$ set cbChainId cid
297
+
$ set cbRPC (mkExec "(+ 1 2)" (mkKeySetData "sender00" [sender00]))
298
+
$ defaultCmd
299
+
-- Test that [badCmd, goodCmd] fails on badCmd, and the batch is rejected.
300
+
-- We just re-use a previously built bad cmd.
301
+
sendExpect [cmdInvalidUserSig, cmdGood] (=="Validation of command at position 0 failed: Command failed validation: The signature at position 0 is invalid: failed to parse ed25519 signature: invalid bytestring size.")
302
+
-- Test that [goodCmd, badCmd] fails on badCmd, and the batch is rejected.
303
+
-- Order matters, and the error message also indicates the position of the
304
+
-- failing tx.
305
+
-- We just re-use a previously built bad cmd.
306
+
sendExpect [cmdGood, cmdInvalidUserSig] (=="Validation of command at position 1 failed: Command failed validation: The signature at position 0 is invalid: failed to parse ed25519 signature: invalid bytestring size.")
307
+
196
308
--| Check that txlogs don't problematically access history
0 commit comments