From cd8ab9b333815047ece57da45c0d2d7c411961b0 Mon Sep 17 00:00:00 2001 From: lykimq Date: Tue, 27 Sep 2022 17:04:26 +0700 Subject: [PATCH 1/2] Tezt/Test: remove python self_address_transfer tests --- .../mini_scenarios/self_address_receiver.tz | 12 ------- .../mini_scenarios/self_address_sender.tz | 17 --------- .../mini_scenarios/self_address_receiver.tz | 12 ------- .../mini_scenarios/self_address_sender.tz | 17 --------- .../mini_scenarios/self_address_receiver.tz | 12 ------- .../mini_scenarios/self_address_sender.tz | 17 --------- ..._hash[client_regtest_custom_scrubber0].out | 2 -- ...i_scenarios--self_address_receiver.tz].out | 19 ---------- ...ini_scenarios--self_address_sender.tz].out | 23 ------------ tests_python/tests_013/test_contract.py | 35 ------------------- ..._hash[client_regtest_custom_scrubber0].out | 2 -- ...i_scenarios--self_address_receiver.tz].out | 19 ---------- ...ini_scenarios--self_address_sender.tz].out | 23 ------------ tests_python/tests_014/test_contract.py | 35 ------------------- ..._hash[client_regtest_custom_scrubber0].out | 2 -- ...i_scenarios--self_address_receiver.tz].out | 19 ---------- ...ini_scenarios--self_address_sender.tz].out | 23 ------------ tests_python/tests_alpha/test_contract.py | 35 ------------------- 18 files changed, 324 deletions(-) delete mode 100644 tests_python/contracts_013/mini_scenarios/self_address_receiver.tz delete mode 100644 tests_python/contracts_013/mini_scenarios/self_address_sender.tz delete mode 100644 tests_python/contracts_014/mini_scenarios/self_address_receiver.tz delete mode 100644 tests_python/contracts_014/mini_scenarios/self_address_sender.tz delete mode 100644 tests_python/contracts_alpha/mini_scenarios/self_address_receiver.tz delete mode 100644 tests_python/contracts_alpha/mini_scenarios/self_address_sender.tz delete mode 100644 tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out delete mode 100644 tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out delete mode 100644 tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out delete mode 100644 tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out delete mode 100644 tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out delete mode 100644 tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out diff --git a/tests_python/contracts_013/mini_scenarios/self_address_receiver.tz b/tests_python/contracts_013/mini_scenarios/self_address_receiver.tz deleted file mode 100644 index 6ebda8daad9e..000000000000 --- a/tests_python/contracts_013/mini_scenarios/self_address_receiver.tz +++ /dev/null @@ -1,12 +0,0 @@ -# See self_address_sender.tz -parameter (lambda unit address); -storage unit; -code { - UNPAIR; - UNIT; - EXEC; - SELF_ADDRESS; - ASSERT_CMPEQ; - NIL operation; - PAIR - } diff --git a/tests_python/contracts_013/mini_scenarios/self_address_sender.tz b/tests_python/contracts_013/mini_scenarios/self_address_sender.tz deleted file mode 100644 index b0f74073c2ff..000000000000 --- a/tests_python/contracts_013/mini_scenarios/self_address_sender.tz +++ /dev/null @@ -1,17 +0,0 @@ -# This tests that the SELF_ADDRESS inside a lambda returns the address -# of the contract executing the lambda (not the contract defining it). -# To do so, two contracts called the sender and the receiver are used. -# The sender (this contract) sends the lambda { DROP; SELF_ADDRESS } -# to the receiver (see self_address_receiver.tz) who checks that the -# returned value is the same as its SELF_ADDRESS. -parameter (contract (lambda unit address)); -storage unit; -code { - CAR; - BALANCE; - LAMBDA unit address { DROP; SELF_ADDRESS }; - TRANSFER_TOKENS; - DIP { UNIT; NIL operation }; - CONS; - PAIR - } diff --git a/tests_python/contracts_014/mini_scenarios/self_address_receiver.tz b/tests_python/contracts_014/mini_scenarios/self_address_receiver.tz deleted file mode 100644 index 6ebda8daad9e..000000000000 --- a/tests_python/contracts_014/mini_scenarios/self_address_receiver.tz +++ /dev/null @@ -1,12 +0,0 @@ -# See self_address_sender.tz -parameter (lambda unit address); -storage unit; -code { - UNPAIR; - UNIT; - EXEC; - SELF_ADDRESS; - ASSERT_CMPEQ; - NIL operation; - PAIR - } diff --git a/tests_python/contracts_014/mini_scenarios/self_address_sender.tz b/tests_python/contracts_014/mini_scenarios/self_address_sender.tz deleted file mode 100644 index b0f74073c2ff..000000000000 --- a/tests_python/contracts_014/mini_scenarios/self_address_sender.tz +++ /dev/null @@ -1,17 +0,0 @@ -# This tests that the SELF_ADDRESS inside a lambda returns the address -# of the contract executing the lambda (not the contract defining it). -# To do so, two contracts called the sender and the receiver are used. -# The sender (this contract) sends the lambda { DROP; SELF_ADDRESS } -# to the receiver (see self_address_receiver.tz) who checks that the -# returned value is the same as its SELF_ADDRESS. -parameter (contract (lambda unit address)); -storage unit; -code { - CAR; - BALANCE; - LAMBDA unit address { DROP; SELF_ADDRESS }; - TRANSFER_TOKENS; - DIP { UNIT; NIL operation }; - CONS; - PAIR - } diff --git a/tests_python/contracts_alpha/mini_scenarios/self_address_receiver.tz b/tests_python/contracts_alpha/mini_scenarios/self_address_receiver.tz deleted file mode 100644 index 6ebda8daad9e..000000000000 --- a/tests_python/contracts_alpha/mini_scenarios/self_address_receiver.tz +++ /dev/null @@ -1,12 +0,0 @@ -# See self_address_sender.tz -parameter (lambda unit address); -storage unit; -code { - UNPAIR; - UNIT; - EXEC; - SELF_ADDRESS; - ASSERT_CMPEQ; - NIL operation; - PAIR - } diff --git a/tests_python/contracts_alpha/mini_scenarios/self_address_sender.tz b/tests_python/contracts_alpha/mini_scenarios/self_address_sender.tz deleted file mode 100644 index b0f74073c2ff..000000000000 --- a/tests_python/contracts_alpha/mini_scenarios/self_address_sender.tz +++ /dev/null @@ -1,17 +0,0 @@ -# This tests that the SELF_ADDRESS inside a lambda returns the address -# of the contract executing the lambda (not the contract defining it). -# To do so, two contracts called the sender and the receiver are used. -# The sender (this contract) sends the lambda { DROP; SELF_ADDRESS } -# to the receiver (see self_address_receiver.tz) who checks that the -# returned value is the same as its SELF_ADDRESS. -parameter (contract (lambda unit address)); -storage unit; -code { - CAR; - BALANCE; - LAMBDA unit address { DROP; SELF_ADDRESS }; - TRANSFER_TOKENS; - DIP { UNIT; NIL operation }; - CONS; - PAIR - } diff --git a/tests_python/tests_013/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out b/tests_python/tests_013/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out index 63077194cdae..2b334167a0d3 100644 --- a/tests_python/tests_013/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out +++ b/tests_python/tests_013/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out @@ -88,8 +88,6 @@ exprtzYM9ERr612k6ZBwGFJYHYcFbrG44y3KsanKg6Rz5VtEV7vUZK [CONTRACT_PATH]/mini_scen exprucgYdABPRbbq2yy2rpyt4Z8fv7PN4yhkch3QYZ5QQ5ehbtNA4K [CONTRACT_PATH]/mini_scenarios/parameterized_multisig.tz exprvJ8zXaBkyXMhJ2eKtPwdwbg5NLrggvW8MEpVK3hk3nAe215PQ6 [CONTRACT_PATH]/mini_scenarios/replay.tz exprtuiYUMjM6d8XxPda1yfKeN61ko6riom35PzybC31NKXkVhgBQy [CONTRACT_PATH]/mini_scenarios/reveal_signed_preimage.tz -expruB4maBvk1y4JaeSLpDXWC3zKiXK5QFYv4B3R5KfdGEt4B5VvTT [CONTRACT_PATH]/mini_scenarios/self_address_receiver.tz -exprvTG7hjtWXeogStj3pzM1MCVcNg1q6KnivqNVzQjviUrJvsjfQn [CONTRACT_PATH]/mini_scenarios/self_address_sender.tz expru9ASRmfbXX8Ajf5uDeiZDbNwonrCiS1e6UaDXUstKU3yuwQwdZ [CONTRACT_PATH]/mini_scenarios/ticket_builder_fungible.tz exprtXrMgaXhLsw6ioNNPThqPF1yDyLjqGdJeB6yMRKLUQZfkTD6jy [CONTRACT_PATH]/mini_scenarios/ticket_builder_non_fungible.tz expruryVEK55xjeHpeGgHjuLr9jtRS2D1gzAgYXpzGfripoX8qFhNK [CONTRACT_PATH]/mini_scenarios/ticket_wallet_fungible.tz diff --git a/tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out b/tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out deleted file mode 100644 index 0ce4cb348524..000000000000 --- a/tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out +++ /dev/null @@ -1,19 +0,0 @@ -tests_013/test_contract.py::TestTypecheck::test_typecheck[mini_scenarios/self_address_receiver.tz] - -Well typed -Gas remaining: 1039992.679 units remaining -{ parameter (lambda unit address) ; - storage unit ; - code { UNPAIR - /* [ lambda unit address : unit ] */ ; - UNIT - /* [ unit : lambda unit address : unit ] */ ; - EXEC - /* [ address : unit ] */ ; - SELF_ADDRESS - /* [ address : address : unit ] */ ; - ASSERT_CMPEQ ; - NIL operation - /* [ list operation : unit ] */ ; - PAIR - /* [ pair (list operation) unit ] */ } } diff --git a/tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out b/tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out deleted file mode 100644 index c9b11850a797..000000000000 --- a/tests_python/tests_013/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out +++ /dev/null @@ -1,23 +0,0 @@ -tests_013/test_contract.py::TestTypecheck::test_typecheck[mini_scenarios/self_address_sender.tz] - -Well typed -Gas remaining: 1039993.319 units remaining -{ parameter (contract (lambda unit address)) ; - storage unit ; - code { CAR - /* [ contract (lambda unit address) ] */ ; - BALANCE - /* [ mutez : contract (lambda unit address) ] */ ; - LAMBDA - unit - address - { DROP /* [] */ ; SELF_ADDRESS /* [ address ] */ } - /* [ lambda unit address : mutez : contract (lambda unit address) ] */ ; - TRANSFER_TOKENS - /* [ operation ] */ ; - DIP { UNIT /* [ unit ] */ ; NIL operation /* [ list operation : unit ] */ } - /* [ operation : list operation : unit ] */ ; - CONS - /* [ list operation : unit ] */ ; - PAIR - /* [ pair (list operation) unit ] */ } } diff --git a/tests_python/tests_013/test_contract.py b/tests_python/tests_013/test_contract.py index e7f0d999cbf0..0ef0903196ff 100644 --- a/tests_python/tests_013/test_contract.py +++ b/tests_python/tests_013/test_contract.py @@ -1865,41 +1865,6 @@ class TestOrderInTopLevelDoesNotMatter: client.typecheck(contract, file=False) -@pytest.mark.incremental -@pytest.mark.contract -@pytest.mark.regression -class TestSelfAddressTransfer: - def test_self_address_originate_sender( - self, client_regtest_scrubbed, session - ): - client = client_regtest_scrubbed - path = os.path.join( - CONTRACT_PATH, 'mini_scenarios', 'self_address_sender.tz' - ) - originate(client, session, path, 'Unit', 0) - - def test_self_address_originate_receiver( - self, client_regtest_scrubbed, session - ): - client = client_regtest_scrubbed - path = os.path.join( - CONTRACT_PATH, 'mini_scenarios', 'self_address_receiver.tz' - ) - originate(client, session, path, 'Unit', 0) - session['receiver_address'] = session['contract'] - - def test_send_self_address(self, client_regtest_scrubbed, session): - client = client_regtest_scrubbed - receiver_address = session['receiver_address'] - client.transfer( - 0, - 'bootstrap2', - 'self_address_sender', - ['--arg', f'"{receiver_address}"', '--burn-cap', '2'], - ) - utils.bake(client, 'bootstrap5') - - @pytest.mark.slow @pytest.mark.contract @pytest.mark.regression diff --git a/tests_python/tests_014/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out b/tests_python/tests_014/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out index c31af02feb42..22118ff04728 100644 --- a/tests_python/tests_014/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out +++ b/tests_python/tests_014/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out @@ -89,8 +89,6 @@ exprtzYM9ERr612k6ZBwGFJYHYcFbrG44y3KsanKg6Rz5VtEV7vUZK [CONTRACT_PATH]/mini_scen exprucgYdABPRbbq2yy2rpyt4Z8fv7PN4yhkch3QYZ5QQ5ehbtNA4K [CONTRACT_PATH]/mini_scenarios/parameterized_multisig.tz exprvJ8zXaBkyXMhJ2eKtPwdwbg5NLrggvW8MEpVK3hk3nAe215PQ6 [CONTRACT_PATH]/mini_scenarios/replay.tz exprtuiYUMjM6d8XxPda1yfKeN61ko6riom35PzybC31NKXkVhgBQy [CONTRACT_PATH]/mini_scenarios/reveal_signed_preimage.tz -expruB4maBvk1y4JaeSLpDXWC3zKiXK5QFYv4B3R5KfdGEt4B5VvTT [CONTRACT_PATH]/mini_scenarios/self_address_receiver.tz -exprvTG7hjtWXeogStj3pzM1MCVcNg1q6KnivqNVzQjviUrJvsjfQn [CONTRACT_PATH]/mini_scenarios/self_address_sender.tz expru9ASRmfbXX8Ajf5uDeiZDbNwonrCiS1e6UaDXUstKU3yuwQwdZ [CONTRACT_PATH]/mini_scenarios/ticket_builder_fungible.tz exprtXrMgaXhLsw6ioNNPThqPF1yDyLjqGdJeB6yMRKLUQZfkTD6jy [CONTRACT_PATH]/mini_scenarios/ticket_builder_non_fungible.tz expruryVEK55xjeHpeGgHjuLr9jtRS2D1gzAgYXpzGfripoX8qFhNK [CONTRACT_PATH]/mini_scenarios/ticket_wallet_fungible.tz diff --git a/tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out b/tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out deleted file mode 100644 index 0b1a3a592450..000000000000 --- a/tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out +++ /dev/null @@ -1,19 +0,0 @@ -tests_014/test_contract.py::TestTypecheck::test_typecheck[mini_scenarios/self_address_receiver.tz] - -Well typed -Gas remaining: 1039992.799 units remaining -{ parameter (lambda unit address) ; - storage unit ; - code { UNPAIR - /* [ lambda unit address : unit ] */ ; - UNIT - /* [ unit : lambda unit address : unit ] */ ; - EXEC - /* [ address : unit ] */ ; - SELF_ADDRESS - /* [ address : address : unit ] */ ; - ASSERT_CMPEQ ; - NIL operation - /* [ list operation : unit ] */ ; - PAIR - /* [ pair (list operation) unit ] */ } } diff --git a/tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out b/tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out deleted file mode 100644 index 680ea98cd6ca..000000000000 --- a/tests_python/tests_014/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out +++ /dev/null @@ -1,23 +0,0 @@ -tests_014/test_contract.py::TestTypecheck::test_typecheck[mini_scenarios/self_address_sender.tz] - -Well typed -Gas remaining: 1039993.319 units remaining -{ parameter (contract (lambda unit address)) ; - storage unit ; - code { CAR - /* [ contract (lambda unit address) ] */ ; - BALANCE - /* [ mutez : contract (lambda unit address) ] */ ; - LAMBDA - unit - address - { DROP /* [] */ ; SELF_ADDRESS /* [ address ] */ } - /* [ lambda unit address : mutez : contract (lambda unit address) ] */ ; - TRANSFER_TOKENS - /* [ operation ] */ ; - DIP { UNIT /* [ unit ] */ ; NIL operation /* [ list operation : unit ] */ } - /* [ operation : list operation : unit ] */ ; - CONS - /* [ list operation : unit ] */ ; - PAIR - /* [ pair (list operation) unit ] */ } } diff --git a/tests_python/tests_014/test_contract.py b/tests_python/tests_014/test_contract.py index 773dfe9182df..ca5e7937a8a5 100644 --- a/tests_python/tests_014/test_contract.py +++ b/tests_python/tests_014/test_contract.py @@ -1860,41 +1860,6 @@ class TestOrderInTopLevelDoesNotMatter: client.typecheck(contract, file=False) -@pytest.mark.incremental -@pytest.mark.contract -@pytest.mark.regression -class TestSelfAddressTransfer: - def test_self_address_originate_sender( - self, client_regtest_scrubbed, session - ): - client = client_regtest_scrubbed - path = os.path.join( - CONTRACT_PATH, 'mini_scenarios', 'self_address_sender.tz' - ) - originate(client, session, path, 'Unit', 0) - - def test_self_address_originate_receiver( - self, client_regtest_scrubbed, session - ): - client = client_regtest_scrubbed - path = os.path.join( - CONTRACT_PATH, 'mini_scenarios', 'self_address_receiver.tz' - ) - originate(client, session, path, 'Unit', 0) - session['receiver_address'] = session['contract'] - - def test_send_self_address(self, client_regtest_scrubbed, session): - client = client_regtest_scrubbed - receiver_address = session['receiver_address'] - client.transfer( - 0, - 'bootstrap2', - 'self_address_sender', - ['--arg', f'"{receiver_address}"', '--burn-cap', '2'], - ) - utils.bake(client, 'bootstrap5') - - @pytest.mark.slow @pytest.mark.contract @pytest.mark.regression diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out b/tests_python/tests_alpha/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out index 2665db42079e..8bc7efa485ed 100644 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out +++ b/tests_python/tests_alpha/_regtest_outputs/test_contract.TestScriptHashRegression::test_contract_hash[client_regtest_custom_scrubber0].out @@ -90,8 +90,6 @@ exprucgYdABPRbbq2yy2rpyt4Z8fv7PN4yhkch3QYZ5QQ5ehbtNA4K [CONTRACT_PATH]/mini_scen expruyXnWo3aJfqo9Z6ycLDjyJygYCeH5JUrchAfFHZcvU1ebtDBXx [CONTRACT_PATH]/mini_scenarios/receive_tickets_in_big_map.tz exprvJ8zXaBkyXMhJ2eKtPwdwbg5NLrggvW8MEpVK3hk3nAe215PQ6 [CONTRACT_PATH]/mini_scenarios/replay.tz exprtuiYUMjM6d8XxPda1yfKeN61ko6riom35PzybC31NKXkVhgBQy [CONTRACT_PATH]/mini_scenarios/reveal_signed_preimage.tz -expruB4maBvk1y4JaeSLpDXWC3zKiXK5QFYv4B3R5KfdGEt4B5VvTT [CONTRACT_PATH]/mini_scenarios/self_address_receiver.tz -exprvTG7hjtWXeogStj3pzM1MCVcNg1q6KnivqNVzQjviUrJvsjfQn [CONTRACT_PATH]/mini_scenarios/self_address_sender.tz expru6tUaVWpaR7D5invwY7inJnPZGPXTcDqFvirrHPMRxSeHki5Fz [CONTRACT_PATH]/mini_scenarios/send_tickets_in_big_map.tz expruaFvFLsin2MWRuDkLRfe56pdPTUQ8RK9k1ks1rUTjBnwryPyPx [CONTRACT_PATH]/mini_scenarios/ticket_builder_fungible.tz expruMFhigCZpXrGaL5sMyjGw5k7CanAa7XRkHFemCoCwMfJFJjDuD [CONTRACT_PATH]/mini_scenarios/ticket_builder_non_fungible.tz diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out b/tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out deleted file mode 100644 index d8e557ae8e26..000000000000 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_receiver.tz].out +++ /dev/null @@ -1,19 +0,0 @@ -tests_alpha/test_contract.py::TestTypecheck::test_typecheck[mini_scenarios/self_address_receiver.tz] - -Well typed -Gas remaining: 1039992.799 units remaining -{ parameter (lambda unit address) ; - storage unit ; - code { UNPAIR - /* [ lambda unit address : unit ] */ ; - UNIT - /* [ unit : lambda unit address : unit ] */ ; - EXEC - /* [ address : unit ] */ ; - SELF_ADDRESS - /* [ address : address : unit ] */ ; - ASSERT_CMPEQ ; - NIL operation - /* [ list operation : unit ] */ ; - PAIR - /* [ pair (list operation) unit ] */ } } diff --git a/tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out b/tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out deleted file mode 100644 index ac66182f1794..000000000000 --- a/tests_python/tests_alpha/_regtest_outputs/test_contract.TestTypecheck::test_typecheck[mini_scenarios--self_address_sender.tz].out +++ /dev/null @@ -1,23 +0,0 @@ -tests_alpha/test_contract.py::TestTypecheck::test_typecheck[mini_scenarios/self_address_sender.tz] - -Well typed -Gas remaining: 1039993.319 units remaining -{ parameter (contract (lambda unit address)) ; - storage unit ; - code { CAR - /* [ contract (lambda unit address) ] */ ; - BALANCE - /* [ mutez : contract (lambda unit address) ] */ ; - LAMBDA - unit - address - { DROP /* [] */ ; SELF_ADDRESS /* [ address ] */ } - /* [ lambda unit address : mutez : contract (lambda unit address) ] */ ; - TRANSFER_TOKENS - /* [ operation ] */ ; - DIP { UNIT /* [ unit ] */ ; NIL operation /* [ list operation : unit ] */ } - /* [ operation : list operation : unit ] */ ; - CONS - /* [ list operation : unit ] */ ; - PAIR - /* [ pair (list operation) unit ] */ } } diff --git a/tests_python/tests_alpha/test_contract.py b/tests_python/tests_alpha/test_contract.py index 773dfe9182df..ca5e7937a8a5 100644 --- a/tests_python/tests_alpha/test_contract.py +++ b/tests_python/tests_alpha/test_contract.py @@ -1860,41 +1860,6 @@ class TestOrderInTopLevelDoesNotMatter: client.typecheck(contract, file=False) -@pytest.mark.incremental -@pytest.mark.contract -@pytest.mark.regression -class TestSelfAddressTransfer: - def test_self_address_originate_sender( - self, client_regtest_scrubbed, session - ): - client = client_regtest_scrubbed - path = os.path.join( - CONTRACT_PATH, 'mini_scenarios', 'self_address_sender.tz' - ) - originate(client, session, path, 'Unit', 0) - - def test_self_address_originate_receiver( - self, client_regtest_scrubbed, session - ): - client = client_regtest_scrubbed - path = os.path.join( - CONTRACT_PATH, 'mini_scenarios', 'self_address_receiver.tz' - ) - originate(client, session, path, 'Unit', 0) - session['receiver_address'] = session['contract'] - - def test_send_self_address(self, client_regtest_scrubbed, session): - client = client_regtest_scrubbed - receiver_address = session['receiver_address'] - client.transfer( - 0, - 'bootstrap2', - 'self_address_sender', - ['--arg', f'"{receiver_address}"', '--burn-cap', '2'], - ) - utils.bake(client, 'bootstrap5') - - @pytest.mark.slow @pytest.mark.contract @pytest.mark.regression -- GitLab From bfce17b7ddb4776b9d58bf21e7b1566759ff2edd Mon Sep 17 00:00:00 2001 From: lykimq Date: Tue, 27 Sep 2022 17:05:19 +0700 Subject: [PATCH 2/2] Tezt/Test: add tezt tests for self address transfer Tezt/Test: rerun regressions test Tezt/Test: remove protocol_dependent path --- .../proto_alpha/self_address_receiver.tz | 12 ++ .../proto_alpha/self_address_sender.tz | 17 +++ .../Alpha- Self address transfer.out | 141 ++++++++++++++++++ .../Jakarta- Self address transfer.out | 141 ++++++++++++++++++ .../Kathmandu- Self address transfer.out | 141 ++++++++++++++++++ .../Lima- Self address transfer.out | 141 ++++++++++++++++++ tezt/tests/main.ml | 1 + tezt/tests/self_address_transfer.ml | 76 ++++++++++ 8 files changed, 670 insertions(+) create mode 100644 tezt/tests/contracts/proto_alpha/self_address_receiver.tz create mode 100644 tezt/tests/contracts/proto_alpha/self_address_sender.tz create mode 100644 tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out create mode 100644 tezt/tests/expected/self_address_transfer.ml/Jakarta- Self address transfer.out create mode 100644 tezt/tests/expected/self_address_transfer.ml/Kathmandu- Self address transfer.out create mode 100644 tezt/tests/expected/self_address_transfer.ml/Lima- Self address transfer.out create mode 100644 tezt/tests/self_address_transfer.ml diff --git a/tezt/tests/contracts/proto_alpha/self_address_receiver.tz b/tezt/tests/contracts/proto_alpha/self_address_receiver.tz new file mode 100644 index 000000000000..6ebda8daad9e --- /dev/null +++ b/tezt/tests/contracts/proto_alpha/self_address_receiver.tz @@ -0,0 +1,12 @@ +# See self_address_sender.tz +parameter (lambda unit address); +storage unit; +code { + UNPAIR; + UNIT; + EXEC; + SELF_ADDRESS; + ASSERT_CMPEQ; + NIL operation; + PAIR + } diff --git a/tezt/tests/contracts/proto_alpha/self_address_sender.tz b/tezt/tests/contracts/proto_alpha/self_address_sender.tz new file mode 100644 index 000000000000..b0f74073c2ff --- /dev/null +++ b/tezt/tests/contracts/proto_alpha/self_address_sender.tz @@ -0,0 +1,17 @@ +# This tests that the SELF_ADDRESS inside a lambda returns the address +# of the contract executing the lambda (not the contract defining it). +# To do so, two contracts called the sender and the receiver are used. +# The sender (this contract) sends the lambda { DROP; SELF_ADDRESS } +# to the receiver (see self_address_receiver.tz) who checks that the +# returned value is the same as its SELF_ADDRESS. +parameter (contract (lambda unit address)); +storage unit; +code { + CAR; + BALANCE; + LAMBDA unit address { DROP; SELF_ADDRESS }; + TRANSFER_TOKENS; + DIP { UNIT; NIL operation }; + CONS; + PAIR + } diff --git a/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out b/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out new file mode 100644 index 000000000000..06d6d81ce6d2 --- /dev/null +++ b/tezt/tests/expected/self_address_transfer.ml/Alpha- Self address transfer.out @@ -0,0 +1,141 @@ + +./tezos-client --mode mockup --wait none originate contract self_address_sender.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_sender.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1422.092 units (will add 100 for safety) +Estimated storage: 339 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000462 + Expected counter: 1 + Gas limit: 1523 + Storage limit: 359 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000462 + payload fees(the block proposer) ....... +ꜩ0.000462 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (contract (lambda unit address)) ; + storage unit ; + code { CAR ; + BALANCE ; + LAMBDA unit address { DROP ; SELF_ADDRESS } ; + TRANSFER_TOKENS ; + DIP { UNIT ; NIL operation } ; + CONS ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 82 bytes + Paid storage size diff: 82 bytes + Consumed gas: 1422.092 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.0205 + storage fees ........................... +ꜩ0.0205 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_sender.tz. + +./tezos-client --mode mockup --wait none originate contract self_address_receiver.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_receiver.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1422.501 units (will add 100 for safety) +Estimated storage: 340 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000463 + Expected counter: 2 + Gas limit: 1523 + Storage limit: 360 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000463 + payload fees(the block proposer) ....... +ꜩ0.000463 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (lambda unit address) ; + storage unit ; + code { UNPAIR ; + UNIT ; + EXEC ; + SELF_ADDRESS ; + ASSERT_CMPEQ ; + NIL operation ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 83 bytes + Paid storage size diff: 83 bytes + Consumed gas: 1422.501 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.02075 + storage fees ........................... +ꜩ0.02075 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_receiver.tz. + +./tezos-client --mode mockup --wait none transfer 0 from bootstrap2 to '[CONTRACT_HASH]' --burn-cap 2 --arg '"[CONTRACT_HASH]"' +Node is bootstrapped. +Estimated gas: 4691.490 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000774 + Expected counter: 1 + Gas limit: 4792 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000774 + payload fees(the block proposer) ....... +ꜩ0.000774 + Transaction: + Amount: ꜩ0 + From: [PUBLIC_KEY_HASH] + To: [CONTRACT_HASH] + Parameter: "[CONTRACT_HASH]" + This transaction was successfully applied + Updated storage: Unit + Storage size: 82 bytes + Consumed gas: 2575.690 + Internal operations: + Internal Transaction: + Amount: ꜩ0 + From: [CONTRACT_HASH] + To: [CONTRACT_HASH] + Parameter: { DROP ; SELF_ADDRESS } + This transaction was successfully applied + Updated storage: Unit + Storage size: 83 bytes + Consumed gas: 2117.047 + diff --git a/tezt/tests/expected/self_address_transfer.ml/Jakarta- Self address transfer.out b/tezt/tests/expected/self_address_transfer.ml/Jakarta- Self address transfer.out new file mode 100644 index 000000000000..537466f2ed00 --- /dev/null +++ b/tezt/tests/expected/self_address_transfer.ml/Jakarta- Self address transfer.out @@ -0,0 +1,141 @@ + +./tezos-client --mode mockup --wait none originate contract self_address_sender.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_sender.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1419.932 units (will add 100 for safety) +Estimated storage: 339 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000461 + Expected counter: 1 + Gas limit: 1520 + Storage limit: 359 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000461 + payload fees(the block proposer) ....... +ꜩ0.000461 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (contract (lambda unit address)) ; + storage unit ; + code { CAR ; + BALANCE ; + LAMBDA unit address { DROP ; SELF_ADDRESS } ; + TRANSFER_TOKENS ; + DIP { UNIT ; NIL operation } ; + CONS ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 82 bytes + Paid storage size diff: 82 bytes + Consumed gas: 1419.932 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.0205 + storage fees ........................... +ꜩ0.0205 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_sender.tz. + +./tezos-client --mode mockup --wait none originate contract self_address_receiver.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_receiver.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1420.416 units (will add 100 for safety) +Estimated storage: 340 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000463 + Expected counter: 2 + Gas limit: 1521 + Storage limit: 360 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000463 + payload fees(the block proposer) ....... +ꜩ0.000463 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (lambda unit address) ; + storage unit ; + code { UNPAIR ; + UNIT ; + EXEC ; + SELF_ADDRESS ; + ASSERT_CMPEQ ; + NIL operation ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 83 bytes + Paid storage size diff: 83 bytes + Consumed gas: 1420.416 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.02075 + storage fees ........................... +ꜩ0.02075 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_receiver.tz. + +./tezos-client --mode mockup --wait none transfer 0 from bootstrap2 to '[CONTRACT_HASH]' --burn-cap 2 --arg '"[CONTRACT_HASH]"' +Node is bootstrapped. +Estimated gas: 4695.311 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000774 + Expected counter: 1 + Gas limit: 4796 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000774 + payload fees(the block proposer) ....... +ꜩ0.000774 + Transaction: + Amount: ꜩ0 + From: [PUBLIC_KEY_HASH] + To: [CONTRACT_HASH] + Parameter: "[CONTRACT_HASH]" + This transaction was successfully applied + Updated storage: Unit + Storage size: 82 bytes + Consumed gas: 3493.817 + Internal operations: + Transaction: + Amount: ꜩ0 + From: [CONTRACT_HASH] + To: [CONTRACT_HASH] + Parameter: { DROP ; SELF_ADDRESS } + This transaction was successfully applied + Updated storage: Unit + Storage size: 83 bytes + Consumed gas: 1203.090 + diff --git a/tezt/tests/expected/self_address_transfer.ml/Kathmandu- Self address transfer.out b/tezt/tests/expected/self_address_transfer.ml/Kathmandu- Self address transfer.out new file mode 100644 index 000000000000..1ee23e5a268b --- /dev/null +++ b/tezt/tests/expected/self_address_transfer.ml/Kathmandu- Self address transfer.out @@ -0,0 +1,141 @@ + +./tezos-client --mode mockup --wait none originate contract self_address_sender.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_sender.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1419.437 units (will add 100 for safety) +Estimated storage: 339 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000461 + Expected counter: 1 + Gas limit: 1520 + Storage limit: 359 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000461 + payload fees(the block proposer) ....... +ꜩ0.000461 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (contract (lambda unit address)) ; + storage unit ; + code { CAR ; + BALANCE ; + LAMBDA unit address { DROP ; SELF_ADDRESS } ; + TRANSFER_TOKENS ; + DIP { UNIT ; NIL operation } ; + CONS ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 82 bytes + Paid storage size diff: 82 bytes + Consumed gas: 1419.437 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.0205 + storage fees ........................... +ꜩ0.0205 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_sender.tz. + +./tezos-client --mode mockup --wait none originate contract self_address_receiver.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_receiver.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1420.026 units (will add 100 for safety) +Estimated storage: 340 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000463 + Expected counter: 2 + Gas limit: 1521 + Storage limit: 360 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000463 + payload fees(the block proposer) ....... +ꜩ0.000463 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (lambda unit address) ; + storage unit ; + code { UNPAIR ; + UNIT ; + EXEC ; + SELF_ADDRESS ; + ASSERT_CMPEQ ; + NIL operation ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 83 bytes + Paid storage size diff: 83 bytes + Consumed gas: 1420.026 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.02075 + storage fees ........................... +ꜩ0.02075 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_receiver.tz. + +./tezos-client --mode mockup --wait none transfer 0 from bootstrap2 to '[CONTRACT_HASH]' --burn-cap 2 --arg '"[CONTRACT_HASH]"' +Node is bootstrapped. +Estimated gas: 4691.060 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000774 + Expected counter: 1 + Gas limit: 4792 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000774 + payload fees(the block proposer) ....... +ꜩ0.000774 + Transaction: + Amount: ꜩ0 + From: [PUBLIC_KEY_HASH] + To: [CONTRACT_HASH] + Parameter: "[CONTRACT_HASH]" + This transaction was successfully applied + Updated storage: Unit + Storage size: 82 bytes + Consumed gas: 2575.235 + Internal operations: + Internal Transaction: + Amount: ꜩ0 + From: [CONTRACT_HASH] + To: [CONTRACT_HASH] + Parameter: { DROP ; SELF_ADDRESS } + This transaction was successfully applied + Updated storage: Unit + Storage size: 83 bytes + Consumed gas: 2117.072 + diff --git a/tezt/tests/expected/self_address_transfer.ml/Lima- Self address transfer.out b/tezt/tests/expected/self_address_transfer.ml/Lima- Self address transfer.out new file mode 100644 index 000000000000..06d6d81ce6d2 --- /dev/null +++ b/tezt/tests/expected/self_address_transfer.ml/Lima- Self address transfer.out @@ -0,0 +1,141 @@ + +./tezos-client --mode mockup --wait none originate contract self_address_sender.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_sender.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1422.092 units (will add 100 for safety) +Estimated storage: 339 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000462 + Expected counter: 1 + Gas limit: 1523 + Storage limit: 359 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000462 + payload fees(the block proposer) ....... +ꜩ0.000462 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (contract (lambda unit address)) ; + storage unit ; + code { CAR ; + BALANCE ; + LAMBDA unit address { DROP ; SELF_ADDRESS } ; + TRANSFER_TOKENS ; + DIP { UNIT ; NIL operation } ; + CONS ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 82 bytes + Paid storage size diff: 82 bytes + Consumed gas: 1422.092 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.0205 + storage fees ........................... +ꜩ0.0205 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_sender.tz. + +./tezos-client --mode mockup --wait none originate contract self_address_receiver.tz transferring 0 from bootstrap1 running file:./tezt/tests/contracts/proto_alpha/self_address_receiver.tz --init Unit --burn-cap 1 +Node is bootstrapped. +Estimated gas: 1422.501 units (will add 100 for safety) +Estimated storage: 340 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000463 + Expected counter: 2 + Gas limit: 1523 + Storage limit: 360 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000463 + payload fees(the block proposer) ....... +ꜩ0.000463 + Origination: + From: [PUBLIC_KEY_HASH] + Credit: ꜩ0 + Script: + { parameter (lambda unit address) ; + storage unit ; + code { UNPAIR ; + UNIT ; + EXEC ; + SELF_ADDRESS ; + ASSERT_CMPEQ ; + NIL operation ; + PAIR } } + Initial storage: Unit + No delegate for this contract + This origination was successfully applied + Originated contracts: + [CONTRACT_HASH] + Storage size: 83 bytes + Paid storage size diff: 83 bytes + Consumed gas: 1422.501 + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.02075 + storage fees ........................... +ꜩ0.02075 + [PUBLIC_KEY_HASH] ... -ꜩ0.06425 + storage fees ........................... +ꜩ0.06425 + +New contract [CONTRACT_HASH] originated. +Contract memorized as self_address_receiver.tz. + +./tezos-client --mode mockup --wait none transfer 0 from bootstrap2 to '[CONTRACT_HASH]' --burn-cap 2 --arg '"[CONTRACT_HASH]"' +Node is bootstrapped. +Estimated gas: 4691.490 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + tezos-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000774 + Expected counter: 1 + Gas limit: 4792 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000774 + payload fees(the block proposer) ....... +ꜩ0.000774 + Transaction: + Amount: ꜩ0 + From: [PUBLIC_KEY_HASH] + To: [CONTRACT_HASH] + Parameter: "[CONTRACT_HASH]" + This transaction was successfully applied + Updated storage: Unit + Storage size: 82 bytes + Consumed gas: 2575.690 + Internal operations: + Internal Transaction: + Amount: ꜩ0 + From: [CONTRACT_HASH] + To: [CONTRACT_HASH] + Parameter: { DROP ; SELF_ADDRESS } + This transaction was successfully applied + Updated storage: Unit + Storage size: 83 bytes + Consumed gas: 2117.047 + diff --git a/tezt/tests/main.ml b/tezt/tests/main.ml index c7d55f41af97..f40e0262b376 100644 --- a/tezt/tests/main.ml +++ b/tezt/tests/main.ml @@ -130,6 +130,7 @@ let register_protocol_agnostic_tests () = Run_script.register ~protocols:[Alpha] ; Runtime_script_failure.register ~protocols ; Sapling.register ~protocols:[Alpha] ; + Self_address_transfer.register ~protocols ; Signer_test.register ~protocols:[Alpha] ; Stresstest_command.register ~protocols:[Alpha] ; Synchronisation_heuristic.register ~protocols:[Alpha] ; diff --git a/tezt/tests/self_address_transfer.ml b/tezt/tests/self_address_transfer.ml new file mode 100644 index 000000000000..fa67da91e48a --- /dev/null +++ b/tezt/tests/self_address_transfer.ml @@ -0,0 +1,76 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 Marigold *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +(* Testing + ------- + Components: Michelson + Invocation: dune exec tezt/tests/main.exe -- --file self_address_transfer.ml + Subject: Regression tests for the Michelson [SELF_ADDRESS] instruction +*) + +let hooks = Tezos_regression.hooks + +let test_self_address_transfer = + Protocol.register_regression_test + ~__FILE__ + ~title:"Self address transfer" + ~tags:["client"; "michelson"] + @@ fun protocol -> + let* client = Client.init_mockup ~protocol () in + let* send_contract_hash = + Client.originate_contract + ~alias:"self_address_sender.tz" + ~amount:Tez.zero + ~src:"bootstrap1" + ~prg:"file:./tezt/tests/contracts/proto_alpha/self_address_sender.tz" + ~init:"Unit" + ~burn_cap:Tez.one + ~hooks + client + in + let* receive_contract_hash = + Client.originate_contract + ~alias:"self_address_receiver.tz" + ~amount:Tez.zero + ~src:"bootstrap1" + ~prg:"file:./tezt/tests/contracts/proto_alpha/self_address_receiver.tz" + ~init:"Unit" + ~burn_cap:Tez.one + ~hooks + client + in + let* () = + Client.transfer + ~burn_cap:(Tez.of_int 2) + ~amount:Tez.zero + ~giver:"bootstrap2" + ~receiver:send_contract_hash + ~arg:(sf {|"%s"|} receive_contract_hash) + ~hooks + client + in + unit + +let register ~protocols = test_self_address_transfer protocols -- GitLab