diff --git a/src/proto_alpha/lib_protocol/test/contracts/accounts.tz b/src/proto_alpha/lib_protocol/test/contracts/accounts.tz new file mode 100644 index 000000000..fe1a45da8 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/accounts.tz @@ -0,0 +1,42 @@ +# This is a very simple accounts system. +# (Left key) initializes or deposits into an account +# (Right key (pair tez (signed tez))) withdraws tez amount to a +# DEFAULT_ACCOUNT created from the key if the balance is available +# and the key is correctly signed +parameter (or key_hash (pair key (pair tez signature))); +# Maps the key to the balance they have stored +storage (map key_hash tez); +return unit; +code { DUP; CAR; + # Deposit into account + IF_LEFT { DUP; DIIP{ CDR; DUP }; + DIP{ SWAP }; GET; + # Create the account + IF_NONE { DIP{ AMOUNT; SOME }; UPDATE; UNIT; PAIR } + # Add to an existing account + { AMOUNT; ADD; SOME; SWAP; UPDATE; UNIT; PAIR }} + # Withdrawl + { DUP; DUP; DUP; DUP; + # Check signature on data + CAR; DIIP{ CDAR; H }; DIP{ CDDR; PAIR }; CHECK_SIGNATURE; + IF {} { FAIL }; + # Get user account information + DIIP{ CDR; DUP }; CAR; HASH_KEY; DIP{ SWAP }; GET; + # Account does not exist + IF_NONE { FAIL } + # Account exists + { DUP; DIIP{ DUP; CDAR; DUP }; + # Ensure funds are available + DIP{ CMPLT }; SWAP; + IF { FAIL } + { SUB; DIP{ DUP; DIP{ SWAP }}; DUP; + # Delete account if balance is 0 + PUSH tez "0.00"; CMPEQ; + IF { DROP; NONE tez } + # Otherwise update storage with new balance + { SOME }; + SWAP; CAR; HASH_KEY; UPDATE; + SWAP; DUP; CDAR; + # Execute the transfer + DIP{ CAR; HASH_KEY; DEFAULT_ACCOUNT }; UNIT; TRANSFER_TOKENS; + PAIR }}}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/add1.tz b/src/proto_alpha/lib_protocol/test/contracts/add1.tz new file mode 100644 index 000000000..858f70263 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/add1.tz @@ -0,0 +1,10 @@ + +parameter int; +storage unit; +return int; +code {CAR; # Get the parameter + PUSH int 1; # We're adding 1, so we need to put 1 on the stack + ADD; # Add the two numbers + UNIT; # We need to put the storage value on the stack + SWAP; # The values must be rearranged to match the return calling convention + PAIR} # Create the end value diff --git a/src/proto_alpha/lib_protocol/test/contracts/add1_list.tz b/src/proto_alpha/lib_protocol/test/contracts/add1_list.tz new file mode 100644 index 000000000..811ba38b1 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/add1_list.tz @@ -0,0 +1,9 @@ +parameter (list int); +storage unit; +return (list int); +code { CAR; # Get the parameter + LAMBDA int int { PUSH int 1; ADD }; # Create a lambda that adds 1 + MAP; # Map over the list + UNIT; # Push Unit + SWAP; # Reorder the stack for the PAIR + PAIR } # Match the calling convetion diff --git a/src/proto_alpha/lib_protocol/test/contracts/add_delta_timestamp.tz b/src/proto_alpha/lib_protocol/test/contracts/add_delta_timestamp.tz new file mode 100644 index 000000000..b0a235731 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/add_delta_timestamp.tz @@ -0,0 +1,4 @@ +parameter (pair int timestamp); +storage unit; +return timestamp; +code { CAR; DUP; CAR; DIP{CDR}; ADD; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/add_timestamp_delta.tz b/src/proto_alpha/lib_protocol/test/contracts/add_timestamp_delta.tz new file mode 100644 index 000000000..405cea517 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/add_timestamp_delta.tz @@ -0,0 +1,4 @@ +parameter (pair timestamp int); +storage unit; +return timestamp; +code { CAR; DUP; CAR; DIP{CDR}; ADD; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/after_strategy.tz b/src/proto_alpha/lib_protocol/test/contracts/after_strategy.tz new file mode 100644 index 000000000..51e199707 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/after_strategy.tz @@ -0,0 +1,4 @@ +parameter nat; +storage timestamp; +return (pair nat bool); +code {DUP; CAR; DIP{CDR; DUP; NOW; CMPGT}; PAIR; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/always.tz b/src/proto_alpha/lib_protocol/test/contracts/always.tz new file mode 100644 index 000000000..a578996b2 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/always.tz @@ -0,0 +1,6 @@ + +parameter nat; +return (pair nat bool); +storage unit; +code { CAR; PUSH bool True; SWAP; + PAIR; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/and.tz b/src/proto_alpha/lib_protocol/test/contracts/and.tz new file mode 100644 index 000000000..dcd4ed46a --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/and.tz @@ -0,0 +1,4 @@ +parameter (pair (bool @first) (bool @second)); +return bool; +storage unit; +code { CAR @param; DUP; CAR @first; DIP{CDR @second}; AND; UNIT; SWAP; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/append.tz b/src/proto_alpha/lib_protocol/test/contracts/append.tz new file mode 100644 index 000000000..e3dcbc1b9 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/append.tz @@ -0,0 +1,15 @@ + +parameter (pair (list int) (list int)); +return (list int); +storage unit; +code { CAR; DUP; DIP{CDR}; CAR; # Unpack lists + NIL int; SWAP; # Setup reverse accumulator + LAMBDA (pair int (list int)) + (list int) + {DUP; CAR; DIP{CDR}; CONS}; + REDUCE; # Reverse list + LAMBDA (pair int (list int)) + (list int) + {DUP; CAR; DIP{CDR}; CONS}; + REDUCE; # Append reversed list + UNIT; SWAP; PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert.tz b/src/proto_alpha/lib_protocol/test/contracts/assert.tz new file mode 100644 index 000000000..087b12907 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert.tz @@ -0,0 +1,4 @@ +parameter bool; +storage unit; +return unit; +code {CAR; ASSERT; UNIT; UNIT; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_cmpeq.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpeq.tz new file mode 100644 index 000000000..f5dd7d0f4 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpeq.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPEQ; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_cmpge.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpge.tz new file mode 100644 index 000000000..3db916747 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpge.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPGE; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_cmpgt.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpgt.tz new file mode 100644 index 000000000..a2d172017 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpgt.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPGT; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_cmple.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_cmple.tz new file mode 100644 index 000000000..c728c2183 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_cmple.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPLE; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_cmplt.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_cmplt.tz new file mode 100644 index 000000000..200165564 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_cmplt.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPLT; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_cmpneq.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpneq.tz new file mode 100644 index 000000000..8c8e13b93 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_cmpneq.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; ASSERT_CMPNEQ; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_eq.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_eq.tz new file mode 100644 index 000000000..45f6afb10 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_eq.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_EQ; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_ge.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_ge.tz new file mode 100644 index 000000000..b3a24b8a7 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_ge.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_GE; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_gt.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_gt.tz new file mode 100644 index 000000000..559c77f66 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_gt.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_GT; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_le.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_le.tz new file mode 100644 index 000000000..c9ace4a7f --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_le.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_LE; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_lt.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_lt.tz new file mode 100644 index 000000000..21f883dac --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_lt.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_LT; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/assert_neq.tz b/src/proto_alpha/lib_protocol/test/contracts/assert_neq.tz new file mode 100644 index 000000000..c381882df --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/assert_neq.tz @@ -0,0 +1,4 @@ +parameter (pair int int); +storage unit; +return unit; +code {CAR; DUP; CAR; DIP{CDR}; COMPARE; ASSERT_NEQ; UNIT; DUP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/at_least.tz b/src/proto_alpha/lib_protocol/test/contracts/at_least.tz new file mode 100644 index 000000000..ae2180860 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/at_least.tz @@ -0,0 +1,7 @@ + +parameter unit; +return unit; +storage tez; # How much you have to send me +code {CDR; DUP; # Get the amount required (once for comparison, once to save back in storage) + AMOUNT; CMPLT; # Check to make sure no one is wasting my time + IF {FAIL} {UNIT; PAIR}} # Finish the transaction or reject the person diff --git a/src/proto_alpha/lib_protocol/test/contracts/auction.tz b/src/proto_alpha/lib_protocol/test/contracts/auction.tz new file mode 100644 index 000000000..5ebbfd2f6 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/auction.tz @@ -0,0 +1,9 @@ +parameter key_hash; +storage (pair timestamp (pair tez key_hash)); +return unit; +code { DUP; CDAR; DUP; NOW; CMPGT; IF {FAIL} {}; SWAP; # Check if auction has ended + DUP; CAR; DIP{CDDR}; AMOUNT; PAIR; SWAP; DIP{SWAP; PAIR}; # Setup replacement storage + DUP; CAR; AMOUNT; CMPLE; IF {FAIL} {}; # Check to make sure that the new amount is greater + DUP; CAR; # Get amount of refund + DIP{CDR; DEFAULT_ACCOUNT}; UNIT; TRANSFER_TOKENS; # Make refund + PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz b/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz new file mode 100644 index 000000000..7ccd27993 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/bad_lockup.tz @@ -0,0 +1,6 @@ +parameter unit; +storage (pair timestamp (pair (contract unit unit) (contract unit unit))); +return unit; +code { CDR; DUP; CAR; NOW; CMPLT; IF {FAIL} {}; + DUP; CDAR; PUSH tez "100"; UNIT; TRANSFER_TOKENS; DROP; + DUP; CDDR; PUSH tez "100"; UNIT; TRANSFER_TOKENS; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/balance.tz b/src/proto_alpha/lib_protocol/test/contracts/balance.tz new file mode 100644 index 000000000..2bd161da6 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/balance.tz @@ -0,0 +1,4 @@ +parameter unit; +storage unit; +return tez; +code {DROP; UNIT; BALANCE; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/build_list.tz b/src/proto_alpha/lib_protocol/test/contracts/build_list.tz new file mode 100644 index 000000000..bb36dc2f7 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/build_list.tz @@ -0,0 +1,7 @@ +parameter nat; +return (list nat); +storage unit; +code { CAR @counter; NIL @acc nat; SWAP; DUP @cmp_num; PUSH nat 0; CMPNEQ; + LOOP { DUP; DIP {SWAP}; CONS @acc; SWAP; PUSH nat 1; SWAP; SUB @counter; + DUP; DIP{ABS}; PUSH int 0; CMPNEQ}; + CONS; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/cadr_annotation.tz b/src/proto_alpha/lib_protocol/test/contracts/cadr_annotation.tz new file mode 100644 index 000000000..43afa55d9 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/cadr_annotation.tz @@ -0,0 +1,4 @@ +parameter (pair (pair unit (string @no_name)) bool); +storage unit; +return unit; +code { CAR @name; CADR @second_name; DROP; UNIT; UNIT; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/check_signature.tz b/src/proto_alpha/lib_protocol/test/contracts/check_signature.tz new file mode 100644 index 000000000..727eca8bc --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/check_signature.tz @@ -0,0 +1,7 @@ +parameter key; +storage (pair signature string); +return bool; +code { DUP; DUP; + DIP{ CDR; DUP; CAR; + DIP{CDR; H}; PAIR}; + CAR; CHECK_SIGNATURE; DIP{CDR}; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/compare.tz b/src/proto_alpha/lib_protocol/test/contracts/compare.tz new file mode 100644 index 000000000..ed661ec87 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/compare.tz @@ -0,0 +1,10 @@ +parameter (pair tez tez); +return (list bool); +storage unit; +code {CAR; DUP; DUP; DUP; DUP; DIIIIIP {NIL bool}; + DIIIIP {DUP; CAR; DIP {CDR}; COMPARE; LE; CONS}; + DIIIP {DUP; CAR; DIP {CDR}; COMPARE; GE; CONS}; + DIIP{DUP; CAR; DIP {CDR}; COMPARE; LT; CONS}; + DIP {DUP; CAR; DIP {CDR}; COMPARE; GT; CONS}; + DUP; CAR; DIP {CDR}; COMPARE; EQ; CONS; + UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/concat.tz b/src/proto_alpha/lib_protocol/test/contracts/concat.tz new file mode 100644 index 000000000..203d03b12 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/concat.tz @@ -0,0 +1,11 @@ + +parameter string; +storage string; +return string; +code {DUP; # We're going to need both the storage and parameter + CAR; # Get the parameter + DIP{CDR; # Get the storage value + DUP}; # We need to replace it in the storage, so we dup it + SWAP; # Get the order we want (this is optional) + CONCAT; # Concatenate the strings + PAIR} # Pair them up, matching the calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/concat_hello.tz b/src/proto_alpha/lib_protocol/test/contracts/concat_hello.tz new file mode 100644 index 000000000..3fe89e70c --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/concat_hello.tz @@ -0,0 +1,5 @@ +parameter (list string); +return (list string); +storage unit; +code{ CAR; LAMBDA string string { PUSH @hello string "Hello "; CONCAT }; + MAP; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/concat_list.tz b/src/proto_alpha/lib_protocol/test/contracts/concat_list.tz new file mode 100644 index 000000000..1c4b9339e --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/concat_list.tz @@ -0,0 +1,6 @@ +parameter (list string); +return string; +storage unit; +code {CAR; PUSH string ""; SWAP; + LAMBDA (pair string string) string {DUP; CDR; DIP{CAR}; CONCAT}; + REDUCE; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/conditionals.tz b/src/proto_alpha/lib_protocol/test/contracts/conditionals.tz new file mode 100644 index 000000000..740e6bc82 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/conditionals.tz @@ -0,0 +1,11 @@ + +parameter (or string (option int)); +storage unit; +return string; +code { CAR; # Access the storage + IF_LEFT {} # The string is on top of the stack, nothing to do + { IF_NONE { FAIL} # Fail if None + { PUSH int 0; CMPGT; # Check for negative number + IF {FAIL} # Fail if negative + {PUSH string ""}}}; # Push the empty string + UNIT; SWAP; PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/cons_twice.tz b/src/proto_alpha/lib_protocol/test/contracts/cons_twice.tz new file mode 100644 index 000000000..d0894f00f --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/cons_twice.tz @@ -0,0 +1,12 @@ + +parameter nat; +storage (list nat); +return unit; +code { DUP; # Duplicate the storage and parameter + CAR; # Extract the parameter + DIP{CDR}; # Extract the storage + DUP; # Duplicate the parameter + DIP{CONS}; # Add the first instance of the parameter to the list + CONS; # Add the second instance of the parameter to the list + PUSH unit Unit; # Put the value Unit on the stack (calling convention) + PAIR} # Finish the calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/contains_all.tz b/src/proto_alpha/lib_protocol/test/contracts/contains_all.tz new file mode 100644 index 000000000..8b6d30583 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/contains_all.tz @@ -0,0 +1,10 @@ +parameter (pair (list string) (list string)); +storage unit; +return bool; +code {CAR; DUP; CAR; DIP{CDR}; EMPTY_SET string; SWAP; + LAMBDA (pair string (set string)) (set string) {DUP; CAR; DIP{CDR}; PUSH bool True; SWAP; UPDATE}; + REDUCE; PUSH bool True; SWAP; PAIR; SWAP; + LAMBDA (pair string (pair (set string) bool)) + (pair (set string) bool) + {DUP; DUP; CAR; DIP{CDAR; DIP{CDDR}; DUP}; MEM; DIP{SWAP}; AND; SWAP; PAIR}; + REDUCE; CDR; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/create_account.tz b/src/proto_alpha/lib_protocol/test/contracts/create_account.tz new file mode 100644 index 000000000..c04de7a26 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/create_account.tz @@ -0,0 +1,5 @@ +parameter key_hash; +return unit; +storage (contract unit unit); +code {CAR; DIP{PUSH tez "100.00"; PUSH bool False; NONE key_hash}; + CREATE_ACCOUNT; UNIT; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/create_add1_lists.tz b/src/proto_alpha/lib_protocol/test/contracts/create_add1_lists.tz new file mode 100644 index 000000000..43ea501d6 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/create_add1_lists.tz @@ -0,0 +1,22 @@ +parameter unit; +return (contract (list int) (list int)); +storage unit; +code { CAR; # Get the UNIT value (starting storage for contract) + LAMBDA (pair (list int) unit) # Start of stack for contract (see above) + (pair (list int) unit) # End of stack for contract (see above) + # See the contract above. I copied and pasted + { CAR; + LAMBDA int int {PUSH int 1; ADD}; + MAP; + UNIT; + SWAP; + PAIR }; + AMOUNT; # Push the starting balance + PUSH bool False; # Not spendable + DUP; # Or delegatable + NONE key_hash; # No delegate + PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5"; + CREATE_CONTRACT; # Create the contract + UNIT; # Ending calling convention stuff + SWAP; + PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz b/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz new file mode 100644 index 000000000..2138adecc --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/create_contract.tz @@ -0,0 +1,13 @@ +parameter key_hash; +storage string; +return unit; +code {CAR; + DIP{UNIT; + LAMBDA (pair string unit) + (pair string unit) + {CAR; UNIT; SWAP; PAIR}; + PUSH tez "100.00"; PUSH bool False; + PUSH bool False; NONE key_hash}; + CREATE_CONTRACT; DIP{PUSH string ""}; PUSH tez "0.00"; + PUSH string "abcdefg"; TRANSFER_TOKENS; + DIP{DROP}; UNIT; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/create_contract_literal.tz b/src/proto_alpha/lib_protocol/test/contracts/create_contract_literal.tz new file mode 100644 index 000000000..4043ef1ff --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/create_contract_literal.tz @@ -0,0 +1,14 @@ +parameter key_hash; +storage string; +return unit; +code { CAR; + DIP { UNIT; + PUSH tez "100.00"; PUSH bool False; + PUSH bool False; NONE key_hash }; + CREATE_CONTRACT { parameter string ; + storage unit ; + return string ; + code {CAR; UNIT; SWAP; PAIR } } ; + DIP{PUSH string ""}; PUSH tez "0.00"; + PUSH string "abcdefg"; TRANSFER_TOKENS; + DIP{DROP}; UNIT; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/data_publisher.tz b/src/proto_alpha/lib_protocol/test/contracts/data_publisher.tz new file mode 100644 index 000000000..25f7b0c82 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/data_publisher.tz @@ -0,0 +1,15 @@ + +# NONE if user wants to get the value +# SOME (signed hash of the string, string) +parameter (option (pair signature (pair string nat))); +return string; +storage (pair (pair key nat) string); +code { DUP; CAR; DIP{CDR; DUP}; + IF_NONE { AMOUNT; PUSH tez "1.00"; # The fee I'm charging for queries + CMPLE; IF {} {FAIL}; + CDR; PAIR} + { SWAP; DIP{DUP}; CAAR; DIP{DUP; CAR; DIP{CDR; H}; PAIR}; + CHECK_SIGNATURE; + IF { CDR; DUP; DIP{CAR; DIP{CAAR}}; CDR; PUSH nat 1; ADD; + DIP{SWAP}; SWAP; PAIR; PAIR; PUSH string ""; PAIR} + {FAIL}}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/default_account.tz b/src/proto_alpha/lib_protocol/test/contracts/default_account.tz new file mode 100644 index 000000000..85895f358 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/default_account.tz @@ -0,0 +1,5 @@ +parameter key_hash; +return unit; +storage unit; +code {DIP{UNIT}; CAR; DEFAULT_ACCOUNT; + PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/diff_timestamps.tz b/src/proto_alpha/lib_protocol/test/contracts/diff_timestamps.tz new file mode 100644 index 000000000..5655a866b --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/diff_timestamps.tz @@ -0,0 +1,4 @@ +parameter (pair timestamp timestamp); +return int; +storage unit; +code { CAR; DUP; CAR; DIP{CDR}; SUB; UNIT; SWAP; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/dispatch.tz b/src/proto_alpha/lib_protocol/test/contracts/dispatch.tz new file mode 100644 index 000000000..6f4fc468e --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/dispatch.tz @@ -0,0 +1,9 @@ +parameter (or string (pair string (lambda unit string))); +return string; +storage (map string (lambda unit string)); +code { DUP; DIP{CDR}; CAR; # Unpack stack + IF_LEFT { DIP{DUP}; GET; # Get lambda if it exists + IF_NONE {FAIL} {}; # Fail if it doesn't + UNIT; EXEC } # Execute the lambda + { DUP; CAR; DIP {CDR; SOME}; UPDATE; PUSH string ""}; # Update the storage + PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/empty.tz b/src/proto_alpha/lib_protocol/test/contracts/empty.tz new file mode 100644 index 000000000..0edda09b3 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/empty.tz @@ -0,0 +1,5 @@ + +parameter unit; +storage unit; +return unit; +code {} diff --git a/src/proto_alpha/lib_protocol/test/contracts/empty_map.tz b/src/proto_alpha/lib_protocol/test/contracts/empty_map.tz new file mode 100644 index 000000000..ff7b3d0d2 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/empty_map.tz @@ -0,0 +1,7 @@ +storage unit; +return (map string string); +parameter unit; +code {DROP; + EMPTY_MAP string string; + PUSH string "world"; SOME; PUSH string "hello"; UPDATE; + UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/exec_concat.tz b/src/proto_alpha/lib_protocol/test/contracts/exec_concat.tz new file mode 100644 index 000000000..7278670a7 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/exec_concat.tz @@ -0,0 +1,6 @@ +parameter string; +return string; +storage unit; +code {CAR; + LAMBDA string string {PUSH string "_abc"; SWAP; CONCAT}; + SWAP; EXEC; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/fail.tz b/src/proto_alpha/lib_protocol/test/contracts/fail.tz new file mode 100644 index 000000000..92ac980c5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/fail.tz @@ -0,0 +1,6 @@ +parameter unit; +code + { # This contract will never accept a incoming transaction + FAIL}; +return unit; +storage unit; diff --git a/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz b/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz new file mode 100644 index 000000000..9f9be1fcc --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/fail_amount.tz @@ -0,0 +1,5 @@ +# Fail if the amount transferred is less than 10 +parameter unit; +storage unit; +return unit; +code {AMOUNT; PUSH tez "10"; CMPGT; IF {FAIL} {}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/first.tz b/src/proto_alpha/lib_protocol/test/contracts/first.tz new file mode 100644 index 000000000..b2c9622c1 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/first.tz @@ -0,0 +1,4 @@ +parameter (list nat); +return nat; +storage unit; +code{CAR; IF_CONS {DIP{DROP}} {FAIL}; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/get_map_value.tz b/src/proto_alpha/lib_protocol/test/contracts/get_map_value.tz new file mode 100644 index 000000000..d8d95a783 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/get_map_value.tz @@ -0,0 +1,4 @@ +parameter string; +storage (map string string); +return (option string); +code {DUP; CAR; DIP{CDR; DUP}; GET; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/hardlimit.tz b/src/proto_alpha/lib_protocol/test/contracts/hardlimit.tz new file mode 100644 index 000000000..b9122789a --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/hardlimit.tz @@ -0,0 +1,7 @@ +parameter unit ; +code + { # This contract stops accepting transactions after N incoming transactions + CDR ; DUP ; PUSH int 0 ; CMPLT; IF {PUSH int -1 ; ADD} {FAIL}; + UNIT; PAIR} ; +return unit ; +storage int diff --git a/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz b/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz new file mode 100644 index 000000000..6909ba82b --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/hash_consistency_checker.tz @@ -0,0 +1,4 @@ +parameter (pair tez (pair timestamp int)) ; +return string ; +storage unit ; +code { CAR ; H ; UNIT ; SWAP ; PAIR } \ No newline at end of file diff --git a/src/proto_alpha/lib_protocol/test/contracts/hash_key.tz b/src/proto_alpha/lib_protocol/test/contracts/hash_key.tz new file mode 100644 index 000000000..feba0b58d --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/hash_key.tz @@ -0,0 +1,4 @@ +parameter key; +return key_hash; +storage unit; +code {CAR; HASH_KEY; DIP{UNIT}; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/hash_string.tz b/src/proto_alpha/lib_protocol/test/contracts/hash_string.tz new file mode 100644 index 000000000..2afbfb56e --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/hash_string.tz @@ -0,0 +1,4 @@ +parameter string; +return string; +storage unit; +code {CAR; H; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/id.tz b/src/proto_alpha/lib_protocol/test/contracts/id.tz new file mode 100644 index 000000000..ae9b9612e --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/id.tz @@ -0,0 +1,5 @@ + +parameter string; +return string; +storage unit; +code {}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/if.tz b/src/proto_alpha/lib_protocol/test/contracts/if.tz new file mode 100644 index 000000000..5a0d423a7 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/if.tz @@ -0,0 +1,4 @@ +parameter bool; +storage unit; +return bool; +code {CAR; IF {PUSH bool True} {PUSH bool False}; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/if_some.tz b/src/proto_alpha/lib_protocol/test/contracts/if_some.tz new file mode 100644 index 000000000..2ccc280a7 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/if_some.tz @@ -0,0 +1,4 @@ +parameter (option string); +return string; +storage unit; +code { CAR; IF_SOME {} {PUSH string ""}; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/infinite_loop.tz b/src/proto_alpha/lib_protocol/test/contracts/infinite_loop.tz new file mode 100644 index 000000000..dc78d4d33 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/infinite_loop.tz @@ -0,0 +1,4 @@ +parameter unit; +storage unit; +return unit; +code { DROP; PUSH bool True; LOOP {PUSH bool True}; UNIT; UNIT; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/insertion_sort.tz b/src/proto_alpha/lib_protocol/test/contracts/insertion_sort.tz new file mode 100644 index 000000000..47c7014f4 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/insertion_sort.tz @@ -0,0 +1,27 @@ + +parameter (list int); +return (list int); +storage unit; +code { CAR; # Access list + # Insert procedure + LAMBDA (pair int (list int)) + (list int) + { DUP; CDR; DIP{CAR}; # Unpack accumulator and existing list + DIIP{NIL int}; PUSH bool True; # Setup loop + LOOP { IF_CONS { SWAP; + DIP{DUP; DIIP{DUP}; DIP{CMPLT}; SWAP}; # Duplicate numbers + SWAP; + # If less than + IF { DIP{SWAP; DIP{CONS}}; PUSH bool True} + # Otherwise + { SWAP; CONS; PUSH bool False}} + # Ending case + { NIL int; PUSH bool False}}; + SWAP; CONS; SWAP; # Finish lists + LAMBDA (pair int (list int)) + (list int) + {DUP; CAR; DIP{CDR}; CONS}; + REDUCE}; + NIL int; SWAP; DIP{SWAP}; # Accumulator for reverse onto + REDUCE; # Execute reverse onto + UNIT; SWAP; PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz b/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz new file mode 100644 index 000000000..db8da7c10 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/int_publisher.tz @@ -0,0 +1,21 @@ +# NONE if user wants to get the value +# SOME (signed hash of the string, string) +parameter (option (pair signature int)); +return int; +# The key used to update the contract +# The data +storage (pair key int); +code {DUP; DUP; CAR; + IF_NONE {PUSH tez "1.00"; # Fee pattern from July 26 + AMOUNT; CMPLE; IF {FAIL} {}; + # Provide the data + CDR; DIP {CDDR}} + {DUP; DIP{SWAP}; SWAP; CDAR; # Move key to the top + DIP {DUP; CAR; DIP {CDR; H}; PAIR}; # Arrange the new piece of data + CHECK_SIGNATURE; # Check to ensure the data is authentic + # Update data + IF {CDR; SWAP; DIP{DUP}; CDAR; PAIR} + # Revert the update. This could be replaced with FAIL + {DROP; DUP; CDR; DIP{CDDR}}}; + # Cleanup + SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz b/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz new file mode 100644 index 000000000..899fff0cb --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/king_of_tez.tz @@ -0,0 +1,18 @@ +parameter key_hash; +storage (pair timestamp (pair tez key_hash)); +return unit; +code { DUP; CDAR; + # If the time is more than 2 weeks, any amount makes you king + NOW; CMPGT; + # User becomes king of tez + IF { CAR; AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR } + # Check balance to see if user has paid enough to become the new king + { DUP; CDDAR; AMOUNT; CMPLT; + IF { FAIL } # user has not paid out + { CAR; DUP; + # New storage + DIP{ AMOUNT; PAIR; NOW; PUSH int 604800; ADD; PAIR }; + # Pay funds to old king + DEFAULT_ACCOUNT; AMOUNT; UNIT; TRANSFER_TOKENS; DROP }}; + # Cleanup + UNIT; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_id.tz b/src/proto_alpha/lib_protocol/test/contracts/list_id.tz new file mode 100644 index 000000000..75a99e7c5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/list_id.tz @@ -0,0 +1,4 @@ +parameter (list string); +return (list string); +storage unit; +code {} diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_id_map.tz b/src/proto_alpha/lib_protocol/test/contracts/list_id_map.tz new file mode 100644 index 000000000..3ae75b50f --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/list_id_map.tz @@ -0,0 +1,4 @@ +parameter (list string); +return (list string); +storage unit; +code {CAR; LAMBDA string string {}; MAP; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_iter.tz b/src/proto_alpha/lib_protocol/test/contracts/list_iter.tz new file mode 100644 index 000000000..d09b75a24 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/list_iter.tz @@ -0,0 +1,6 @@ +parameter (list int); +storage unit; +return int; +code { CAR; PUSH int 1; SWAP; + ITER { MUL }; + UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_iter2.tz b/src/proto_alpha/lib_protocol/test/contracts/list_iter2.tz new file mode 100644 index 000000000..39fd7706c --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/list_iter2.tz @@ -0,0 +1,6 @@ +parameter (list string); +return string; +storage unit; +code { CAR; PUSH string ""; SWAP; + ITER { CONCAT }; + UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_map_block.tz b/src/proto_alpha/lib_protocol/test/contracts/list_map_block.tz new file mode 100644 index 000000000..a404af562 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/list_map_block.tz @@ -0,0 +1,6 @@ +parameter (list int); +return (list int); +storage unit; +code { CAR; PUSH int 0; SWAP; + MAP { DIP{DUP}; ADD; DIP{PUSH int 1; ADD}}; + UNIT; SWAP; PAIR; DIP{DROP}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz b/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz new file mode 100644 index 000000000..1be3259e3 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/list_of_transactions.tz @@ -0,0 +1,9 @@ + +parameter unit; +storage (list (contract unit unit)); +return unit; +code { CDR; PUSH bool True; # Setup loop + LOOP {IF_CONS { PUSH tez "1.00"; UNIT; TRANSFER_TOKENS; # Make transfer + DROP; PUSH bool True} # Setup for next round of loop + { NIL (contract unit unit); PUSH bool False}}; # Data to satisfy types and end loop + UNIT; PAIR}; # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/lockup.tz b/src/proto_alpha/lib_protocol/test/contracts/lockup.tz new file mode 100644 index 000000000..5b3f68516 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/lockup.tz @@ -0,0 +1,18 @@ +parameter unit; +storage (pair timestamp (pair tez (contract unit unit))); +return unit; +code { CDR; # Ignore the parameter + DUP; # Duplicate the storage + CAR; # Get the timestamp + NOW; # Push the current timestamp + CMPLT; # Compare to the current time + IF {FAIL} {}; # Fail if it is too soon + DUP; # Duplicate the storage value + # this must be on the bottom of the stack for us to call transfer tokens + CDR; # Ignore the timestamp, focussing in on the tranfser data + DUP; # Duplicate the transfer information + CAR; # Get the amount of the transfer on top of the stack + DIP{CDR}; # Put the contract underneath it + UNIT; # Put the contract's argument type on top of the stack + TRANSFER_TOKENS; # Make the transfer + PAIR} # Pair up to meet the calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/loop_left.tz b/src/proto_alpha/lib_protocol/test/contracts/loop_left.tz new file mode 100644 index 000000000..80bad5de5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/loop_left.tz @@ -0,0 +1,8 @@ +parameter (list string); +return (list string); +storage unit; +code { CAR; NIL string; SWAP; PAIR; LEFT (list string); + LOOP_LEFT { DUP; CAR; DIP{CDR}; + IF_CONS { SWAP; DIP{CONS}; PAIR; LEFT (list string) } + { RIGHT (pair (list string) (list string)) }; }; + UNIT; SWAP; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/macro_annotations.tz b/src/proto_alpha/lib_protocol/test/contracts/macro_annotations.tz new file mode 100644 index 000000000..fdc374061 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/macro_annotations.tz @@ -0,0 +1,6 @@ +return unit; +parameter unit; +storage unit; +code { PUSH unit Unit ; + DUUP @truc ; + DROP ; DROP } diff --git a/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz b/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz new file mode 100644 index 000000000..75ea96744 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/map_caddaadr.tz @@ -0,0 +1,4 @@ +parameter unit; +storage (pair (pair nat (pair nat (pair (pair (pair nat tez) nat) nat))) nat); +return unit; +code { MAP_CDADDAADR { PUSH tez "1.00" ; ADD } }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/map_car.tz b/src/proto_alpha/lib_protocol/test/contracts/map_car.tz new file mode 100644 index 000000000..6d8dab481 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/map_car.tz @@ -0,0 +1,4 @@ +parameter bool; +storage (pair bool nat); +return unit; +code { DUP; CAR; DIP{CDR}; SWAP; MAP_CAR { AND } ; UNIT; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/map_id.tz b/src/proto_alpha/lib_protocol/test/contracts/map_id.tz new file mode 100644 index 000000000..2d2981bb1 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/map_id.tz @@ -0,0 +1,4 @@ +parameter (map nat nat); +return (map nat nat); +storage unit; +code {} diff --git a/src/proto_alpha/lib_protocol/test/contracts/map_iter.tz b/src/proto_alpha/lib_protocol/test/contracts/map_iter.tz new file mode 100644 index 000000000..2e1716330 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/map_iter.tz @@ -0,0 +1,7 @@ +parameter (map int int); +return (pair int int); +storage unit; +code { CAR; PUSH int 0; DUP; PAIR; SWAP; + ITER { DIP {DUP; CAR; DIP{CDR}}; DUP; # Last instr + DIP{CAR; ADD}; SWAP; DIP{CDR; ADD}; PAIR }; + UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/map_size.tz b/src/proto_alpha/lib_protocol/test/contracts/map_size.tz new file mode 100644 index 000000000..befa00755 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/map_size.tz @@ -0,0 +1,4 @@ +parameter (map string nat); +return nat; +storage unit; +code {CAR; SIZE; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/max_in_list.tz b/src/proto_alpha/lib_protocol/test/contracts/max_in_list.tz new file mode 100644 index 000000000..65a8ce4c6 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/max_in_list.tz @@ -0,0 +1,10 @@ +parameter (list int); +storage unit; +return (option int); +code {CAR; DIP{NONE int}; + LAMBDA + (pair int (option int)) + (option int) + {DUP; DUP; CAR; SWAP; CDR; + IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}}; + REDUCE; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/min.tz b/src/proto_alpha/lib_protocol/test/contracts/min.tz new file mode 100644 index 000000000..5a7ac2643 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/min.tz @@ -0,0 +1,13 @@ + +parameter (pair int int); +return int; +storage unit; +code { CAR; # Ignore the storage + DUP; # Duplicate so we can get both the numbers passed as parameters + DUP; # Second dup so we can access the lesser number + CAR; DIP{CDR}; # Unpack the numbers on top of the stack + CMPLT; # Compare the two numbers, placing a boolean on top of the stack + IF {CAR} {CDR}; # Access the first number if the boolean was true + UNIT; # Push storage value + SWAP; # Correct order for calling convention pair + PAIR} # Pair the numbers satisfying the calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/noop.tz b/src/proto_alpha/lib_protocol/test/contracts/noop.tz new file mode 100644 index 000000000..54a511a24 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/noop.tz @@ -0,0 +1,4 @@ +parameter unit; +code {}; +return unit; +storage unit; diff --git a/src/proto_alpha/lib_protocol/test/contracts/not.tz b/src/proto_alpha/lib_protocol/test/contracts/not.tz new file mode 100644 index 000000000..b6155da09 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/not.tz @@ -0,0 +1,4 @@ +parameter bool; +return bool; +storage unit; +code {CAR; NOT; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/or.tz b/src/proto_alpha/lib_protocol/test/contracts/or.tz new file mode 100644 index 000000000..1b45ccc8f --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/or.tz @@ -0,0 +1,5 @@ +parameter (pair bool bool); +return bool; +storage unit; +code {CAR; DUP; CAR; SWAP; CDR; OR; + UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/originator.tz b/src/proto_alpha/lib_protocol/test/contracts/originator.tz new file mode 100644 index 000000000..a03ab3fe5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/originator.tz @@ -0,0 +1,17 @@ +storage unit ; +parameter nat ; +return (list (contract unit unit)) ; +code + { CAR ; DUP ; PUSH nat 0 ; CMPNEQ ; + DIIP { NIL (contract unit unit) } ; + LOOP + { PUSH tez "5.00" ; + PUSH bool True ; # delegatable + NONE key_hash ; # delegate + PUSH key_hash "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" ; # manager + CREATE_ACCOUNT ; + SWAP ; DIP { CONS } ; + PUSH nat 1 ; SWAP ; SUB ; ABS ; + DUP ; PUSH nat 0 ; CMPNEQ } ; + DROP ; + UNIT ; SWAP ; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/pair_id.tz b/src/proto_alpha/lib_protocol/test/contracts/pair_id.tz new file mode 100644 index 000000000..0284956e5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/pair_id.tz @@ -0,0 +1,4 @@ +parameter (pair bool bool); +return (pair bool bool); +storage unit; +code {} diff --git a/src/proto_alpha/lib_protocol/test/contracts/pair_macro.tz b/src/proto_alpha/lib_protocol/test/contracts/pair_macro.tz new file mode 100644 index 000000000..ab9246e17 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/pair_macro.tz @@ -0,0 +1,4 @@ +parameter unit; +return unit; +storage unit; +code { UNIT; UNIT; UNIT; UNIT; UNIT; PAIAAIAIAIR @name; DROP} diff --git a/src/proto_alpha/lib_protocol/test/contracts/parameterizable_payments.tz b/src/proto_alpha/lib_protocol/test/contracts/parameterizable_payments.tz new file mode 100644 index 000000000..2d95dafe2 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/parameterizable_payments.tz @@ -0,0 +1,26 @@ +parameter (or (pair string (pair tez (contract unit unit))) nat); +return unit; +storage (pair (contract nat (pair nat bool)) (pair nat (map nat (pair string (pair tez (contract unit unit)))))); +code { DUP; DIP{CDR}; CAR; # Get the input while preserving the output + IF_LEFT { DIP{ DUP; CAR; SWAP; CDR; DUP; CAR; DIP{CDR}}; + SOME; SWAP; DUP; DIP{UPDATE}; # Add the element to the map + PUSH nat 1; ADD; PAIR; SWAP; # Add 1 to the index + PAIR; UNIT; PAIR} # Cleanup and finish + # Check our other contract to see if the transaction is allowed + { DIP{DUP; CAR}; PUSH tez "0.00"; SWAP; TRANSFER_TOKENS; + # Arrange the stack + DUP; CDR; + IF { CAR; DUP; DIIP{DUP; CDDR; DUP}; + DIP{ GET; # Get the value of the data + IF_NONE {FAIL} {}; # This should not happen + SWAP; + NONE (pair string (pair tez (contract unit unit)))}; + UPDATE; # Delete the element + SWAP; + # More stack arranging + DIP{ SWAP; DUP; CAR; DIP{CDR}}; + DIP{DIP{CAR; PAIR}; PAIR}; + DUP; CDAR; + DIP{CDDR}; UNIT; TRANSFER_TOKENS; # Make the transfer + PAIR} + { FAIL }}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/parameterized_multisig.tz b/src/proto_alpha/lib_protocol/test/contracts/parameterized_multisig.tz new file mode 100644 index 000000000..22c7f94ac --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/parameterized_multisig.tz @@ -0,0 +1,24 @@ +storage (pair (map nat (pair bool bool)) (pair key key)); +return bool; +parameter (or nat (pair signature nat)); +code { DUP; CAR; DIP{CDR}; # Stack rangling + IF_LEFT { DIP{DUP; CAR}; GET; # Get the value stored for that index + IF_NONE { PUSH bool False} # If not referenced, reject + { DUP; CAR; DIP{CDR}; AND}; + PAIR} + { DUP; CAR; DIP{CDR; DUP; H}; PAIR; SWAP; # Create the signature pair + DIP{ DIP{DUP; CDR; DIP{CAR}; DUP}; + SWAP; CAR; DIP{DUP}; CHECK_SIGNATURE }; # Check the first signature + SWAP; + # If the signature typechecked, get and update the first element of the pair + IF { DIP{DROP; SWAP; DUP}; DUP; + DIP{ GET; IF_NONE{PUSH (pair bool bool) (Pair False False)} {}; + CDR; PUSH bool True; PAIR; SOME }} + # Check the second signature + { DIP{DIP{DUP; CDR}; SWAP; CHECK_SIGNATURE}; SWAP; + IF { DUP; DIP{DIP{SWAP; DUP}; GET}; SWAP; + IF_NONE {PUSH (pair bool bool) (Pair False False)} {}; + CAR; PUSH bool True; SWAP; PAIR; SOME; SWAP} + {FAIL}}; + # Update the stored value and finish off + UPDATE; PAIR; PUSH bool False; PAIR}} diff --git a/src/proto_alpha/lib_protocol/test/contracts/publisher_payouts.tz b/src/proto_alpha/lib_protocol/test/contracts/publisher_payouts.tz new file mode 100644 index 000000000..15bca5d55 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/publisher_payouts.tz @@ -0,0 +1,17 @@ +parameter unit; +storage (option + (pair (pair (contract unit unit) (contract unit unit)) + (pair (pair timestamp (contract (option (pair signature int)) int)) + (pair tez int)))); +return unit; +code { CDR; IF_NONE {FAIL} {}; # Check if settlement has already ocurred + DUP; CDAAR; NOW; CMPLT; IF {FAIL} {}; # Check the timestamp + DUP; CDADR; DIP{SOME}; PUSH tez "1.01"; NONE (pair signature int); + TRANSFER_TOKENS; DIP{IF_NONE{FAIL} {}}; + DIP{DUP; CDDR; DUP; CDR}; CMPGT; + SWAP; + DIP{ IF {CAAR} {CADR}; + DIP{ NONE (pair (pair (contract unit unit) (contract unit unit)) + (pair (pair timestamp (contract (option (pair signature int)) int)) + (pair tez int)))}}; + CAR; UNIT; TRANSFER_TOKENS; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/queue.tz b/src/proto_alpha/lib_protocol/test/contracts/queue.tz new file mode 100644 index 000000000..10a894fea --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/queue.tz @@ -0,0 +1,24 @@ +parameter (option string); +storage (pair (pair nat nat) (map nat string)); +return (option string); +code { DUP; CAR; + # Retrieving an element + IF_NONE { CDR; DUP; CAR; DIP{CDR; DUP}; DUP; + CAR; SWAP; DIP{GET}; # Check if an element is available + SWAP; + # Put NONE on stack and finish + IF_NONE { NONE string; DIP{PAIR}; PAIR} + # Reoption the element and remove the entry from the map + { SOME; + DIP{ DUP; DIP{ CAR; DIP{ NONE string }; UPDATE }; + # Increment the counter and cleanup + DUP; CAR; PUSH nat 1; ADD; DIP{ CDR }; PAIR; PAIR}; + PAIR }} + # Arrange the stack + { DIP{DUP; CDAR; DIP{CDDR}; DUP}; SWAP; CAR; + # Add the element to the map + DIP{ SOME; SWAP; CDR; DUP; DIP{UPDATE}; + # Increment the second number + PUSH nat 1; ADD}; + # Cleanup and finish + PAIR; PAIR; NONE string; PAIR }} diff --git a/src/proto_alpha/lib_protocol/test/contracts/reduce_map.tz b/src/proto_alpha/lib_protocol/test/contracts/reduce_map.tz new file mode 100644 index 000000000..f112ff283 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/reduce_map.tz @@ -0,0 +1,22 @@ + +parameter (pair (lambda int int) (list int)); +return (list int); +storage unit; +code { DIP{NIL int}; + CAR; + DUP; + DIP{CAR; PAIR}; # Unpack data and setup accumulator + CDR; + LAMBDA (pair int (pair (lambda int int) (list int))) + (pair (lambda int int) (list int)) + # Apply the lambda and add the new element to the list + { DUP; CDAR; + DIP{ DUP; DIP{CDAR}; DUP; + CAR; DIP{CDDR; SWAP}; EXEC; CONS}; + PAIR}; + REDUCE; CDR; DIP{NIL int}; # First reduce + LAMBDA (pair int (list int)) + (list int) + {DUP; CAR; DIP{CDR}; CONS}; + REDUCE; # Correct list order + UNIT; SWAP; PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz b/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz new file mode 100644 index 000000000..f30f21ae5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/reentrancy.tz @@ -0,0 +1,6 @@ +parameter unit; +storage (pair (contract unit unit) (contract unit unit)); +return unit; +code { CDR; DUP; CAR; PUSH tez "5.00"; UNIT; + TRANSFER_TOKENS; DROP; DUP; CDR; + PUSH tez "5.00"; UNIT; TRANSFER_TOKENS; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/ret_int.tz b/src/proto_alpha/lib_protocol/test/contracts/ret_int.tz new file mode 100644 index 000000000..e6415d413 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/ret_int.tz @@ -0,0 +1,4 @@ +parameter unit; +code {CAR; PUSH nat 300; PAIR}; +return nat; +storage unit; diff --git a/src/proto_alpha/lib_protocol/test/contracts/reverse.tz b/src/proto_alpha/lib_protocol/test/contracts/reverse.tz new file mode 100644 index 000000000..08a110e41 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/reverse.tz @@ -0,0 +1,8 @@ +parameter (list string); +storage unit; +return (list string); +code { CAR; NIL string; SWAP; + LAMBDA (pair string (list string)) + (list string) + {DUP; CAR; DIP{CDR}; CONS}; + REDUCE; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/reverse_loop.tz b/src/proto_alpha/lib_protocol/test/contracts/reverse_loop.tz new file mode 100644 index 000000000..ca626c4ec --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/reverse_loop.tz @@ -0,0 +1,6 @@ +parameter (list string); +return (list string); +storage unit; +code { CAR; NIL string; SWAP; PUSH bool True; + LOOP { IF_CONS {SWAP; DIP{CONS}; PUSH bool True} {NIL string; PUSH bool False}}; + DROP; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/self.tz b/src/proto_alpha/lib_protocol/test/contracts/self.tz new file mode 100644 index 000000000..ab682c252 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/self.tz @@ -0,0 +1,4 @@ +parameter unit ; +storage (contract unit unit) ; +return unit ; +code { MAP_CDR { DROP ; SELF } } diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz b/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz new file mode 100644 index 000000000..8a55c4109 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_caddaadr.tz @@ -0,0 +1,6 @@ +parameter tez; +storage (pair (pair nat (pair nat (pair (pair (pair nat tez) nat) nat))) nat); +return unit; +code { DUP ; CAR ; SWAP ; CDR ; + SET_CADDAADR @annot ; + UNIT ; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_car.tz b/src/proto_alpha/lib_protocol/test/contracts/set_car.tz new file mode 100644 index 000000000..4c0d24c77 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_car.tz @@ -0,0 +1,4 @@ +parameter string; +storage (pair string nat); +return (pair string nat); +code { DUP; CDR; DIP{CAR}; SET_CAR @hello; DUP; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_cdr.tz b/src/proto_alpha/lib_protocol/test/contracts/set_cdr.tz new file mode 100644 index 000000000..549787cfd --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_cdr.tz @@ -0,0 +1,4 @@ +parameter nat; +storage (pair string nat); +return (pair string nat); +code { DUP; CDR; DIP{CAR}; SET_CDR @annot; DUP; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_id.tz b/src/proto_alpha/lib_protocol/test/contracts/set_id.tz new file mode 100644 index 000000000..e98f7f8fd --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_id.tz @@ -0,0 +1,4 @@ +parameter (set string); +return (set string); +storage unit; +code {} diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_iter.tz b/src/proto_alpha/lib_protocol/test/contracts/set_iter.tz new file mode 100644 index 000000000..27985ca20 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_iter.tz @@ -0,0 +1,4 @@ +parameter (set int); +return int; +storage unit; +code { CAR; PUSH int 0; SWAP; ITER { ADD }; UNIT; SWAP; PAIR } diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_member.tz b/src/proto_alpha/lib_protocol/test/contracts/set_member.tz new file mode 100644 index 000000000..3aa55693d --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_member.tz @@ -0,0 +1,4 @@ +parameter string; +storage (set string); +return bool; +code {DUP; CAR; DIP{CDR}; MEM; DIP{EMPTY_SET string}; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/set_size.tz b/src/proto_alpha/lib_protocol/test/contracts/set_size.tz new file mode 100644 index 000000000..0fb1b10ad --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/set_size.tz @@ -0,0 +1,4 @@ +parameter (set int); +storage unit; +return nat; +code {CAR; SIZE; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz b/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz new file mode 100644 index 000000000..48ef21d29 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/spawn_identities.tz @@ -0,0 +1,27 @@ +parameter nat; +return unit; +storage (list (contract string string)); +code { DUP; + CAR; # Get the number + DIP{CDR}; # Put the accumulator on the stack + PUSH bool True; # Push true so we have a do while loop + LOOP { DUP; PUSH nat 0; CMPEQ; # Check if the number is 0 + IF { PUSH bool False} # End the loop + { PUSH nat 1; SWAP; SUB; ABS; # Subtract 1. The ABS is to make it back into a nat + UNIT; # Storage type + LAMBDA (pair string unit) # Identity contract + (pair string unit) + {}; + PUSH tez "5.00"; # Strating balance + PUSH bool False; DUP; # Not spendable or delegatable + NONE key_hash; + # This is once again my key from the alphanet. + # I highly encourage you to send funds to it + # Will it help you? Will it help me? The answer is no, + # However, do it anyway + PUSH key_hash "tz1cxcwwnzENRdhe2Kb8ZdTrdNy4bFNyScx5"; + CREATE_CONTRACT; # Make the contract + SWAP; # Add to the list + DIP{CONS}; + PUSH bool True}}; # Continue the loop + DROP; UNIT; PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/steps_to_quota.tz b/src/proto_alpha/lib_protocol/test/contracts/steps_to_quota.tz new file mode 100644 index 000000000..35a1cea7e --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/steps_to_quota.tz @@ -0,0 +1,4 @@ +parameter unit; +return nat; +storage unit; +code {DROP; UNIT; STEPS_TO_QUOTA; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/store_input.tz b/src/proto_alpha/lib_protocol/test/contracts/store_input.tz new file mode 100644 index 000000000..1ccaf78e1 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/store_input.tz @@ -0,0 +1,4 @@ +parameter string; +return unit; +storage string; +code {CAR; UNIT; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/store_now.tz b/src/proto_alpha/lib_protocol/test/contracts/store_now.tz new file mode 100644 index 000000000..c88f7980f --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/store_now.tz @@ -0,0 +1,4 @@ +parameter unit; +storage timestamp; +return unit; +code {DROP; NOW; UNIT; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/str_id.tz b/src/proto_alpha/lib_protocol/test/contracts/str_id.tz new file mode 100644 index 000000000..1fc1cd60c --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/str_id.tz @@ -0,0 +1,4 @@ +parameter string; +return string; +storage unit; +code {}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/strategy_proxy.tz b/src/proto_alpha/lib_protocol/test/contracts/strategy_proxy.tz new file mode 100644 index 000000000..f80c90078 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/strategy_proxy.tz @@ -0,0 +1,9 @@ +parameter nat; +storage (pair (option nat) (contract (or nat (pair signature nat)) bool)); +return (pair nat bool); +code { DUP; CAR; DIP{CDDR; DUP}; DUP; DIP{SOME; PAIR; SWAP}; # Store the nat in strorage + # Query our stored contract + LEFT (pair signature nat); DIP{PUSH tez "0.00"}; TRANSFER_TOKENS; + # Cleanup and finish + DIP{DUP; CAR}; DIP{IF_NONE {FAIL} {}}; SWAP; + PAIR; DIP{CDR; NONE nat; PAIR}; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/sub_timestamp_delta.tz b/src/proto_alpha/lib_protocol/test/contracts/sub_timestamp_delta.tz new file mode 100644 index 000000000..df7e98b35 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/sub_timestamp_delta.tz @@ -0,0 +1,4 @@ +parameter (pair timestamp int); +storage unit; +return timestamp; +code { CAR; DUP; CAR; DIP{CDR}; SUB; UNIT; SWAP; PAIR} diff --git a/src/proto_alpha/lib_protocol/test/contracts/subset.tz b/src/proto_alpha/lib_protocol/test/contracts/subset.tz new file mode 100644 index 000000000..6924c57fe --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/subset.tz @@ -0,0 +1,18 @@ +parameter (pair (set string) (set string)); +return bool; +storage unit; +code { CAR; DUP; CDR; DIP{CAR}; # Unpack lists + PUSH bool True; + PAIR; SWAP; # Setup accumulator + LAMBDA (pair string (pair bool (set string))) + (pair bool (set string)) + { DUP; # Unpack accumulator and input + CAR; + DIP{ CDR; DUP; DUP; CDR; + DIP{CAR; DIP{CDR}}}; + MEM; # Check membership + AND; # Combine accumulator and input + PAIR}; + REDUCE; # Reduce + CAR; # Get the accumulator value + UNIT; SWAP; PAIR} # Calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/swap_left_right.tz b/src/proto_alpha/lib_protocol/test/contracts/swap_left_right.tz new file mode 100644 index 000000000..00bcfcbf0 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/swap_left_right.tz @@ -0,0 +1,4 @@ +parameter (or bool string); +return (or string bool); +storage unit; +code {CAR; IF_LEFT {RIGHT string} {LEFT bool}; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/swap_storage_input.tz b/src/proto_alpha/lib_protocol/test/contracts/swap_storage_input.tz new file mode 100644 index 000000000..a63a2179b --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/swap_storage_input.tz @@ -0,0 +1,9 @@ + +parameter string; +return string; +storage string; # Note that all three values are of the same type +code { DUP; # In order to access both the storage and parameter, I need to duplicate the (pair parameter storage) + CAR; # Access the parameter + SWAP; # Exchange top and second element on the stack + CDR; # Get the storage in the pair + PAIR}; # Generate pair of elements diff --git a/src/proto_alpha/lib_protocol/test/contracts/swap_storage_input_dip.tz b/src/proto_alpha/lib_protocol/test/contracts/swap_storage_input_dip.tz new file mode 100644 index 000000000..5459623e1 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/swap_storage_input_dip.tz @@ -0,0 +1,8 @@ + +parameter string; +storage string; +return string; +code { DUP; # Duplicate the (pair parameter storage) + CDR; # Access the storage + DIP{CAR}; # Access the parameter, but leave the storage unchanged on top of the stack + PAIR} # Pair the elements, fulfilling the calling convention diff --git a/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz b/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz new file mode 100644 index 000000000..2b4109bc7 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/take_my_money.tz @@ -0,0 +1,9 @@ +parameter key_hash; +return unit; +storage unit; +code { CAR; DEFAULT_ACCOUNT; # Create an account for the recipient of the funds + DIP{UNIT}; # Push a value of the storage type below the contract + PUSH tez "1.00"; # The person can have a ęś© + UNIT; # Push the contract's argument type + TRANSFER_TOKENS; # Run the transfer + PAIR }; # Cleanup and put the return values diff --git a/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz b/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz new file mode 100644 index 000000000..ad3a1c2d9 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/tez_add_sub.tz @@ -0,0 +1,6 @@ +parameter (pair tez tez); +storage unit; +return (pair tez tez); +code {CAR; DUP; DUP; CAR; DIP{CDR}; ADD; + DIP{DUP; CAR; DIP{CDR}; SUB}; + PAIR; UNIT; SWAP; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz b/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz new file mode 100644 index 000000000..1e562b603 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/transfer_amount.tz @@ -0,0 +1,4 @@ +parameter unit; +storage tez; +return unit; +code { DROP; AMOUNT; UNIT; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz b/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz new file mode 100644 index 000000000..c4a8673f5 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/transfer_to.tz @@ -0,0 +1,4 @@ +parameter (contract unit unit); +return unit; +storage unit; +code {CAR; DIP{UNIT}; PUSH tez "100.00"; UNIT; TRANSFER_TOKENS; PAIR}; diff --git a/src/proto_alpha/lib_protocol/test/contracts/two_vulnerabilities.tz b/src/proto_alpha/lib_protocol/test/contracts/two_vulnerabilities.tz new file mode 100644 index 000000000..96786e639 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/two_vulnerabilities.tz @@ -0,0 +1,7 @@ + +parameter unit; +storage (pair (contract unit unit) (contract unit unit)); +return unit; +code { CDR; DUP; CAR; PUSH tez "5.00"; UNIT; + TRANSFER_TOKENS; DROP; DUP; CDR; + PUSH tez "5.00"; UNIT; TRANSFER_TOKENS; PAIR }; diff --git a/src/proto_alpha/lib_protocol/test/contracts/unpair_macro.tz b/src/proto_alpha/lib_protocol/test/contracts/unpair_macro.tz new file mode 100644 index 000000000..12a4578df --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/unpair_macro.tz @@ -0,0 +1,4 @@ +parameter unit; +storage unit; +return unit; +code { UNIT; UNIT; UNIT; UNIT; PAIAAIR; UNPAIAAIR; DROP; DROP; DROP; DROP } diff --git a/src/proto_alpha/lib_protocol/test/contracts/weather_insurance.tz b/src/proto_alpha/lib_protocol/test/contracts/weather_insurance.tz new file mode 100644 index 000000000..d437f87fa --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/weather_insurance.tz @@ -0,0 +1,18 @@ +# (pair signed_weather_data actual_level) +parameter (pair (signature @sig) (nat @nat)); +# (pair (under_key over_key) (pair weather_service_key (pair rain_level days_in_future))) +storage (pair (pair (contract @lt unit unit) + (contract @geq unit unit)) + (pair nat key)); +return unit; +code { DUP; DUP; + CAR; MAP_CDR{H}; + SWAP; CDDDR; CHECK_SIGNATURE; # Check if the data has been correctly signed + ASSERT; # If signature is not correct, end the execution + DUP; DUP; DUP; DIIIP{CDR}; # Place storage type on bottom of stack + DIIP{CDAR}; # Place contracts below numbers + DIP{CADR}; # Get actual rain + CDDAR; # Get rain threshold + CMPLT; IF {CAR @winner} {CDR @winner}; # Select contract to receive tokens + BALANCE; UNIT; TRANSFER_TOKENS; # Setup and execute transfer + PAIR }; # Save storage diff --git a/src/proto_alpha/lib_protocol/test/contracts/xor.tz b/src/proto_alpha/lib_protocol/test/contracts/xor.tz new file mode 100644 index 000000000..f7185a14a --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/contracts/xor.tz @@ -0,0 +1,4 @@ +parameter (pair bool bool); +return bool; +storage unit; +code {CAR; DUP; CAR; DIP{CDR}; XOR; UNIT; SWAP; PAIR}; diff --git a/test/proto_alpha_isolate_helpers/helpers_account.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_account.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_account.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_account.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_account.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_account.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_account.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_account.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_apply.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_apply.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_apply.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_apply.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_apply.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_apply.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_apply.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_apply.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_assert.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_assert.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_assert.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_assert.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_assert.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_assert.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_assert.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_assert.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_block.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_block.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_block.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_block.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_block.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_block.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_block.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_block.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_cast.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_cast.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_cast.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_cast.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_cast.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_cast.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_cast.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_cast.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_constants.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_constants.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_constants.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_constants.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_constants.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_constants.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_constants.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_constants.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_init.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_init.ml similarity index 94% rename from test/proto_alpha_isolate_helpers/helpers_init.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_init.ml index 986d6d094..8968dae06 100644 --- a/test/proto_alpha_isolate_helpers/helpers_init.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/helpers_init.ml @@ -102,8 +102,12 @@ let get_alpha () = return (global_state , state , result) let get_sandbox () = - Data_encoding_ezjsonm.read_file "test/proto_alpha/sandbox.json" >>= fun x -> - Lwt.return @@ Helpers_assert.no_error ~msg:__LOC__ x + Data_encoding_ezjsonm.read_file + "src/proto_alpha/lib_protocol/test/sandbox.json" >>= function + | Ok x -> Lwt.return x + | Error _ -> + Data_encoding_ezjsonm.read_file "test/sandbox.json" >>= fun x -> + Lwt.return @@ Helpers_assert.no_error ~msg:__LOC__ x open Helpers_assert diff --git a/test/proto_alpha_isolate_helpers/helpers_init.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_init.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_init.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_init.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_logger.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_logger.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_logger.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_logger.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_logger.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_logger.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_logger.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_logger.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_misc.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_misc.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_misc.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_misc.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_misc.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_misc.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_misc.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_misc.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_operation.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_operation.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_operation.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_operation.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_operation.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_operation.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_operation.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_operation.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_script.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_script.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_script.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_script.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_script.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_script.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_script.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_script.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_services.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_services.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_services.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_services.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_services.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_services.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_services.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_services.mli diff --git a/test/proto_alpha_isolate_helpers/helpers_sodium.ml b/src/proto_alpha/lib_protocol/test/helpers/helpers_sodium.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_sodium.ml rename to src/proto_alpha/lib_protocol/test/helpers/helpers_sodium.ml diff --git a/test/proto_alpha_isolate_helpers/helpers_sodium.mli b/src/proto_alpha/lib_protocol/test/helpers/helpers_sodium.mli similarity index 100% rename from test/proto_alpha_isolate_helpers/helpers_sodium.mli rename to src/proto_alpha/lib_protocol/test/helpers/helpers_sodium.mli diff --git a/test/proto_alpha_isolate_helpers/isolate_helpers.ml b/src/proto_alpha/lib_protocol/test/helpers/isolate_helpers.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/isolate_helpers.ml rename to src/proto_alpha/lib_protocol/test/helpers/isolate_helpers.ml diff --git a/test/proto_alpha_isolate_helpers/jbuild b/src/proto_alpha/lib_protocol/test/helpers/jbuild similarity index 95% rename from test/proto_alpha_isolate_helpers/jbuild rename to src/proto_alpha/lib_protocol/test/helpers/jbuild index 46c8217a1..a4e0c16eb 100644 --- a/test/proto_alpha_isolate_helpers/jbuild +++ b/src/proto_alpha/lib_protocol/test/helpers/jbuild @@ -4,7 +4,6 @@ ((name tezos_proto_alpha_isolate_helpers) (libraries (tezos-test-helpers tezos-base - tezos-shell tezos-embedded-protocol-genesis tezos-embedded-protocol-alpha)) (wrapped false) diff --git a/test/proto_alpha_isolate_helpers/proto_alpha.ml b/src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml similarity index 100% rename from test/proto_alpha_isolate_helpers/proto_alpha.ml rename to src/proto_alpha/lib_protocol/test/helpers/proto_alpha.ml diff --git a/test/proto_alpha_isolate/jbuild b/src/proto_alpha/lib_protocol/test/jbuild similarity index 67% rename from test/proto_alpha_isolate/jbuild rename to src/proto_alpha/lib_protocol/test/jbuild index c21348010..07daf552d 100644 --- a/test/proto_alpha_isolate/jbuild +++ b/src/proto_alpha/lib_protocol/test/jbuild @@ -1,18 +1,9 @@ (jbuild_version 1) -(rule - ((targets (michelson_v1_parser.ml)) - (action (copy# ../../src/proto_alpha/lib_client/michelson_v1_parser.ml michelson_v1_parser.ml)))) - -(rule - ((targets (michelson_macros.ml)) - (action (copy# ../../src/proto_alpha/lib_client/michelson_macros.ml michelson_macros.ml)))) - (executables ((names (test_isolate_main)) (libraries (tezos-base tezos-rpc-http - tezos-shell tezos-test-helpers tezos_proto_alpha_isolate_helpers)) (flags (:standard -w -9-32 -safe-string @@ -22,15 +13,18 @@ (alias ((name buildtest) + (package tezos-embedded-protocol-alpha) (deps (test_isolate_main.exe)))) (alias ((name runtest_isolate_main) - (deps (../proto_alpha/sandbox.json (glob_files ../contracts/*.tz))) + (package tezos-embedded-protocol-alpha) + (deps (sandbox.json (glob_files contracts/*.tz))) (action (chdir ${ROOT} (run ${exe:test_isolate_main.exe}))))) (alias ((name runtest) + (package tezos-embedded-protocol-alpha) (deps ((alias runtest_isolate_main))))) (alias diff --git a/src/proto_alpha/lib_protocol/test/michelson_macros.ml b/src/proto_alpha/lib_protocol/test/michelson_macros.ml new file mode 120000 index 000000000..b34d8db4e --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/michelson_macros.ml @@ -0,0 +1 @@ +../../lib_client/michelson_macros.ml \ No newline at end of file diff --git a/src/proto_alpha/lib_protocol/test/michelson_v1_parser.ml b/src/proto_alpha/lib_protocol/test/michelson_v1_parser.ml new file mode 120000 index 000000000..c72317c98 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/michelson_v1_parser.ml @@ -0,0 +1 @@ +../../lib_client/michelson_v1_parser.ml \ No newline at end of file diff --git a/src/proto_alpha/lib_protocol/test/sandbox.json b/src/proto_alpha/lib_protocol/test/sandbox.json new file mode 100644 index 000000000..505882b40 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/sandbox.json @@ -0,0 +1,15 @@ +{ + "genesis_pubkey": + "edpkuSLWfVU1Vq7Jg9FucPyKmma6otcMHac9zG4oU1KMHSTBpJuGQ2", + "bootstrap_keys": [ + "edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav", + "edpktzNbDAUjUk697W7gYg2CRuBQjyPxbEg8dLccYYwKSKvkPvjtV9", + "edpkuTXkJDGcFd5nh6VvMz8phXxU3Bi7h6hqgywNFi1vZTfQNnS1RV", + "edpkuFrRoDSEbJYgxRtLx2ps82UdaYc1WwfS9sE11yhauZt5DgCHbU", + "edpkv8EUUH68jmo3f7Um5PezmfGrRF24gnfLpH3sVNwJnV5bVCxL2n" + ], + "slot_durations" : [ 1, 0 ], + "cycle_length" : 4, + "time_before_reward" : 1, + "first_free_baking_slot" : 4 +} diff --git a/test/proto_alpha_isolate/test_isolate_dsl.ml b/src/proto_alpha/lib_protocol/test/test_isolate_dsl.ml similarity index 100% rename from test/proto_alpha_isolate/test_isolate_dsl.ml rename to src/proto_alpha/lib_protocol/test/test_isolate_dsl.ml diff --git a/test/proto_alpha_isolate/test_isolate_endorsement.ml b/src/proto_alpha/lib_protocol/test/test_isolate_endorsement.ml similarity index 100% rename from test/proto_alpha_isolate/test_isolate_endorsement.ml rename to src/proto_alpha/lib_protocol/test/test_isolate_endorsement.ml diff --git a/test/proto_alpha_isolate/test_isolate_main.ml b/src/proto_alpha/lib_protocol/test/test_isolate_main.ml similarity index 100% rename from test/proto_alpha_isolate/test_isolate_main.ml rename to src/proto_alpha/lib_protocol/test/test_isolate_main.ml diff --git a/test/proto_alpha_isolate/test_isolate_michelson.ml b/src/proto_alpha/lib_protocol/test/test_isolate_michelson.ml similarity index 100% rename from test/proto_alpha_isolate/test_isolate_michelson.ml rename to src/proto_alpha/lib_protocol/test/test_isolate_michelson.ml diff --git a/test/proto_alpha_isolate/test_isolate_origination.ml b/src/proto_alpha/lib_protocol/test/test_isolate_origination.ml similarity index 100% rename from test/proto_alpha_isolate/test_isolate_origination.ml rename to src/proto_alpha/lib_protocol/test/test_isolate_origination.ml diff --git a/test/proto_alpha_isolate/test_isolate_transaction.ml b/src/proto_alpha/lib_protocol/test/test_isolate_transaction.ml similarity index 100% rename from test/proto_alpha_isolate/test_isolate_transaction.ml rename to src/proto_alpha/lib_protocol/test/test_isolate_transaction.ml diff --git a/src/proto_alpha/lib_protocol/tezos-embedded-protocol-alpha.opam b/src/proto_alpha/lib_protocol/tezos-embedded-protocol-alpha.opam index 586454b96..22f08d56d 100644 --- a/src/proto_alpha/lib_protocol/tezos-embedded-protocol-alpha.opam +++ b/src/proto_alpha/lib_protocol/tezos-embedded-protocol-alpha.opam @@ -12,6 +12,8 @@ depends: [ "tezos-protocol-compiler" "tezos-protocol-updater" "tezos-shell" + "tezos-test-helpers" { test } + "tezos-embedded-protocol-genesis" { test } ] build: [ [ "rm" "jbuild" "src/jbuild" ] diff --git a/test/LOG.1 b/test/LOG.1 new file mode 100644 index 000000000..a111e45b2 --- /dev/null +++ b/test/LOG.1 @@ -0,0 +1,56 @@ +Generating a new identity... (level: 0.00) |.....| +Stored the new identity (idtQz1SPen7S6kf6ycS3twScNWzmo4) into '/tmp/tezos-node.H8iQAOvn/identity.json'. +Jan 31 17:05:09 - node.main: Starting the Tezos node... +Jan 31 17:05:09 - node.main: Peer's global id: idtQz1SPen7S6kf6ycS3twScNWzmo4 +Jan 31 17:05:09 - node.worker: bootstraping network... +Jan 31 17:05:09 - node.validator: activate network NetXj4yEEKnjaK8 +Jan 31 17:05:09 - p2p.maintenance: Too few connections (0) +Jan 31 17:05:09 - node.main: Starting the RPC server listening on port 18731. +Jan 31 17:05:09 - node.main: The Tezos node is now running! +Jan 31 17:05:10 - validator.block: [] Block BMNffiC51dD5ywYcv9urMBGXTCQtfDDbUrbLyJzexD37m72v4Ts succesfully validated +Jan 31 17:05:10 - validator.block: Pushed: 2018-01-31T16:05:10Z, Treated: 2018-01-31T16:05:10Z, Completed: 2018-01-31T16:05:10Z +Jan 31 17:05:10 - prevalidator: [NetXj4yEEKnjaK8] switching to new head BMNffiC51dD5ywYcv9urMBGXTCQtfDDbUrbLyJzexD37m72v4Ts +Jan 31 17:05:10 - prevalidator: Pushed: 2018-01-31T16:05:10Z, Treated: 2018-01-31T16:05:10Z, Completed: 2018-01-31T16:05:10Z +Jan 31 17:05:10 - net_validator: [NetXj4yEEKnjaK8] Update current head to BMNffiC51dD5ywYcv9urMBGXTCQtfDDbUrbLyJzexD37m72v4Ts (fitness 00::0000000000000001), same branch +Jan 31 17:05:10 - net_validator: Pushed: 2018-01-31T16:05:10Z, Treated: 2018-01-31T16:05:10Z, Completed: 2018-01-31T16:05:10Z +Jan 31 17:05:13 - validator.block: [] Block BMQUPiYAEYQ9ciE7cEs3nX5jquMGTrE2jTTPtqbo3YZVB5DPygr succesfully validated +Jan 31 17:05:13 - validator.block: Pushed: 2018-01-31T16:05:13Z, Treated: 2018-01-31T16:05:13Z, Completed: 2018-01-31T16:05:13Z +Jan 31 17:05:13 - prevalidator: [NetXj4yEEKnjaK8] switching to new head BMQUPiYAEYQ9ciE7cEs3nX5jquMGTrE2jTTPtqbo3YZVB5DPygr +Jan 31 17:05:13 - prevalidator: Pushed: 2018-01-31T16:05:13Z, Treated: 2018-01-31T16:05:13Z, Completed: 2018-01-31T16:05:13Z +Jan 31 17:05:13 - net_validator: [NetXj4yEEKnjaK8] Update current head to BMQUPiYAEYQ9ciE7cEs3nX5jquMGTrE2jTTPtqbo3YZVB5DPygr (fitness 00::0000000000000002), same branch +Jan 31 17:05:13 - net_validator: Pushed: 2018-01-31T16:05:13Z, Treated: 2018-01-31T16:05:13Z, Completed: 2018-01-31T16:05:13Z +Jan 31 17:05:13 - prevalidator: [NetXj4yEEKnjaK8] injecting operation ooaNUJkDP9jLAPwoWnTATHH4pcCeH1Tv45bT8sJAKCzeh8bm8wE +Jan 31 17:05:13 - prevalidator: Pushed: 2018-01-31T16:05:13Z, Treated: 2018-01-31T16:05:13Z, Completed: 2018-01-31T16:05:13Z +Jan 31 17:05:13 - prevalidator: [NetXj4yEEKnjaK8] injecting operation onzZfuRw5wMwYME9ZjuTrfumDiay7uym2vUR9nctz6of3kVVhU9 +Jan 31 17:05:13 - prevalidator: Pushed: 2018-01-31T16:05:13Z, Treated: 2018-01-31T16:05:13Z, Completed: 2018-01-31T16:05:13Z +Jan 31 17:05:13 - prevalidator: [NetXj4yEEKnjaK8] injecting operation onmCT6EwLBt2s5DbCty56jkHeU6Sgf5KeSJxtRUNJk1ZHw5nuPa +Jan 31 17:05:13 - prevalidator: Pushed: 2018-01-31T16:05:13Z, Treated: 2018-01-31T16:05:13Z, Completed: 2018-01-31T16:05:13Z +Jan 31 17:05:14 - p2p.maintenance: Too few connections (0) +Jan 31 17:05:14 - validator.block: [] Block BMS7x6FxryR7UvzAp8iUYwbd94Eu3B8hWNRNfwtv3jPD3D6Zq1o succesfully validated +Jan 31 17:05:14 - validator.block: Pushed: 2018-01-31T16:05:14Z, Treated: 2018-01-31T16:05:14Z, Completed: 2018-01-31T16:05:14Z +Jan 31 17:05:14 - prevalidator: [NetXj4yEEKnjaK8] switching to new head BMS7x6FxryR7UvzAp8iUYwbd94Eu3B8hWNRNfwtv3jPD3D6Zq1o +Jan 31 17:05:14 - prevalidator: Pushed: 2018-01-31T16:05:14Z, Treated: 2018-01-31T16:05:14Z, Completed: 2018-01-31T16:05:14Z +Jan 31 17:05:14 - net_validator: [NetXj4yEEKnjaK8] Update current head to BMS7x6FxryR7UvzAp8iUYwbd94Eu3B8hWNRNfwtv3jPD3D6Zq1o (fitness 00::0000000000000003), same branch +Jan 31 17:05:14 - net_validator: Pushed: 2018-01-31T16:05:14Z, Treated: 2018-01-31T16:05:14Z, Completed: 2018-01-31T16:05:14Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation opa2yA6dgUqfM7FpqmdSVyDTG5nS8KWH2Q9yEeGY1kvfxjg8qeQ +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation ootmLu2syJ5HgP38j96nREAD7138uZ1wBpnD9oPPbeRLdx9ALf7 +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation oopVFXbYMRH2fG2CLwQTYFUbTYCQTcoGTevkeFAUJFcpbmCkWcX +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation opG7QbUQfdnMecC47ZZVrRZao8qFh2cs469zgpowLCUgeScWRNG +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation ooGr1XcFmxvPmt2y1DNsMgERdUABzZVyqZtz6DjNf9vBRzYsF2e +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation oo5y1mfyPBNx5ypFYvgmV6RZXBektmWhnAeLaqaEHExRxCZG9d1 +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation onmMVBau5ZpMMPX6EwiPzqPyfUy5RoyMQ4T5k4kFr5uRewqtPkV +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation ootJHUSYZi13APP8c6ty1kkVEGqotNULMV26hchXfuT1gFoZTLN +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - prevalidator: [NetXj4yEEKnjaK8] injecting operation op7SjzpmnvApUBSoPjQnAgXVueFPBNAPjz4ouCEmHJnGEBq5DZx +Jan 31 17:05:15 - prevalidator: Pushed: 2018-01-31T16:05:15Z, Treated: 2018-01-31T16:05:15Z, Completed: 2018-01-31T16:05:15Z +Jan 31 17:05:15 - node.main: Received the TERM signal, triggering shutdown. +Jan 31 17:05:15 - node.main: Shutting down the Tezos node... +Jan 31 17:05:15 - node.main: Shutting down the RPC server... +Jan 31 17:05:15 - node.main: BYE (-11)