diff --git a/etherlink/bin_node/lib_dev/tezlink/tezlink_directory.ml b/etherlink/bin_node/lib_dev/tezlink/tezlink_directory.ml index fdcdd7d3207228a43adaf6742b78319239d66a3a..9be4bf299ad517e99ccb444a04fa1d7de17a23a5 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 1c0cd07a46dddea7b907043283b293e7a76204f1..0c0cc6ef35f3343dbb8dcbb3d9e32e4e56b4cad0 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 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 da201179cf555238f05a0f2933a50ffd45b5d264..3c830feef5ad73ac8ec512a41dd4a4672c806675 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.