From 42803b268d16bc9de5d6f1e6d358c83ebdc1c890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Mon, 23 Jun 2025 13:37:06 +0200 Subject: [PATCH 1/3] Tezt: drop "tez_" prefix in arguments of "register_tezlink_test" --- etherlink/tezt/tests/evm_sequencer.ml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index 7260f939cd1b..c23b04ab76f3 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -369,8 +369,8 @@ let register_upgrade_all ~title ~tags ~genesis_timestamp protocols) kernels -let register_tezlink_test ~title ~tags ?tez_bootstrap_accounts - ?tez_bootstrap_contracts scenario protocols = +let register_tezlink_test ~title ~tags ?bootstrap_accounts ?bootstrap_contracts + scenario protocols = register_all ~kernels:[Kernel.Latest] ~title @@ -380,8 +380,8 @@ let register_tezlink_test ~title ~tags ?tez_bootstrap_accounts { (Evm_node.default_l2_setup ~l2_chain_id:12) with l2_chain_family = "Michelson"; - tez_bootstrap_accounts; - tez_bootstrap_contracts; + tez_bootstrap_accounts = bootstrap_accounts; + tez_bootstrap_contracts = bootstrap_contracts; }; ] ~use_multichain:Register_with_feature @@ -562,7 +562,7 @@ let test_tezlink_balance = register_tezlink_test ~title:"Test of the balance rpc" ~tags:["rpc"; "balance"] - ~tez_bootstrap_accounts:[Constant.bootstrap1] + ~bootstrap_accounts:[Constant.bootstrap1] @@ fun {sequencer; client; _} _protocol -> (* call the balance rpc and parse the result *) let endpoint = @@ -591,7 +591,7 @@ let test_tezlink_storage = register_tezlink_test ~title:"Test of the storage rpc" ~tags:["rpc"; "storage"] - ~tez_bootstrap_contracts:[contract] + ~bootstrap_contracts:[contract] @@ fun {sequencer; client; _} _protocol -> let endpoint = Client.( @@ -623,7 +623,7 @@ let test_tezlink_contract_info = register_tezlink_test ~title:"Test of the contract info rpc" ~tags:["rpc"; "contract"; "info"] - ~tez_bootstrap_accounts:[Constant.bootstrap1] + ~bootstrap_accounts:[Constant.bootstrap1] @@ fun {sequencer; _} _protocol -> (* call the balance rpc and check the result *) let* valid_info = account_rpc sequencer Constant.bootstrap1 "" in @@ -638,7 +638,7 @@ let test_tezlink_manager_key = register_tezlink_test ~title:"Test of the manager_key rpc" ~tags:["rpc"; "manager_key"] - ~tez_bootstrap_accounts:[Constant.bootstrap1] + ~bootstrap_accounts:[Constant.bootstrap1] @@ fun {sequencer; _} _protocol -> let* valid_res = account_rpc sequencer Constant.bootstrap1 "manager_key" in Check.( @@ -656,7 +656,7 @@ let test_tezlink_counter = register_tezlink_test ~title:"Test of the counter rpc" ~tags:["evm"; "rpc"; "counter"] - ~tez_bootstrap_accounts:[Constant.bootstrap1] + ~bootstrap_accounts:[Constant.bootstrap1] @@ fun {sequencer; _} _protocol -> let* valid_res = account_rpc sequencer Constant.bootstrap1 "counter" in Check.(JSON.(valid_res |> as_int = 0) int ~error_msg:"Expected %R but got %L") ; -- GitLab From d841bd9c191379a3ea5dee2b1dfe744b6793be13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Wed, 7 May 2025 00:08:14 +0200 Subject: [PATCH 2/3] Tezlink/Tezt: integration test for transfer --- etherlink/tezt/tests/evm_sequencer.ml | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index c23b04ab76f3..e7db8428f010 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -1481,6 +1481,45 @@ let test_tezlink_raw_json_cycle = ~error_msg:"Unexpected random_seed field") ; unit +let test_tezlink_transfer = + let bootstrap_balance = Tez.of_mutez_int 3_800_000_000_000 in + register_tezlink_test + ~title:"Test Tezlink transfer" + ~tags:["kernel"; "transfer"] + ~bootstrap_accounts:[Constant.bootstrap1] + @@ fun {sequencer; client; _} _protocol -> + let endpoint = + Client.( + Foreign_endpoint + Endpoint. + {(Evm_node.rpc_endpoint_record sequencer) with path = "/tezlink"}) + in + let amount = Tez.one in + let* () = + Client.transfer + ~endpoint + ~amount + ~giver:Constant.bootstrap1.alias + ~receiver:Constant.bootstrap2.alias + ~burn_cap:Tez.one + client + in + let*@ _ = produce_block sequencer in + let* balance1 = + Client.get_balance_for ~endpoint ~account:Constant.bootstrap1.alias client + in + let* balance2 = + Client.get_balance_for ~endpoint ~account:Constant.bootstrap2.alias client + in + Check.( + (Tez.to_mutez balance1 + = Tez.to_mutez bootstrap_balance - Tez.to_mutez amount) + int) + ~error_msg:"Wrong balance for bootstrap1: exptected %R, actual %L" ; + Check.((Tez.to_mutez balance2 = Tez.to_mutez amount) int) + ~error_msg:"Wrong balance for bootstrap2: exptected %R, actual %L" ; + unit + module Protocol = struct include Protocol @@ -14108,6 +14147,7 @@ let () = test_tezlink_raw_json_cycle [Alpha] ; test_tezlink_chain_id [Alpha] ; test_tezlink_bootstrapped [Alpha] ; + test_tezlink_transfer [Alpha] ; test_fa_deposit_can_be_claimed [Alpha] ; test_tezlink_block_info [Alpha] ; test_tezlink_storage [Alpha] ; -- GitLab From 41917865e5576307baf452a11e0e9a9cb0699dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Thu, 22 May 2025 17:45:20 +0200 Subject: [PATCH 3/3] Tezlink/Tezt: integration test for reveal --- etherlink/tezt/tests/evm_sequencer.ml | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index e7db8428f010..8b3765be586d 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -1520,6 +1520,43 @@ let test_tezlink_transfer = ~error_msg:"Wrong balance for bootstrap2: exptected %R, actual %L" ; unit +let test_tezlink_reveal = + register_tezlink_test + ~title:"Test Tezlink reveal" + ~tags:["kernel"; "reveal"] + ~bootstrap_accounts:[Constant.bootstrap1] + @@ fun {sequencer; client; _} _protocol -> + let endpoint = + Client.( + Foreign_endpoint + Endpoint. + {(Evm_node.rpc_endpoint_record sequencer) with path = "/tezlink"}) + in + let amount = Tez.one in + let* () = + Client.transfer + ~endpoint + ~amount + ~giver:Constant.bootstrap1.alias + ~receiver:Constant.bootstrap2.alias + ~burn_cap:Tez.one + client + in + let*@ _ = produce_block sequencer in + let* manager_key = account_rpc sequencer Constant.bootstrap2 "manager_key" in + Check.( + JSON.(manager_key |> as_string_opt = None) + (option string) + ~error_msg:"Expected %R but got %L") ; + let*! () = Client.reveal ~endpoint ~src:Constant.bootstrap2.alias client in + let*@ _ = produce_block sequencer in + let* manager_key = account_rpc sequencer Constant.bootstrap2 "manager_key" in + Check.( + JSON.(manager_key |> as_string_opt = Some Constant.bootstrap2.public_key) + (option string) + ~error_msg:"Expected %R but got %L") ; + unit + module Protocol = struct include Protocol @@ -14148,6 +14185,7 @@ let () = test_tezlink_chain_id [Alpha] ; test_tezlink_bootstrapped [Alpha] ; test_tezlink_transfer [Alpha] ; + test_tezlink_reveal [Alpha] ; test_fa_deposit_can_be_claimed [Alpha] ; test_tezlink_block_info [Alpha] ; test_tezlink_storage [Alpha] ; -- GitLab