From 6d5d342406c375bf4ec909aef8910c3e616ed471 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Cornilleau Date: Wed, 2 Apr 2025 12:40:41 +0200 Subject: [PATCH 1/3] Tezlink: add describe endpoint to tezlink directory --- etherlink/bin_node/lib_dev/tezos_services.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etherlink/bin_node/lib_dev/tezos_services.ml b/etherlink/bin_node/lib_dev/tezos_services.ml index 680f66c93a45..0338097f3e91 100644 --- a/etherlink/bin_node/lib_dev/tezos_services.ml +++ b/etherlink/bin_node/lib_dev/tezos_services.ml @@ -264,5 +264,10 @@ let tezlink_root = Tezos_rpc.Path.(open_root / "tezlink") (* module entrypoint *) let register_tezlink_services impl = let directory = build_dir impl in + let directory = + Tezos_rpc.Directory.register_describe_directory_service + directory + Tezos_rpc.Service.description_service + in let tezlink_directory = Tezos_rpc.Directory.prefix tezlink_root directory in Evm_directory.init_from_resto_directory tezlink_directory -- GitLab From eea9b29eb8264e1a81eb8e38c91324f73bf67d16 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Cornilleau Date: Wed, 2 Apr 2025 16:03:47 +0200 Subject: [PATCH 2/3] tezlink/tezt: expose l2_chains arg in setup util --- etherlink/tezt/lib/setup.ml | 25 ++++++++++++++----------- etherlink/tezt/lib/setup.mli | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/etherlink/tezt/lib/setup.ml b/etherlink/tezt/lib/setup.ml index 45cbeb5867b7..1d90ab2de29c 100644 --- a/etherlink/tezt/lib/setup.ml +++ b/etherlink/tezt/lib/setup.ml @@ -666,19 +666,22 @@ let setup_sequencer ?max_delayed_inbox_blueprint_length ?next_wasm_runtime ?drop_duplicate_when_injection ?blueprints_publisher_order_enabled ?rollup_history_mode ~enable_dal ?dal_slots ~enable_multichain ?rpc_server ?websockets ?history_mode ?enable_tx_queue ?spawn_rpc - ?periodic_snapshot_path protocol = + ?periodic_snapshot_path ?l2_chains protocol = (* Note that the chain_id is not important (it will become important later) *) let l2_chains = - [ - { - (Evm_node.default_l2_setup ~l2_chain_id:1) with - sequencer_pool_address; - bootstrap_accounts = Some bootstrap_accounts; - da_fee_per_byte = da_fee; - minimum_base_fee_per_gas; - maximum_gas_per_transaction; - }; - ] + Option.value + ~default: + [ + { + (Evm_node.default_l2_setup ~l2_chain_id:1) with + sequencer_pool_address; + bootstrap_accounts = Some bootstrap_accounts; + da_fee_per_byte = da_fee; + minimum_base_fee_per_gas; + maximum_gas_per_transaction; + }; + ] + l2_chains in let* sequencer_setup = setup_sequencer_internal diff --git a/etherlink/tezt/lib/setup.mli b/etherlink/tezt/lib/setup.mli index 62ec486d4176..60c6073ab54d 100644 --- a/etherlink/tezt/lib/setup.mli +++ b/etherlink/tezt/lib/setup.mli @@ -269,5 +269,6 @@ val setup_sequencer : ?enable_tx_queue:Evm_node.tx_queue_config -> ?spawn_rpc:int -> ?periodic_snapshot_path:string -> + ?l2_chains:Evm_node.l2_setup list -> Protocol.t -> sequencer_setup Lwt.t -- GitLab From 1bf639a9e62215a240a6966bec21f82b8b80fabe Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Cornilleau Date: Wed, 2 Apr 2025 16:04:33 +0200 Subject: [PATCH 3/3] Tezlink/tezt: test /tezlink/describe --- etherlink/tezt/tests/evm_sequencer.ml | 24 ++++++++++++++++- .../Alpha- Test the -describe endpoint.out | 27 +++++++++++++++++++ .../Quebec- Test the -describe endpoint.out | 27 +++++++++++++++++++ .../R022-- Test the -describe endpoint.out | 27 +++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index 559f8d9e3ad1..aab8d30e154a 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -9921,11 +9921,22 @@ let test_describe_endpoint = Constant.smart_rollup_installer; ]) @@ fun protocol -> + let l2_chains = + [ + { + (Evm_node.default_l2_setup ~l2_chain_id:12) with + l2_chain_family = "Michelson"; + }; + ] + in let* {sequencer; client; _} = Setup.setup_sequencer ~mainnet_compat:false ~enable_dal:false - ~enable_multichain:false + ~enable_multichain:true + ~l2_chains + ~rpc_server:Evm_node.Resto + ~spawn_rpc:(Port.fresh ()) protocol in let hooks = Tezos_regression.hooks in @@ -9933,6 +9944,17 @@ let test_describe_endpoint = Client.(Foreign_endpoint (Evm_node.rpc_endpoint_record sequencer)) in let* (_ : string) = Client.rpc_list ~hooks ~endpoint client in + let path = "/tezlink/describe?recurse=yes" in + (* TODO replace with a call of octez-client when it supports a non empty + root see !17532 *) + let* res = + (* We check that the "/tezlink/describe" RPC is available. We don't record + the result in the regression trace because it is already contained in + the call to "/describe" above. *) + Curl.get_raw ~args:["-v"] (Evm_node.endpoint sequencer ^ path) + |> Runnable.run + in + let _ = JSON.parse ~origin:"curl_tezlink_describe" res in unit let test_relay_restricted_rpcs = diff --git a/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Test the -describe endpoint.out b/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Test the -describe endpoint.out index b3628e76970f..883bf7def0ce 100644 --- a/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Test the -describe endpoint.out +++ b/etherlink/tezt/tests/expected/evm_sequencer.ml/Alpha- Test the -describe endpoint.out @@ -20,12 +20,39 @@ Available services: Get the maximum time between two blocks - GET /health_check Assess the health of the RPC server + + tezlink/ + - GET /tezlink/chains//blocks//helpers/current_level + Returns the level of the interrogated block, or the one of a block + located `offset` blocks after it in the chain. For instance, the next + block if `offset` is 1. The offset cannot be negative. + - GET /tezlink/chains//blocks//protocols + Current and next protocol. + - GET /tezlink/describe + RPCs documentation and input/output schema + - GET /tezlink/version + Get information on the node version - GET /version version Dynamic parameter description: + + A block identifier. This can take one of the following + values: + 1.Block-hash - Hash in Base58Check notation. + 2.Alias - One of + the following:'genesis/ head/ caboose/ savepoint/ + checkpoint'. + 3.Block-level - index(integer) in the chain. + One can + also specify the relative positions of block with respect to above + three block identifiers. For ex. 'checkpoint~N' or checkpoint+N, where + N is an integer, denotes the Nth block before(~) or after (+) the + checkpoint. + + A chain identifier. This is either a chain hash in Base58Check notation + or a one the predefined aliases: 'main', 'test'. uint63 Warning: diff --git a/etherlink/tezt/tests/expected/evm_sequencer.ml/Quebec- Test the -describe endpoint.out b/etherlink/tezt/tests/expected/evm_sequencer.ml/Quebec- Test the -describe endpoint.out index b3628e76970f..883bf7def0ce 100644 --- a/etherlink/tezt/tests/expected/evm_sequencer.ml/Quebec- Test the -describe endpoint.out +++ b/etherlink/tezt/tests/expected/evm_sequencer.ml/Quebec- Test the -describe endpoint.out @@ -20,12 +20,39 @@ Available services: Get the maximum time between two blocks - GET /health_check Assess the health of the RPC server + + tezlink/ + - GET /tezlink/chains//blocks//helpers/current_level + Returns the level of the interrogated block, or the one of a block + located `offset` blocks after it in the chain. For instance, the next + block if `offset` is 1. The offset cannot be negative. + - GET /tezlink/chains//blocks//protocols + Current and next protocol. + - GET /tezlink/describe + RPCs documentation and input/output schema + - GET /tezlink/version + Get information on the node version - GET /version version Dynamic parameter description: + + A block identifier. This can take one of the following + values: + 1.Block-hash - Hash in Base58Check notation. + 2.Alias - One of + the following:'genesis/ head/ caboose/ savepoint/ + checkpoint'. + 3.Block-level - index(integer) in the chain. + One can + also specify the relative positions of block with respect to above + three block identifiers. For ex. 'checkpoint~N' or checkpoint+N, where + N is an integer, denotes the Nth block before(~) or after (+) the + checkpoint. + + A chain identifier. This is either a chain hash in Base58Check notation + or a one the predefined aliases: 'main', 'test'. uint63 Warning: diff --git a/etherlink/tezt/tests/expected/evm_sequencer.ml/R022-- Test the -describe endpoint.out b/etherlink/tezt/tests/expected/evm_sequencer.ml/R022-- Test the -describe endpoint.out index b3628e76970f..883bf7def0ce 100644 --- a/etherlink/tezt/tests/expected/evm_sequencer.ml/R022-- Test the -describe endpoint.out +++ b/etherlink/tezt/tests/expected/evm_sequencer.ml/R022-- Test the -describe endpoint.out @@ -20,12 +20,39 @@ Available services: Get the maximum time between two blocks - GET /health_check Assess the health of the RPC server + + tezlink/ + - GET /tezlink/chains//blocks//helpers/current_level + Returns the level of the interrogated block, or the one of a block + located `offset` blocks after it in the chain. For instance, the next + block if `offset` is 1. The offset cannot be negative. + - GET /tezlink/chains//blocks//protocols + Current and next protocol. + - GET /tezlink/describe + RPCs documentation and input/output schema + - GET /tezlink/version + Get information on the node version - GET /version version Dynamic parameter description: + + A block identifier. This can take one of the following + values: + 1.Block-hash - Hash in Base58Check notation. + 2.Alias - One of + the following:'genesis/ head/ caboose/ savepoint/ + checkpoint'. + 3.Block-level - index(integer) in the chain. + One can + also specify the relative positions of block with respect to above + three block identifiers. For ex. 'checkpoint~N' or checkpoint+N, where + N is an integer, denotes the Nth block before(~) or after (+) the + checkpoint. + + A chain identifier. This is either a chain hash in Base58Check notation + or a one the predefined aliases: 'main', 'test'. uint63 Warning: -- GitLab