From eba97bbb6d0e36ec8d9c026ec21e611f1200d61a Mon Sep 17 00:00:00 2001 From: Luciano Freitas Date: Mon, 7 Jul 2025 13:43:43 +0200 Subject: [PATCH 1/3] Tezt/Tezlink: fix typos --- etherlink/tezt/tests/tezlink.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etherlink/tezt/tests/tezlink.ml b/etherlink/tezt/tests/tezlink.ml index 1be6dd1792ff..5eb28ccbd17d 100644 --- a/etherlink/tezt/tests/tezlink.ml +++ b/etherlink/tezt/tests/tezlink.ml @@ -818,9 +818,9 @@ let test_tezlink_transfer = (Tez.to_mutez balance1 = Tez.to_mutez bootstrap_balance - Tez.to_mutez amount) int) - ~error_msg:"Wrong balance for bootstrap1: exptected %R, actual %L" ; + ~error_msg:"Wrong balance for bootstrap1: expected %R, actual %L" ; Check.((Tez.to_mutez balance2 = Tez.to_mutez amount) int) - ~error_msg:"Wrong balance for bootstrap2: exptected %R, actual %L" ; + ~error_msg:"Wrong balance for bootstrap2: expected %R, actual %L" ; unit let test_tezlink_reveal = -- GitLab From aa6c9df91b73ccc34a814017356c846b7e7e0fbc Mon Sep 17 00:00:00 2001 From: Luciano Freitas Date: Mon, 7 Jul 2025 13:41:40 +0200 Subject: [PATCH 2/3] Tezt/Tezlink: contracts are literals not arrays --- etherlink/tezt/lib/michelson_contracts.ml | 20 +++++++++----------- etherlink/tezt/tests/tezlink.ml | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/etherlink/tezt/lib/michelson_contracts.ml b/etherlink/tezt/lib/michelson_contracts.ml index 267d29f191e9..1fd070b728fb 100644 --- a/etherlink/tezt/lib/michelson_contracts.ml +++ b/etherlink/tezt/lib/michelson_contracts.ml @@ -7,14 +7,12 @@ let tezlink_protocol = Protocol.R022 -let bootstraps () = - [| - Evm_node. - { - address = "KT1Q36KWPSba7dHsH5E4ZsQHehrChc51e19d"; - path = - Michelson_script.( - find ["opcodes"; "concat_hello"] tezlink_protocol |> path); - initial_storage = "{ \"initial\" }"; - }; - |] +let concat_hello () = + Evm_node. + { + address = "KT1Q36KWPSba7dHsH5E4ZsQHehrChc51e19d"; + path = + Michelson_script.( + find ["opcodes"; "concat_hello"] tezlink_protocol |> path); + initial_storage = "{ \"initial\" }"; + } diff --git a/etherlink/tezt/tests/tezlink.ml b/etherlink/tezt/tests/tezlink.ml index 5eb28ccbd17d..7c26500711b6 100644 --- a/etherlink/tezt/tests/tezlink.ml +++ b/etherlink/tezt/tests/tezlink.ml @@ -292,7 +292,7 @@ let test_tezlink_balance = unit let test_tezlink_storage = - let contract = (Michelson_contracts.bootstraps ()).(0) in + let contract = Michelson_contracts.concat_hello () in register_tezlink_test ~title:"Test of the storage rpc" ~tags:["rpc"; "storage"] -- GitLab From fe13ac0d30be612d59b2057033dbb1e121fbd1aa Mon Sep 17 00:00:00 2001 From: Luciano Freitas Date: Mon, 7 Jul 2025 13:42:14 +0200 Subject: [PATCH 3/3] Tezt/Tezlink: execution of smart contracts --- etherlink/tezt/tests/tezlink.ml | 37 ++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/etherlink/tezt/tests/tezlink.ml b/etherlink/tezt/tests/tezlink.ml index 7c26500711b6..762989d4d1ca 100644 --- a/etherlink/tezt/tests/tezlink.ml +++ b/etherlink/tezt/tests/tezlink.ml @@ -860,6 +860,40 @@ let test_tezlink_reveal = ~error_msg:"Expected %R but got %L") ; unit +let test_tezlink_execution = + let contract = Michelson_contracts.concat_hello () in + register_tezlink_test + ~title:"Test of tezlink execution" + ~tags:["execution"; "hello"] + ~bootstrap_contracts:[contract] + ~bootstrap_accounts:[Constant.bootstrap1] + @@ fun {sequencer; client; _} _protocol -> + let endpoint = + Client.( + Foreign_endpoint + {(Evm_node.rpc_endpoint_record sequencer) with path = "/tezlink"}) + in + let expected_result = "{ \"Hello world\" }" in + let* () = + Client.transfer + ~endpoint + ~amount:(Tez.of_int 10) + ~giver:Constant.bootstrap1.public_key_hash + ~receiver:contract.address + ~arg:"{\"world\"}" + ~burn_cap:Tez.one + client + in + let*@ _ = produce_block sequencer in + let* actual_result = + Client.contract_storage ~endpoint contract.address client + in + Check.( + (String.trim actual_result = String.trim expected_result) + string + ~error_msg:"Expected \"%R\" but got \"%L\"") ; + unit + let () = test_describe_endpoint [Alpha] ; test_tezlink_current_level [Alpha] ; @@ -883,4 +917,5 @@ let () = test_tezlink_transfer [Alpha] ; test_tezlink_reveal [Alpha] ; test_tezlink_block_info [Alpha] ; - test_tezlink_storage [Alpha] + test_tezlink_storage [Alpha] ; + test_tezlink_execution [Alpha] -- GitLab