From 51714e7eb2ce506027c5df124dc9254bd45756a0 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Mon, 5 Jul 2021 20:14:10 +0200 Subject: [PATCH 01/22] Test contracts added --- tests/checker/good/Good.ml | 2 + .../good/gold/accounting_tests.scilla.gold | 111 ++++++ .../gold/accounting_tests_support.scilla.gold | 75 ++++ tests/contracts/accounting_tests.scilla | 334 ++++++++++++++++++ .../contracts/accounting_tests_support.scilla | 43 +++ 5 files changed, 565 insertions(+) create mode 100644 tests/checker/good/gold/accounting_tests.scilla.gold create mode 100644 tests/checker/good/gold/accounting_tests_support.scilla.gold create mode 100644 tests/contracts/accounting_tests.scilla create mode 100644 tests/contracts/accounting_tests_support.scilla diff --git a/tests/checker/good/Good.ml b/tests/checker/good/Good.ml index 1fe87650b..622503476 100644 --- a/tests/checker/good/Good.ml +++ b/tests/checker/good/Good.ml @@ -84,6 +84,8 @@ module Tests = Scilla_test.Util.DiffBasedTests (struct "polymorphic_address.scilla"; "simple-dex-remote-reads.scilla"; "type_casts.scilla"; + "accounting_tests.scilla"; + "accounting_tests_support.scilla"; ] let exit_code : UnixLabels.process_status = WEXITED 0 diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold new file mode 100644 index 000000000..1854615ed --- /dev/null +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -0,0 +1,111 @@ +{ + "cashflow_tags": { + "State variables": [ + { "field": "support_contract", "tag": "NotMoney" }, + { "field": "test_string_1", "tag": "NoInfo" }, + { "field": "test_string_2", "tag": "NoInfo" }, + { "field": "outgoing_amount", "tag": "Money" }, + { "field": "max_outgoing_msgs", "tag": "NotMoney" } + ], + "ADT constructors": [] + }, + "contract_info": { + "scilla_major_version": "0", + "vname": "AccountingTests", + "params": [ + { + "vname": "support_contract", + "type": + "ByStr20 with contract field stored_strings : List (String) end" + } + ], + "fields": [ + { "vname": "test_string_1", "type": "String", "depth": 0 }, + { "vname": "test_string_2", "type": "String", "depth": 0 }, + { "vname": "outgoing_amount", "type": "Uint128", "depth": 0 }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "depth": 0 } + ], + "transitions": [ + { "vname": "Reset", "params": [] }, + { "vname": "Test_Send_1", "params": [] }, + { "vname": "Finalize_Test_Send_1", "params": [] }, + { "vname": "Test_Send_2", "params": [] }, + { "vname": "Finalize_Test_Send_2", "params": [] }, + { "vname": "Test_Send_3", "params": [] }, + { "vname": "Test_Send_3_Helper", "params": [] }, + { "vname": "Finalize_Test_Send_3", "params": [] }, + { "vname": "Test_Send_4", "params": [] }, + { "vname": "Test_Send_5", "params": [] }, + { "vname": "Test_Send_6", "params": [] }, + { "vname": "Test_Send_7", "params": [] }, + { + "vname": "Finalize_Send_6_7", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + }, + { "vname": "Test_Send_8", "params": [] }, + { + "vname": "Finalize_Send_8_9", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + }, + { "vname": "Test_Send_9", "params": [] } + ], + "procedures": [ + { "vname": "AssertReset", "params": [] }, + { + "vname": "Finalize_Test_Send_Helper_2_Msgs", + "params": [ { "vname": "test_no", "type": "Uint128" } ] + }, + { + "vname": "CheckBalance", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + }, + { + "vname": "CheckSupportBalance", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + } + ], + "events": [], + "ADTs": [ + { + "tname": "Option", + "tparams": [ "'A" ], + "tmap": [ + { "cname": "Some", "argtypes": [ "'A" ] }, + { "cname": "None", "argtypes": [] } + ] + }, + { + "tname": "Bool", + "tparams": [], + "tmap": [ + { "cname": "True", "argtypes": [] }, + { "cname": "False", "argtypes": [] } + ] + }, + { + "tname": "Nat", + "tparams": [], + "tmap": [ + { "cname": "Zero", "argtypes": [] }, + { "cname": "Succ", "argtypes": [ "Nat" ] } + ] + }, + { + "tname": "List", + "tparams": [ "'A" ], + "tmap": [ + { "cname": "Cons", "argtypes": [ "'A", "List ('A)" ] }, + { "cname": "Nil", "argtypes": [] } + ] + }, + { + "tname": "Pair", + "tparams": [ "'A", "'B" ], + "tmap": [ { "cname": "Pair", "argtypes": [ "'A", "'B" ] } ] + } + ] + }, + "warnings": [], + "gas_remaining": "7916" +} + diff --git a/tests/checker/good/gold/accounting_tests_support.scilla.gold b/tests/checker/good/gold/accounting_tests_support.scilla.gold new file mode 100644 index 000000000..bacfa33bf --- /dev/null +++ b/tests/checker/good/gold/accounting_tests_support.scilla.gold @@ -0,0 +1,75 @@ +{ + "cashflow_tags": { + "State variables": [ + { "field": "stored_strings", "tag": "(List NoInfo)" } + ], + "ADT constructors": [] + }, + "contract_info": { + "scilla_major_version": "0", + "vname": "AccountingTestsSupport", + "params": [], + "fields": [ + { "vname": "stored_strings", "type": "List (String)", "depth": 0 } + ], + "transitions": [ + { "vname": "Reset", "params": [] }, + { + "vname": "StoreString", + "params": [ { "vname": "s", "type": "String" } ] + }, + { "vname": "Accept", "params": [] }, + { "vname": "NonAccept", "params": [] }, + { "vname": "AcceptAndCheckBalance", "params": [] } + ], + "procedures": [ + { + "vname": "CheckBalance", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + } + ], + "events": [], + "ADTs": [ + { + "tname": "Option", + "tparams": [ "'A" ], + "tmap": [ + { "cname": "Some", "argtypes": [ "'A" ] }, + { "cname": "None", "argtypes": [] } + ] + }, + { + "tname": "Bool", + "tparams": [], + "tmap": [ + { "cname": "True", "argtypes": [] }, + { "cname": "False", "argtypes": [] } + ] + }, + { + "tname": "Nat", + "tparams": [], + "tmap": [ + { "cname": "Zero", "argtypes": [] }, + { "cname": "Succ", "argtypes": [ "Nat" ] } + ] + }, + { + "tname": "List", + "tparams": [ "'A" ], + "tmap": [ + { "cname": "Cons", "argtypes": [ "'A", "List ('A)" ] }, + { "cname": "Nil", "argtypes": [] } + ] + }, + { + "tname": "Pair", + "tparams": [ "'A", "'B" ], + "tmap": [ { "cname": "Pair", "argtypes": [ "'A", "'B" ] } ] + } + ] + }, + "warnings": [], + "gas_remaining": "7999" +} + diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla new file mode 100644 index 000000000..1484470cd --- /dev/null +++ b/tests/contracts/accounting_tests.scilla @@ -0,0 +1,334 @@ +scilla_version 0 + +import ListUtils + +library Lib + +let one_msg : Message -> List Message = + fun (m : Message) => + let mty = Nil { Message } in + Cons { Message } m mty + +let list_head_string = @list_head String +let list_eq_string = + let string_eq = fun (x : String) => fun (y : String) => builtin eq x y in + let list_eq_string = @list_eq String in + list_eq_string string_eq + +contract AccountingTests(support_contract : ByStr20 with contract field stored_strings : List String end) + +field test_string_1 : String = "Hello" +field test_string_2 : String = "World" + +field outgoing_amount : Uint128 = Uint128 10 +field max_outgoing_msgs : Uint128 = Uint128 2 + +transition Reset() + msg = { _recipient : support_contract; + _tag : "Reset"; + _amount : Uint128 0 }; + msgs = one_msg msg; + send msgs; + accept +end + +procedure AssertReset() + ss <- & support_contract.stored_strings; + cur_head = list_head_string ss; + match cur_head with + | None => (* OK *) + | Some _ => + e = { _exception : "Support contract not reset" }; + throw e + end; + (* Ensure that sufficient balance is available *) + amount <- outgoing_amount; + max_msgs <- max_outgoing_msgs; + minimum = builtin mul amount max_msgs; + bal <- _balance; + insufficient_balance = builtin lt bal minimum; + match insufficient_balance with + | False => (* OK *) + | True => + e = { _exception : "Insufficient balance for tests" }; + throw e + end +end + +(* ********************************************************* *) +(* TESTS OF THE ORDER OF SENT MESSAGES *) +(* ********************************************************* *) + +(* Test that multiple sends result in messages being processed in the order of the sends *) +transition Test_Send_1() + AssertReset; + s1 <- test_string_1; + msg1 = { _recipient : support_contract; + _tag : "StoreString"; + _amount : Uint128 0; + s : s1}; + msgs1 = one_msg msg1; + send msgs1; + s2 <- test_string_2; + msg2 = { _recipient : support_contract; + _tag : "StoreString"; + _amount : Uint128 0; + s : s2}; + msgs2 = one_msg msg2; + send msgs2; + msg_final = { _recipient : _this_address; + _tag : "Finalize_Test_Send_1"; + _amount : Uint128 0}; + msgs_final = one_msg msg_final; + send msgs_final +end + +procedure Finalize_Test_Send_Helper_2_Msgs(test_no : Uint128) + s1 <- test_string_1; + s2 <- test_string_2; + expected = + let mty = Nil { String } in + let fst = Cons { String } s1 mty in + Cons { String } s2 fst; + actual <- & support_contract.stored_strings; + res = list_eq_string expected actual; + match res with + | True => (* Ok *) + | False => + e = { _exception : "Test_Send failed"; test_no: test_no; expected : expected; actual : actual }; + throw e + end +end + +(* Check that the stored strings at the support contract are in the correct order *) +transition Finalize_Test_Send_1() + x = Uint128 1; + Finalize_Test_Send_Helper_2_Msgs x +end + +(* Test that a send with multiple messages result in messages being processed in the order the messages are added to the argument list *) +transition Test_Send_2() + AssertReset; + s1 <- test_string_1; + msg1 = { _recipient : support_contract; + _tag : "StoreString"; + _amount : Uint128 0; + s : s1}; + msgs1 = one_msg msg1; + s2 <- test_string_2; + msg2 = { _recipient : support_contract; + _tag : "StoreString"; + _amount : Uint128 0; + s : s2}; + msgs = Cons { Message } msg2 msgs1; + send msgs; + msg_final = { _recipient : _this_address; + _tag : "Finalize_Test_Send_2"; + _amount : Uint128 0}; + msgs_final = one_msg msg_final; + send msgs_final +end + +(* Check that the stored strings at the support contract are in the correct order *) +transition Finalize_Test_Send_2() + x = Uint128 2; + Finalize_Test_Send_Helper_2_Msgs x +end + +(* Test that outgoing messages are processed depth-first *) +transition Test_Send_3() + AssertReset; + s1 <- test_string_1; + msg1 = { _recipient : _this_address; + _tag : "Test_Send_3_Helper"; + _amount : Uint128 0}; + msgs1 = one_msg msg1; + send msgs1; + s2 <- test_string_2; + msg2 = { _recipient : support_contract; + _tag : "StoreString"; + _amount : Uint128 0; + s : s2}; + msgs2 = one_msg msg2; + send msgs2; + msg_final = { _recipient : _this_address; + _tag : "Finalize_Test_Send_3"; + _amount : Uint128 0}; + msgs_final = one_msg msg_final; + send msgs_final +end + +(* Test that outgoing messages are processed depth-first *) +transition Test_Send_3_Helper() + s1 <- test_string_1; + msg1 = { _recipient : support_contract; + _tag : "StoreString"; + _amount : Uint128 0; + s : s1}; + msgs1 = one_msg msg1; + send msgs1 +end + +(* Check that the stored strings at the support contract are in the correct order *) +transition Finalize_Test_Send_3() + x = Uint128 3; + Finalize_Test_Send_Helper_2_Msgs x +end + +(* ********************************************************* *) +(* TESTS OF SEND AND ACCEPT OF ZIL *) +(* ********************************************************* *) + +(* Send should deduct from the current contract's balance. Message construction should not *) +(* Send of multiple messages should deduct all sent money from the current contract's balance. *) +(* Remote read of current contract's balance should be identical to _balance at all times - THIS DOESN'T WORK AFTER ACCEPT BECAUSE OF A MISSING CORNER CASE IN EvalUtil.ml *) +(* Accept should increase current contract's balance, but not decrease sender's balance - THIS DOESN'T WORK BECAUSE OF A CORNER CASE THAT SHOULDN'T BE TREATED AS A CORNER CASE *) +(* Non-acceptance should result in an increase of the sender's balance by the amount in the message *) + +procedure CheckBalance(expected_balance : Uint128) + cur_balance <- _balance; + is_expected = builtin eq expected_balance cur_balance; + match is_expected with + | True => (* OK *) + | False => + e = { _exception : "Unexpected balance"; + expected : expected_balance; + actual : cur_balance }; + throw e + end +end + +procedure CheckSupportBalance(expected_balance : Uint128) + cur_balance <- & support_contract._balance; + is_expected = builtin eq expected_balance cur_balance; + match is_expected with + | True => (* OK *) + | False => + e = { _exception : "Main contract read unexpected support contract balance"; + expected : expected_balance; + actual : cur_balance }; + throw e + end +end + +(* Check that the current contract's balance is decreased when sending funds in single messages *) +transition Test_Send_4() + AssertReset; + amount <- outgoing_amount; + init_bal <- _balance; + msg1 = { _recipient : support_contract; + _tag : "Accept"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + expected_intermediate_balance = builtin sub init_bal amount; + CheckBalance expected_intermediate_balance; + msg2 = { _recipient : support_contract; + _tag : "NonAccept"; + _amount : amount}; + msgs2 = one_msg msg2; + send msgs2; + expected_final_balance = builtin sub expected_intermediate_balance amount; + CheckBalance expected_final_balance +end + +(* Check that the current contract's balance is decreased when sending funds in multiple messages in a single send *) +transition Test_Send_5() + AssertReset; + amount <- outgoing_amount; + init_bal <- _balance; + msg1 = { _recipient : support_contract; + _tag : "Accept"; + _amount : amount}; + msgs1 = one_msg msg1; + msg2 = { _recipient : support_contract; + _tag : "NonAccept"; + _amount : amount}; + msgs = Cons {Message} msg2 msgs1; + send msgs; + expected_intermediate_balance = builtin sub init_bal amount; + expected_final_balance = builtin sub expected_intermediate_balance amount; + CheckBalance expected_final_balance +end + +(* Check that funds are transferred on acceptance *) +transition Test_Send_6() + AssertReset; + amount <- outgoing_amount; + bal <- _balance; + msg1 = { _recipient : support_contract; + _tag : "Accept"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + expected_balance = builtin sub bal amount; + msg2 = { _recipient : _this_address; + _tag : "Finalize_Send_6_7"; + _amount : Uint128 0; + expected_balance : expected_balance }; + msgs2 = one_msg msg2; + send msgs2 +end + +(* Check that funds are returned on non-acceptance *) +transition Test_Send_7() + AssertReset; + amount <- outgoing_amount; + bal <- _balance; + msg1 = { _recipient : support_contract; + _tag : "NonAccept"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + msg2 = { _recipient : _this_address; + _tag : "Finalize_Send_6_7"; + _amount : Uint128 0; + expected_balance : bal }; + msgs2 = one_msg msg2; + send msgs2 +end + +transition Finalize_Send_6_7(expected_balance : Uint128) + CheckBalance expected_balance +end + +(* Check that the recipient's balance isn't updated until the funds are accepted *) +transition Test_Send_8() + AssertReset; + amount <- outgoing_amount; + msg1 = { _recipient : support_contract; + _tag : "AcceptAndCheckBalance"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + support_bal <- & support_contract._balance; + expected_balance = builtin add support_bal amount; + msg2 = { _recipient : _this_address; + _tag : "Finalize_Send_8_9"; + _amount : Uint128 0; + expected_balance : expected_balance }; + msgs2 = one_msg msg2; + send msgs2 +end + +transition Finalize_Send_8_9(expected_balance : Uint128) + CheckSupportBalance expected_balance +end + +(* Check that the recipient's balance isn't updated if funds are not accepted *) +transition Test_Send_9() + AssertReset; + amount <- outgoing_amount; + msg1 = { _recipient : support_contract; + _tag : "NonAccept"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + support_bal <- & support_contract._balance; + msg2 = { _recipient : _this_address; + _tag : "Finalize_Send_8_9"; + _amount : Uint128 0; + expected_balance : support_bal }; + msgs2 = one_msg msg2; + send msgs2 +end diff --git a/tests/contracts/accounting_tests_support.scilla b/tests/contracts/accounting_tests_support.scilla new file mode 100644 index 000000000..909ba51da --- /dev/null +++ b/tests/contracts/accounting_tests_support.scilla @@ -0,0 +1,43 @@ +scilla_version 0 + +contract AccountingTestsSupport() + +field stored_strings : List String = Nil { String } + +transition Reset() + new_strings = Nil { String }; + stored_strings := new_strings +end + +transition StoreString (s : String) + old_strings <- stored_strings; + new_strings = Cons { String } s old_strings; + stored_strings := new_strings +end + +transition Accept() + accept +end + +transition NonAccept() +end + +procedure CheckBalance(expected_balance : Uint128) + cur_balance <- _balance; + is_expected = builtin eq expected_balance cur_balance; + match is_expected with + | True => (* OK *) + | False => + e = { _exception : "Unexpected balance at support contract"; + expected : expected_balance; + actual : cur_balance }; + throw e + end +end + +transition AcceptAndCheckBalance() + init_bal <- _balance; + accept; + expected_balance = builtin add init_bal _amount; + CheckBalance expected_balance +end From 884752b546527c318ccce81f8fcafc5483017350 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Mon, 5 Jul 2021 20:16:36 +0200 Subject: [PATCH 02/22] Fixed incorrect constant --- tests/contracts/accounting_tests.scilla | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index 1484470cd..3912a8e64 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -21,7 +21,7 @@ field test_string_1 : String = "Hello" field test_string_2 : String = "World" field outgoing_amount : Uint128 = Uint128 10 -field max_outgoing_msgs : Uint128 = Uint128 2 +field max_outgoing_msgs : Uint128 = Uint128 3 transition Reset() msg = { _recipient : support_contract; From 0e9e69b12c9aedc4d9e6cb3290c1961d8d132f18 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Tue, 6 Jul 2021 18:51:02 +0200 Subject: [PATCH 03/22] First test added, and improved error message for missing field in remote read --- src/eval/EvalUtil.ml | 5 ++- tests/runner/Testcontracts.ml | 2 + .../runner/accounting_tests/blockchain_1.json | 1 + tests/runner/accounting_tests/init.json | 22 +++++++++ .../runner/accounting_tests/init_output.json | 0 tests/runner/accounting_tests/init_state.json | 18 ++++++++ tests/runner/accounting_tests/message_1.json | 7 +++ tests/runner/accounting_tests/output_1.json | 21 +++++++++ tests/runner/accounting_tests/state_1.json | 45 +++++++++++++++++++ 9 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_1.json create mode 100644 tests/runner/accounting_tests/init.json create mode 100644 tests/runner/accounting_tests/init_output.json create mode 100644 tests/runner/accounting_tests/init_state.json create mode 100644 tests/runner/accounting_tests/message_1.json create mode 100644 tests/runner/accounting_tests/output_1.json create mode 100644 tests/runner/accounting_tests/state_1.json diff --git a/src/eval/EvalUtil.ml b/src/eval/EvalUtil.ml index ca5854fc5..7af21f16a 100644 --- a/src/eval/EvalUtil.ml +++ b/src/eval/EvalUtil.ml @@ -233,8 +233,9 @@ module Configuration = struct else pure v | _ -> fail1 - (Printf.sprintf "Error loading field %s" - (EvalName.as_error_string (get_id k))) + (Printf.sprintf "Error loading remote field %s at address %s" + (EvalName.as_error_string (get_id k)) + (SLiteral.Bystrx.hex_encoding caddr)) (ER.get_loc (get_rep k)) let remote_field_type caddr k = diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index f6966aedd..c2cdab73f 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -470,6 +470,8 @@ let contract_tests env = "address_list_traversal" succ_code 1 2 []; "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; + "accounting_tests" + >::: build_contract_tests env "accounting_tests" succ_code 1 1 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" diff --git a/tests/runner/accounting_tests/blockchain_1.json b/tests/runner/accounting_tests/blockchain_1.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_1.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/init.json b/tests/runner/accounting_tests/init.json new file mode 100644 index 000000000..fc54c8ab1 --- /dev/null +++ b/tests/runner/accounting_tests/init.json @@ -0,0 +1,22 @@ +[ + { + "vname" : "_scilla_version", + "type" : "Uint32", + "value" : "0" + }, + { + "vname" : "_this_address", + "type" : "ByStr20", + "value" : "0x3620c286757a29985cee194eb90064270fb65414" + }, + { + "vname" : "_creation_block", + "type" : "BNum", + "value" : "1" + }, + { + "vname" : "support_contract", + "type" : "ByStr20", + "value" : "0xabfeccdc9012345678901234567890f777564323" + } +] diff --git a/tests/runner/accounting_tests/init_output.json b/tests/runner/accounting_tests/init_output.json new file mode 100644 index 000000000..e69de29bb diff --git a/tests/runner/accounting_tests/init_state.json b/tests/runner/accounting_tests/init_state.json new file mode 100644 index 000000000..024378312 --- /dev/null +++ b/tests/runner/accounting_tests/init_state.json @@ -0,0 +1,18 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "42" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/message_1.json b/tests/runner/accounting_tests/message_1.json new file mode 100644 index 000000000..0bb44d81b --- /dev/null +++ b/tests/runner/accounting_tests/message_1.json @@ -0,0 +1,7 @@ +{ + "_tag": "Reset", + "_amount": "30", + "_sender": "0xabfeccdc9012345678901234567890f777564322", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_1.json b/tests/runner/accounting_tests/output_1.json new file mode 100644 index 000000000..9bbff1e1a --- /dev/null +++ b/tests/runner/accounting_tests/output_1.json @@ -0,0 +1,21 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7951", + "_accepted": "true", + "messages": [ + { + "_tag": "Reset", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_1.json b/tests/runner/accounting_tests/state_1.json new file mode 100644 index 000000000..8e9bc55ab --- /dev/null +++ b/tests/runner/accounting_tests/state_1.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] From 5a8a51c1a56ad800eae7286af90715e5c5072608 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Thu, 8 Jul 2021 19:44:28 +0200 Subject: [PATCH 04/22] Support contract tests --- tests/runner/Testcontracts.ml | 6 ++- .../blockchain_1.json | 1 + .../blockchain_2.json | 1 + .../blockchain_3.json | 1 + .../runner/accounting_tests_support/init.json | 17 +++++++ .../accounting_tests_support/message_1.json | 7 +++ .../accounting_tests_support/message_2.json | 13 +++++ .../accounting_tests_support/message_3.json | 7 +++ .../accounting_tests_support/output_1.json | 11 +++++ .../accounting_tests_support/output_2.json | 15 ++++++ .../accounting_tests_support/output_3.json | 11 +++++ .../accounting_tests_support/state_1.json | 48 +++++++++++++++++++ .../accounting_tests_support/state_2.json | 48 +++++++++++++++++++ .../accounting_tests_support/state_3.json | 48 +++++++++++++++++++ 14 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 tests/runner/accounting_tests_support/blockchain_1.json create mode 100644 tests/runner/accounting_tests_support/blockchain_2.json create mode 100644 tests/runner/accounting_tests_support/blockchain_3.json create mode 100644 tests/runner/accounting_tests_support/init.json create mode 100644 tests/runner/accounting_tests_support/message_1.json create mode 100644 tests/runner/accounting_tests_support/message_2.json create mode 100644 tests/runner/accounting_tests_support/message_3.json create mode 100644 tests/runner/accounting_tests_support/output_1.json create mode 100644 tests/runner/accounting_tests_support/output_2.json create mode 100644 tests/runner/accounting_tests_support/output_3.json create mode 100644 tests/runner/accounting_tests_support/state_1.json create mode 100644 tests/runner/accounting_tests_support/state_2.json create mode 100644 tests/runner/accounting_tests_support/state_3.json diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index c2cdab73f..32c91f935 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,7 +471,9 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 1 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 2 []; + "accounting_tests_support" + >::: build_contract_tests env "accounting_tests_support" succ_code 1 3 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" @@ -573,6 +575,8 @@ let contract_tests env = >: build_contract_init_test env fail_code "address_list_as_cparam" "init_address_type" ~is_library:false ~ipc_mode:true; + "accounting_tests" + >::: build_contract_tests env "accounting_tests" fail_code 100 101 []; ]; "misc_tests" >::: build_misc_tests env; ] diff --git a/tests/runner/accounting_tests_support/blockchain_1.json b/tests/runner/accounting_tests_support/blockchain_1.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_1.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/blockchain_2.json b/tests/runner/accounting_tests_support/blockchain_2.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_2.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/blockchain_3.json b/tests/runner/accounting_tests_support/blockchain_3.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_3.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/init.json b/tests/runner/accounting_tests_support/init.json new file mode 100644 index 000000000..d216b5a39 --- /dev/null +++ b/tests/runner/accounting_tests_support/init.json @@ -0,0 +1,17 @@ +[ + { + "vname" : "_scilla_version", + "type" : "Uint32", + "value" : "0" + }, + { + "vname" : "_this_address", + "type" : "ByStr20", + "value" : "0xabfeccdc9012345678901234567890f777564323" + }, + { + "vname" : "_creation_block", + "type" : "BNum", + "value" : "1" + } +] diff --git a/tests/runner/accounting_tests_support/message_1.json b/tests/runner/accounting_tests_support/message_1.json new file mode 100644 index 000000000..c733b3821 --- /dev/null +++ b/tests/runner/accounting_tests_support/message_1.json @@ -0,0 +1,7 @@ +{ + "_tag": "Reset", + "_amount": "30", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests_support/message_2.json b/tests/runner/accounting_tests_support/message_2.json new file mode 100644 index 000000000..17b56237b --- /dev/null +++ b/tests/runner/accounting_tests_support/message_2.json @@ -0,0 +1,13 @@ +{ + "_tag": "StoreString", + "_amount": "30", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { + "vname" : "s", + "type" : "String", + "value" : "World" + } + ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests_support/message_3.json b/tests/runner/accounting_tests_support/message_3.json new file mode 100644 index 000000000..8abe0faa4 --- /dev/null +++ b/tests/runner/accounting_tests_support/message_3.json @@ -0,0 +1,7 @@ +{ + "_tag": "AcceptAndCheckBalance", + "_amount": "10", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests_support/output_1.json b/tests/runner/accounting_tests_support/output_1.json new file mode 100644 index 000000000..43ae1b8aa --- /dev/null +++ b/tests/runner/accounting_tests_support/output_1.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7975", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/output_2.json b/tests/runner/accounting_tests_support/output_2.json new file mode 100644 index 000000000..4e1bfdbfc --- /dev/null +++ b/tests/runner/accounting_tests_support/output_2.json @@ -0,0 +1,15 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7952", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { + "vname": "stored_strings", + "type": "List (String)", + "value": [ "World", "Hello" ] + } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/output_3.json b/tests/runner/accounting_tests_support/output_3.json new file mode 100644 index 000000000..a0a9cf679 --- /dev/null +++ b/tests/runner/accounting_tests_support/output_3.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7966", + "_accepted": "true", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/state_1.json b/tests/runner/accounting_tests_support/state_1.json new file mode 100644 index 000000000..4453be269 --- /dev/null +++ b/tests/runner/accounting_tests_support/state_1.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ "Hello" ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests_support/state_2.json b/tests/runner/accounting_tests_support/state_2.json new file mode 100644 index 000000000..4453be269 --- /dev/null +++ b/tests/runner/accounting_tests_support/state_2.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ "Hello" ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests_support/state_3.json b/tests/runner/accounting_tests_support/state_3.json new file mode 100644 index 000000000..48c04892b --- /dev/null +++ b/tests/runner/accounting_tests_support/state_3.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] From 62607605ecd4c1df8ffc21f5c8ffa32cd2040b86 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Fri, 9 Jul 2021 12:56:30 +0200 Subject: [PATCH 05/22] Testing of test 1 --- tests/runner/Testcontracts.ml | 4 +- .../accounting_tests/blockchain_100.json | 1 + .../accounting_tests/blockchain_101.json | 1 + .../accounting_tests/blockchain_102.json | 1 + .../accounting_tests/blockchain_103.json | 1 + .../accounting_tests/blockchain_104.json | 1 + .../runner/accounting_tests/blockchain_2.json | 1 + .../runner/accounting_tests/blockchain_3.json | 1 + .../runner/accounting_tests/message_100.json | 7 +++ .../runner/accounting_tests/message_101.json | 7 +++ .../runner/accounting_tests/message_102.json | 7 +++ .../runner/accounting_tests/message_103.json | 7 +++ .../runner/accounting_tests/message_104.json | 7 +++ tests/runner/accounting_tests/message_2.json | 7 +++ tests/runner/accounting_tests/message_3.json | 7 +++ tests/runner/accounting_tests/output_100.json | 25 +++++++++ tests/runner/accounting_tests/output_101.json | 25 +++++++++ tests/runner/accounting_tests/output_102.json | 25 +++++++++ tests/runner/accounting_tests/output_103.json | 25 +++++++++ tests/runner/accounting_tests/output_104.json | 25 +++++++++ tests/runner/accounting_tests/output_2.json | 33 +++++++++++ tests/runner/accounting_tests/output_3.json | 14 +++++ tests/runner/accounting_tests/state_100.json | 45 +++++++++++++++ tests/runner/accounting_tests/state_101.json | 56 +++++++++++++++++++ tests/runner/accounting_tests/state_102.json | 45 +++++++++++++++ tests/runner/accounting_tests/state_103.json | 45 +++++++++++++++ tests/runner/accounting_tests/state_104.json | 45 +++++++++++++++ tests/runner/accounting_tests/state_2.json | 45 +++++++++++++++ tests/runner/accounting_tests/state_3.json | 45 +++++++++++++++ 29 files changed, 556 insertions(+), 2 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_100.json create mode 100644 tests/runner/accounting_tests/blockchain_101.json create mode 100644 tests/runner/accounting_tests/blockchain_102.json create mode 100644 tests/runner/accounting_tests/blockchain_103.json create mode 100644 tests/runner/accounting_tests/blockchain_104.json create mode 100644 tests/runner/accounting_tests/blockchain_2.json create mode 100644 tests/runner/accounting_tests/blockchain_3.json create mode 100644 tests/runner/accounting_tests/message_100.json create mode 100644 tests/runner/accounting_tests/message_101.json create mode 100644 tests/runner/accounting_tests/message_102.json create mode 100644 tests/runner/accounting_tests/message_103.json create mode 100644 tests/runner/accounting_tests/message_104.json create mode 100644 tests/runner/accounting_tests/message_2.json create mode 100644 tests/runner/accounting_tests/message_3.json create mode 100644 tests/runner/accounting_tests/output_100.json create mode 100644 tests/runner/accounting_tests/output_101.json create mode 100644 tests/runner/accounting_tests/output_102.json create mode 100644 tests/runner/accounting_tests/output_103.json create mode 100644 tests/runner/accounting_tests/output_104.json create mode 100644 tests/runner/accounting_tests/output_2.json create mode 100644 tests/runner/accounting_tests/output_3.json create mode 100644 tests/runner/accounting_tests/state_100.json create mode 100644 tests/runner/accounting_tests/state_101.json create mode 100644 tests/runner/accounting_tests/state_102.json create mode 100644 tests/runner/accounting_tests/state_103.json create mode 100644 tests/runner/accounting_tests/state_104.json create mode 100644 tests/runner/accounting_tests/state_2.json create mode 100644 tests/runner/accounting_tests/state_3.json diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index 32c91f935..16da44d27 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,7 +471,7 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 2 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 3 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" succ_code 1 3 []; "addfunds_proxy" @@ -576,7 +576,7 @@ let contract_tests env = "address_list_as_cparam" "init_address_type" ~is_library:false ~ipc_mode:true; "accounting_tests" - >::: build_contract_tests env "accounting_tests" fail_code 100 101 []; + >::: build_contract_tests env "accounting_tests" fail_code 100 104 []; ]; "misc_tests" >::: build_misc_tests env; ] diff --git a/tests/runner/accounting_tests/blockchain_100.json b/tests/runner/accounting_tests/blockchain_100.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_100.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_101.json b/tests/runner/accounting_tests/blockchain_101.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_101.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_102.json b/tests/runner/accounting_tests/blockchain_102.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_102.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_103.json b/tests/runner/accounting_tests/blockchain_103.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_103.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_104.json b/tests/runner/accounting_tests/blockchain_104.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_104.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_2.json b/tests/runner/accounting_tests/blockchain_2.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_2.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_3.json b/tests/runner/accounting_tests/blockchain_3.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_3.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_100.json b/tests/runner/accounting_tests/message_100.json new file mode 100644 index 000000000..2b3ec847e --- /dev/null +++ b/tests/runner/accounting_tests/message_100.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_1", + "_amount": "0", + "_sender": "0xabfeccdc9012345678901234567890f777564322", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_101.json b/tests/runner/accounting_tests/message_101.json new file mode 100644 index 000000000..2b3ec847e --- /dev/null +++ b/tests/runner/accounting_tests/message_101.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_1", + "_amount": "0", + "_sender": "0xabfeccdc9012345678901234567890f777564322", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_102.json b/tests/runner/accounting_tests/message_102.json new file mode 100644 index 000000000..2b3ec847e --- /dev/null +++ b/tests/runner/accounting_tests/message_102.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_1", + "_amount": "0", + "_sender": "0xabfeccdc9012345678901234567890f777564322", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_103.json b/tests/runner/accounting_tests/message_103.json new file mode 100644 index 000000000..2b3ec847e --- /dev/null +++ b/tests/runner/accounting_tests/message_103.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_1", + "_amount": "0", + "_sender": "0xabfeccdc9012345678901234567890f777564322", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_104.json b/tests/runner/accounting_tests/message_104.json new file mode 100644 index 000000000..91a6bd6d8 --- /dev/null +++ b/tests/runner/accounting_tests/message_104.json @@ -0,0 +1,7 @@ +{ + "_tag": "Finalize_Test_Send_1", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_2.json b/tests/runner/accounting_tests/message_2.json new file mode 100644 index 000000000..2b3ec847e --- /dev/null +++ b/tests/runner/accounting_tests/message_2.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_1", + "_amount": "0", + "_sender": "0xabfeccdc9012345678901234567890f777564322", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_3.json b/tests/runner/accounting_tests/message_3.json new file mode 100644 index 000000000..91a6bd6d8 --- /dev/null +++ b/tests/runner/accounting_tests/message_3.json @@ -0,0 +1,7 @@ +{ + "_tag": "Finalize_Test_Send_1", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_100.json b/tests/runner/accounting_tests/output_100.json new file mode 100644 index 000000000..f8b886b13 --- /dev/null +++ b/tests/runner/accounting_tests/output_100.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7946", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Insufficient balance for tests\"))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 54, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Test_Send_1", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 63, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_101.json b/tests/runner/accounting_tests/output_101.json new file mode 100644 index 000000000..2b779a01f --- /dev/null +++ b/tests/runner/accounting_tests/output_101.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7957", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Support contract not reset\"))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 42, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Test_Send_1", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 63, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_102.json b/tests/runner/accounting_tests/output_102.json new file mode 100644 index 000000000..2b779a01f --- /dev/null +++ b/tests/runner/accounting_tests/output_102.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7957", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Support contract not reset\"))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 42, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Test_Send_1", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 63, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_103.json b/tests/runner/accounting_tests/output_103.json new file mode 100644 index 000000000..f8b886b13 --- /dev/null +++ b/tests/runner/accounting_tests/output_103.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7946", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Insufficient balance for tests\"))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 54, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Test_Send_1", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 63, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_104.json b/tests/runner/accounting_tests/output_104.json new file mode 100644 index 000000000..6899af226 --- /dev/null +++ b/tests/runner/accounting_tests/output_104.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7922", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Test_Send failed\")) ; (test_no : (Uint128 1)) ; (expected : (List (String \"World\"), (String \"Hello\"), (Nil))) ; (actual : (List (String \"Hello\"), (String \"World\"), (Nil)))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 99, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Finalize_Test_Send_1", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 104, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_2.json b/tests/runner/accounting_tests/output_2.json new file mode 100644 index 000000000..df2edec3c --- /dev/null +++ b/tests/runner/accounting_tests/output_2.json @@ -0,0 +1,33 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7891", + "_accepted": "false", + "messages": [ + { + "_tag": "StoreString", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [ { "vname": "s", "type": "String", "value": "Hello" } ] + }, + { + "_tag": "StoreString", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [ { "vname": "s", "type": "String", "value": "World" } ] + }, + { + "_tag": "Finalize_Test_Send_1", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_3.json b/tests/runner/accounting_tests/output_3.json new file mode 100644 index 000000000..6b8f8d2bb --- /dev/null +++ b/tests/runner/accounting_tests/output_3.json @@ -0,0 +1,14 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7942", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_100.json b/tests/runner/accounting_tests/state_100.json new file mode 100644 index 000000000..71cbd19a6 --- /dev/null +++ b/tests/runner/accounting_tests/state_100.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_101.json b/tests/runner/accounting_tests/state_101.json new file mode 100644 index 000000000..cdd6d053b --- /dev/null +++ b/tests/runner/accounting_tests/state_101.json @@ -0,0 +1,56 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", + "type": "List String", + "value": { "constructor": "Cons", + "argtypes": ["String"], + "arguments": [ + "Hello", + { + "constructor": "Nil", + "argtypes": [ "String" ], + "arguments": [] + } + ] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_102.json b/tests/runner/accounting_tests/state_102.json new file mode 100644 index 000000000..1b89dd470 --- /dev/null +++ b/tests/runner/accounting_tests/state_102.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": [ "Hello" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_103.json b/tests/runner/accounting_tests/state_103.json new file mode 100644 index 000000000..30db96602 --- /dev/null +++ b/tests/runner/accounting_tests/state_103.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "29" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_104.json b/tests/runner/accounting_tests/state_104.json new file mode 100644 index 000000000..61bd10ab7 --- /dev/null +++ b/tests/runner/accounting_tests/state_104.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ "Hello", "World" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_2.json b/tests/runner/accounting_tests/state_2.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_2.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_3.json b/tests/runner/accounting_tests/state_3.json new file mode 100644 index 000000000..dd2dae293 --- /dev/null +++ b/tests/runner/accounting_tests/state_3.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ "World", "Hello" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] From e50cd1d243ad37b8bca73f2de7d337ca938585df Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Mon, 12 Jul 2021 10:57:41 +0200 Subject: [PATCH 06/22] Test ordering of multi-message sends --- tests/contracts/accounting_tests.scilla | 6 +-- tests/runner/Testcontracts.ml | 4 +- .../accounting_tests/blockchain_105.json | 1 + .../runner/accounting_tests/blockchain_4.json | 1 + .../runner/accounting_tests/blockchain_5.json | 1 + .../runner/accounting_tests/message_105.json | 7 +++ tests/runner/accounting_tests/message_4.json | 7 +++ tests/runner/accounting_tests/message_5.json | 7 +++ tests/runner/accounting_tests/output_105.json | 25 +++++++++++ tests/runner/accounting_tests/output_4.json | 33 ++++++++++++++ tests/runner/accounting_tests/output_5.json | 14 ++++++ tests/runner/accounting_tests/state_105.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_4.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_5.json | 45 +++++++++++++++++++ 14 files changed, 236 insertions(+), 5 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_105.json create mode 100644 tests/runner/accounting_tests/blockchain_4.json create mode 100644 tests/runner/accounting_tests/blockchain_5.json create mode 100644 tests/runner/accounting_tests/message_105.json create mode 100644 tests/runner/accounting_tests/message_4.json create mode 100644 tests/runner/accounting_tests/message_5.json create mode 100644 tests/runner/accounting_tests/output_105.json create mode 100644 tests/runner/accounting_tests/output_4.json create mode 100644 tests/runner/accounting_tests/output_5.json create mode 100644 tests/runner/accounting_tests/state_105.json create mode 100644 tests/runner/accounting_tests/state_4.json create mode 100644 tests/runner/accounting_tests/state_5.json diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index 3912a8e64..680441e70 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -106,7 +106,7 @@ transition Finalize_Test_Send_1() Finalize_Test_Send_Helper_2_Msgs x end -(* Test that a send with multiple messages result in messages being processed in the order the messages are added to the argument list *) +(* Test that a send with multiple messages result in messages being processed in the order that the messages appear in in the argument list *) transition Test_Send_2() AssertReset; s1 <- test_string_1; @@ -114,13 +114,13 @@ transition Test_Send_2() _tag : "StoreString"; _amount : Uint128 0; s : s1}; - msgs1 = one_msg msg1; s2 <- test_string_2; msg2 = { _recipient : support_contract; _tag : "StoreString"; _amount : Uint128 0; s : s2}; - msgs = Cons { Message } msg2 msgs1; + msgs_tmp = one_msg msg2; + msgs = Cons { Message } msg1 msgs_tmp; send msgs; msg_final = { _recipient : _this_address; _tag : "Finalize_Test_Send_2"; diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index 16da44d27..f19f99511 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,7 +471,7 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 3 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 4 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" succ_code 1 3 []; "addfunds_proxy" @@ -576,7 +576,7 @@ let contract_tests env = "address_list_as_cparam" "init_address_type" ~is_library:false ~ipc_mode:true; "accounting_tests" - >::: build_contract_tests env "accounting_tests" fail_code 100 104 []; + >::: build_contract_tests env "accounting_tests" fail_code 100 105 []; ]; "misc_tests" >::: build_misc_tests env; ] diff --git a/tests/runner/accounting_tests/blockchain_105.json b/tests/runner/accounting_tests/blockchain_105.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_105.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_4.json b/tests/runner/accounting_tests/blockchain_4.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_4.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_5.json b/tests/runner/accounting_tests/blockchain_5.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_5.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_105.json b/tests/runner/accounting_tests/message_105.json new file mode 100644 index 000000000..cc826cf87 --- /dev/null +++ b/tests/runner/accounting_tests/message_105.json @@ -0,0 +1,7 @@ +{ + "_tag": "Finalize_Test_Send_2", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_4.json b/tests/runner/accounting_tests/message_4.json new file mode 100644 index 000000000..476f132f5 --- /dev/null +++ b/tests/runner/accounting_tests/message_4.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_2", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_5.json b/tests/runner/accounting_tests/message_5.json new file mode 100644 index 000000000..cc826cf87 --- /dev/null +++ b/tests/runner/accounting_tests/message_5.json @@ -0,0 +1,7 @@ +{ + "_tag": "Finalize_Test_Send_2", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_105.json b/tests/runner/accounting_tests/output_105.json new file mode 100644 index 000000000..1a6cacabf --- /dev/null +++ b/tests/runner/accounting_tests/output_105.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7922", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Test_Send failed\")) ; (test_no : (Uint128 2)) ; (expected : (List (String \"World\"), (String \"Hello\"), (Nil))) ; (actual : (List (String \"Hello\"), (String \"World\"), (Nil)))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 99, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Finalize_Test_Send_2", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 133, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_4.json b/tests/runner/accounting_tests/output_4.json new file mode 100644 index 000000000..b878d5dd6 --- /dev/null +++ b/tests/runner/accounting_tests/output_4.json @@ -0,0 +1,33 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7892", + "_accepted": "false", + "messages": [ + { + "_tag": "StoreString", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [ { "vname": "s", "type": "String", "value": "Hello" } ] + }, + { + "_tag": "StoreString", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [ { "vname": "s", "type": "String", "value": "World" } ] + }, + { + "_tag": "Finalize_Test_Send_2", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_5.json b/tests/runner/accounting_tests/output_5.json new file mode 100644 index 000000000..a5a495831 --- /dev/null +++ b/tests/runner/accounting_tests/output_5.json @@ -0,0 +1,14 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7942", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} diff --git a/tests/runner/accounting_tests/state_105.json b/tests/runner/accounting_tests/state_105.json new file mode 100644 index 000000000..61bd10ab7 --- /dev/null +++ b/tests/runner/accounting_tests/state_105.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ "Hello", "World" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_4.json b/tests/runner/accounting_tests/state_4.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_4.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_5.json b/tests/runner/accounting_tests/state_5.json new file mode 100644 index 000000000..dd2dae293 --- /dev/null +++ b/tests/runner/accounting_tests/state_5.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ "World", "Hello" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] From 8fc922ef89d3e12eed97404eae991d449ddb782b Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Tue, 13 Jul 2021 15:42:37 +0200 Subject: [PATCH 07/22] Moved sufficient balance check to send statment, and added tests of same plus accounting tests 5-7 --- src/eval/Eval.ml | 29 +----------- src/eval/EvalUtil.ml | 29 ++++++++++-- .../good/gold/accounting_tests.scilla.gold | 5 ++- tests/contracts/accounting_tests.scilla | 27 +++++++---- tests/runner/Testcontracts.ml | 4 +- .../accounting_tests/blockchain_10.json | 1 + .../accounting_tests/blockchain_106.json | 1 + .../accounting_tests/blockchain_107.json | 1 + .../accounting_tests/blockchain_108.json | 1 + .../accounting_tests/blockchain_11.json | 1 + .../accounting_tests/blockchain_12.json | 1 + .../accounting_tests/blockchain_13.json | 1 + .../runner/accounting_tests/blockchain_6.json | 1 + .../runner/accounting_tests/blockchain_7.json | 1 + .../runner/accounting_tests/blockchain_8.json | 1 + .../runner/accounting_tests/blockchain_9.json | 1 + tests/runner/accounting_tests/message_10.json | 7 +++ .../runner/accounting_tests/message_106.json | 7 +++ .../runner/accounting_tests/message_107.json | 13 ++++++ .../runner/accounting_tests/message_108.json | 7 +++ tests/runner/accounting_tests/message_11.json | 7 +++ tests/runner/accounting_tests/message_12.json | 7 +++ tests/runner/accounting_tests/message_13.json | 13 ++++++ tests/runner/accounting_tests/message_6.json | 7 +++ tests/runner/accounting_tests/message_7.json | 7 +++ tests/runner/accounting_tests/message_8.json | 7 +++ tests/runner/accounting_tests/message_9.json | 7 +++ tests/runner/accounting_tests/output_10.json | 27 +++++++++++ tests/runner/accounting_tests/output_100.json | 2 +- tests/runner/accounting_tests/output_101.json | 2 +- tests/runner/accounting_tests/output_102.json | 2 +- tests/runner/accounting_tests/output_103.json | 2 +- tests/runner/accounting_tests/output_104.json | 4 +- tests/runner/accounting_tests/output_105.json | 4 +- tests/runner/accounting_tests/output_106.json | 25 +++++++++++ tests/runner/accounting_tests/output_107.json | 25 +++++++++++ tests/runner/accounting_tests/output_108.json | 12 +++++ tests/runner/accounting_tests/output_11.json | 29 ++++++++++++ tests/runner/accounting_tests/output_12.json | 29 ++++++++++++ tests/runner/accounting_tests/output_13.json | 14 ++++++ tests/runner/accounting_tests/output_5.json | 2 +- tests/runner/accounting_tests/output_6.json | 33 ++++++++++++++ tests/runner/accounting_tests/output_7.json | 21 +++++++++ tests/runner/accounting_tests/output_8.json | 14 ++++++ tests/runner/accounting_tests/output_9.json | 27 +++++++++++ tests/runner/accounting_tests/state_10.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_106.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_107.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_108.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_11.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_12.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_13.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_6.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_7.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_8.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_9.json | 45 +++++++++++++++++++ 56 files changed, 910 insertions(+), 53 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_10.json create mode 100644 tests/runner/accounting_tests/blockchain_106.json create mode 100644 tests/runner/accounting_tests/blockchain_107.json create mode 100644 tests/runner/accounting_tests/blockchain_108.json create mode 100644 tests/runner/accounting_tests/blockchain_11.json create mode 100644 tests/runner/accounting_tests/blockchain_12.json create mode 100644 tests/runner/accounting_tests/blockchain_13.json create mode 100644 tests/runner/accounting_tests/blockchain_6.json create mode 100644 tests/runner/accounting_tests/blockchain_7.json create mode 100644 tests/runner/accounting_tests/blockchain_8.json create mode 100644 tests/runner/accounting_tests/blockchain_9.json create mode 100644 tests/runner/accounting_tests/message_10.json create mode 100644 tests/runner/accounting_tests/message_106.json create mode 100644 tests/runner/accounting_tests/message_107.json create mode 100644 tests/runner/accounting_tests/message_108.json create mode 100644 tests/runner/accounting_tests/message_11.json create mode 100644 tests/runner/accounting_tests/message_12.json create mode 100644 tests/runner/accounting_tests/message_13.json create mode 100644 tests/runner/accounting_tests/message_6.json create mode 100644 tests/runner/accounting_tests/message_7.json create mode 100644 tests/runner/accounting_tests/message_8.json create mode 100644 tests/runner/accounting_tests/message_9.json create mode 100644 tests/runner/accounting_tests/output_10.json create mode 100644 tests/runner/accounting_tests/output_106.json create mode 100644 tests/runner/accounting_tests/output_107.json create mode 100644 tests/runner/accounting_tests/output_108.json create mode 100644 tests/runner/accounting_tests/output_11.json create mode 100644 tests/runner/accounting_tests/output_12.json create mode 100644 tests/runner/accounting_tests/output_13.json create mode 100644 tests/runner/accounting_tests/output_6.json create mode 100644 tests/runner/accounting_tests/output_7.json create mode 100644 tests/runner/accounting_tests/output_8.json create mode 100644 tests/runner/accounting_tests/output_9.json create mode 100644 tests/runner/accounting_tests/state_10.json create mode 100644 tests/runner/accounting_tests/state_106.json create mode 100644 tests/runner/accounting_tests/state_107.json create mode 100644 tests/runner/accounting_tests/state_108.json create mode 100644 tests/runner/accounting_tests/state_11.json create mode 100644 tests/runner/accounting_tests/state_12.json create mode 100644 tests/runner/accounting_tests/state_13.json create mode 100644 tests/runner/accounting_tests/state_6.json create mode 100644 tests/runner/accounting_tests/state_7.json create mode 100644 tests/runner/accounting_tests/state_8.json create mode 100644 tests/runner/accounting_tests/state_9.json diff --git a/src/eval/Eval.ml b/src/eval/Eval.ml index 0aed475c1..0c67fadfa 100644 --- a/src/eval/Eval.ml +++ b/src/eval/Eval.ml @@ -901,31 +901,6 @@ let prepare_for_message contr entries = let%bind tenv, pending_dyn_checks = check_message_entries tparams other in pure ((tenv, incoming_amount, tprocedures, tbody, tname), pending_dyn_checks) -(* Subtract the amounts to be transferred *) -let post_process_msgs cstate outs = - (* Evey outgoing message should carry an "_amount" tag *) - let%bind amounts = - mapM outs ~f:(fun l -> - match l with - | Msg es -> fromR @@ MessagePayload.get_amount es - | _ -> fail0 @@ sprintf "Not a message literal: %s." (pp_literal l)) - in - let open Uint128 in - let to_be_transferred = - List.fold_left amounts ~init:zero ~f:(fun z a -> add z a) - in - let open ContractState in - if compare cstate.balance to_be_transferred < 0 then - fail0 - @@ sprintf - "The balance is too low (%s) to transfer all the funds in the \ - messages (%s)" - (to_string cstate.balance) - (to_string to_be_transferred) - else - let balance = sub cstate.balance to_be_transferred in - pure { cstate with balance } - (* Handle message: * tenv, incoming_funds, procedures, stmts, tname: Result of prepare_for_message, minus dynamic typechecks @@ -970,8 +945,6 @@ let handle_message (tenv, incoming_funds, procedures, stmts, tname) cstate in let new_msgs = conf'.emitted in let new_events = conf'.events in - (* Make sure that we aren't too generous and subract funds *) - let%bind cstate'' = post_process_msgs cstate' new_msgs in (*Return new contract state, messages and events *) - pure (cstate'', new_msgs, new_events, conf'.accepted) + pure (cstate', new_msgs, new_events, conf'.accepted) diff --git a/src/eval/EvalUtil.ml b/src/eval/EvalUtil.ml index 7af21f16a..8808c729b 100644 --- a/src/eval/EvalUtil.ml +++ b/src/eval/EvalUtil.ml @@ -402,7 +402,7 @@ module Configuration = struct String.compare s t) in if tag_found && amount_found && recipient_found && uniq_entries then - pure m' + pure () else fail0 @@ sprintf @@ -416,10 +416,31 @@ module Configuration = struct let send_messages conf ms = let%bind ls' = fromR @@ Datatypes.scilla_list_to_ocaml ms in - let%bind ls = mapM ~f:validate_outgoing_message ls' in + let%bind () = forallM ~f:validate_outgoing_message ls' in + let%bind out_funds = foldM ls' ~init:Uint128.zero ~f:(fun run_total msg_lit -> + match msg_lit with + | SLiteral.Msg msg -> + let%bind amount = fromR @@ MessagePayload.get_amount msg in + pure (Uint128.(run_total + amount)) + | _ -> + fail0 + @@ sprintf "Literal %s verified as a message, but is not a message literal." + (pp_literal msg_lit)) + in let old_emitted = conf.emitted in - let emitted = old_emitted @ ls in - pure { conf with emitted } + let emitted = old_emitted @ ls' in + let old_balance = conf.balance in + let%bind balance = + if Uint128.compare old_balance out_funds < 0 then + fail0 + @@ sprintf + "The balance (%s) is too low to transfer all the funds in the \ + messages (%s)" + (Uint128.to_string old_balance) + (Uint128.to_string out_funds) + else pure @@ Uint128.(old_balance - out_funds) + in + pure { conf with emitted; balance } let validate_event m' = let open EvalLiteral in diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index 1854615ed..a417cf8d0 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -27,6 +27,7 @@ ], "transitions": [ { "vname": "Reset", "params": [] }, + { "vname": "Test_Insufficient_Balance", "params": [] }, { "vname": "Test_Send_1", "params": [] }, { "vname": "Finalize_Test_Send_1", "params": [] }, { "vname": "Test_Send_2", "params": [] }, @@ -39,12 +40,12 @@ { "vname": "Test_Send_6", "params": [] }, { "vname": "Test_Send_7", "params": [] }, { - "vname": "Finalize_Send_6_7", + "vname": "Finalize_Test_Send_6_7", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] }, { "vname": "Test_Send_8", "params": [] }, { - "vname": "Finalize_Send_8_9", + "vname": "Finalize_Test_Send_8_9", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] }, { "vname": "Test_Send_9", "params": [] } diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index 680441e70..af893e69f 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -55,6 +55,17 @@ procedure AssertReset() end end +(* Simple test that an error is thrown on the Scilla side if the contract has insufficient balance to cover the outgoing amounts. + Ignore when testing at blockchain level. *) +transition Test_Insufficient_Balance() + amount <- outgoing_amount; + msg1 = { _recipient : support_contract; + _tag : "NonAccept"; + _amount : amount}; + msgs = one_msg msg1; + send msgs +end + (* ********************************************************* *) (* TESTS OF THE ORDER OF SENT MESSAGES *) (* ********************************************************* *) @@ -240,11 +251,11 @@ transition Test_Send_5() msg1 = { _recipient : support_contract; _tag : "Accept"; _amount : amount}; - msgs1 = one_msg msg1; msg2 = { _recipient : support_contract; _tag : "NonAccept"; _amount : amount}; - msgs = Cons {Message} msg2 msgs1; + msgs_tmp = one_msg msg2; + msgs = Cons {Message} msg1 msgs_tmp; send msgs; expected_intermediate_balance = builtin sub init_bal amount; expected_final_balance = builtin sub expected_intermediate_balance amount; @@ -263,7 +274,7 @@ transition Test_Send_6() send msgs1; expected_balance = builtin sub bal amount; msg2 = { _recipient : _this_address; - _tag : "Finalize_Send_6_7"; + _tag : "Finalize_Test_Send_6_7"; _amount : Uint128 0; expected_balance : expected_balance }; msgs2 = one_msg msg2; @@ -281,14 +292,14 @@ transition Test_Send_7() msgs1 = one_msg msg1; send msgs1; msg2 = { _recipient : _this_address; - _tag : "Finalize_Send_6_7"; + _tag : "Finalize_Test_Send_6_7"; _amount : Uint128 0; expected_balance : bal }; msgs2 = one_msg msg2; send msgs2 end -transition Finalize_Send_6_7(expected_balance : Uint128) +transition Finalize_Test_Send_6_7(expected_balance : Uint128) CheckBalance expected_balance end @@ -304,14 +315,14 @@ transition Test_Send_8() support_bal <- & support_contract._balance; expected_balance = builtin add support_bal amount; msg2 = { _recipient : _this_address; - _tag : "Finalize_Send_8_9"; + _tag : "Finalize_Test_Send_8_9"; _amount : Uint128 0; expected_balance : expected_balance }; msgs2 = one_msg msg2; send msgs2 end -transition Finalize_Send_8_9(expected_balance : Uint128) +transition Finalize_Test_Send_8_9(expected_balance : Uint128) CheckSupportBalance expected_balance end @@ -326,7 +337,7 @@ transition Test_Send_9() send msgs1; support_bal <- & support_contract._balance; msg2 = { _recipient : _this_address; - _tag : "Finalize_Send_8_9"; + _tag : "Finalize_Test_Send_8_9"; _amount : Uint128 0; expected_balance : support_bal }; msgs2 = one_msg msg2; diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index f19f99511..0194c9040 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,7 +471,7 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 4 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 13 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" succ_code 1 3 []; "addfunds_proxy" @@ -576,7 +576,7 @@ let contract_tests env = "address_list_as_cparam" "init_address_type" ~is_library:false ~ipc_mode:true; "accounting_tests" - >::: build_contract_tests env "accounting_tests" fail_code 100 105 []; + >::: build_contract_tests env "accounting_tests" fail_code 100 108 []; ]; "misc_tests" >::: build_misc_tests env; ] diff --git a/tests/runner/accounting_tests/blockchain_10.json b/tests/runner/accounting_tests/blockchain_10.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_10.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_106.json b/tests/runner/accounting_tests/blockchain_106.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_106.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_107.json b/tests/runner/accounting_tests/blockchain_107.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_107.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_108.json b/tests/runner/accounting_tests/blockchain_108.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_108.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_11.json b/tests/runner/accounting_tests/blockchain_11.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_11.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_12.json b/tests/runner/accounting_tests/blockchain_12.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_12.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_13.json b/tests/runner/accounting_tests/blockchain_13.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_13.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_6.json b/tests/runner/accounting_tests/blockchain_6.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_6.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_7.json b/tests/runner/accounting_tests/blockchain_7.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_7.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_8.json b/tests/runner/accounting_tests/blockchain_8.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_8.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_9.json b/tests/runner/accounting_tests/blockchain_9.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_9.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_10.json b/tests/runner/accounting_tests/message_10.json new file mode 100644 index 000000000..3a5ae2fd4 --- /dev/null +++ b/tests/runner/accounting_tests/message_10.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_5", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_106.json b/tests/runner/accounting_tests/message_106.json new file mode 100644 index 000000000..9bb803e3f --- /dev/null +++ b/tests/runner/accounting_tests/message_106.json @@ -0,0 +1,7 @@ +{ + "_tag": "Finalize_Test_Send_3", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_107.json b/tests/runner/accounting_tests/message_107.json new file mode 100644 index 000000000..5ba57aacd --- /dev/null +++ b/tests/runner/accounting_tests/message_107.json @@ -0,0 +1,13 @@ +{ + "_tag": "Finalize_Test_Send_6_7", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { + "vname" : "expected_balance", + "type" : "Uint128", + "value" : "30" + } + ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_108.json b/tests/runner/accounting_tests/message_108.json new file mode 100644 index 000000000..0c9c611c3 --- /dev/null +++ b/tests/runner/accounting_tests/message_108.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Insufficient_Balance", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_11.json b/tests/runner/accounting_tests/message_11.json new file mode 100644 index 000000000..374a8dce5 --- /dev/null +++ b/tests/runner/accounting_tests/message_11.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_6", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_12.json b/tests/runner/accounting_tests/message_12.json new file mode 100644 index 000000000..393c4109b --- /dev/null +++ b/tests/runner/accounting_tests/message_12.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_7", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_13.json b/tests/runner/accounting_tests/message_13.json new file mode 100644 index 000000000..5ba57aacd --- /dev/null +++ b/tests/runner/accounting_tests/message_13.json @@ -0,0 +1,13 @@ +{ + "_tag": "Finalize_Test_Send_6_7", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { + "vname" : "expected_balance", + "type" : "Uint128", + "value" : "30" + } + ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_6.json b/tests/runner/accounting_tests/message_6.json new file mode 100644 index 000000000..b689c1900 --- /dev/null +++ b/tests/runner/accounting_tests/message_6.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_3", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_7.json b/tests/runner/accounting_tests/message_7.json new file mode 100644 index 000000000..d0c56683c --- /dev/null +++ b/tests/runner/accounting_tests/message_7.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_3_Helper", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_8.json b/tests/runner/accounting_tests/message_8.json new file mode 100644 index 000000000..9bb803e3f --- /dev/null +++ b/tests/runner/accounting_tests/message_8.json @@ -0,0 +1,7 @@ +{ + "_tag": "Finalize_Test_Send_3", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_9.json b/tests/runner/accounting_tests/message_9.json new file mode 100644 index 000000000..3acf6d49a --- /dev/null +++ b/tests/runner/accounting_tests/message_9.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_4", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_10.json b/tests/runner/accounting_tests/output_10.json new file mode 100644 index 000000000..e5976418b --- /dev/null +++ b/tests/runner/accounting_tests/output_10.json @@ -0,0 +1,27 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7913", + "_accepted": "false", + "messages": [ + { + "_tag": "Accept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "NonAccept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_100.json b/tests/runner/accounting_tests/output_100.json index f8b886b13..ab04ec41e 100644 --- a/tests/runner/accounting_tests/output_100.json +++ b/tests/runner/accounting_tests/output_100.json @@ -15,7 +15,7 @@ "error_message": "Raised from Test_Send_1", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 63, + "line": 74, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_101.json b/tests/runner/accounting_tests/output_101.json index 2b779a01f..b2383bb7a 100644 --- a/tests/runner/accounting_tests/output_101.json +++ b/tests/runner/accounting_tests/output_101.json @@ -15,7 +15,7 @@ "error_message": "Raised from Test_Send_1", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 63, + "line": 74, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_102.json b/tests/runner/accounting_tests/output_102.json index 2b779a01f..b2383bb7a 100644 --- a/tests/runner/accounting_tests/output_102.json +++ b/tests/runner/accounting_tests/output_102.json @@ -15,7 +15,7 @@ "error_message": "Raised from Test_Send_1", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 63, + "line": 74, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_103.json b/tests/runner/accounting_tests/output_103.json index f8b886b13..ab04ec41e 100644 --- a/tests/runner/accounting_tests/output_103.json +++ b/tests/runner/accounting_tests/output_103.json @@ -15,7 +15,7 @@ "error_message": "Raised from Test_Send_1", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 63, + "line": 74, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_104.json b/tests/runner/accounting_tests/output_104.json index 6899af226..063a3c12e 100644 --- a/tests/runner/accounting_tests/output_104.json +++ b/tests/runner/accounting_tests/output_104.json @@ -6,7 +6,7 @@ "Exception thrown: (Message [(_exception : (String \"Test_Send failed\")) ; (test_no : (Uint128 1)) ; (expected : (List (String \"World\"), (String \"Hello\"), (Nil))) ; (actual : (List (String \"Hello\"), (String \"World\"), (Nil)))])", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 99, + "line": 110, "column": 5 }, "end_location": { "file": "", "line": 0, "column": 0 } @@ -15,7 +15,7 @@ "error_message": "Raised from Finalize_Test_Send_1", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 104, + "line": 115, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_105.json b/tests/runner/accounting_tests/output_105.json index 1a6cacabf..f0f38bdec 100644 --- a/tests/runner/accounting_tests/output_105.json +++ b/tests/runner/accounting_tests/output_105.json @@ -6,7 +6,7 @@ "Exception thrown: (Message [(_exception : (String \"Test_Send failed\")) ; (test_no : (Uint128 2)) ; (expected : (List (String \"World\"), (String \"Hello\"), (Nil))) ; (actual : (List (String \"Hello\"), (String \"World\"), (Nil)))])", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 99, + "line": 110, "column": 5 }, "end_location": { "file": "", "line": 0, "column": 0 } @@ -15,7 +15,7 @@ "error_message": "Raised from Finalize_Test_Send_2", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 133, + "line": 144, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_106.json b/tests/runner/accounting_tests/output_106.json new file mode 100644 index 000000000..069c2476e --- /dev/null +++ b/tests/runner/accounting_tests/output_106.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7922", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Test_Send failed\")) ; (test_no : (Uint128 3)) ; (expected : (List (String \"World\"), (String \"Hello\"), (Nil))) ; (actual : (List (String \"Hello\"), (String \"World\"), (Nil)))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 110, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Finalize_Test_Send_3", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 184, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_107.json b/tests/runner/accounting_tests/output_107.json new file mode 100644 index 000000000..0b2305e0c --- /dev/null +++ b/tests/runner/accounting_tests/output_107.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7932", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Unexpected balance\")) ; (expected : (Uint128 30)) ; (actual : (Uint128 20))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 208, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Finalize_Test_Send_6_7", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 302, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_108.json b/tests/runner/accounting_tests/output_108.json new file mode 100644 index 000000000..e55e0a964 --- /dev/null +++ b/tests/runner/accounting_tests/output_108.json @@ -0,0 +1,12 @@ +{ + "gas_remaining": "7947", + "errors": [ + { + "error_message": + "The balance (0) is too low to transfer all the funds in the messages (10)", + "start_location": { "file": "", "line": 0, "column": 0 }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_11.json b/tests/runner/accounting_tests/output_11.json new file mode 100644 index 000000000..642fc8cf4 --- /dev/null +++ b/tests/runner/accounting_tests/output_11.json @@ -0,0 +1,29 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7912", + "_accepted": "false", + "messages": [ + { + "_tag": "Accept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "Finalize_Test_Send_6_7", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_12.json b/tests/runner/accounting_tests/output_12.json new file mode 100644 index 000000000..1a07cc787 --- /dev/null +++ b/tests/runner/accounting_tests/output_12.json @@ -0,0 +1,29 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7913", + "_accepted": "false", + "messages": [ + { + "_tag": "NonAccept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "Finalize_Test_Send_6_7", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "30" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_13.json b/tests/runner/accounting_tests/output_13.json new file mode 100644 index 000000000..a0cdbd991 --- /dev/null +++ b/tests/runner/accounting_tests/output_13.json @@ -0,0 +1,14 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7946", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_5.json b/tests/runner/accounting_tests/output_5.json index a5a495831..6b8f8d2bb 100644 --- a/tests/runner/accounting_tests/output_5.json +++ b/tests/runner/accounting_tests/output_5.json @@ -11,4 +11,4 @@ { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } ], "events": [] -} +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_6.json b/tests/runner/accounting_tests/output_6.json new file mode 100644 index 000000000..2be3c7563 --- /dev/null +++ b/tests/runner/accounting_tests/output_6.json @@ -0,0 +1,33 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7896", + "_accepted": "false", + "messages": [ + { + "_tag": "Test_Send_3_Helper", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [] + }, + { + "_tag": "StoreString", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [ { "vname": "s", "type": "String", "value": "World" } ] + }, + { + "_tag": "Finalize_Test_Send_3", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_7.json b/tests/runner/accounting_tests/output_7.json new file mode 100644 index 000000000..e4428f07a --- /dev/null +++ b/tests/runner/accounting_tests/output_7.json @@ -0,0 +1,21 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7943", + "_accepted": "false", + "messages": [ + { + "_tag": "StoreString", + "_amount": "0", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [ { "vname": "s", "type": "String", "value": "Hello" } ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_8.json b/tests/runner/accounting_tests/output_8.json new file mode 100644 index 000000000..6b8f8d2bb --- /dev/null +++ b/tests/runner/accounting_tests/output_8.json @@ -0,0 +1,14 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7942", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_9.json b/tests/runner/accounting_tests/output_9.json new file mode 100644 index 000000000..8a4d7d987 --- /dev/null +++ b/tests/runner/accounting_tests/output_9.json @@ -0,0 +1,27 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7909", + "_accepted": "false", + "messages": [ + { + "_tag": "Accept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "NonAccept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_10.json b/tests/runner/accounting_tests/state_10.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_10.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_106.json b/tests/runner/accounting_tests/state_106.json new file mode 100644 index 000000000..61bd10ab7 --- /dev/null +++ b/tests/runner/accounting_tests/state_106.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ "Hello", "World" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_107.json b/tests/runner/accounting_tests/state_107.json new file mode 100644 index 000000000..5618d9287 --- /dev/null +++ b/tests/runner/accounting_tests/state_107.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_108.json b/tests/runner/accounting_tests/state_108.json new file mode 100644 index 000000000..70441504f --- /dev/null +++ b/tests/runner/accounting_tests/state_108.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_11.json b/tests/runner/accounting_tests/state_11.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_11.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_12.json b/tests/runner/accounting_tests/state_12.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_12.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_13.json b/tests/runner/accounting_tests/state_13.json new file mode 100644 index 000000000..881cc6e2d --- /dev/null +++ b/tests/runner/accounting_tests/state_13.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_6.json b/tests/runner/accounting_tests/state_6.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_6.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_7.json b/tests/runner/accounting_tests/state_7.json new file mode 100644 index 000000000..881cc6e2d --- /dev/null +++ b/tests/runner/accounting_tests/state_7.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_8.json b/tests/runner/accounting_tests/state_8.json new file mode 100644 index 000000000..dd2dae293 --- /dev/null +++ b/tests/runner/accounting_tests/state_8.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List String", "value": [ "World", "Hello" ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_9.json b/tests/runner/accounting_tests/state_9.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_9.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] From c56f35ff62203e4bbc2ae619859c9a6f4ee1fd5b Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Tue, 13 Jul 2021 15:56:50 +0200 Subject: [PATCH 08/22] Added accounting tests 8 and 9 --- .../good/gold/accounting_tests.scilla.gold | 4 +- tests/contracts/accounting_tests.scilla | 8 ++-- tests/runner/Testcontracts.ml | 4 +- .../accounting_tests/blockchain_109.json | 1 + .../accounting_tests/blockchain_14.json | 1 + .../accounting_tests/blockchain_15.json | 1 + .../accounting_tests/blockchain_16.json | 1 + .../runner/accounting_tests/message_109.json | 13 ++++++ tests/runner/accounting_tests/message_14.json | 7 +++ tests/runner/accounting_tests/message_15.json | 7 +++ tests/runner/accounting_tests/message_16.json | 13 ++++++ tests/runner/accounting_tests/output_109.json | 25 +++++++++++ tests/runner/accounting_tests/output_14.json | 29 ++++++++++++ tests/runner/accounting_tests/output_15.json | 29 ++++++++++++ tests/runner/accounting_tests/output_16.json | 14 ++++++ tests/runner/accounting_tests/state_109.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_14.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_15.json | 45 +++++++++++++++++++ tests/runner/accounting_tests/state_16.json | 45 +++++++++++++++++++ 19 files changed, 329 insertions(+), 8 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_109.json create mode 100644 tests/runner/accounting_tests/blockchain_14.json create mode 100644 tests/runner/accounting_tests/blockchain_15.json create mode 100644 tests/runner/accounting_tests/blockchain_16.json create mode 100644 tests/runner/accounting_tests/message_109.json create mode 100644 tests/runner/accounting_tests/message_14.json create mode 100644 tests/runner/accounting_tests/message_15.json create mode 100644 tests/runner/accounting_tests/message_16.json create mode 100644 tests/runner/accounting_tests/output_109.json create mode 100644 tests/runner/accounting_tests/output_14.json create mode 100644 tests/runner/accounting_tests/output_15.json create mode 100644 tests/runner/accounting_tests/output_16.json create mode 100644 tests/runner/accounting_tests/state_109.json create mode 100644 tests/runner/accounting_tests/state_14.json create mode 100644 tests/runner/accounting_tests/state_15.json create mode 100644 tests/runner/accounting_tests/state_16.json diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index a417cf8d0..21ce54233 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -44,11 +44,11 @@ "params": [ { "vname": "expected_balance", "type": "Uint128" } ] }, { "vname": "Test_Send_8", "params": [] }, + { "vname": "Test_Send_9", "params": [] }, { "vname": "Finalize_Test_Send_8_9", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] - }, - { "vname": "Test_Send_9", "params": [] } + } ], "procedures": [ { "vname": "AssertReset", "params": [] }, diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index af893e69f..0b423bcf2 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -322,10 +322,6 @@ transition Test_Send_8() send msgs2 end -transition Finalize_Test_Send_8_9(expected_balance : Uint128) - CheckSupportBalance expected_balance -end - (* Check that the recipient's balance isn't updated if funds are not accepted *) transition Test_Send_9() AssertReset; @@ -343,3 +339,7 @@ transition Test_Send_9() msgs2 = one_msg msg2; send msgs2 end + +transition Finalize_Test_Send_8_9(expected_balance : Uint128) + CheckSupportBalance expected_balance +end diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index 0194c9040..01a30168b 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,7 +471,7 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 13 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 16 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" succ_code 1 3 []; "addfunds_proxy" @@ -576,7 +576,7 @@ let contract_tests env = "address_list_as_cparam" "init_address_type" ~is_library:false ~ipc_mode:true; "accounting_tests" - >::: build_contract_tests env "accounting_tests" fail_code 100 108 []; + >::: build_contract_tests env "accounting_tests" fail_code 100 109 []; ]; "misc_tests" >::: build_misc_tests env; ] diff --git a/tests/runner/accounting_tests/blockchain_109.json b/tests/runner/accounting_tests/blockchain_109.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_109.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_14.json b/tests/runner/accounting_tests/blockchain_14.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_14.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_15.json b/tests/runner/accounting_tests/blockchain_15.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_15.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_16.json b/tests/runner/accounting_tests/blockchain_16.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_16.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_109.json b/tests/runner/accounting_tests/message_109.json new file mode 100644 index 000000000..50fcb1e8f --- /dev/null +++ b/tests/runner/accounting_tests/message_109.json @@ -0,0 +1,13 @@ +{ + "_tag": "Finalize_Test_Send_8_9", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { + "vname" : "expected_balance", + "type" : "Uint128", + "value" : "52" + } + ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_14.json b/tests/runner/accounting_tests/message_14.json new file mode 100644 index 000000000..b4bf67170 --- /dev/null +++ b/tests/runner/accounting_tests/message_14.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_8", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_15.json b/tests/runner/accounting_tests/message_15.json new file mode 100644 index 000000000..56f96b0e3 --- /dev/null +++ b/tests/runner/accounting_tests/message_15.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_9", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_16.json b/tests/runner/accounting_tests/message_16.json new file mode 100644 index 000000000..50fcb1e8f --- /dev/null +++ b/tests/runner/accounting_tests/message_16.json @@ -0,0 +1,13 @@ +{ + "_tag": "Finalize_Test_Send_8_9", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { + "vname" : "expected_balance", + "type" : "Uint128", + "value" : "52" + } + ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_109.json b/tests/runner/accounting_tests/output_109.json new file mode 100644 index 000000000..6916931dc --- /dev/null +++ b/tests/runner/accounting_tests/output_109.json @@ -0,0 +1,25 @@ +{ + "gas_remaining": "7927", + "errors": [ + { + "error_message": + "Exception thrown: (Message [(_exception : (String \"Main contract read unexpected support contract balance\")) ; (expected : (Uint128 52)) ; (actual : (Uint128 42))])", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 221, + "column": 5 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + }, + { + "error_message": "Raised from Finalize_Test_Send_8_9", + "start_location": { + "file": "tests/contracts/accounting_tests.scilla", + "line": 343, + "column": 12 + }, + "end_location": { "file": "", "line": 0, "column": 0 } + } + ], + "warnings": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_14.json b/tests/runner/accounting_tests/output_14.json new file mode 100644 index 000000000..54d77645a --- /dev/null +++ b/tests/runner/accounting_tests/output_14.json @@ -0,0 +1,29 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7912", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptAndCheckBalance", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "Finalize_Test_Send_8_9", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "52" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_15.json b/tests/runner/accounting_tests/output_15.json new file mode 100644 index 000000000..8cd31a664 --- /dev/null +++ b/tests/runner/accounting_tests/output_15.json @@ -0,0 +1,29 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7913", + "_accepted": "false", + "messages": [ + { + "_tag": "NonAccept", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "Finalize_Test_Send_8_9", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "42" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_16.json b/tests/runner/accounting_tests/output_16.json new file mode 100644 index 000000000..a0cdbd991 --- /dev/null +++ b/tests/runner/accounting_tests/output_16.json @@ -0,0 +1,14 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7946", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_109.json b/tests/runner/accounting_tests/state_109.json new file mode 100644 index 000000000..d251fba44 --- /dev/null +++ b/tests/runner/accounting_tests/state_109.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_14.json b/tests/runner/accounting_tests/state_14.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_14.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_15.json b/tests/runner/accounting_tests/state_15.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_15.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_16.json b/tests/runner/accounting_tests/state_16.json new file mode 100644 index 000000000..8b1ab389f --- /dev/null +++ b/tests/runner/accounting_tests/state_16.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "52" }, + { "vname": "stored_strings", "type": "List String", "value": [ ] }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] From b6ae19189194b7d06248462c3d0a785102822daa Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Wed, 14 Jul 2021 17:14:15 +0200 Subject: [PATCH 09/22] Do not decrease sender balance on accept, and test of same --- src/eval/Eval.ml | 2 +- src/eval/EvalUtil.ml | 31 ++---------- .../good/gold/accounting_tests.scilla.gold | 3 +- .../gold/accounting_tests_support.scilla.gold | 7 ++- tests/contracts/accounting_tests.scilla | 11 +++++ .../contracts/accounting_tests_support.scilla | 19 ++++++++ tests/runner/Testcontracts.ml | 4 +- .../accounting_tests/blockchain_17.json | 1 + tests/runner/accounting_tests/message_17.json | 7 +++ tests/runner/accounting_tests/output_17.json | 21 ++++++++ tests/runner/accounting_tests/state_17.json | 45 +++++++++++++++++ .../blockchain_4.json | 1 + .../accounting_tests_support/message_4.json | 7 +++ .../accounting_tests_support/output_4.json | 11 +++++ .../accounting_tests_support/state_4.json | 48 +++++++++++++++++++ tests/runner/remote_state_reads/output_9.json | 4 +- 16 files changed, 187 insertions(+), 35 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_17.json create mode 100644 tests/runner/accounting_tests/message_17.json create mode 100644 tests/runner/accounting_tests/output_17.json create mode 100644 tests/runner/accounting_tests/state_17.json create mode 100644 tests/runner/accounting_tests_support/blockchain_4.json create mode 100644 tests/runner/accounting_tests_support/message_4.json create mode 100644 tests/runner/accounting_tests_support/output_4.json create mode 100644 tests/runner/accounting_tests_support/state_4.json diff --git a/src/eval/Eval.ml b/src/eval/Eval.ml index 0c67fadfa..5bebde905 100644 --- a/src/eval/Eval.ml +++ b/src/eval/Eval.ml @@ -370,7 +370,7 @@ let rec stmt_eval conf stmts = let%bind a = fromR @@ Configuration.lookup conf adr in match a with | ByStrX s' when Bystrx.width s' = Type.address_length -> - let%bind l = Configuration.remote_load conf s' r in + let%bind l = Configuration.remote_load s' r in let conf' = Configuration.bind conf (get_id x) l in stmt_eval conf' sts | _ -> fail0 "Expected remote load address to be ByStr20 value") diff --git a/src/eval/EvalUtil.ml b/src/eval/EvalUtil.ml index 8808c729b..07f0e6059 100644 --- a/src/eval/EvalUtil.ml +++ b/src/eval/EvalUtil.ml @@ -199,38 +199,13 @@ module Configuration = struct (EvalName.as_error_string i)) (ER.get_loc (get_rep k)) - let remote_load st caddr k = + let remote_load caddr k = let%bind fval = fromR @@ StateService.external_fetch ~caddr ~fname:k ~keys:[] ~ignoreval:false in match fval with - | Some v, _ -> - (* _sender._balance is a special case if funds have been accepted. _amount must be deducted. *) - let%bind sender_addr = lookup_sender_addr st in - if - st.accepted - && EvalLiteral.Bystrx.equal sender_addr caddr - && EvalName.equal (get_id k) balance_label - then - let%bind amount_lit = - fromR - @@ lookup st - (mk_loc_id (label_name_of_string MessagePayload.amount_label)) - in - match (v, amount_lit) with - | UintLit (Uint128L sender_balance), UintLit (Uint128L amount) - when Uint128.compare sender_balance amount >= 0 -> - pure - @@ EvalLiteral.UintLit - (Uint128L Uint128.(sender_balance - amount)) - | _ -> - fail0 - @@ sprintf - "Unexpected sender balance or amount literal: sender \ - balance = %s, amount = %s" - (pp_literal v) (pp_literal amount_lit) - else pure v + | Some v, _ -> pure v | _ -> fail1 (Printf.sprintf "Error loading remote field %s at address %s" @@ -337,7 +312,7 @@ module Configuration = struct (* Check that sender balance is sufficient *) let%bind sender_addr = lookup_sender_addr st in let%bind sender_balance_l = - remote_load st sender_addr (mk_loc_id balance_label) + remote_load sender_addr (mk_loc_id balance_label) in let incoming' = st.incoming_funds in match sender_balance_l with diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index 21ce54233..8addbe744 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -48,7 +48,8 @@ { "vname": "Finalize_Test_Send_8_9", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] - } + }, + { "vname": "Test_Send_10", "params": [] } ], "procedures": [ { "vname": "AssertReset", "params": [] }, diff --git a/tests/checker/good/gold/accounting_tests_support.scilla.gold b/tests/checker/good/gold/accounting_tests_support.scilla.gold index bacfa33bf..aa6a255c7 100644 --- a/tests/checker/good/gold/accounting_tests_support.scilla.gold +++ b/tests/checker/good/gold/accounting_tests_support.scilla.gold @@ -20,12 +20,17 @@ }, { "vname": "Accept", "params": [] }, { "vname": "NonAccept", "params": [] }, - { "vname": "AcceptAndCheckBalance", "params": [] } + { "vname": "AcceptAndCheckBalance", "params": [] }, + { "vname": "AcceptAndCheckSenderBalance", "params": [] } ], "procedures": [ { "vname": "CheckBalance", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + }, + { + "vname": "CheckSenderBalance", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] } ], "events": [], diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index 0b423bcf2..b039474cb 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -343,3 +343,14 @@ end transition Finalize_Test_Send_8_9(expected_balance : Uint128) CheckSupportBalance expected_balance end + +(* Check that acceptance does not affect sender's balance *) +transition Test_Send_10() + AssertReset; + amount <- outgoing_amount; + msg1 = { _recipient : support_contract; + _tag : "AcceptAndCheckSenderBalance"; + _amount : amount}; + msgs = one_msg msg1; + send msgs +end \ No newline at end of file diff --git a/tests/contracts/accounting_tests_support.scilla b/tests/contracts/accounting_tests_support.scilla index 909ba51da..ea77fd393 100644 --- a/tests/contracts/accounting_tests_support.scilla +++ b/tests/contracts/accounting_tests_support.scilla @@ -35,9 +35,28 @@ procedure CheckBalance(expected_balance : Uint128) end end +procedure CheckSenderBalance(expected_balance : Uint128) + cur_balance <-& _sender._balance; + is_expected = builtin eq expected_balance cur_balance; + match is_expected with + | True => (* OK *) + | False => + e = { _exception : "Unexpected sender balance read by support contract"; + expected : expected_balance; + actual : cur_balance }; + throw e + end +end + transition AcceptAndCheckBalance() init_bal <- _balance; accept; expected_balance = builtin add init_bal _amount; CheckBalance expected_balance end + +transition AcceptAndCheckSenderBalance() + init_bal <- & _sender._balance; + accept; + CheckSenderBalance init_bal +end \ No newline at end of file diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index 01a30168b..2d900e79d 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,9 +471,9 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 16 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 17 []; "accounting_tests_support" - >::: build_contract_tests env "accounting_tests_support" succ_code 1 3 []; + >::: build_contract_tests env "accounting_tests_support" succ_code 1 4 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" diff --git a/tests/runner/accounting_tests/blockchain_17.json b/tests/runner/accounting_tests/blockchain_17.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_17.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_17.json b/tests/runner/accounting_tests/message_17.json new file mode 100644 index 000000000..0a825fd28 --- /dev/null +++ b/tests/runner/accounting_tests/message_17.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_10", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_17.json b/tests/runner/accounting_tests/output_17.json new file mode 100644 index 000000000..3442d04ec --- /dev/null +++ b/tests/runner/accounting_tests/output_17.json @@ -0,0 +1,21 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7934", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_17.json b/tests/runner/accounting_tests/state_17.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_17.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests_support/blockchain_4.json b/tests/runner/accounting_tests_support/blockchain_4.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_4.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/message_4.json b/tests/runner/accounting_tests_support/message_4.json new file mode 100644 index 000000000..86e4827d9 --- /dev/null +++ b/tests/runner/accounting_tests_support/message_4.json @@ -0,0 +1,7 @@ +{ + "_tag": "AcceptAndCheckSenderBalance", + "_amount": "10", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests_support/output_4.json b/tests/runner/accounting_tests_support/output_4.json new file mode 100644 index 000000000..a0a9cf679 --- /dev/null +++ b/tests/runner/accounting_tests_support/output_4.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7966", + "_accepted": "true", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/state_4.json b/tests/runner/accounting_tests_support/state_4.json new file mode 100644 index 000000000..3fd594a91 --- /dev/null +++ b/tests/runner/accounting_tests_support/state_4.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] diff --git a/tests/runner/remote_state_reads/output_9.json b/tests/runner/remote_state_reads/output_9.json index f0b85173f..57500f202 100644 --- a/tests/runner/remote_state_reads/output_9.json +++ b/tests/runner/remote_state_reads/output_9.json @@ -5,8 +5,8 @@ "messages": [], "states": [ { "vname": "_balance", "type": "Uint128", "value": "100" }, - { "vname": "sender_balance_post", "type": "Uint128", "value": "999900" }, - { "vname": "sender_balance_mid", "type": "Uint128", "value": "999900" }, + { "vname": "sender_balance_post", "type": "Uint128", "value": "1000000" }, + { "vname": "sender_balance_mid", "type": "Uint128", "value": "1000000" }, { "vname": "sender_balance_pre", "type": "Uint128", "value": "1000000" }, { "vname": "assign_test_1", From a87436217e279f561bf2e8ac7abc0819a03b6dc5 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Wed, 14 Jul 2021 18:25:17 +0200 Subject: [PATCH 10/22] Delete obsolete json files (see next commit) --- .../remote_state_reads/blockchain_127.json | 1 - .../remote_state_reads/blockchain_9.json | 1 - .../remote_state_reads/message_127.json | 7 - .../runner/remote_state_reads/message_9.json | 7 - .../runner/remote_state_reads/output_127.json | 12 -- tests/runner/remote_state_reads/output_9.json | 142 ----------------- .../runner/remote_state_reads/state_127.json | 124 --------------- tests/runner/remote_state_reads/state_9.json | 148 ------------------ 8 files changed, 442 deletions(-) delete mode 100644 tests/runner/remote_state_reads/blockchain_127.json delete mode 100644 tests/runner/remote_state_reads/blockchain_9.json delete mode 100644 tests/runner/remote_state_reads/message_127.json delete mode 100644 tests/runner/remote_state_reads/message_9.json delete mode 100644 tests/runner/remote_state_reads/output_127.json delete mode 100644 tests/runner/remote_state_reads/output_9.json delete mode 100644 tests/runner/remote_state_reads/state_127.json delete mode 100644 tests/runner/remote_state_reads/state_9.json diff --git a/tests/runner/remote_state_reads/blockchain_127.json b/tests/runner/remote_state_reads/blockchain_127.json deleted file mode 100644 index d962cce79..000000000 --- a/tests/runner/remote_state_reads/blockchain_127.json +++ /dev/null @@ -1 +0,0 @@ -[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/remote_state_reads/blockchain_9.json b/tests/runner/remote_state_reads/blockchain_9.json deleted file mode 100644 index d962cce79..000000000 --- a/tests/runner/remote_state_reads/blockchain_9.json +++ /dev/null @@ -1 +0,0 @@ -[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/remote_state_reads/message_127.json b/tests/runner/remote_state_reads/message_127.json deleted file mode 100644 index 2986ce244..000000000 --- a/tests/runner/remote_state_reads/message_127.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "_tag": "SenderBalanceTest", - "_amount": "100", - "_sender": "0xabfeccdc9012345678901234567890f777564322", - "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" -} diff --git a/tests/runner/remote_state_reads/message_9.json b/tests/runner/remote_state_reads/message_9.json deleted file mode 100644 index 296535d7a..000000000 --- a/tests/runner/remote_state_reads/message_9.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "_tag": "SenderBalanceTest", - "_amount": "100", - "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", - "params": [], - "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" -} diff --git a/tests/runner/remote_state_reads/output_127.json b/tests/runner/remote_state_reads/output_127.json deleted file mode 100644 index ca600122e..000000000 --- a/tests/runner/remote_state_reads/output_127.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "gas_remaining": "7966", - "errors": [ - { - "error_message": - "Insufficient sender balance for acceptance. Incoming vs sender_balance: 100 vs 50", - "start_location": { "file": "", "line": 0, "column": 0 }, - "end_location": { "file": "", "line": 0, "column": 0 } - } - ], - "warnings": [] -} \ No newline at end of file diff --git a/tests/runner/remote_state_reads/output_9.json b/tests/runner/remote_state_reads/output_9.json deleted file mode 100644 index 57500f202..000000000 --- a/tests/runner/remote_state_reads/output_9.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "scilla_major_version": "0", - "gas_remaining": "7958", - "_accepted": "true", - "messages": [], - "states": [ - { "vname": "_balance", "type": "Uint128", "value": "100" }, - { "vname": "sender_balance_post", "type": "Uint128", "value": "1000000" }, - { "vname": "sender_balance_mid", "type": "Uint128", "value": "1000000" }, - { "vname": "sender_balance_pre", "type": "Uint128", "value": "1000000" }, - { - "vname": "assign_test_1", - "type": "ByStr20 with end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_2", - "type": "ByStr20 with contract field transactionCount : Uint32 end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_3", - "type": "ByStr20 with contract field admin : ByStr20 with end end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_4", - "type": "ByStr20 with contract field admin : ByStr20 end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_5", - "type": "ByStr20 with contract field owners : Map (ByStr20) (Bool) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_6", - "type": - "ByStr20 with contract field signatures : Map (Uint32) (Map (ByStr20) (Bool)) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_7", - "type": - "ByStr20 with contract field other_map : Map (Uint128) (ByStr20) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_8", - "type": "0x3620c286757a29985cee194eb90064270fb65414.AddressADT", - "value": { - "constructor": "0x3620c286757a29985cee194eb90064270fb65414.Address1", - "argtypes": [], - "arguments": [ "0x1234567890123456789012345678901234567890" ] - } - }, - { - "vname": "assign_test_9", - "type": "List (0x3620c286757a29985cee194eb90064270fb65414.AddressADT)", - "value": { - "constructor": "Nil", - "argtypes": [ - "0x3620c286757a29985cee194eb90064270fb65414.AddressADT" - ], - "arguments": [] - } - }, - { - "vname": "assign_test_10", - "type": - "Map (Uint128) (Map (Uint128) (0x3620c286757a29985cee194eb90064270fb65414.AddressADT))", - "value": [] - }, - { "vname": "remote_reads_test_res_1_1", "type": "Uint128", "value": "0" }, - { "vname": "remote_reads_test_res_2_1", "type": "Uint128", "value": "0" }, - { "vname": "remote_reads_test_res_3_1", "type": "Uint128", "value": "0" }, - { "vname": "remote_reads_test_res_3_3", "type": "Uint32", "value": "0" }, - { - "vname": "remote_reads_test_res_3_4", - "type": "ByStr20 with end", - "value": "0xabfeccdc9012345678901234567890f777567890" - }, - { "vname": "remote_reads_test_res_3_5", "type": "Uint128", "value": "0" }, - { - "vname": "remote_reads_test_res_3_6", - "type": "Map (ByStr20 with end) (Bool)", - "value": [] - }, - { - "vname": "remote_reads_test_res_3_7", - "type": "Bool", - "value": { "constructor": "True", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_8", - "type": "Option (Bool)", - "value": { - "constructor": "Some", - "argtypes": [ "Bool" ], - "arguments": [ - { "constructor": "True", "argtypes": [], "arguments": [] } - ] - } - }, - { - "vname": "remote_reads_test_res_3_9", - "type": "Map (Uint32) (Map (ByStr20 with end) (Bool))", - "value": [] - }, - { - "vname": "remote_reads_test_res_3_10", - "type": "Bool", - "value": { "constructor": "False", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_11", - "type": "Option (Map (ByStr20 with end) (Bool))", - "value": { - "constructor": "None", - "argtypes": [ "Map (ByStr20 with end) (Bool)" ], - "arguments": [] - } - }, - { - "vname": "remote_reads_test_res_3_12", - "type": "Bool", - "value": { "constructor": "True", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_13", - "type": "Option (Bool)", - "value": { - "constructor": "Some", - "argtypes": [ "Bool" ], - "arguments": [ - { "constructor": "True", "argtypes": [], "arguments": [] } - ] - } - } - ], - "events": [] -} \ No newline at end of file diff --git a/tests/runner/remote_state_reads/state_127.json b/tests/runner/remote_state_reads/state_127.json deleted file mode 100644 index d493e09cb..000000000 --- a/tests/runner/remote_state_reads/state_127.json +++ /dev/null @@ -1,124 +0,0 @@ -[ - { "vname": "_balance", "type": "Uint128", "value": "0" }, - { - "vname": "assign_test_1", - "type": "ByStr20 with end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_2", - "type": "ByStr20 with contract field transactionCount : Uint32 end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_3", - "type": "ByStr20 with contract field admin : ByStr20 with end end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_4", - "type": "ByStr20 with contract field admin : ByStr20 end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_5", - "type": "ByStr20 with contract field owners : Map (ByStr20) (Bool) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_6", - "type": - "ByStr20 with contract field signatures : Map (Uint32) (Map (ByStr20) (Bool)) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_7", - "type": "ByStr20 with contract field other_map : Map (Uint128) (ByStr20) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "remote_reads_test_res_1_1", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_2_1", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_1", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_3", - "type": "Uint32", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_4", - "type": "ByStr20 with end", - "value": "0xabfeccdc9012345678901234567890f777567890" - }, - { - "vname": "remote_reads_test_res_3_5", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_6", - "type": "Map (ByStr20 with end) Bool", - "value": [] - }, - { - "vname": "remote_reads_test_res_3_7", - "type": "Bool", - "value": { "constructor": "True", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_8", - "type": "Option Bool", - "value": { "constructor": "Some", "argtypes": ["Bool"], "arguments": [ { "constructor": "True", "argtypes": [], "arguments": [] } ] } - }, - { - "vname": "remote_reads_test_res_3_9", - "type": "Map Uint32 (Map (ByStr20 with end) Bool)", - "value": [] - }, - { - "vname": "remote_reads_test_res_3_10", - "type": "Bool", - "value": { "constructor": "False", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_11", - "type": "Option (Map (ByStr20 with end) Bool)", - "value": { "constructor": "None", "argtypes": ["Map (ByStr20 with end) (Bool)"], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_12", - "type": "Bool", - "value": { "constructor": "True", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_13", - "type": "Option Bool", - "value": { "constructor": "Some", "argtypes": ["Bool"], "arguments": [ { "constructor": "True", "argtypes": [], "arguments": [] } ] } - }, - { "vname": "sender_balance_pre", "type": "Uint128", "value": "0" }, - { "vname": "sender_balance_mid", "type": "Uint128", "value": "0" }, - { "vname": "sender_balance_post", "type": "Uint128", "value": "0" }, - { - "vname": "_external", - "type": "Unit", - "value": [ - { - "address": "0xabfeccdc9012345678901234567890f777564322", - "state": [ - { "vname": "_balance", "type": "Uint128", "value": "50" } - ] - } - ] - } -] diff --git a/tests/runner/remote_state_reads/state_9.json b/tests/runner/remote_state_reads/state_9.json deleted file mode 100644 index 0998c8aec..000000000 --- a/tests/runner/remote_state_reads/state_9.json +++ /dev/null @@ -1,148 +0,0 @@ -[ - { "vname": "_balance", "type": "Uint128", "value": "0" }, - { - "vname": "assign_test_1", - "type": "ByStr20 with end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_2", - "type": "ByStr20 with contract field transactionCount : Uint32 end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_3", - "type": "ByStr20 with contract field admin : ByStr20 with end end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_4", - "type": "ByStr20 with contract field admin : ByStr20 end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_5", - "type": "ByStr20 with contract field owners : Map (ByStr20) (Bool) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_6", - "type": - "ByStr20 with contract field signatures : Map (Uint32) (Map (ByStr20) (Bool)) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_7", - "type": "ByStr20 with contract field other_map : Map (Uint128) (ByStr20) end", - "value": "0x1234567890123456789012345678901234567890" - }, - { - "vname": "assign_test_8", - "type": "0x3620c286757a29985cee194eb90064270fb65414.AddressADT", - "value": { - "constructor": "0x3620c286757a29985cee194eb90064270fb65414.Address1", - "argtypes": [], - "arguments": [ "0x1234567890123456789012345678901234567890" ] - } - }, - { - "vname": "assign_test_9", - "type": "List (0x3620c286757a29985cee194eb90064270fb65414.AddressADT)", - "value": { - "constructor" : "Nil", - "argtypes" : ["0x3620c286757a29985cee194eb90064270fb65414.AddressADT"], - "arguments": [] - } - }, - { - "vname": "assign_test_10", - "type": - "Map (Uint128) (Map (Uint128) (0x3620c286757a29985cee194eb90064270fb65414.AddressADT))", - "value": [] - }, - { - "vname": "remote_reads_test_res_1_1", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_2_1", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_1", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_3", - "type": "Uint32", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_4", - "type": "ByStr20 with end", - "value": "0xabfeccdc9012345678901234567890f777567890" - }, - { - "vname": "remote_reads_test_res_3_5", - "type": "Uint128", - "value": "0" - }, - { - "vname": "remote_reads_test_res_3_6", - "type": "Map (ByStr20 with end) Bool", - "value": [] - }, - { - "vname": "remote_reads_test_res_3_7", - "type": "Bool", - "value": { "constructor": "True", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_8", - "type": "Option Bool", - "value": { "constructor": "Some", "argtypes": ["Bool"], "arguments": [ { "constructor": "True", "argtypes": [], "arguments": [] } ] } - }, - { - "vname": "remote_reads_test_res_3_9", - "type": "Map Uint32 (Map (ByStr20 with end) Bool)", - "value": [] - }, - { - "vname": "remote_reads_test_res_3_10", - "type": "Bool", - "value": { "constructor": "False", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_11", - "type": "Option (Map (ByStr20 with end) Bool)", - "value": { "constructor": "None", "argtypes": ["Map (ByStr20 with end) (Bool)"], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_12", - "type": "Bool", - "value": { "constructor": "True", "argtypes": [], "arguments": [] } - }, - { - "vname": "remote_reads_test_res_3_13", - "type": "Option Bool", - "value": { "constructor": "Some", "argtypes": ["Bool"], "arguments": [ { "constructor": "True", "argtypes": [], "arguments": [] } ] } - }, - { "vname": "sender_balance_pre", "type": "Uint128", "value": "0" }, - { "vname": "sender_balance_mid", "type": "Uint128", "value": "0" }, - { "vname": "sender_balance_post", "type": "Uint128", "value": "0" }, - { - "vname": "_external", - "type": "Unit", - "value": [ - { - "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", - "state": [ - { "vname": "_balance", "type": "Uint128", "value": "1000000" } - ] - } - ] - } -] From 8bd45ed173dde463bc274b72eb5b4332637d5ae5 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Wed, 14 Jul 2021 18:34:52 +0200 Subject: [PATCH 11/22] Move multi-accept tests to accounting_tests.scilla --- .../good/gold/accounting_tests.scilla.gold | 21 +++--- .../gold/accounting_tests_support.scilla.gold | 35 ++++++++- .../good/gold/remote_state_reads.scilla.gold | 17 +---- tests/contracts/accounting_tests.scilla | 75 +++++++++++++++---- .../contracts/accounting_tests_support.scilla | 17 ++++- tests/contracts/remote_state_reads.scilla | 14 ---- tests/runner/Testcontracts.ml | 8 +- .../blockchain_18.json} | 0 .../blockchain_19.json} | 0 .../accounting_tests/blockchain_20.json | 1 + .../runner/accounting_tests/message_107.json | 2 +- .../runner/accounting_tests/message_109.json | 2 +- tests/runner/accounting_tests/message_13.json | 2 +- tests/runner/accounting_tests/message_16.json | 2 +- tests/runner/accounting_tests/message_18.json | 7 ++ tests/runner/accounting_tests/message_19.json | 7 ++ tests/runner/accounting_tests/message_20.json | 7 ++ tests/runner/accounting_tests/output_107.json | 4 +- tests/runner/accounting_tests/output_109.json | 6 +- tests/runner/accounting_tests/output_11.json | 2 +- tests/runner/accounting_tests/output_12.json | 2 +- tests/runner/accounting_tests/output_14.json | 2 +- tests/runner/accounting_tests/output_15.json | 2 +- tests/runner/accounting_tests/output_18.json | 21 ++++++ tests/runner/accounting_tests/output_19.json | 29 +++++++ tests/runner/accounting_tests/output_20.json | 29 +++++++ tests/runner/accounting_tests/state_18.json | 45 +++++++++++ tests/runner/accounting_tests/state_19.json | 45 +++++++++++ tests/runner/accounting_tests/state_20.json | 45 +++++++++++ .../blockchain_5.json | 1 + .../accounting_tests_support/message_5.json | 7 ++ .../accounting_tests_support/output_5.json | 11 +++ .../accounting_tests_support/state_5.json | 48 ++++++++++++ .../remote_state_reads/blockchain_127.json | 1 + .../remote_state_reads/blockchain_9.json | 1 + .../init_address_type_ipc_output.json | 2 +- .../init_assignable_map_types_ipc_output.json | 2 +- .../init_balance_and_nonce_ipc_output.json | 2 +- .../init_balance_no_nonce_ipc_output.json | 2 +- .../remote_state_reads/init_ipc_output.json | 2 +- .../init_missing_field_ipc_output.json | 2 +- .../init_no_address_ipc_output.json | 2 +- .../init_nonce_no_balance_ipc_output.json | 2 +- ...t_wrong_address_field_type_ipc_output.json | 2 +- .../init_wrong_field_type_ipc_output.json | 2 +- .../init_wrong_map_type_ipc_output.json | 2 +- .../{message_131.json => message_127.json} | 0 .../{message_11.json => message_9.json} | 0 .../{output_131.json => output_127.json} | 0 .../{output_11.json => output_9.json} | 0 .../{state_131.json => state_127.json} | 0 .../{state_11.json => state_9.json} | 0 52 files changed, 461 insertions(+), 79 deletions(-) rename tests/runner/{remote_state_reads/blockchain_11.json => accounting_tests/blockchain_18.json} (100%) rename tests/runner/{remote_state_reads/blockchain_131.json => accounting_tests/blockchain_19.json} (100%) create mode 100644 tests/runner/accounting_tests/blockchain_20.json create mode 100644 tests/runner/accounting_tests/message_18.json create mode 100644 tests/runner/accounting_tests/message_19.json create mode 100644 tests/runner/accounting_tests/message_20.json create mode 100644 tests/runner/accounting_tests/output_18.json create mode 100644 tests/runner/accounting_tests/output_19.json create mode 100644 tests/runner/accounting_tests/output_20.json create mode 100644 tests/runner/accounting_tests/state_18.json create mode 100644 tests/runner/accounting_tests/state_19.json create mode 100644 tests/runner/accounting_tests/state_20.json create mode 100644 tests/runner/accounting_tests_support/blockchain_5.json create mode 100644 tests/runner/accounting_tests_support/message_5.json create mode 100644 tests/runner/accounting_tests_support/output_5.json create mode 100644 tests/runner/accounting_tests_support/state_5.json create mode 100644 tests/runner/remote_state_reads/blockchain_127.json create mode 100644 tests/runner/remote_state_reads/blockchain_9.json rename tests/runner/remote_state_reads/{message_131.json => message_127.json} (100%) rename tests/runner/remote_state_reads/{message_11.json => message_9.json} (100%) rename tests/runner/remote_state_reads/{output_131.json => output_127.json} (100%) rename tests/runner/remote_state_reads/{output_11.json => output_9.json} (100%) rename tests/runner/remote_state_reads/{state_131.json => state_127.json} (100%) rename tests/runner/remote_state_reads/{state_11.json => state_9.json} (100%) diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index 8addbe744..d0d0257b3 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -35,21 +35,24 @@ { "vname": "Test_Send_3", "params": [] }, { "vname": "Test_Send_3_Helper", "params": [] }, { "vname": "Finalize_Test_Send_3", "params": [] }, - { "vname": "Test_Send_4", "params": [] }, - { "vname": "Test_Send_5", "params": [] }, - { "vname": "Test_Send_6", "params": [] }, - { "vname": "Test_Send_7", "params": [] }, { - "vname": "Finalize_Test_Send_6_7", + "vname": "CheckSenderBalance", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] }, - { "vname": "Test_Send_8", "params": [] }, - { "vname": "Test_Send_9", "params": [] }, { - "vname": "Finalize_Test_Send_8_9", + "vname": "CheckRecipientBalance", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] }, - { "vname": "Test_Send_10", "params": [] } + { "vname": "Test_Send_4", "params": [] }, + { "vname": "Test_Send_5", "params": [] }, + { "vname": "Test_Send_6", "params": [] }, + { "vname": "Test_Send_7", "params": [] }, + { "vname": "Test_Send_8", "params": [] }, + { "vname": "Test_Send_9", "params": [] }, + { "vname": "Test_Send_10", "params": [] }, + { "vname": "Test_Send_11", "params": [] }, + { "vname": "Test_Send_12", "params": [] }, + { "vname": "Test_Send_13", "params": [] } ], "procedures": [ { "vname": "AssertReset", "params": [] }, diff --git a/tests/checker/good/gold/accounting_tests_support.scilla.gold b/tests/checker/good/gold/accounting_tests_support.scilla.gold index aa6a255c7..6299a830e 100644 --- a/tests/checker/good/gold/accounting_tests_support.scilla.gold +++ b/tests/checker/good/gold/accounting_tests_support.scilla.gold @@ -19,8 +19,10 @@ "params": [ { "vname": "s", "type": "String" } ] }, { "vname": "Accept", "params": [] }, + { "vname": "AcceptTwice", "params": [] }, { "vname": "NonAccept", "params": [] }, { "vname": "AcceptAndCheckBalance", "params": [] }, + { "vname": "AcceptTwiceAndCheckBalance", "params": [] }, { "vname": "AcceptAndCheckSenderBalance", "params": [] } ], "procedures": [ @@ -74,7 +76,38 @@ } ] }, - "warnings": [], + "warnings": [ + { + "warning_message": + "transition AcceptTwiceAndCheckBalance has a potential code path with duplicate accept statements:\n Accept at contracts/accounting_tests_support.scilla:65:3\n Accept at contracts/accounting_tests_support.scilla:68:3\n", + "start_location": { + "file": "contracts/accounting_tests_support.scilla", + "line": 65, + "column": 3 + }, + "end_location": { + "file": "contracts/accounting_tests_support.scilla", + "line": 68, + "column": 9 + }, + "warning_id": 1 + }, + { + "warning_message": + "transition AcceptTwice has a potential code path with duplicate accept statements:\n Accept at contracts/accounting_tests_support.scilla:23:3\n Accept at contracts/accounting_tests_support.scilla:24:3\n", + "start_location": { + "file": "contracts/accounting_tests_support.scilla", + "line": 23, + "column": 3 + }, + "end_location": { + "file": "contracts/accounting_tests_support.scilla", + "line": 24, + "column": 9 + }, + "warning_id": 1 + } + ], "gas_remaining": "7999" } diff --git a/tests/checker/good/gold/remote_state_reads.scilla.gold b/tests/checker/good/gold/remote_state_reads.scilla.gold index b3d33c3e4..cfa30c635 100644 --- a/tests/checker/good/gold/remote_state_reads.scilla.gold +++ b/tests/checker/good/gold/remote_state_reads.scilla.gold @@ -179,8 +179,7 @@ }, { "vname": "OutgoingMsgTest", "params": [] }, { "vname": "ExceptionTest", "params": [] }, - { "vname": "AssignTest", "params": [] }, - { "vname": "SenderBalanceTest", "params": [] } + { "vname": "AssignTest", "params": [] } ], "procedures": [], "events": [ @@ -248,17 +247,9 @@ "warnings": [ { "warning_message": - "transition SenderBalanceTest has a potential code path with duplicate accept statements:\n Accept at contracts/remote_state_reads.scilla:169:3\n Accept at contracts/remote_state_reads.scilla:173:3\n", - "start_location": { - "file": "contracts/remote_state_reads.scilla", - "line": 169, - "column": 3 - }, - "end_location": { - "file": "contracts/remote_state_reads.scilla", - "line": 173, - "column": 9 - }, + "No transition in contract RRContract contains an accept statement\n", + "start_location": { "file": "", "line": 0, "column": 0 }, + "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 1 } ], diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index b039474cb..a247f750c 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -209,6 +209,10 @@ procedure CheckBalance(expected_balance : Uint128) end end +transition CheckSenderBalance(expected_balance : Uint128) + CheckBalance expected_balance +end + procedure CheckSupportBalance(expected_balance : Uint128) cur_balance <- & support_contract._balance; is_expected = builtin eq expected_balance cur_balance; @@ -222,6 +226,10 @@ procedure CheckSupportBalance(expected_balance : Uint128) end end +transition CheckRecipientBalance(expected_balance : Uint128) + CheckSupportBalance expected_balance +end + (* Check that the current contract's balance is decreased when sending funds in single messages *) transition Test_Send_4() AssertReset; @@ -274,7 +282,7 @@ transition Test_Send_6() send msgs1; expected_balance = builtin sub bal amount; msg2 = { _recipient : _this_address; - _tag : "Finalize_Test_Send_6_7"; + _tag : "CheckSenderBalance"; _amount : Uint128 0; expected_balance : expected_balance }; msgs2 = one_msg msg2; @@ -292,17 +300,13 @@ transition Test_Send_7() msgs1 = one_msg msg1; send msgs1; msg2 = { _recipient : _this_address; - _tag : "Finalize_Test_Send_6_7"; + _tag : "CheckSenderBalance"; _amount : Uint128 0; expected_balance : bal }; msgs2 = one_msg msg2; send msgs2 end -transition Finalize_Test_Send_6_7(expected_balance : Uint128) - CheckBalance expected_balance -end - (* Check that the recipient's balance isn't updated until the funds are accepted *) transition Test_Send_8() AssertReset; @@ -315,7 +319,7 @@ transition Test_Send_8() support_bal <- & support_contract._balance; expected_balance = builtin add support_bal amount; msg2 = { _recipient : _this_address; - _tag : "Finalize_Test_Send_8_9"; + _tag : "CheckRecipientBalance"; _amount : Uint128 0; expected_balance : expected_balance }; msgs2 = one_msg msg2; @@ -333,17 +337,13 @@ transition Test_Send_9() send msgs1; support_bal <- & support_contract._balance; msg2 = { _recipient : _this_address; - _tag : "Finalize_Test_Send_8_9"; + _tag : "CheckRecipientBalance"; _amount : Uint128 0; expected_balance : support_bal }; msgs2 = one_msg msg2; send msgs2 end -transition Finalize_Test_Send_8_9(expected_balance : Uint128) - CheckSupportBalance expected_balance -end - (* Check that acceptance does not affect sender's balance *) transition Test_Send_10() AssertReset; @@ -353,4 +353,53 @@ transition Test_Send_10() _amount : amount}; msgs = one_msg msg1; send msgs -end \ No newline at end of file +end + +(* Check that only the first accept affects the recipient's balance *) +transition Test_Send_11() + AssertReset; + amount <- outgoing_amount; + msg1 = { _recipient : support_contract; + _tag : "AcceptTwiceAndCheckBalance"; + _amount : amount}; + msgs = one_msg msg1; + send msgs +end + +(* Check that only one of multiple accepts decrease the sender's balance *) +transition Test_Send_12() + amount <- outgoing_amount; + bal <- _balance; + msg1 = { _recipient : support_contract; + _tag : "AcceptTwiceAndCheckBalance"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + expected_balance = builtin sub bal amount; + msg2 = { _recipient : _this_address; + _tag : "CheckSenderBalance"; + _amount : Uint128 0; + expected_balance : expected_balance }; + msgs2 = one_msg msg2; + send msgs2 +end + +(* Check that only one of multiple accepts increase the recipient's balance *) +transition Test_Send_13() + (* Check that the recipient's balance isn't updated until the funds are accepted *) + AssertReset; + amount <- outgoing_amount; + msg1 = { _recipient : support_contract; + _tag : "AcceptTwiceAndCheckBalance"; + _amount : amount}; + msgs1 = one_msg msg1; + send msgs1; + support_bal <- & support_contract._balance; + expected_balance = builtin add support_bal amount; + msg2 = { _recipient : _this_address; + _tag : "CheckRecipientBalance"; + _amount : Uint128 0; + expected_balance : expected_balance }; + msgs2 = one_msg msg2; + send msgs2 +end diff --git a/tests/contracts/accounting_tests_support.scilla b/tests/contracts/accounting_tests_support.scilla index ea77fd393..f2ad0ed87 100644 --- a/tests/contracts/accounting_tests_support.scilla +++ b/tests/contracts/accounting_tests_support.scilla @@ -19,6 +19,11 @@ transition Accept() accept end +transition AcceptTwice() + accept; + accept +end + transition NonAccept() end @@ -55,8 +60,18 @@ transition AcceptAndCheckBalance() CheckBalance expected_balance end +transition AcceptTwiceAndCheckBalance() + init_bal <- _balance; + accept; + expected_balance = builtin add init_bal _amount; + CheckBalance expected_balance; + accept; + CheckBalance expected_balance +end + transition AcceptAndCheckSenderBalance() init_bal <- & _sender._balance; accept; CheckSenderBalance init_bal -end \ No newline at end of file +end + diff --git a/tests/contracts/remote_state_reads.scilla b/tests/contracts/remote_state_reads.scilla index 8698f663d..f59c2ecea 100644 --- a/tests/contracts/remote_state_reads.scilla +++ b/tests/contracts/remote_state_reads.scilla @@ -160,17 +160,3 @@ transition AssignTest() k2 = Uint128 42; assign_test_10[k1][k2] := x end - -(* Check that sender balance is deducted on acceptance *) -transition SenderBalanceTest() - pre <-& _sender._balance; - sender_balance_pre := pre; - (* First accept should cause sender balance to decrease *) - accept; - mid <-& _sender._balance; - sender_balance_mid := mid; - (* Second accept should make no difference *) - accept; - post <-& _sender._balance; - sender_balance_post := post -end diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index 2d900e79d..d9f49d9cf 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -442,7 +442,7 @@ let contract_tests env = "init" ~is_library:false ~ipc_mode:true; "remote_state_reads" >::: build_contract_tests ~pplit:false env "remote_state_reads" - succ_code 1 11 []; + succ_code 1 10 []; "remote_state_reads_2" >::: build_contract_tests ~pplit:false env "remote_state_reads_2" succ_code 1 5 []; @@ -471,9 +471,9 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 17 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 20 []; "accounting_tests_support" - >::: build_contract_tests env "accounting_tests_support" succ_code 1 4 []; + >::: build_contract_tests env "accounting_tests_support" succ_code 1 5 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" @@ -552,7 +552,7 @@ let contract_tests env = "init_address_type" ~is_library:false ~ipc_mode:true; "remote_state_reads" >::: build_contract_tests env "remote_state_reads" fail_code 101 - 131 []; + 130 []; "map_as_cparam" >: build_contract_init_test env fail_code "map_as_cparam" "init_illegal_key" ~is_library:false ~ipc_mode:true; diff --git a/tests/runner/remote_state_reads/blockchain_11.json b/tests/runner/accounting_tests/blockchain_18.json similarity index 100% rename from tests/runner/remote_state_reads/blockchain_11.json rename to tests/runner/accounting_tests/blockchain_18.json diff --git a/tests/runner/remote_state_reads/blockchain_131.json b/tests/runner/accounting_tests/blockchain_19.json similarity index 100% rename from tests/runner/remote_state_reads/blockchain_131.json rename to tests/runner/accounting_tests/blockchain_19.json diff --git a/tests/runner/accounting_tests/blockchain_20.json b/tests/runner/accounting_tests/blockchain_20.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_20.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_107.json b/tests/runner/accounting_tests/message_107.json index 5ba57aacd..f42c69042 100644 --- a/tests/runner/accounting_tests/message_107.json +++ b/tests/runner/accounting_tests/message_107.json @@ -1,5 +1,5 @@ { - "_tag": "Finalize_Test_Send_6_7", + "_tag": "CheckSenderBalance", "_amount": "0", "_sender": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/message_109.json b/tests/runner/accounting_tests/message_109.json index 50fcb1e8f..3eaa66c1d 100644 --- a/tests/runner/accounting_tests/message_109.json +++ b/tests/runner/accounting_tests/message_109.json @@ -1,5 +1,5 @@ { - "_tag": "Finalize_Test_Send_8_9", + "_tag": "CheckRecipientBalance", "_amount": "0", "_sender": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/message_13.json b/tests/runner/accounting_tests/message_13.json index 5ba57aacd..f42c69042 100644 --- a/tests/runner/accounting_tests/message_13.json +++ b/tests/runner/accounting_tests/message_13.json @@ -1,5 +1,5 @@ { - "_tag": "Finalize_Test_Send_6_7", + "_tag": "CheckSenderBalance", "_amount": "0", "_sender": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/message_16.json b/tests/runner/accounting_tests/message_16.json index 50fcb1e8f..3eaa66c1d 100644 --- a/tests/runner/accounting_tests/message_16.json +++ b/tests/runner/accounting_tests/message_16.json @@ -1,5 +1,5 @@ { - "_tag": "Finalize_Test_Send_8_9", + "_tag": "CheckRecipientBalance", "_amount": "0", "_sender": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/message_18.json b/tests/runner/accounting_tests/message_18.json new file mode 100644 index 000000000..9066baf16 --- /dev/null +++ b/tests/runner/accounting_tests/message_18.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_11", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_19.json b/tests/runner/accounting_tests/message_19.json new file mode 100644 index 000000000..761bb5667 --- /dev/null +++ b/tests/runner/accounting_tests/message_19.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_12", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/message_20.json b/tests/runner/accounting_tests/message_20.json new file mode 100644 index 000000000..7c6da924a --- /dev/null +++ b/tests/runner/accounting_tests/message_20.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_13", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_107.json b/tests/runner/accounting_tests/output_107.json index 0b2305e0c..401c8d409 100644 --- a/tests/runner/accounting_tests/output_107.json +++ b/tests/runner/accounting_tests/output_107.json @@ -12,10 +12,10 @@ "end_location": { "file": "", "line": 0, "column": 0 } }, { - "error_message": "Raised from Finalize_Test_Send_6_7", + "error_message": "Raised from CheckSenderBalance", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 302, + "line": 212, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_109.json b/tests/runner/accounting_tests/output_109.json index 6916931dc..e1e636975 100644 --- a/tests/runner/accounting_tests/output_109.json +++ b/tests/runner/accounting_tests/output_109.json @@ -6,16 +6,16 @@ "Exception thrown: (Message [(_exception : (String \"Main contract read unexpected support contract balance\")) ; (expected : (Uint128 52)) ; (actual : (Uint128 42))])", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 221, + "line": 225, "column": 5 }, "end_location": { "file": "", "line": 0, "column": 0 } }, { - "error_message": "Raised from Finalize_Test_Send_8_9", + "error_message": "Raised from CheckRecipientBalance", "start_location": { "file": "tests/contracts/accounting_tests.scilla", - "line": 343, + "line": 229, "column": 12 }, "end_location": { "file": "", "line": 0, "column": 0 } diff --git a/tests/runner/accounting_tests/output_11.json b/tests/runner/accounting_tests/output_11.json index 642fc8cf4..8b5c96c6a 100644 --- a/tests/runner/accounting_tests/output_11.json +++ b/tests/runner/accounting_tests/output_11.json @@ -10,7 +10,7 @@ "params": [] }, { - "_tag": "Finalize_Test_Send_6_7", + "_tag": "CheckSenderBalance", "_amount": "0", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/output_12.json b/tests/runner/accounting_tests/output_12.json index 1a07cc787..d09c91249 100644 --- a/tests/runner/accounting_tests/output_12.json +++ b/tests/runner/accounting_tests/output_12.json @@ -10,7 +10,7 @@ "params": [] }, { - "_tag": "Finalize_Test_Send_6_7", + "_tag": "CheckSenderBalance", "_amount": "0", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/output_14.json b/tests/runner/accounting_tests/output_14.json index 54d77645a..f28cf6064 100644 --- a/tests/runner/accounting_tests/output_14.json +++ b/tests/runner/accounting_tests/output_14.json @@ -10,7 +10,7 @@ "params": [] }, { - "_tag": "Finalize_Test_Send_8_9", + "_tag": "CheckRecipientBalance", "_amount": "0", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/output_15.json b/tests/runner/accounting_tests/output_15.json index 8cd31a664..13d486669 100644 --- a/tests/runner/accounting_tests/output_15.json +++ b/tests/runner/accounting_tests/output_15.json @@ -10,7 +10,7 @@ "params": [] }, { - "_tag": "Finalize_Test_Send_8_9", + "_tag": "CheckRecipientBalance", "_amount": "0", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/output_18.json b/tests/runner/accounting_tests/output_18.json new file mode 100644 index 000000000..ac4942fb2 --- /dev/null +++ b/tests/runner/accounting_tests/output_18.json @@ -0,0 +1,21 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7934", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptTwiceAndCheckBalance", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_19.json b/tests/runner/accounting_tests/output_19.json new file mode 100644 index 000000000..ea0924a55 --- /dev/null +++ b/tests/runner/accounting_tests/output_19.json @@ -0,0 +1,29 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7925", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptTwiceAndCheckBalance", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "CheckSenderBalance", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_20.json b/tests/runner/accounting_tests/output_20.json new file mode 100644 index 000000000..a24a7e66a --- /dev/null +++ b/tests/runner/accounting_tests/output_20.json @@ -0,0 +1,29 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7911", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptTwiceAndCheckBalance", + "_amount": "10", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + }, + { + "_tag": "CheckRecipientBalance", + "_amount": "0", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "52" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_18.json b/tests/runner/accounting_tests/state_18.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_18.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_19.json b/tests/runner/accounting_tests/state_19.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_19.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_20.json b/tests/runner/accounting_tests/state_20.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_20.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests_support/blockchain_5.json b/tests/runner/accounting_tests_support/blockchain_5.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_5.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/message_5.json b/tests/runner/accounting_tests_support/message_5.json new file mode 100644 index 000000000..2e1f9f1c9 --- /dev/null +++ b/tests/runner/accounting_tests_support/message_5.json @@ -0,0 +1,7 @@ +{ + "_tag": "AcceptTwiceAndCheckBalance", + "_amount": "10", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests_support/output_5.json b/tests/runner/accounting_tests_support/output_5.json new file mode 100644 index 000000000..dc9817a81 --- /dev/null +++ b/tests/runner/accounting_tests_support/output_5.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7962", + "_accepted": "true", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/state_5.json b/tests/runner/accounting_tests_support/state_5.json new file mode 100644 index 000000000..3fd594a91 --- /dev/null +++ b/tests/runner/accounting_tests_support/state_5.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] diff --git a/tests/runner/remote_state_reads/blockchain_127.json b/tests/runner/remote_state_reads/blockchain_127.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/remote_state_reads/blockchain_127.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/remote_state_reads/blockchain_9.json b/tests/runner/remote_state_reads/blockchain_9.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/remote_state_reads/blockchain_9.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/remote_state_reads/init_address_type_ipc_output.json b/tests/runner/remote_state_reads/init_address_type_ipc_output.json index c4b542ba7..743b2696c 100644 --- a/tests/runner/remote_state_reads/init_address_type_ipc_output.json +++ b/tests/runner/remote_state_reads/init_address_type_ipc_output.json @@ -1,5 +1,5 @@ { - "gas_remaining": "7063", + "gas_remaining": "7112", "errors": [ { "error_message": "Address type not allowed in json file", diff --git a/tests/runner/remote_state_reads/init_assignable_map_types_ipc_output.json b/tests/runner/remote_state_reads/init_assignable_map_types_ipc_output.json index 7bfa4af1c..ad8254e1a 100644 --- a/tests/runner/remote_state_reads/init_assignable_map_types_ipc_output.json +++ b/tests/runner/remote_state_reads/init_assignable_map_types_ipc_output.json @@ -1,6 +1,6 @@ { "scilla_major_version": "0", - "gas_remaining": "56479", + "gas_remaining": "56875", "_accepted": "false", "messages": null, "states": [ { "vname": "_balance", "type": "Uint128", "value": "0" } ], diff --git a/tests/runner/remote_state_reads/init_balance_and_nonce_ipc_output.json b/tests/runner/remote_state_reads/init_balance_and_nonce_ipc_output.json index 7bfa4af1c..ad8254e1a 100644 --- a/tests/runner/remote_state_reads/init_balance_and_nonce_ipc_output.json +++ b/tests/runner/remote_state_reads/init_balance_and_nonce_ipc_output.json @@ -1,6 +1,6 @@ { "scilla_major_version": "0", - "gas_remaining": "56479", + "gas_remaining": "56875", "_accepted": "false", "messages": null, "states": [ { "vname": "_balance", "type": "Uint128", "value": "0" } ], diff --git a/tests/runner/remote_state_reads/init_balance_no_nonce_ipc_output.json b/tests/runner/remote_state_reads/init_balance_no_nonce_ipc_output.json index 7bfa4af1c..ad8254e1a 100644 --- a/tests/runner/remote_state_reads/init_balance_no_nonce_ipc_output.json +++ b/tests/runner/remote_state_reads/init_balance_no_nonce_ipc_output.json @@ -1,6 +1,6 @@ { "scilla_major_version": "0", - "gas_remaining": "56479", + "gas_remaining": "56875", "_accepted": "false", "messages": null, "states": [ { "vname": "_balance", "type": "Uint128", "value": "0" } ], diff --git a/tests/runner/remote_state_reads/init_ipc_output.json b/tests/runner/remote_state_reads/init_ipc_output.json index 7bfa4af1c..ad8254e1a 100644 --- a/tests/runner/remote_state_reads/init_ipc_output.json +++ b/tests/runner/remote_state_reads/init_ipc_output.json @@ -1,6 +1,6 @@ { "scilla_major_version": "0", - "gas_remaining": "56479", + "gas_remaining": "56875", "_accepted": "false", "messages": null, "states": [ { "vname": "_balance", "type": "Uint128", "value": "0" } ], diff --git a/tests/runner/remote_state_reads/init_missing_field_ipc_output.json b/tests/runner/remote_state_reads/init_missing_field_ipc_output.json index 02a82f2c6..1e02eee15 100644 --- a/tests/runner/remote_state_reads/init_missing_field_ipc_output.json +++ b/tests/runner/remote_state_reads/init_missing_field_ipc_output.json @@ -1,5 +1,5 @@ { - "gas_remaining": "7058", + "gas_remaining": "7108", "errors": [ { "error_message": diff --git a/tests/runner/remote_state_reads/init_no_address_ipc_output.json b/tests/runner/remote_state_reads/init_no_address_ipc_output.json index 2eded2ee6..d61876966 100644 --- a/tests/runner/remote_state_reads/init_no_address_ipc_output.json +++ b/tests/runner/remote_state_reads/init_no_address_ipc_output.json @@ -1,5 +1,5 @@ { - "gas_remaining": "7058", + "gas_remaining": "7107", "errors": [ { "error_message": diff --git a/tests/runner/remote_state_reads/init_nonce_no_balance_ipc_output.json b/tests/runner/remote_state_reads/init_nonce_no_balance_ipc_output.json index 7bfa4af1c..ad8254e1a 100644 --- a/tests/runner/remote_state_reads/init_nonce_no_balance_ipc_output.json +++ b/tests/runner/remote_state_reads/init_nonce_no_balance_ipc_output.json @@ -1,6 +1,6 @@ { "scilla_major_version": "0", - "gas_remaining": "56479", + "gas_remaining": "56875", "_accepted": "false", "messages": null, "states": [ { "vname": "_balance", "type": "Uint128", "value": "0" } ], diff --git a/tests/runner/remote_state_reads/init_wrong_address_field_type_ipc_output.json b/tests/runner/remote_state_reads/init_wrong_address_field_type_ipc_output.json index 02a82f2c6..1e02eee15 100644 --- a/tests/runner/remote_state_reads/init_wrong_address_field_type_ipc_output.json +++ b/tests/runner/remote_state_reads/init_wrong_address_field_type_ipc_output.json @@ -1,5 +1,5 @@ { - "gas_remaining": "7058", + "gas_remaining": "7108", "errors": [ { "error_message": diff --git a/tests/runner/remote_state_reads/init_wrong_field_type_ipc_output.json b/tests/runner/remote_state_reads/init_wrong_field_type_ipc_output.json index 02a82f2c6..1e02eee15 100644 --- a/tests/runner/remote_state_reads/init_wrong_field_type_ipc_output.json +++ b/tests/runner/remote_state_reads/init_wrong_field_type_ipc_output.json @@ -1,5 +1,5 @@ { - "gas_remaining": "7058", + "gas_remaining": "7108", "errors": [ { "error_message": diff --git a/tests/runner/remote_state_reads/init_wrong_map_type_ipc_output.json b/tests/runner/remote_state_reads/init_wrong_map_type_ipc_output.json index 02a82f2c6..1e02eee15 100644 --- a/tests/runner/remote_state_reads/init_wrong_map_type_ipc_output.json +++ b/tests/runner/remote_state_reads/init_wrong_map_type_ipc_output.json @@ -1,5 +1,5 @@ { - "gas_remaining": "7058", + "gas_remaining": "7108", "errors": [ { "error_message": diff --git a/tests/runner/remote_state_reads/message_131.json b/tests/runner/remote_state_reads/message_127.json similarity index 100% rename from tests/runner/remote_state_reads/message_131.json rename to tests/runner/remote_state_reads/message_127.json diff --git a/tests/runner/remote_state_reads/message_11.json b/tests/runner/remote_state_reads/message_9.json similarity index 100% rename from tests/runner/remote_state_reads/message_11.json rename to tests/runner/remote_state_reads/message_9.json diff --git a/tests/runner/remote_state_reads/output_131.json b/tests/runner/remote_state_reads/output_127.json similarity index 100% rename from tests/runner/remote_state_reads/output_131.json rename to tests/runner/remote_state_reads/output_127.json diff --git a/tests/runner/remote_state_reads/output_11.json b/tests/runner/remote_state_reads/output_9.json similarity index 100% rename from tests/runner/remote_state_reads/output_11.json rename to tests/runner/remote_state_reads/output_9.json diff --git a/tests/runner/remote_state_reads/state_131.json b/tests/runner/remote_state_reads/state_127.json similarity index 100% rename from tests/runner/remote_state_reads/state_131.json rename to tests/runner/remote_state_reads/state_127.json diff --git a/tests/runner/remote_state_reads/state_11.json b/tests/runner/remote_state_reads/state_9.json similarity index 100% rename from tests/runner/remote_state_reads/state_11.json rename to tests/runner/remote_state_reads/state_9.json From 07475d6d7a4f29022e24178454e706d30731a76f Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Wed, 14 Jul 2021 18:37:06 +0200 Subject: [PATCH 12/22] Merge --- .../good/gold/accounting_tests.scilla.gold | 57 ++++++++++++++++++- .../good/gold/remote_state_reads.scilla.gold | 46 +++++++-------- 2 files changed, 79 insertions(+), 24 deletions(-) diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index d0d0257b3..f8613282b 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -110,7 +110,62 @@ } ] }, - "warnings": [], + "warnings": [ + { + "warning_message": + "Read only field, consider making it a contract parameter: test_string_2", + "start_location": { + "file": "contracts/accounting_tests.scilla", + "line": 83, + "column": 9 + }, + "end_location": { "file": "", "line": 0, "column": 0 }, + "warning_id": 3 + }, + { + "warning_message": + "Read only field, consider making it a contract parameter: test_string_1", + "start_location": { + "file": "contracts/accounting_tests.scilla", + "line": 76, + "column": 9 + }, + "end_location": { "file": "", "line": 0, "column": 0 }, + "warning_id": 3 + }, + { + "warning_message": + "Read only field, consider making it a contract parameter: outgoing_amount", + "start_location": { + "file": "contracts/accounting_tests.scilla", + "line": 45, + "column": 13 + }, + "end_location": { "file": "", "line": 0, "column": 0 }, + "warning_id": 3 + }, + { + "warning_message": + "Read only field, consider making it a contract parameter: max_outgoing_msgs", + "start_location": { + "file": "contracts/accounting_tests.scilla", + "line": 46, + "column": 15 + }, + "end_location": { "file": "", "line": 0, "column": 0 }, + "warning_id": 3 + }, + { + "warning_message": "Unused load statement to: s1", + "start_location": { + "file": "contracts/accounting_tests.scilla", + "line": 152, + "column": 3 + }, + "end_location": { "file": "", "line": 0, "column": 0 }, + "warning_id": 3 + } + ], "gas_remaining": "7916" } diff --git a/tests/checker/good/gold/remote_state_reads.scilla.gold b/tests/checker/good/gold/remote_state_reads.scilla.gold index f72f1ed91..a6f32fdf1 100644 --- a/tests/checker/good/gold/remote_state_reads.scilla.gold +++ b/tests/checker/good/gold/remote_state_reads.scilla.gold @@ -246,101 +246,101 @@ }, "warnings": [ { - "warning_message": "Unused field: assign_test_7", + "warning_message": "Unused field: sender_balance_post", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 31, + "line": 53, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Unused field: assign_test_6", + "warning_message": "Unused field: sender_balance_mid", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 30, + "line": 52, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Unused field: assign_test_5", + "warning_message": "Unused field: sender_balance_pre", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 29, + "line": 51, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Unused field: assign_test_4", + "warning_message": "Unused field: assign_test_7", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 28, + "line": 31, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Unused field: assign_test_3", + "warning_message": "Unused field: assign_test_6", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 27, + "line": 30, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Unused field: assign_test_2", + "warning_message": "Unused field: assign_test_5", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 26, + "line": 29, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Unused field: assign_test_1", + "warning_message": "Unused field: assign_test_4", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 25, + "line": 28, "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Write only field: sender_balance_pre", + "warning_message": "Unused field: assign_test_3", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 167, - "column": 3 + "line": 27, + "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Write only field: sender_balance_post", + "warning_message": "Unused field: assign_test_2", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 175, - "column": 3 + "line": 26, + "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 }, { - "warning_message": "Write only field: sender_balance_mid", + "warning_message": "Unused field: assign_test_1", "start_location": { "file": "contracts/remote_state_reads.scilla", - "line": 171, - "column": 3 + "line": 25, + "column": 7 }, "end_location": { "file": "", "line": 0, "column": 0 }, "warning_id": 3 From 6f5c6bef8fd8e8c4e5fcf23d8d38abc154795735 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Wed, 14 Jul 2021 18:37:27 +0200 Subject: [PATCH 13/22] fmt --- src/eval/EvalUtil.ml | 29 ++++++++++++++++------------- tests/runner/Testcontracts.ml | 9 ++++++--- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/eval/EvalUtil.ml b/src/eval/EvalUtil.ml index 07f0e6059..b8b1cad15 100644 --- a/src/eval/EvalUtil.ml +++ b/src/eval/EvalUtil.ml @@ -392,15 +392,18 @@ module Configuration = struct let send_messages conf ms = let%bind ls' = fromR @@ Datatypes.scilla_list_to_ocaml ms in let%bind () = forallM ~f:validate_outgoing_message ls' in - let%bind out_funds = foldM ls' ~init:Uint128.zero ~f:(fun run_total msg_lit -> - match msg_lit with - | SLiteral.Msg msg -> - let%bind amount = fromR @@ MessagePayload.get_amount msg in - pure (Uint128.(run_total + amount)) - | _ -> - fail0 - @@ sprintf "Literal %s verified as a message, but is not a message literal." - (pp_literal msg_lit)) + let%bind out_funds = + foldM ls' ~init:Uint128.zero ~f:(fun run_total msg_lit -> + match msg_lit with + | SLiteral.Msg msg -> + let%bind amount = fromR @@ MessagePayload.get_amount msg in + pure Uint128.(run_total + amount) + | _ -> + fail0 + @@ sprintf + "Literal %s verified as a message, but is not a message \ + literal." + (pp_literal msg_lit)) in let old_emitted = conf.emitted in let emitted = old_emitted @ ls' in @@ -409,10 +412,10 @@ module Configuration = struct if Uint128.compare old_balance out_funds < 0 then fail0 @@ sprintf - "The balance (%s) is too low to transfer all the funds in the \ - messages (%s)" - (Uint128.to_string old_balance) - (Uint128.to_string out_funds) + "The balance (%s) is too low to transfer all the funds in the \ + messages (%s)" + (Uint128.to_string old_balance) + (Uint128.to_string out_funds) else pure @@ Uint128.(old_balance - out_funds) in pure { conf with emitted; balance } diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index d9f49d9cf..226ff91b9 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,9 +471,11 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 20 []; + >::: build_contract_tests env "accounting_tests" succ_code 1 20 + []; "accounting_tests_support" - >::: build_contract_tests env "accounting_tests_support" succ_code 1 5 []; + >::: build_contract_tests env "accounting_tests_support" + succ_code 1 5 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" @@ -576,7 +578,8 @@ let contract_tests env = "address_list_as_cparam" "init_address_type" ~is_library:false ~ipc_mode:true; "accounting_tests" - >::: build_contract_tests env "accounting_tests" fail_code 100 109 []; + >::: build_contract_tests env "accounting_tests" fail_code 100 + 109 []; ]; "misc_tests" >::: build_misc_tests env; ] From 5dddcf23495904886f80daf1b0ad9a808371eb76 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Thu, 15 Jul 2021 16:24:41 +0200 Subject: [PATCH 14/22] Remove erroneous sender balance check during accept --- src/eval/EvalUtil.ml | 36 ++------------ tests/runner/Testcontracts.ml | 2 +- .../blockchain_6.json | 1 + .../accounting_tests_support/message_6.json | 7 +++ .../accounting_tests_support/output_6.json | 11 +++++ .../accounting_tests_support/state_6.json | 48 +++++++++++++++++++ 6 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 tests/runner/accounting_tests_support/blockchain_6.json create mode 100644 tests/runner/accounting_tests_support/message_6.json create mode 100644 tests/runner/accounting_tests_support/output_6.json create mode 100644 tests/runner/accounting_tests_support/state_6.json diff --git a/src/eval/EvalUtil.ml b/src/eval/EvalUtil.ml index b8b1cad15..ec6512e9c 100644 --- a/src/eval/EvalUtil.ml +++ b/src/eval/EvalUtil.ml @@ -309,39 +309,11 @@ module Configuration = struct if st.accepted then (* Do nothing *) pure st else - (* Check that sender balance is sufficient *) - let%bind sender_addr = lookup_sender_addr st in - let%bind sender_balance_l = - remote_load sender_addr (mk_loc_id balance_label) - in let incoming' = st.incoming_funds in - match sender_balance_l with - | UintLit (Uint128L sender_balance) -> - if Uint128.compare incoming' sender_balance > 0 then - fail0 - ("Insufficient sender balance for acceptance. Incoming vs \ - sender_balance: " - ^ Uint128.to_string incoming' - ^ " vs " - ^ Uint128.to_string sender_balance) - else if - (* Although unsigned integer is used, and this check isn't - * necessary, we have it just in case, somehow a malformed - * Uint128 literal manages to reach here. *) - Uint128.compare incoming' Uint128.zero >= 0 - then - let balance = Uint128.add st.balance incoming' in - let accepted = true in - let incoming_funds = Uint128.zero in - pure @@ { st with balance; accepted; incoming_funds } - else - fail0 - @@ sprintf "Incoming balance is negative (somehow):%s." - (Uint128.to_string incoming') - | _ -> - fail0 - @@ sprintf "Unrecognized balance literal at sender: %s" - (pp_literal sender_balance_l) + let balance = Uint128.add st.balance incoming' in + let accepted = true in + let incoming_funds = Uint128.zero in + pure @@ { st with balance; accepted; incoming_funds } (* Finds a procedure proc_name, and returns the procedure and the list of procedures in scope for that procedure *) diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index 226ff91b9..e0b2d4a4d 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -475,7 +475,7 @@ let contract_tests env = []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" - succ_code 1 5 []; + succ_code 1 6 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" diff --git a/tests/runner/accounting_tests_support/blockchain_6.json b/tests/runner/accounting_tests_support/blockchain_6.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_6.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/message_6.json b/tests/runner/accounting_tests_support/message_6.json new file mode 100644 index 000000000..9869f6e98 --- /dev/null +++ b/tests/runner/accounting_tests_support/message_6.json @@ -0,0 +1,7 @@ +{ + "_tag": "Accept", + "_amount": "10", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ ], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests_support/output_6.json b/tests/runner/accounting_tests_support/output_6.json new file mode 100644 index 000000000..1d1f56307 --- /dev/null +++ b/tests/runner/accounting_tests_support/output_6.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7975", + "_accepted": "true", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/state_6.json b/tests/runner/accounting_tests_support/state_6.json new file mode 100644 index 000000000..acecbc513 --- /dev/null +++ b/tests/runner/accounting_tests_support/state_6.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] From 882fcba9bc87dd90882235cbc99a23a6c95e2927 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Thu, 15 Jul 2021 16:36:34 +0200 Subject: [PATCH 15/22] Added test that allows transfer of all remaining funds --- .../good/gold/accounting_tests.scilla.gold | 3 +- tests/contracts/accounting_tests.scilla | 11 +++++ tests/runner/Testcontracts.ml | 2 +- .../accounting_tests/blockchain_21.json | 1 + tests/runner/accounting_tests/message_21.json | 7 +++ tests/runner/accounting_tests/output_21.json | 21 +++++++++ tests/runner/accounting_tests/state_21.json | 45 +++++++++++++++++++ 7 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_21.json create mode 100644 tests/runner/accounting_tests/message_21.json create mode 100644 tests/runner/accounting_tests/output_21.json create mode 100644 tests/runner/accounting_tests/state_21.json diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index f8613282b..6101c6968 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -52,7 +52,8 @@ { "vname": "Test_Send_10", "params": [] }, { "vname": "Test_Send_11", "params": [] }, { "vname": "Test_Send_12", "params": [] }, - { "vname": "Test_Send_13", "params": [] } + { "vname": "Test_Send_13", "params": [] }, + { "vname": "Test_Send_14", "params": [] } ], "procedures": [ { "vname": "AssertReset", "params": [] }, diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index a247f750c..d61a14bb3 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -403,3 +403,14 @@ transition Test_Send_13() msgs2 = one_msg msg2; send msgs2 end + +(* Check that it is possible to transfer all funds (this ensures that the sender's balance isn't deducted more than once) *) +transition Test_Send_14() + AssertReset; + amount <- _balance; + msg1 = { _recipient : support_contract; + _tag : "Accept"; + _amount : amount}; + msgs = one_msg msg1; + send msgs +end \ No newline at end of file diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index e0b2d4a4d..e2ba850aa 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,7 +471,7 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 20 + >::: build_contract_tests env "accounting_tests" succ_code 1 21 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" diff --git a/tests/runner/accounting_tests/blockchain_21.json b/tests/runner/accounting_tests/blockchain_21.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_21.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_21.json b/tests/runner/accounting_tests/message_21.json new file mode 100644 index 000000000..fefcf78fd --- /dev/null +++ b/tests/runner/accounting_tests/message_21.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_14", + "_amount": "0", + "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [], + "_origin": "0xabfeccdc9012345678901234567890f777564322" +} diff --git a/tests/runner/accounting_tests/output_21.json b/tests/runner/accounting_tests/output_21.json new file mode 100644 index 000000000..55b587ea7 --- /dev/null +++ b/tests/runner/accounting_tests/output_21.json @@ -0,0 +1,21 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7935", + "_accepted": "false", + "messages": [ + { + "_tag": "Accept", + "_amount": "30", + "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "params": [] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_21.json b/tests/runner/accounting_tests/state_21.json new file mode 100644 index 000000000..845aa4057 --- /dev/null +++ b/tests/runner/accounting_tests/state_21.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0xabfeccdc9012345678901234567890f777564322", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0xabfeccdc9012345678901234567890f777564323", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + ] + } + ] + } +] From e03e8808883018e72ba74a536bf83b388d705ec0 Mon Sep 17 00:00:00 2001 From: Vaivaswatha Nagaraj Date: Thu, 29 Jul 2021 12:54:44 +0530 Subject: [PATCH 16/22] Add deployment output file --- tests/runner/accounting_tests/init_output.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/runner/accounting_tests/init_output.json b/tests/runner/accounting_tests/init_output.json index e69de29bb..876ecb6f9 100644 --- a/tests/runner/accounting_tests/init_output.json +++ b/tests/runner/accounting_tests/init_output.json @@ -0,0 +1,14 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "66565", + "_accepted": "false", + "messages": null, + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file From da93575fac989b53c1de942b76ed3c9021ce8222 Mon Sep 17 00:00:00 2001 From: Vaivaswatha Nagaraj Date: Mon, 2 Aug 2021 22:08:23 +0530 Subject: [PATCH 17/22] Change addresses to match those in the blockchain unittests --- tests/runner/accounting_tests/init.json | 4 ++-- tests/runner/accounting_tests/init_state.json | 4 ++-- tests/runner/accounting_tests/message_1.json | 4 ++-- tests/runner/accounting_tests/message_10.json | 4 ++-- tests/runner/accounting_tests/message_100.json | 4 ++-- tests/runner/accounting_tests/message_101.json | 4 ++-- tests/runner/accounting_tests/message_102.json | 4 ++-- tests/runner/accounting_tests/message_103.json | 4 ++-- tests/runner/accounting_tests/message_104.json | 4 ++-- tests/runner/accounting_tests/message_105.json | 4 ++-- tests/runner/accounting_tests/message_106.json | 4 ++-- tests/runner/accounting_tests/message_107.json | 4 ++-- tests/runner/accounting_tests/message_108.json | 4 ++-- tests/runner/accounting_tests/message_109.json | 4 ++-- tests/runner/accounting_tests/message_11.json | 4 ++-- tests/runner/accounting_tests/message_12.json | 4 ++-- tests/runner/accounting_tests/message_13.json | 4 ++-- tests/runner/accounting_tests/message_14.json | 4 ++-- tests/runner/accounting_tests/message_15.json | 4 ++-- tests/runner/accounting_tests/message_16.json | 4 ++-- tests/runner/accounting_tests/message_17.json | 4 ++-- tests/runner/accounting_tests/message_18.json | 4 ++-- tests/runner/accounting_tests/message_19.json | 4 ++-- tests/runner/accounting_tests/message_2.json | 4 ++-- tests/runner/accounting_tests/message_20.json | 4 ++-- tests/runner/accounting_tests/message_21.json | 4 ++-- tests/runner/accounting_tests/message_3.json | 4 ++-- tests/runner/accounting_tests/message_4.json | 4 ++-- tests/runner/accounting_tests/message_5.json | 4 ++-- tests/runner/accounting_tests/message_6.json | 4 ++-- tests/runner/accounting_tests/message_7.json | 4 ++-- tests/runner/accounting_tests/message_8.json | 4 ++-- tests/runner/accounting_tests/message_9.json | 4 ++-- tests/runner/accounting_tests/output_1.json | 2 +- tests/runner/accounting_tests/output_10.json | 4 ++-- tests/runner/accounting_tests/output_11.json | 4 ++-- tests/runner/accounting_tests/output_12.json | 4 ++-- tests/runner/accounting_tests/output_14.json | 4 ++-- tests/runner/accounting_tests/output_15.json | 4 ++-- tests/runner/accounting_tests/output_17.json | 2 +- tests/runner/accounting_tests/output_18.json | 2 +- tests/runner/accounting_tests/output_19.json | 4 ++-- tests/runner/accounting_tests/output_2.json | 6 +++--- tests/runner/accounting_tests/output_20.json | 4 ++-- tests/runner/accounting_tests/output_21.json | 2 +- tests/runner/accounting_tests/output_4.json | 6 +++--- tests/runner/accounting_tests/output_6.json | 6 +++--- tests/runner/accounting_tests/output_7.json | 2 +- tests/runner/accounting_tests/output_9.json | 4 ++-- tests/runner/accounting_tests/state_1.json | 6 +++--- tests/runner/accounting_tests/state_10.json | 6 +++--- tests/runner/accounting_tests/state_100.json | 6 +++--- tests/runner/accounting_tests/state_101.json | 6 +++--- tests/runner/accounting_tests/state_102.json | 6 +++--- tests/runner/accounting_tests/state_103.json | 6 +++--- tests/runner/accounting_tests/state_104.json | 6 +++--- tests/runner/accounting_tests/state_105.json | 6 +++--- tests/runner/accounting_tests/state_106.json | 6 +++--- tests/runner/accounting_tests/state_107.json | 6 +++--- tests/runner/accounting_tests/state_108.json | 6 +++--- tests/runner/accounting_tests/state_109.json | 6 +++--- tests/runner/accounting_tests/state_11.json | 6 +++--- tests/runner/accounting_tests/state_12.json | 6 +++--- tests/runner/accounting_tests/state_13.json | 6 +++--- tests/runner/accounting_tests/state_14.json | 6 +++--- tests/runner/accounting_tests/state_15.json | 6 +++--- tests/runner/accounting_tests/state_16.json | 6 +++--- tests/runner/accounting_tests/state_17.json | 6 +++--- tests/runner/accounting_tests/state_18.json | 6 +++--- tests/runner/accounting_tests/state_19.json | 6 +++--- tests/runner/accounting_tests/state_2.json | 6 +++--- tests/runner/accounting_tests/state_20.json | 6 +++--- tests/runner/accounting_tests/state_21.json | 6 +++--- tests/runner/accounting_tests/state_3.json | 6 +++--- tests/runner/accounting_tests/state_4.json | 6 +++--- tests/runner/accounting_tests/state_5.json | 6 +++--- tests/runner/accounting_tests/state_6.json | 6 +++--- tests/runner/accounting_tests/state_7.json | 6 +++--- tests/runner/accounting_tests/state_8.json | 6 +++--- tests/runner/accounting_tests/state_9.json | 6 +++--- tests/runner/accounting_tests_support/init.json | 2 +- .../runner/accounting_tests_support/init_output.json | 11 +++++++++++ tests/runner/accounting_tests_support/message_1.json | 4 ++-- tests/runner/accounting_tests_support/message_2.json | 4 ++-- tests/runner/accounting_tests_support/message_3.json | 4 ++-- tests/runner/accounting_tests_support/message_4.json | 4 ++-- tests/runner/accounting_tests_support/message_5.json | 4 ++-- tests/runner/accounting_tests_support/message_6.json | 4 ++-- tests/runner/accounting_tests_support/state_1.json | 6 +++--- tests/runner/accounting_tests_support/state_2.json | 6 +++--- tests/runner/accounting_tests_support/state_3.json | 6 +++--- tests/runner/accounting_tests_support/state_4.json | 6 +++--- tests/runner/accounting_tests_support/state_5.json | 6 +++--- tests/runner/accounting_tests_support/state_6.json | 6 +++--- 94 files changed, 231 insertions(+), 220 deletions(-) create mode 100644 tests/runner/accounting_tests_support/init_output.json diff --git a/tests/runner/accounting_tests/init.json b/tests/runner/accounting_tests/init.json index fc54c8ab1..021300643 100644 --- a/tests/runner/accounting_tests/init.json +++ b/tests/runner/accounting_tests/init.json @@ -7,7 +7,7 @@ { "vname" : "_this_address", "type" : "ByStr20", - "value" : "0x3620c286757a29985cee194eb90064270fb65414" + "value" : "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname" : "_creation_block", @@ -17,6 +17,6 @@ { "vname" : "support_contract", "type" : "ByStr20", - "value" : "0xabfeccdc9012345678901234567890f777564323" + "value" : "0x3620c286757a29985cee194eb90064270fb65414" } ] diff --git a/tests/runner/accounting_tests/init_state.json b/tests/runner/accounting_tests/init_state.json index 024378312..b7a5f6d5e 100644 --- a/tests/runner/accounting_tests/init_state.json +++ b/tests/runner/accounting_tests/init_state.json @@ -5,11 +5,11 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "42" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } } ] } diff --git a/tests/runner/accounting_tests/message_1.json b/tests/runner/accounting_tests/message_1.json index 0bb44d81b..7480d4c11 100644 --- a/tests/runner/accounting_tests/message_1.json +++ b/tests/runner/accounting_tests/message_1.json @@ -1,7 +1,7 @@ { "_tag": "Reset", "_amount": "30", - "_sender": "0xabfeccdc9012345678901234567890f777564322", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_10.json b/tests/runner/accounting_tests/message_10.json index 3a5ae2fd4..36657910f 100644 --- a/tests/runner/accounting_tests/message_10.json +++ b/tests/runner/accounting_tests/message_10.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_5", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_100.json b/tests/runner/accounting_tests/message_100.json index 2b3ec847e..a007264b5 100644 --- a/tests/runner/accounting_tests/message_100.json +++ b/tests/runner/accounting_tests/message_100.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_1", "_amount": "0", - "_sender": "0xabfeccdc9012345678901234567890f777564322", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_101.json b/tests/runner/accounting_tests/message_101.json index 2b3ec847e..a007264b5 100644 --- a/tests/runner/accounting_tests/message_101.json +++ b/tests/runner/accounting_tests/message_101.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_1", "_amount": "0", - "_sender": "0xabfeccdc9012345678901234567890f777564322", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_102.json b/tests/runner/accounting_tests/message_102.json index 2b3ec847e..a007264b5 100644 --- a/tests/runner/accounting_tests/message_102.json +++ b/tests/runner/accounting_tests/message_102.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_1", "_amount": "0", - "_sender": "0xabfeccdc9012345678901234567890f777564322", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_103.json b/tests/runner/accounting_tests/message_103.json index 2b3ec847e..a007264b5 100644 --- a/tests/runner/accounting_tests/message_103.json +++ b/tests/runner/accounting_tests/message_103.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_1", "_amount": "0", - "_sender": "0xabfeccdc9012345678901234567890f777564322", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_104.json b/tests/runner/accounting_tests/message_104.json index 91a6bd6d8..d84f1027a 100644 --- a/tests/runner/accounting_tests/message_104.json +++ b/tests/runner/accounting_tests/message_104.json @@ -1,7 +1,7 @@ { "_tag": "Finalize_Test_Send_1", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_105.json b/tests/runner/accounting_tests/message_105.json index cc826cf87..9ffba0cb0 100644 --- a/tests/runner/accounting_tests/message_105.json +++ b/tests/runner/accounting_tests/message_105.json @@ -1,7 +1,7 @@ { "_tag": "Finalize_Test_Send_2", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_106.json b/tests/runner/accounting_tests/message_106.json index 9bb803e3f..d31f5a23c 100644 --- a/tests/runner/accounting_tests/message_106.json +++ b/tests/runner/accounting_tests/message_106.json @@ -1,7 +1,7 @@ { "_tag": "Finalize_Test_Send_3", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_107.json b/tests/runner/accounting_tests/message_107.json index f42c69042..f819235da 100644 --- a/tests/runner/accounting_tests/message_107.json +++ b/tests/runner/accounting_tests/message_107.json @@ -1,7 +1,7 @@ { "_tag": "CheckSenderBalance", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname" : "expected_balance", @@ -9,5 +9,5 @@ "value" : "30" } ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_108.json b/tests/runner/accounting_tests/message_108.json index 0c9c611c3..e7c75f0bb 100644 --- a/tests/runner/accounting_tests/message_108.json +++ b/tests/runner/accounting_tests/message_108.json @@ -1,7 +1,7 @@ { "_tag": "Test_Insufficient_Balance", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_109.json b/tests/runner/accounting_tests/message_109.json index 3eaa66c1d..c5fd3e83c 100644 --- a/tests/runner/accounting_tests/message_109.json +++ b/tests/runner/accounting_tests/message_109.json @@ -1,7 +1,7 @@ { "_tag": "CheckRecipientBalance", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname" : "expected_balance", @@ -9,5 +9,5 @@ "value" : "52" } ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_11.json b/tests/runner/accounting_tests/message_11.json index 374a8dce5..1be161287 100644 --- a/tests/runner/accounting_tests/message_11.json +++ b/tests/runner/accounting_tests/message_11.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_6", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_12.json b/tests/runner/accounting_tests/message_12.json index 393c4109b..1416aa3fa 100644 --- a/tests/runner/accounting_tests/message_12.json +++ b/tests/runner/accounting_tests/message_12.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_7", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_13.json b/tests/runner/accounting_tests/message_13.json index f42c69042..f819235da 100644 --- a/tests/runner/accounting_tests/message_13.json +++ b/tests/runner/accounting_tests/message_13.json @@ -1,7 +1,7 @@ { "_tag": "CheckSenderBalance", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname" : "expected_balance", @@ -9,5 +9,5 @@ "value" : "30" } ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_14.json b/tests/runner/accounting_tests/message_14.json index b4bf67170..f3f1cdd3d 100644 --- a/tests/runner/accounting_tests/message_14.json +++ b/tests/runner/accounting_tests/message_14.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_8", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_15.json b/tests/runner/accounting_tests/message_15.json index 56f96b0e3..88700b3b3 100644 --- a/tests/runner/accounting_tests/message_15.json +++ b/tests/runner/accounting_tests/message_15.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_9", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_16.json b/tests/runner/accounting_tests/message_16.json index 3eaa66c1d..c5fd3e83c 100644 --- a/tests/runner/accounting_tests/message_16.json +++ b/tests/runner/accounting_tests/message_16.json @@ -1,7 +1,7 @@ { "_tag": "CheckRecipientBalance", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname" : "expected_balance", @@ -9,5 +9,5 @@ "value" : "52" } ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_17.json b/tests/runner/accounting_tests/message_17.json index 0a825fd28..5962ca43e 100644 --- a/tests/runner/accounting_tests/message_17.json +++ b/tests/runner/accounting_tests/message_17.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_10", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_18.json b/tests/runner/accounting_tests/message_18.json index 9066baf16..5ec978ae4 100644 --- a/tests/runner/accounting_tests/message_18.json +++ b/tests/runner/accounting_tests/message_18.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_11", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_19.json b/tests/runner/accounting_tests/message_19.json index 761bb5667..3524afed5 100644 --- a/tests/runner/accounting_tests/message_19.json +++ b/tests/runner/accounting_tests/message_19.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_12", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_2.json b/tests/runner/accounting_tests/message_2.json index 2b3ec847e..a007264b5 100644 --- a/tests/runner/accounting_tests/message_2.json +++ b/tests/runner/accounting_tests/message_2.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_1", "_amount": "0", - "_sender": "0xabfeccdc9012345678901234567890f777564322", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_20.json b/tests/runner/accounting_tests/message_20.json index 7c6da924a..60e0626f6 100644 --- a/tests/runner/accounting_tests/message_20.json +++ b/tests/runner/accounting_tests/message_20.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_13", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_21.json b/tests/runner/accounting_tests/message_21.json index fefcf78fd..443ed578e 100644 --- a/tests/runner/accounting_tests/message_21.json +++ b/tests/runner/accounting_tests/message_21.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_14", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_3.json b/tests/runner/accounting_tests/message_3.json index 91a6bd6d8..d84f1027a 100644 --- a/tests/runner/accounting_tests/message_3.json +++ b/tests/runner/accounting_tests/message_3.json @@ -1,7 +1,7 @@ { "_tag": "Finalize_Test_Send_1", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_4.json b/tests/runner/accounting_tests/message_4.json index 476f132f5..c8f2fbf10 100644 --- a/tests/runner/accounting_tests/message_4.json +++ b/tests/runner/accounting_tests/message_4.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_2", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_5.json b/tests/runner/accounting_tests/message_5.json index cc826cf87..9ffba0cb0 100644 --- a/tests/runner/accounting_tests/message_5.json +++ b/tests/runner/accounting_tests/message_5.json @@ -1,7 +1,7 @@ { "_tag": "Finalize_Test_Send_2", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_6.json b/tests/runner/accounting_tests/message_6.json index b689c1900..d90c15479 100644 --- a/tests/runner/accounting_tests/message_6.json +++ b/tests/runner/accounting_tests/message_6.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_3", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_7.json b/tests/runner/accounting_tests/message_7.json index d0c56683c..bdeaa0340 100644 --- a/tests/runner/accounting_tests/message_7.json +++ b/tests/runner/accounting_tests/message_7.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_3_Helper", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_8.json b/tests/runner/accounting_tests/message_8.json index 9bb803e3f..d31f5a23c 100644 --- a/tests/runner/accounting_tests/message_8.json +++ b/tests/runner/accounting_tests/message_8.json @@ -1,7 +1,7 @@ { "_tag": "Finalize_Test_Send_3", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/message_9.json b/tests/runner/accounting_tests/message_9.json index 3acf6d49a..a43d6064b 100644 --- a/tests/runner/accounting_tests/message_9.json +++ b/tests/runner/accounting_tests/message_9.json @@ -1,7 +1,7 @@ { "_tag": "Test_Send_4", "_amount": "0", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests/output_1.json b/tests/runner/accounting_tests/output_1.json index 9bbff1e1a..d1427d3e6 100644 --- a/tests/runner/accounting_tests/output_1.json +++ b/tests/runner/accounting_tests/output_1.json @@ -6,7 +6,7 @@ { "_tag": "Reset", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_10.json b/tests/runner/accounting_tests/output_10.json index e5976418b..661b74603 100644 --- a/tests/runner/accounting_tests/output_10.json +++ b/tests/runner/accounting_tests/output_10.json @@ -6,13 +6,13 @@ { "_tag": "Accept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "NonAccept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_11.json b/tests/runner/accounting_tests/output_11.json index 8b5c96c6a..f42fd243c 100644 --- a/tests/runner/accounting_tests/output_11.json +++ b/tests/runner/accounting_tests/output_11.json @@ -6,13 +6,13 @@ { "_tag": "Accept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "CheckSenderBalance", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname": "expected_balance", "type": "Uint128", "value": "20" } ] diff --git a/tests/runner/accounting_tests/output_12.json b/tests/runner/accounting_tests/output_12.json index d09c91249..a10e8c25f 100644 --- a/tests/runner/accounting_tests/output_12.json +++ b/tests/runner/accounting_tests/output_12.json @@ -6,13 +6,13 @@ { "_tag": "NonAccept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "CheckSenderBalance", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname": "expected_balance", "type": "Uint128", "value": "30" } ] diff --git a/tests/runner/accounting_tests/output_14.json b/tests/runner/accounting_tests/output_14.json index f28cf6064..9b38d89fd 100644 --- a/tests/runner/accounting_tests/output_14.json +++ b/tests/runner/accounting_tests/output_14.json @@ -6,13 +6,13 @@ { "_tag": "AcceptAndCheckBalance", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "CheckRecipientBalance", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname": "expected_balance", "type": "Uint128", "value": "52" } ] diff --git a/tests/runner/accounting_tests/output_15.json b/tests/runner/accounting_tests/output_15.json index 13d486669..030b7507e 100644 --- a/tests/runner/accounting_tests/output_15.json +++ b/tests/runner/accounting_tests/output_15.json @@ -6,13 +6,13 @@ { "_tag": "NonAccept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "CheckRecipientBalance", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname": "expected_balance", "type": "Uint128", "value": "42" } ] diff --git a/tests/runner/accounting_tests/output_17.json b/tests/runner/accounting_tests/output_17.json index 3442d04ec..60e6b9580 100644 --- a/tests/runner/accounting_tests/output_17.json +++ b/tests/runner/accounting_tests/output_17.json @@ -6,7 +6,7 @@ { "_tag": "AcceptAndCheckSenderBalance", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_18.json b/tests/runner/accounting_tests/output_18.json index ac4942fb2..73c78c70b 100644 --- a/tests/runner/accounting_tests/output_18.json +++ b/tests/runner/accounting_tests/output_18.json @@ -6,7 +6,7 @@ { "_tag": "AcceptTwiceAndCheckBalance", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_19.json b/tests/runner/accounting_tests/output_19.json index ea0924a55..068acecf0 100644 --- a/tests/runner/accounting_tests/output_19.json +++ b/tests/runner/accounting_tests/output_19.json @@ -6,13 +6,13 @@ { "_tag": "AcceptTwiceAndCheckBalance", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "CheckSenderBalance", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname": "expected_balance", "type": "Uint128", "value": "20" } ] diff --git a/tests/runner/accounting_tests/output_2.json b/tests/runner/accounting_tests/output_2.json index df2edec3c..4058327f6 100644 --- a/tests/runner/accounting_tests/output_2.json +++ b/tests/runner/accounting_tests/output_2.json @@ -6,19 +6,19 @@ { "_tag": "StoreString", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ { "vname": "s", "type": "String", "value": "Hello" } ] }, { "_tag": "StoreString", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ { "vname": "s", "type": "String", "value": "World" } ] }, { "_tag": "Finalize_Test_Send_1", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_20.json b/tests/runner/accounting_tests/output_20.json index a24a7e66a..ad58285fc 100644 --- a/tests/runner/accounting_tests/output_20.json +++ b/tests/runner/accounting_tests/output_20.json @@ -6,13 +6,13 @@ { "_tag": "AcceptTwiceAndCheckBalance", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "CheckRecipientBalance", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname": "expected_balance", "type": "Uint128", "value": "52" } ] diff --git a/tests/runner/accounting_tests/output_21.json b/tests/runner/accounting_tests/output_21.json index 55b587ea7..eb6da8633 100644 --- a/tests/runner/accounting_tests/output_21.json +++ b/tests/runner/accounting_tests/output_21.json @@ -6,7 +6,7 @@ { "_tag": "Accept", "_amount": "30", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_4.json b/tests/runner/accounting_tests/output_4.json index b878d5dd6..c4cf19f1d 100644 --- a/tests/runner/accounting_tests/output_4.json +++ b/tests/runner/accounting_tests/output_4.json @@ -6,19 +6,19 @@ { "_tag": "StoreString", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ { "vname": "s", "type": "String", "value": "Hello" } ] }, { "_tag": "StoreString", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ { "vname": "s", "type": "String", "value": "World" } ] }, { "_tag": "Finalize_Test_Send_2", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_6.json b/tests/runner/accounting_tests/output_6.json index 2be3c7563..ad7d32bac 100644 --- a/tests/runner/accounting_tests/output_6.json +++ b/tests/runner/accounting_tests/output_6.json @@ -6,19 +6,19 @@ { "_tag": "Test_Send_3_Helper", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [] }, { "_tag": "StoreString", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ { "vname": "s", "type": "String", "value": "World" } ] }, { "_tag": "Finalize_Test_Send_3", "_amount": "0", - "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [] } ], diff --git a/tests/runner/accounting_tests/output_7.json b/tests/runner/accounting_tests/output_7.json index e4428f07a..3533c8bec 100644 --- a/tests/runner/accounting_tests/output_7.json +++ b/tests/runner/accounting_tests/output_7.json @@ -6,7 +6,7 @@ { "_tag": "StoreString", "_amount": "0", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ { "vname": "s", "type": "String", "value": "Hello" } ] } ], diff --git a/tests/runner/accounting_tests/output_9.json b/tests/runner/accounting_tests/output_9.json index 8a4d7d987..1609f61d6 100644 --- a/tests/runner/accounting_tests/output_9.json +++ b/tests/runner/accounting_tests/output_9.json @@ -6,13 +6,13 @@ { "_tag": "Accept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] }, { "_tag": "NonAccept", "_amount": "10", - "_recipient": "0xabfeccdc9012345678901234567890f777564323", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [] } ], diff --git a/tests/runner/accounting_tests/state_1.json b/tests/runner/accounting_tests/state_1.json index 8e9bc55ab..43bce7ae8 100644 --- a/tests/runner/accounting_tests/state_1.json +++ b/tests/runner/accounting_tests/state_1.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_10.json b/tests/runner/accounting_tests/state_10.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_10.json +++ b/tests/runner/accounting_tests/state_10.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_100.json b/tests/runner/accounting_tests/state_100.json index 71cbd19a6..8bb931a45 100644 --- a/tests/runner/accounting_tests/state_100.json +++ b/tests/runner/accounting_tests/state_100.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_101.json b/tests/runner/accounting_tests/state_101.json index cdd6d053b..2cf3d386c 100644 --- a/tests/runner/accounting_tests/state_101.json +++ b/tests/runner/accounting_tests/state_101.json @@ -25,14 +25,14 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, @@ -48,7 +48,7 @@ "arguments": [] } ] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_102.json b/tests/runner/accounting_tests/state_102.json index 1b89dd470..afacedb8d 100644 --- a/tests/runner/accounting_tests/state_102.json +++ b/tests/runner/accounting_tests/state_102.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": [ "Hello" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_103.json b/tests/runner/accounting_tests/state_103.json index 30db96602..4f3b7d1d3 100644 --- a/tests/runner/accounting_tests/state_103.json +++ b/tests/runner/accounting_tests/state_103.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_104.json b/tests/runner/accounting_tests/state_104.json index 61bd10ab7..c0b665585 100644 --- a/tests/runner/accounting_tests/state_104.json +++ b/tests/runner/accounting_tests/state_104.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ "Hello", "World" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_105.json b/tests/runner/accounting_tests/state_105.json index 61bd10ab7..c0b665585 100644 --- a/tests/runner/accounting_tests/state_105.json +++ b/tests/runner/accounting_tests/state_105.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ "Hello", "World" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_106.json b/tests/runner/accounting_tests/state_106.json index 61bd10ab7..c0b665585 100644 --- a/tests/runner/accounting_tests/state_106.json +++ b/tests/runner/accounting_tests/state_106.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ "Hello", "World" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_107.json b/tests/runner/accounting_tests/state_107.json index 5618d9287..5fb1fe591 100644 --- a/tests/runner/accounting_tests/state_107.json +++ b/tests/runner/accounting_tests/state_107.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_108.json b/tests/runner/accounting_tests/state_108.json index 70441504f..e56b00ec3 100644 --- a/tests/runner/accounting_tests/state_108.json +++ b/tests/runner/accounting_tests/state_108.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_109.json b/tests/runner/accounting_tests/state_109.json index d251fba44..626d75db1 100644 --- a/tests/runner/accounting_tests/state_109.json +++ b/tests/runner/accounting_tests/state_109.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_11.json b/tests/runner/accounting_tests/state_11.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_11.json +++ b/tests/runner/accounting_tests/state_11.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_12.json b/tests/runner/accounting_tests/state_12.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_12.json +++ b/tests/runner/accounting_tests/state_12.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_13.json b/tests/runner/accounting_tests/state_13.json index 881cc6e2d..182733828 100644 --- a/tests/runner/accounting_tests/state_13.json +++ b/tests/runner/accounting_tests/state_13.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_14.json b/tests/runner/accounting_tests/state_14.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_14.json +++ b/tests/runner/accounting_tests/state_14.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_15.json b/tests/runner/accounting_tests/state_15.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_15.json +++ b/tests/runner/accounting_tests/state_15.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_16.json b/tests/runner/accounting_tests/state_16.json index 8b1ab389f..633676c7d 100644 --- a/tests/runner/accounting_tests/state_16.json +++ b/tests/runner/accounting_tests/state_16.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "52" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_17.json b/tests/runner/accounting_tests/state_17.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_17.json +++ b/tests/runner/accounting_tests/state_17.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_18.json b/tests/runner/accounting_tests/state_18.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_18.json +++ b/tests/runner/accounting_tests/state_18.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_19.json b/tests/runner/accounting_tests/state_19.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_19.json +++ b/tests/runner/accounting_tests/state_19.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_2.json b/tests/runner/accounting_tests/state_2.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_2.json +++ b/tests/runner/accounting_tests/state_2.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_20.json b/tests/runner/accounting_tests/state_20.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_20.json +++ b/tests/runner/accounting_tests/state_20.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_21.json b/tests/runner/accounting_tests/state_21.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_21.json +++ b/tests/runner/accounting_tests/state_21.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_3.json b/tests/runner/accounting_tests/state_3.json index dd2dae293..93f46248c 100644 --- a/tests/runner/accounting_tests/state_3.json +++ b/tests/runner/accounting_tests/state_3.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ "World", "Hello" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_4.json b/tests/runner/accounting_tests/state_4.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_4.json +++ b/tests/runner/accounting_tests/state_4.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_5.json b/tests/runner/accounting_tests/state_5.json index dd2dae293..93f46248c 100644 --- a/tests/runner/accounting_tests/state_5.json +++ b/tests/runner/accounting_tests/state_5.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ "World", "Hello" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_6.json b/tests/runner/accounting_tests/state_6.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_6.json +++ b/tests/runner/accounting_tests/state_6.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_7.json b/tests/runner/accounting_tests/state_7.json index 881cc6e2d..182733828 100644 --- a/tests/runner/accounting_tests/state_7.json +++ b/tests/runner/accounting_tests/state_7.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_8.json b/tests/runner/accounting_tests/state_8.json index dd2dae293..93f46248c 100644 --- a/tests/runner/accounting_tests/state_8.json +++ b/tests/runner/accounting_tests/state_8.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, { "vname": "stored_strings", "type": "List String", "value": [ "World", "Hello" ] }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests/state_9.json b/tests/runner/accounting_tests/state_9.json index 845aa4057..04ef77be8 100644 --- a/tests/runner/accounting_tests/state_9.json +++ b/tests/runner/accounting_tests/state_9.json @@ -25,19 +25,19 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0xabfeccdc9012345678901234567890f777564323", + "address": "0x3620c286757a29985cee194eb90064270fb65414", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "42" }, { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, - { "vname": "_this_address", "type": "ByStr20", "value": "0xabfeccdc9012345678901234567890f777564323" } + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } ] } ] diff --git a/tests/runner/accounting_tests_support/init.json b/tests/runner/accounting_tests_support/init.json index d216b5a39..775e55aad 100644 --- a/tests/runner/accounting_tests_support/init.json +++ b/tests/runner/accounting_tests_support/init.json @@ -7,7 +7,7 @@ { "vname" : "_this_address", "type" : "ByStr20", - "value" : "0xabfeccdc9012345678901234567890f777564323" + "value" : "0x3620c286757a29985cee194eb90064270fb65414" }, { "vname" : "_creation_block", diff --git a/tests/runner/accounting_tests_support/init_output.json b/tests/runner/accounting_tests_support/init_output.json new file mode 100644 index 000000000..535971e03 --- /dev/null +++ b/tests/runner/accounting_tests_support/init_output.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "77972", + "_accepted": "false", + "messages": null, + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/message_1.json b/tests/runner/accounting_tests_support/message_1.json index c733b3821..8500904da 100644 --- a/tests/runner/accounting_tests_support/message_1.json +++ b/tests/runner/accounting_tests_support/message_1.json @@ -1,7 +1,7 @@ { "_tag": "Reset", "_amount": "30", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests_support/message_2.json b/tests/runner/accounting_tests_support/message_2.json index 17b56237b..c678f8e2a 100644 --- a/tests/runner/accounting_tests_support/message_2.json +++ b/tests/runner/accounting_tests_support/message_2.json @@ -1,7 +1,7 @@ { "_tag": "StoreString", "_amount": "30", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ { "vname" : "s", @@ -9,5 +9,5 @@ "value" : "World" } ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests_support/message_3.json b/tests/runner/accounting_tests_support/message_3.json index 8abe0faa4..565c4c931 100644 --- a/tests/runner/accounting_tests_support/message_3.json +++ b/tests/runner/accounting_tests_support/message_3.json @@ -1,7 +1,7 @@ { "_tag": "AcceptAndCheckBalance", "_amount": "10", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests_support/message_4.json b/tests/runner/accounting_tests_support/message_4.json index 86e4827d9..78f637ade 100644 --- a/tests/runner/accounting_tests_support/message_4.json +++ b/tests/runner/accounting_tests_support/message_4.json @@ -1,7 +1,7 @@ { "_tag": "AcceptAndCheckSenderBalance", "_amount": "10", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests_support/message_5.json b/tests/runner/accounting_tests_support/message_5.json index 2e1f9f1c9..dbe39893c 100644 --- a/tests/runner/accounting_tests_support/message_5.json +++ b/tests/runner/accounting_tests_support/message_5.json @@ -1,7 +1,7 @@ { "_tag": "AcceptTwiceAndCheckBalance", "_amount": "10", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests_support/message_6.json b/tests/runner/accounting_tests_support/message_6.json index 9869f6e98..c5b66dd7b 100644 --- a/tests/runner/accounting_tests_support/message_6.json +++ b/tests/runner/accounting_tests_support/message_6.json @@ -1,7 +1,7 @@ { "_tag": "Accept", "_amount": "10", - "_sender": "0x3620c286757a29985cee194eb90064270fb65414", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "params": [ ], - "_origin": "0xabfeccdc9012345678901234567890f777564322" + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" } diff --git a/tests/runner/accounting_tests_support/state_1.json b/tests/runner/accounting_tests_support/state_1.json index 4453be269..ddb3bf060 100644 --- a/tests/runner/accounting_tests_support/state_1.json +++ b/tests/runner/accounting_tests_support/state_1.json @@ -9,18 +9,18 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0x3620c286757a29985cee194eb90064270fb65414", + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "30" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname": "test_string_1", "type": "String", diff --git a/tests/runner/accounting_tests_support/state_2.json b/tests/runner/accounting_tests_support/state_2.json index 4453be269..ddb3bf060 100644 --- a/tests/runner/accounting_tests_support/state_2.json +++ b/tests/runner/accounting_tests_support/state_2.json @@ -9,18 +9,18 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0x3620c286757a29985cee194eb90064270fb65414", + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "30" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname": "test_string_1", "type": "String", diff --git a/tests/runner/accounting_tests_support/state_3.json b/tests/runner/accounting_tests_support/state_3.json index 48c04892b..d3e7f539a 100644 --- a/tests/runner/accounting_tests_support/state_3.json +++ b/tests/runner/accounting_tests_support/state_3.json @@ -9,18 +9,18 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0x3620c286757a29985cee194eb90064270fb65414", + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "30" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname": "test_string_1", "type": "String", diff --git a/tests/runner/accounting_tests_support/state_4.json b/tests/runner/accounting_tests_support/state_4.json index 3fd594a91..6e08b4211 100644 --- a/tests/runner/accounting_tests_support/state_4.json +++ b/tests/runner/accounting_tests_support/state_4.json @@ -9,18 +9,18 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0x3620c286757a29985cee194eb90064270fb65414", + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "20" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname": "test_string_1", "type": "String", diff --git a/tests/runner/accounting_tests_support/state_5.json b/tests/runner/accounting_tests_support/state_5.json index 3fd594a91..6e08b4211 100644 --- a/tests/runner/accounting_tests_support/state_5.json +++ b/tests/runner/accounting_tests_support/state_5.json @@ -9,18 +9,18 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0x3620c286757a29985cee194eb90064270fb65414", + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "20" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname": "test_string_1", "type": "String", diff --git a/tests/runner/accounting_tests_support/state_6.json b/tests/runner/accounting_tests_support/state_6.json index acecbc513..69c3c057f 100644 --- a/tests/runner/accounting_tests_support/state_6.json +++ b/tests/runner/accounting_tests_support/state_6.json @@ -9,18 +9,18 @@ "type": "Unit", "value": [ { - "address": "0xabfeccdc9012345678901234567890f777564322", + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "100" }, { "vname": "_balance", "type": "Uint128", "value": "42" } ] }, { - "address": "0x3620c286757a29985cee194eb90064270fb65414", + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", "state": [ { "vname": "_nonce", "type": "Uint64", "value": "0" }, { "vname": "_balance", "type": "Uint128", "value": "0" }, - { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, { "vname": "test_string_1", "type": "String", From 05e1bbc0a2607ac02eefe2b0f74ba7335433d3e4 Mon Sep 17 00:00:00 2001 From: Vaivaswatha Nagaraj Date: Tue, 3 Aug 2021 09:35:25 +0530 Subject: [PATCH 18/22] Add test to assert sender balance has amount subtracted --- .../good/gold/accounting_tests.scilla.gold | 3 +- .../gold/accounting_tests_support.scilla.gold | 6 ++- tests/contracts/accounting_tests.scilla | 16 ++++++- .../contracts/accounting_tests_support.scilla | 3 ++ tests/runner/Testcontracts.ml | 4 +- .../accounting_tests/blockchain_22.json | 1 + tests/runner/accounting_tests/message_22.json | 7 +++ tests/runner/accounting_tests/output_22.json | 23 +++++++++ tests/runner/accounting_tests/state_22.json | 45 +++++++++++++++++ .../blockchain_7.json | 1 + .../accounting_tests_support/message_7.json | 9 ++++ .../accounting_tests_support/output_7.json | 11 +++++ .../accounting_tests_support/state_7.json | 48 +++++++++++++++++++ 13 files changed, 172 insertions(+), 5 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_22.json create mode 100644 tests/runner/accounting_tests/message_22.json create mode 100644 tests/runner/accounting_tests/output_22.json create mode 100644 tests/runner/accounting_tests/state_22.json create mode 100644 tests/runner/accounting_tests_support/blockchain_7.json create mode 100644 tests/runner/accounting_tests_support/message_7.json create mode 100644 tests/runner/accounting_tests_support/output_7.json create mode 100644 tests/runner/accounting_tests_support/state_7.json diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index 6101c6968..34a380734 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -53,7 +53,8 @@ { "vname": "Test_Send_11", "params": [] }, { "vname": "Test_Send_12", "params": [] }, { "vname": "Test_Send_13", "params": [] }, - { "vname": "Test_Send_14", "params": [] } + { "vname": "Test_Send_14", "params": [] }, + { "vname": "Test_Send_15", "params": [] } ], "procedures": [ { "vname": "AssertReset", "params": [] }, diff --git a/tests/checker/good/gold/accounting_tests_support.scilla.gold b/tests/checker/good/gold/accounting_tests_support.scilla.gold index 6299a830e..089034451 100644 --- a/tests/checker/good/gold/accounting_tests_support.scilla.gold +++ b/tests/checker/good/gold/accounting_tests_support.scilla.gold @@ -23,7 +23,11 @@ { "vname": "NonAccept", "params": [] }, { "vname": "AcceptAndCheckBalance", "params": [] }, { "vname": "AcceptTwiceAndCheckBalance", "params": [] }, - { "vname": "AcceptAndCheckSenderBalance", "params": [] } + { "vname": "AcceptAndCheckSenderBalance", "params": [] }, + { + "vname": "NoAcceptAndCheckSenderBalance", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + } ], "procedures": [ { diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index d61a14bb3..490b4b907 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -413,4 +413,18 @@ transition Test_Send_14() _amount : amount}; msgs = one_msg msg1; send msgs -end \ No newline at end of file +end + +(* Check that outgoing amount is deducted before invoking next transition (cash in the envelope) *) +transition Test_Send_15() + AssertReset; + cur_bal <- _balance; + out_amount <- outgoing_amount; + expected_balance_as_seen_from_support = builtin sub cur_bal out_amount; + msg1 = { _recipient : support_contract; + _tag : "NoAcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : expected_balance_as_seen_from_support}; + msgs = one_msg msg1; + send msgs +end diff --git a/tests/contracts/accounting_tests_support.scilla b/tests/contracts/accounting_tests_support.scilla index f2ad0ed87..c6da6056e 100644 --- a/tests/contracts/accounting_tests_support.scilla +++ b/tests/contracts/accounting_tests_support.scilla @@ -75,3 +75,6 @@ transition AcceptAndCheckSenderBalance() CheckSenderBalance init_bal end +transition NoAcceptAndCheckSenderBalance(expected_balance : Uint128) + CheckSenderBalance expected_balance +end diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index e2ba850aa..4cb15683b 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -471,11 +471,11 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 21 + >::: build_contract_tests env "accounting_tests" succ_code 1 22 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" - succ_code 1 6 []; + succ_code 1 7 []; "addfunds_proxy" >::: build_contract_tests env "addfunds_proxy" succ_code 1 2 []; "addfunds" diff --git a/tests/runner/accounting_tests/blockchain_22.json b/tests/runner/accounting_tests/blockchain_22.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_22.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_22.json b/tests/runner/accounting_tests/message_22.json new file mode 100644 index 000000000..e979d9d84 --- /dev/null +++ b/tests/runner/accounting_tests/message_22.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_15", + "_amount": "0", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "params": [], + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" +} diff --git a/tests/runner/accounting_tests/output_22.json b/tests/runner/accounting_tests/output_22.json new file mode 100644 index 000000000..268e19243 --- /dev/null +++ b/tests/runner/accounting_tests/output_22.json @@ -0,0 +1,23 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7926", + "_accepted": "false", + "messages": [ + { + "_tag": "NoAcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_22.json b/tests/runner/accounting_tests/state_22.json new file mode 100644 index 000000000..04ef77be8 --- /dev/null +++ b/tests/runner/accounting_tests/state_22.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests_support/blockchain_7.json b/tests/runner/accounting_tests_support/blockchain_7.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests_support/blockchain_7.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests_support/message_7.json b/tests/runner/accounting_tests_support/message_7.json new file mode 100644 index 000000000..c8ac234b1 --- /dev/null +++ b/tests/runner/accounting_tests_support/message_7.json @@ -0,0 +1,9 @@ +{ + "_tag": "NoAcceptAndCheckSenderBalance", + "_amount": "10", + "_sender": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ], + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" +} diff --git a/tests/runner/accounting_tests_support/output_7.json b/tests/runner/accounting_tests_support/output_7.json new file mode 100644 index 000000000..0f612c840 --- /dev/null +++ b/tests/runner/accounting_tests_support/output_7.json @@ -0,0 +1,11 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7959", + "_accepted": "false", + "messages": [], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", "type": "List (String)", "value": [] } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests_support/state_7.json b/tests/runner/accounting_tests_support/state_7.json new file mode 100644 index 000000000..6e08b4211 --- /dev/null +++ b/tests/runner/accounting_tests_support/state_7.json @@ -0,0 +1,48 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "0" }, + { "vname": "stored_strings", + "type": "List String", + "value": [ ] + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "20" }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + } + ] + } + ] + } +] From 95b6847fac0754ae0b888f18563f2d12080d2836 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Fri, 10 Dec 2021 02:42:29 +0100 Subject: [PATCH 19/22] Additional accounting tests --- .../good/gold/accounting_tests.scilla.gold | 6 +- tests/contracts/accounting_tests.scilla | 110 ++++++++++++++++++ tests/runner/Testcontracts.ml | 2 +- .../accounting_tests/blockchain_23.json | 1 + .../accounting_tests/blockchain_24.json | 1 + .../accounting_tests/blockchain_25.json | 1 + tests/runner/accounting_tests/message_23.json | 7 ++ tests/runner/accounting_tests/message_24.json | 7 ++ tests/runner/accounting_tests/message_25.json | 7 ++ tests/runner/accounting_tests/output_23.json | 39 +++++++ tests/runner/accounting_tests/output_24.json | 39 +++++++ tests/runner/accounting_tests/output_25.json | 39 +++++++ tests/runner/accounting_tests/state_23.json | 45 +++++++ tests/runner/accounting_tests/state_24.json | 45 +++++++ tests/runner/accounting_tests/state_25.json | 45 +++++++ 15 files changed, 392 insertions(+), 2 deletions(-) create mode 100644 tests/runner/accounting_tests/blockchain_23.json create mode 100644 tests/runner/accounting_tests/blockchain_24.json create mode 100644 tests/runner/accounting_tests/blockchain_25.json create mode 100644 tests/runner/accounting_tests/message_23.json create mode 100644 tests/runner/accounting_tests/message_24.json create mode 100644 tests/runner/accounting_tests/message_25.json create mode 100644 tests/runner/accounting_tests/output_23.json create mode 100644 tests/runner/accounting_tests/output_24.json create mode 100644 tests/runner/accounting_tests/output_25.json create mode 100644 tests/runner/accounting_tests/state_23.json create mode 100644 tests/runner/accounting_tests/state_24.json create mode 100644 tests/runner/accounting_tests/state_25.json diff --git a/tests/checker/good/gold/accounting_tests.scilla.gold b/tests/checker/good/gold/accounting_tests.scilla.gold index 34a380734..77e2620e0 100644 --- a/tests/checker/good/gold/accounting_tests.scilla.gold +++ b/tests/checker/good/gold/accounting_tests.scilla.gold @@ -54,7 +54,11 @@ { "vname": "Test_Send_12", "params": [] }, { "vname": "Test_Send_13", "params": [] }, { "vname": "Test_Send_14", "params": [] }, - { "vname": "Test_Send_15", "params": [] } + { "vname": "Test_Send_15", "params": [] }, + { "vname": "Test_Send_16", "params": [] }, + { "vname": "Test_Send_17", "params": [] }, + { "vname": "Test_Send_18", "params": [] }, + { "vname": "Test_Send_19", "params": [] } ], "procedures": [ { "vname": "AssertReset", "params": [] }, diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index 490b4b907..0afb80361 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -428,3 +428,113 @@ transition Test_Send_15() msgs = one_msg msg1; send msgs end + +(* Check that all outgoing amounts are deducted before invoking the first transition (cash in the envelope) *) +transition Test_Send_16() + AssertReset; + cur_bal <- _balance; + out_amount <- outgoing_amount; + tmp_expected_balance = builtin sub cur_bal out_amount; + expected_balance_as_seen_from_support = builtin sub tmp_expected_balance out_amount; + msg1 = { _recipient : support_contract; + _tag : "AcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : expected_balance_as_seen_from_support}; + msgs1 = one_msg msg1; + send msgs1; + msg2 = { _recipient : support_contract; + _tag : "AcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : expected_balance_as_seen_from_support}; + msgs2 = one_msg msg2; + send msgs2; + msg3 = { _recipient : _this_address; + _tag : "CheckSenderBalance"; + _amount : Uint128 0; + expected_balance : expected_balance_as_seen_from_support}; + msgs3 = one_msg msg3; + send msgs3 +end + +(* Check that all outgoing amounts are deducted before invoking the first transition (cash in the envelope), + but that money is returned from the first message if it is not accepted. *) +transition Test_Send_17() + AssertReset; + cur_bal <- _balance; + out_amount <- outgoing_amount; + final_expected_balance = builtin sub cur_bal out_amount; + first_expected_balance = builtin sub final_expected_balance out_amount; + msg1 = { _recipient : support_contract; + _tag : "NoAcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : first_expected_balance}; + msgs1 = one_msg msg1; + send msgs1; + msg2 = { _recipient : support_contract; + _tag : "AcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : final_expected_balance}; + msgs2 = one_msg msg2; + send msgs2; + msg3 = { _recipient : _this_address; + _tag : "CheckSenderBalance"; + _amount : Uint128 0; + expected_balance : final_expected_balance}; + msgs3 = one_msg msg3; + send msgs3 +end + +(* Check that all outgoing amounts are deducted before invoking the first transition (cash in the envelope), + but that money from the last message is returned if not accepted. *) +transition Test_Send_18() + AssertReset; + cur_bal <- _balance; + out_amount <- outgoing_amount; + final_expected_balance = builtin sub cur_bal out_amount; + first_expected_balance = builtin sub final_expected_balance out_amount; + msg1 = { _recipient : support_contract; + _tag : "AcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : first_expected_balance}; + msgs1 = one_msg msg1; + send msgs1; + msg2 = { _recipient : support_contract; + _tag : "NoAcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : first_expected_balance}; + msgs2 = one_msg msg2; + send msgs2; + msg3 = { _recipient : _this_address; + _tag : "CheckSenderBalance"; + _amount : Uint128 0; + expected_balance : final_expected_balance}; + msgs3 = one_msg msg3; + send msgs3 +end + +(* Check that all outgoing amounts are deducted before invoking the first transition (cash in the envelope), + but that money from all messages are returned if not accepted. *) +transition Test_Send_19() + AssertReset; + cur_bal <- _balance; out_amount <- outgoing_amount; + middle_expected_balance = builtin sub cur_bal out_amount; + first_expected_balance = builtin sub middle_expected_balance out_amount; + msg1 = { _recipient : support_contract; + _tag : "NoAcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : first_expected_balance}; + msgs1 = one_msg msg1; + send msgs1; + msg2 = { _recipient : support_contract; + _tag : "NoAcceptAndCheckSenderBalance"; + _amount : out_amount; + expected_balance : middle_expected_balance}; + msgs2 = one_msg msg2; + send msgs2; + msg3 = { _recipient : _this_address; + _tag : "CheckSenderBalance"; + _amount : Uint128 0; + expected_balance : cur_bal}; + msgs3 = one_msg msg3; + send msgs3 +end diff --git a/tests/runner/Testcontracts.ml b/tests/runner/Testcontracts.ml index b6164bcc0..397ebbc51 100644 --- a/tests/runner/Testcontracts.ml +++ b/tests/runner/Testcontracts.ml @@ -480,7 +480,7 @@ let contract_tests env = "type_casts" >::: build_contract_tests env "type_casts" succ_code 1 37 []; "accounting_tests" - >::: build_contract_tests env "accounting_tests" succ_code 1 22 + >::: build_contract_tests env "accounting_tests" succ_code 1 25 []; "accounting_tests_support" >::: build_contract_tests env "accounting_tests_support" diff --git a/tests/runner/accounting_tests/blockchain_23.json b/tests/runner/accounting_tests/blockchain_23.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_23.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_24.json b/tests/runner/accounting_tests/blockchain_24.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_24.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/blockchain_25.json b/tests/runner/accounting_tests/blockchain_25.json new file mode 100644 index 000000000..d962cce79 --- /dev/null +++ b/tests/runner/accounting_tests/blockchain_25.json @@ -0,0 +1 @@ +[ { "vname": "BLOCKNUMBER", "type": "BNum", "value": "100" } ] diff --git a/tests/runner/accounting_tests/message_23.json b/tests/runner/accounting_tests/message_23.json new file mode 100644 index 000000000..eb0b4505f --- /dev/null +++ b/tests/runner/accounting_tests/message_23.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_16", + "_amount": "0", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "params": [], + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" +} diff --git a/tests/runner/accounting_tests/message_24.json b/tests/runner/accounting_tests/message_24.json new file mode 100644 index 000000000..88c9f6298 --- /dev/null +++ b/tests/runner/accounting_tests/message_24.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_17", + "_amount": "0", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "params": [], + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" +} diff --git a/tests/runner/accounting_tests/message_25.json b/tests/runner/accounting_tests/message_25.json new file mode 100644 index 000000000..90b6c885b --- /dev/null +++ b/tests/runner/accounting_tests/message_25.json @@ -0,0 +1,7 @@ +{ + "_tag": "Test_Send_18", + "_amount": "0", + "_sender": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "params": [], + "_origin": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0" +} diff --git a/tests/runner/accounting_tests/output_23.json b/tests/runner/accounting_tests/output_23.json new file mode 100644 index 000000000..8dd16fa61 --- /dev/null +++ b/tests/runner/accounting_tests/output_23.json @@ -0,0 +1,39 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7890", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "10" } + ] + }, + { + "_tag": "AcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "10" } + ] + }, + { + "_tag": "CheckSenderBalance", + "_amount": "0", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "10" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_24.json b/tests/runner/accounting_tests/output_24.json new file mode 100644 index 000000000..9993e126a --- /dev/null +++ b/tests/runner/accounting_tests/output_24.json @@ -0,0 +1,39 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7889", + "_accepted": "false", + "messages": [ + { + "_tag": "NoAcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "10" } + ] + }, + { + "_tag": "AcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ] + }, + { + "_tag": "CheckSenderBalance", + "_amount": "0", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/output_25.json b/tests/runner/accounting_tests/output_25.json new file mode 100644 index 000000000..d8c40908a --- /dev/null +++ b/tests/runner/accounting_tests/output_25.json @@ -0,0 +1,39 @@ +{ + "scilla_major_version": "0", + "gas_remaining": "7889", + "_accepted": "false", + "messages": [ + { + "_tag": "AcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "10" } + ] + }, + { + "_tag": "NoAcceptAndCheckSenderBalance", + "_amount": "10", + "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "10" } + ] + }, + { + "_tag": "CheckSenderBalance", + "_amount": "0", + "_recipient": "0x673b712c3e47bf98fae068370f9e5a2a1c1c8047", + "params": [ + { "vname": "expected_balance", "type": "Uint128", "value": "20" } + ] + } + ], + "states": [ + { "vname": "_balance", "type": "Uint128", "value": "10" }, + { "vname": "test_string_1", "type": "String", "value": "Hello" }, + { "vname": "test_string_2", "type": "String", "value": "World" }, + { "vname": "outgoing_amount", "type": "Uint128", "value": "10" }, + { "vname": "max_outgoing_msgs", "type": "Uint128", "value": "3" } + ], + "events": [] +} \ No newline at end of file diff --git a/tests/runner/accounting_tests/state_23.json b/tests/runner/accounting_tests/state_23.json new file mode 100644 index 000000000..04ef77be8 --- /dev/null +++ b/tests/runner/accounting_tests/state_23.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_24.json b/tests/runner/accounting_tests/state_24.json new file mode 100644 index 000000000..04ef77be8 --- /dev/null +++ b/tests/runner/accounting_tests/state_24.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } + ] + } + ] + } +] diff --git a/tests/runner/accounting_tests/state_25.json b/tests/runner/accounting_tests/state_25.json new file mode 100644 index 000000000..04ef77be8 --- /dev/null +++ b/tests/runner/accounting_tests/state_25.json @@ -0,0 +1,45 @@ +[ + { "vname": "_balance", "type": "Uint128", "value": "30" }, + { + "vname": "test_string_1", + "type": "String", + "value": "Hello" + }, + { + "vname": "test_string_2", + "type": "String", + "value": "World" + }, + { + "vname": "outgoing_amount", + "type": "Uint128", + "value": "10" + }, + { + "vname": "max_outgoing_msgs", + "type": "Uint128", + "value": "3" + }, + { + "vname": "_external", + "type": "Unit", + "value": [ + { + "address": "0x5c6712c8f3b049e98e733cfdb38a8e37a1c724c0", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "100" }, + { "vname": "_balance", "type": "Uint128", "value": "42" } + ] + }, + { + "address": "0x3620c286757a29985cee194eb90064270fb65414", + "state": [ + { "vname": "_nonce", "type": "Uint64", "value": "0" }, + { "vname": "_balance", "type": "Uint128", "value": "42" }, + { "vname": "stored_strings", "type": "List String", "value": { "constructor": "Nil", "argtypes": ["String"], "arguments": [] } }, + { "vname": "_this_address", "type": "ByStr20", "value": "0x3620c286757a29985cee194eb90064270fb65414" } + ] + } + ] + } +] From cea34634f8dce982afb6c4e0346c5be3a449eef7 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Fri, 7 Jan 2022 00:01:28 +0100 Subject: [PATCH 20/22] Fixed issue with missing transition parameter --- .../good/gold/accounting_tests_support.scilla.gold | 4 ++++ tests/contracts/accounting_tests.scilla | 8 ++++---- tests/contracts/accounting_tests_support.scilla | 6 ++++++ tests/runner/accounting_tests/output_23.json | 6 +++--- tests/runner/accounting_tests/output_24.json | 4 ++-- tests/runner/accounting_tests/output_25.json | 4 ++-- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tests/checker/good/gold/accounting_tests_support.scilla.gold b/tests/checker/good/gold/accounting_tests_support.scilla.gold index 089034451..1f48c4c14 100644 --- a/tests/checker/good/gold/accounting_tests_support.scilla.gold +++ b/tests/checker/good/gold/accounting_tests_support.scilla.gold @@ -27,6 +27,10 @@ { "vname": "NoAcceptAndCheckSenderBalance", "params": [ { "vname": "expected_balance", "type": "Uint128" } ] + }, + { + "vname": "AcceptAndCheckSenderBalanceAgainstExpected", + "params": [ { "vname": "expected_balance", "type": "Uint128" } ] } ], "procedures": [ diff --git a/tests/contracts/accounting_tests.scilla b/tests/contracts/accounting_tests.scilla index 0afb80361..0669ab9a4 100644 --- a/tests/contracts/accounting_tests.scilla +++ b/tests/contracts/accounting_tests.scilla @@ -437,13 +437,13 @@ transition Test_Send_16() tmp_expected_balance = builtin sub cur_bal out_amount; expected_balance_as_seen_from_support = builtin sub tmp_expected_balance out_amount; msg1 = { _recipient : support_contract; - _tag : "AcceptAndCheckSenderBalance"; + _tag : "AcceptAndCheckSenderBalanceAgainstExpected"; _amount : out_amount; expected_balance : expected_balance_as_seen_from_support}; msgs1 = one_msg msg1; send msgs1; msg2 = { _recipient : support_contract; - _tag : "AcceptAndCheckSenderBalance"; + _tag : "AcceptAndCheckSenderBalanceAgainstExpected"; _amount : out_amount; expected_balance : expected_balance_as_seen_from_support}; msgs2 = one_msg msg2; @@ -471,7 +471,7 @@ transition Test_Send_17() msgs1 = one_msg msg1; send msgs1; msg2 = { _recipient : support_contract; - _tag : "AcceptAndCheckSenderBalance"; + _tag : "AcceptAndCheckSenderBalanceAgainstExpected"; _amount : out_amount; expected_balance : final_expected_balance}; msgs2 = one_msg msg2; @@ -493,7 +493,7 @@ transition Test_Send_18() final_expected_balance = builtin sub cur_bal out_amount; first_expected_balance = builtin sub final_expected_balance out_amount; msg1 = { _recipient : support_contract; - _tag : "AcceptAndCheckSenderBalance"; + _tag : "AcceptAndCheckSenderBalanceAgainstExpected"; _amount : out_amount; expected_balance : first_expected_balance}; msgs1 = one_msg msg1; diff --git a/tests/contracts/accounting_tests_support.scilla b/tests/contracts/accounting_tests_support.scilla index c6da6056e..90b0ac1a9 100644 --- a/tests/contracts/accounting_tests_support.scilla +++ b/tests/contracts/accounting_tests_support.scilla @@ -78,3 +78,9 @@ end transition NoAcceptAndCheckSenderBalance(expected_balance : Uint128) CheckSenderBalance expected_balance end + +transition AcceptAndCheckSenderBalanceAgainstExpected(expected_balance : Uint128) + CheckSenderBalance expected_balance; + accept; + CheckSenderBalance expected_balance +end diff --git a/tests/runner/accounting_tests/output_23.json b/tests/runner/accounting_tests/output_23.json index 8dd16fa61..1be49d96c 100644 --- a/tests/runner/accounting_tests/output_23.json +++ b/tests/runner/accounting_tests/output_23.json @@ -1,10 +1,10 @@ { "scilla_major_version": "0", - "gas_remaining": "7890", + "gas_remaining": "7886", "_accepted": "false", "messages": [ { - "_tag": "AcceptAndCheckSenderBalance", + "_tag": "AcceptAndCheckSenderBalanceAgainstExpected", "_amount": "10", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ @@ -12,7 +12,7 @@ ] }, { - "_tag": "AcceptAndCheckSenderBalance", + "_tag": "AcceptAndCheckSenderBalanceAgainstExpected", "_amount": "10", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/output_24.json b/tests/runner/accounting_tests/output_24.json index 9993e126a..e208f0e95 100644 --- a/tests/runner/accounting_tests/output_24.json +++ b/tests/runner/accounting_tests/output_24.json @@ -1,6 +1,6 @@ { "scilla_major_version": "0", - "gas_remaining": "7889", + "gas_remaining": "7888", "_accepted": "false", "messages": [ { @@ -12,7 +12,7 @@ ] }, { - "_tag": "AcceptAndCheckSenderBalance", + "_tag": "AcceptAndCheckSenderBalanceAgainstExpected", "_amount": "10", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ diff --git a/tests/runner/accounting_tests/output_25.json b/tests/runner/accounting_tests/output_25.json index d8c40908a..984334233 100644 --- a/tests/runner/accounting_tests/output_25.json +++ b/tests/runner/accounting_tests/output_25.json @@ -1,10 +1,10 @@ { "scilla_major_version": "0", - "gas_remaining": "7889", + "gas_remaining": "7888", "_accepted": "false", "messages": [ { - "_tag": "AcceptAndCheckSenderBalance", + "_tag": "AcceptAndCheckSenderBalanceAgainstExpected", "_amount": "10", "_recipient": "0x3620c286757a29985cee194eb90064270fb65414", "params": [ From d22650abbc1aa07463177b66182db7e64c6c8936 Mon Sep 17 00:00:00 2001 From: Jacob Johannsen Date: Fri, 7 Jan 2022 00:27:33 +0100 Subject: [PATCH 21/22] fmt --- src/eval/EvalUtil.ml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/eval/EvalUtil.ml b/src/eval/EvalUtil.ml index 4c652de01..dd64572f4 100644 --- a/src/eval/EvalUtil.ml +++ b/src/eval/EvalUtil.ml @@ -205,9 +205,10 @@ module Configuration = struct | Some v, _ -> pure v | _ -> fail1 ~kind:"Error loading remote field" - ~inst:(Printf.sprintf "%s at address %s" - (EvalName.as_error_string (get_id k)) - (SLiteral.Bystrx.hex_encoding caddr)) + ~inst: + (Printf.sprintf "%s at address %s" + (EvalName.as_error_string (get_id k)) + (SLiteral.Bystrx.hex_encoding caddr)) (ER.get_loc (get_rep k)) let remote_field_type caddr k = @@ -367,7 +368,9 @@ module Configuration = struct let%bind amount = fromR @@ MessagePayload.get_amount msg in pure Uint128.(run_total + amount) | _ -> - fail0 ~kind:"Literal verified as a message, but is not a message literal" + fail0 + ~kind: + "Literal verified as a message, but is not a message literal" ~inst:(pp_literal msg_lit)) in let old_emitted = conf.emitted in @@ -376,9 +379,10 @@ module Configuration = struct let%bind balance = if Uint128.compare old_balance out_funds < 0 then fail0 ~kind:"Balance too low for outgoing message" - ~inst:(sprintf "Current balance: %s. Required balance: %s" - (Uint128.to_string old_balance) - (Uint128.to_string out_funds)) + ~inst: + (sprintf "Current balance: %s. Required balance: %s" + (Uint128.to_string old_balance) + (Uint128.to_string out_funds)) else pure @@ Uint128.(old_balance - out_funds) in pure { conf with emitted; balance } From a558e3eaa464d1ab4825af1c4e9ab818b8a1f89d Mon Sep 17 00:00:00 2001 From: Vaivaswatha Nagaraj Date: Fri, 7 Jan 2022 10:47:28 +0530 Subject: [PATCH 22/22] Print Msg objects in JSON printer --- src/base/PrettyPrinters.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base/PrettyPrinters.ml b/src/base/PrettyPrinters.ml index 7e44d634b..b61dc89d4 100644 --- a/src/base/PrettyPrinters.ml +++ b/src/base/PrettyPrinters.ml @@ -92,7 +92,8 @@ and literal_to_json lit = ("argtypes", `List argtl); ("arguments", `List argl); ] - | _ -> `Null + | Msg m -> `Assoc (List.map m ~f:(fun (s, _t, l') -> (s, literal_to_json l'))) + | Clo _ | TAbs _ -> `Null let literal_to_jstring ?(pp = false) lit = let j = literal_to_json lit in