From 7a75235bf04c8709f9407146d58779ca524ad3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Wed, 7 May 2025 14:03:58 +0200 Subject: [PATCH 1/2] Tezlink/Node: mock the preapply operations RPC --- .../lib_dev/tezlink/tezlink_directory.ml | 17 +++++++++++++++++ .../bin_node/lib_dev/tezlink/tezos_services.ml | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/etherlink/bin_node/lib_dev/tezlink/tezlink_directory.ml b/etherlink/bin_node/lib_dev/tezlink/tezlink_directory.ml index fdcdd7d32072..9be4bf299ad5 100644 --- a/etherlink/bin_node/lib_dev/tezlink/tezlink_directory.ml +++ b/etherlink/bin_node/lib_dev/tezlink/tezlink_directory.ml @@ -286,6 +286,23 @@ let build_block_static_directory ~l2_chain_id Tezlink_mock.Operation_metadata.operation_metadata op in return (op, mock_result)) + |> register + ~service:Tezos_services.preapply_operations + ~impl:(fun {block; chain} param ops -> + let*? _chain = check_chain chain in + let*? _block = check_block block in + let*? receipts = + List.map_e + (fun (op : Alpha_context.packed_operation) -> + let open Result_syntax in + let op = op.protocol_data in + let* mock_result = + Tezlink_mock.Operation_metadata.operation_metadata op + in + return (op, mock_result)) + ops + in + Lwt_result_syntax.return (param#version, receipts)) let register_block_info ~l2_chain_id (module Backend : Tezlink_backend_sig.S) (module Block_header : HEADER) base_dir = diff --git a/etherlink/bin_node/lib_dev/tezlink/tezos_services.ml b/etherlink/bin_node/lib_dev/tezlink/tezos_services.ml index 1c0cd07a46dd..0c0cc6ef35f3 100644 --- a/etherlink/bin_node/lib_dev/tezlink/tezos_services.ml +++ b/etherlink/bin_node/lib_dev/tezlink/tezos_services.ml @@ -467,3 +467,16 @@ let injection_operation : Operation_hash.t ) Tezos_rpc.Service.t = Tezos_shell_services.Injection_services.S.operation + +let preapply_operations : + ( [`POST], + tezlink_rpc_context, + tezlink_rpc_context, + < version : Tezlink_protocols.Shell_impl.version >, + Protocol_types.Alpha_context.packed_operation list, + Tezlink_protocols.Shell_impl.version + * (Protocol_types.Alpha_context.packed_protocol_data + * Imported_protocol.operation_receipt) + list ) + Tezos_rpc.Service.t = + import_service Block_services.S.Helpers.Preapply.operations -- GitLab From d6e404dac17dbadddc036359ea09ad6cf41f1b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Wed, 18 Jun 2025 12:25:34 +0200 Subject: [PATCH 2/2] Tezlink/Tezt: reset regression trace --- .../Alpha- Test the -describe endpoint.out | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) 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 da201179cf55..3c830feef5ad 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 @@ -167,18 +167,22 @@ Available services: The block's hash, its unique identifier. - GET /chains/main/blocks/head/header The whole block header. - - GET /chains/main/blocks/head/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. - - POST /chains/main/blocks/head/helpers/scripts/simulate_operation - Simulate running an operation at some future moment (based on the - number of blocks given in the `latency` argument), and return the - operation application result. The result is the same as run_operation - except for the consumed gas, which depends on the contents of the - cache at that future moment. This RPC estimates future gas - consumption by trying to predict the state of the cache using some - heuristics. + + helpers/ + - GET /chains/main/blocks/head/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. + - POST /chains/main/blocks/head/helpers/preapply/operations + Simulate the application of the operations with the context of the + given block and return the result of each operation application. + - POST /chains/main/blocks/head/helpers/scripts/simulate_operation + Simulate running an operation at some future moment (based on the + number of blocks given in the `latency` argument), and return the + operation application result. The result is the same as + run_operation except for the consumed gas, which depends on the + contents of the cache at that future moment. This RPC estimates + future gas consumption by trying to predict the state of the cache + using some heuristics. - GET /chains/main/blocks/head/protocols Current and next protocol. -- GitLab