Skip to content

Commit

Permalink
Add test with wrong signature
Browse files Browse the repository at this point in the history
  • Loading branch information
raiym committed Feb 24, 2020
1 parent 3b44919 commit ce65dcf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions smartcontract/test/keys/not-owner.pk
@@ -0,0 +1 @@
 е����c�pPI˦�@�\���� T�g�"p
28 changes: 27 additions & 1 deletion smartcontract/test/lottery-test-suite.fif
Expand Up @@ -98,4 +98,30 @@ storage !
exit_code !
."Exit code " exit_code @ . cr

exit_code @ 0 - abort"Test #3 Not passed"
exit_code @ 0 - abort"Test #3 Not passed"

// Test #4. Throw exception when wrong signature provided.

<b 0 32 u, owner_public_key @ B, 0 32 u, 0 32 u, 0 Gram, 0 Gram, owner_wc @ 32 i, owner_account_id @ 256 u, orders @ dict, b> storage !

<b 0 32 u, b> message_to_sign !

variable not_owner_private_key

"./keys/not-owner.pk" file>B not_owner_private_key !

message_to_sign @ hashu not_owner_private_key @ ed25519_sign_uint signature !
<b signature @ B, 0 32 u, b> <s message_to_send !

message_to_send @
recv_external
code
storage @
c7
runvmctx

storage !
exit_code !
."Exit code " exit_code @ . cr

exit_code @ 34 - abort"Test #4 not passed"

0 comments on commit ce65dcf

Please sign in to comment.