From 6445d54f2c37aebc9b6cbe738ec705fc839986af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Tue, 11 Feb 2025 21:28:27 +0100 Subject: [PATCH 1/6] EVM node: unbox the chain_id type --- etherlink/bin_node/lib_dev/encodings/ethereum_types.ml | 2 +- etherlink/bin_node/lib_dev/encodings/ethereum_types.mli | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml index 500e3fa13741..1f5e8a8f1815 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml @@ -115,7 +115,7 @@ let quantity_encoding = let pp_quantity fmt (Qty q) = Z.pp_print fmt q -type chain_id = Chain_id of Z.t +type chain_id = Chain_id of Z.t [@@ocaml.unboxed] let chain_id_encoding : chain_id Data_encoding.t = let open Data_encoding in diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli index efaf47b67b9c..b3555b6cf4dd 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli @@ -53,7 +53,7 @@ val hex_of_utf8 : string -> hex (** [hex_of_bytes] transforms the [bytes] to hexadecimal. *) val hex_of_bytes : bytes -> hex -type chain_id = Chain_id of Z.t +type chain_id = Chain_id of Z.t [@@unboxed] val chain_id_encoding : chain_id Data_encoding.t -- GitLab From de897ac69d6a3772154843bed021d752713a1b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Tue, 11 Feb 2025 21:31:15 +0100 Subject: [PATCH 2/6] EVM node: move chain_id_encoding to the configuration module This is to avoid confusion with the hex encoding used everywhere but in the config. --- etherlink/bin_node/config/configuration.ml | 11 ++++++----- .../bin_node/lib_dev/encodings/ethereum_types.ml | 4 ---- .../bin_node/lib_dev/encodings/ethereum_types.mli | 2 -- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/etherlink/bin_node/config/configuration.ml b/etherlink/bin_node/config/configuration.ml index 8303988938cf..718e482e4e21 100644 --- a/etherlink/bin_node/config/configuration.ml +++ b/etherlink/bin_node/config/configuration.ml @@ -57,6 +57,11 @@ let chain_id network = Ethereum_types.Chain_id (Z.of_int (match network with Mainnet -> 0xa729 | Testnet -> 0x1f47b)) +let chain_id_encoding : Ethereum_types.chain_id Data_encoding.t = + let open Ethereum_types in + let open Data_encoding in + conv (fun (Chain_id z) -> z) (fun z -> Chain_id z) z + type l2_chain = {chain_id : Ethereum_types.chain_id} type experimental_features = { @@ -822,13 +827,9 @@ let opt_monitor_websocket_heartbeat_encoding = let l2_chain_encoding : l2_chain Data_encoding.t = let open Data_encoding in - let open Evm_node_lib_dev_encoding in conv (fun {chain_id} -> chain_id) (fun chain_id -> {chain_id}) @@ obj1 - (req - "chain_id" - ~description:"The id of the l2 chain" - Ethereum_types.chain_id_encoding) + (req "chain_id" ~description:"The id of the l2 chain" chain_id_encoding) let experimental_features_encoding = let open Data_encoding in diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml index 1f5e8a8f1815..98d69d56bbba 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml @@ -117,10 +117,6 @@ let pp_quantity fmt (Qty q) = Z.pp_print fmt q type chain_id = Chain_id of Z.t [@@ocaml.unboxed] -let chain_id_encoding : chain_id Data_encoding.t = - let open Data_encoding in - conv (fun (Chain_id z) -> z) (fun z -> Chain_id z) z - type block_hash = Block_hash of hex [@@ocaml.unboxed] let pp_block_hash fmt (Block_hash (Hex h)) = Format.pp_print_string fmt h diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli index b3555b6cf4dd..92da39b91b6c 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli @@ -55,8 +55,6 @@ val hex_of_bytes : bytes -> hex type chain_id = Chain_id of Z.t [@@unboxed] -val chain_id_encoding : chain_id Data_encoding.t - (** Ethereum block hash (32 bytes) *) type block_hash = Block_hash of hex [@@unboxed] -- GitLab From c517f62496df1501bf3d41adb3c97e30c003be85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Tue, 11 Feb 2025 21:23:54 +0100 Subject: [PATCH 3/6] EVM node: extract decoding functions for Z To reuse them in the case of the chain_id type --- .../lib_dev/encodings/ethereum_types.ml | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml index 98d69d56bbba..dc5a432ee7a5 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml @@ -115,6 +115,16 @@ let quantity_encoding = let pp_quantity fmt (Qty q) = Z.pp_print fmt q +let decode_z_le bytes = Bytes.to_string bytes |> Z.of_bits + +let decode_z_be bytes = + Bytes.fold_left + (fun acc c -> + let open Z in + add (of_int (Char.code c)) (shift_left acc 8)) + Z.zero + bytes + type chain_id = Chain_id of Z.t [@@ocaml.unboxed] type block_hash = Block_hash of hex [@@ocaml.unboxed] @@ -250,16 +260,9 @@ let decode_address bytes = Address (decode_hex bytes) let encode_address (Address address) = encode_hex address -let decode_number_le bytes = Bytes.to_string bytes |> Z.of_bits |> quantity_of_z +let decode_number_le bytes = decode_z_le bytes |> quantity_of_z -let decode_number_be bytes = - Bytes.fold_left - (fun acc c -> - let open Z in - add (of_int (Char.code c)) (shift_left acc 8)) - Z.zero - bytes - |> quantity_of_z +let decode_number_be bytes = decode_z_be bytes |> quantity_of_z let decode_hash bytes = Hash (decode_hex bytes) -- GitLab From 7e5c07c74805c259ed91ddfcac9a631930eefe1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Wed, 12 Feb 2025 10:57:40 +0100 Subject: [PATCH 4/6] Floodgate/build: depend on Evm_node_config This is needed to call the `Configuration.chain_id` function. --- etherlink/bin_floodgate/dune | 4 +++- manifest/product_etherlink.ml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/etherlink/bin_floodgate/dune b/etherlink/bin_floodgate/dune index aa562c93030f..260775957c6c 100644 --- a/etherlink/bin_floodgate/dune +++ b/etherlink/bin_floodgate/dune @@ -16,6 +16,7 @@ octez-libs.clic octez-evm-node-libs.evm_node_lib_dev octez-evm-node-libs.evm_node_lib_dev_encoding + octez-evm-node-libs.evm_node_config octez-libs.tezos-workers) (link_flags (:standard) @@ -24,4 +25,5 @@ (:standard) -open Tezos_base.TzPervasives -open Evm_node_lib_dev - -open Evm_node_lib_dev_encoding)) + -open Evm_node_lib_dev_encoding + -open Evm_node_config)) diff --git a/manifest/product_etherlink.ml b/manifest/product_etherlink.ml index f61b59277b22..94f7bf2ec104 100644 --- a/manifest/product_etherlink.ml +++ b/manifest/product_etherlink.ml @@ -473,5 +473,6 @@ let _floodgate_bin = octez_clic; evm_node_lib_dev |> open_; evm_node_lib_dev_encoding |> open_; + evm_node_config |> open_; octez_workers; ] -- GitLab From 4e56ef6f244642fa1246ed28c57fe051f430290d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Tue, 11 Feb 2025 21:45:36 +0100 Subject: [PATCH 5/6] EVM node: remove Constants.chain_id In favor of Configuration.chain_id --- etherlink/bin_floodgate/network_info.ml | 3 ++- etherlink/bin_node/lib_dev/constants.ml | 3 --- etherlink/bin_node/lib_dev/constants.mli | 2 -- etherlink/bin_node/lib_dev/evm_ro_context.ml | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/etherlink/bin_floodgate/network_info.ml b/etherlink/bin_floodgate/network_info.ml index 334c4c78862c..19ed94a8d9c4 100644 --- a/etherlink/bin_floodgate/network_info.ml +++ b/etherlink/bin_floodgate/network_info.ml @@ -17,8 +17,9 @@ let get_chain_id ~evm_node_endpoint = ~evm_node_endpoint () in + let (Chain_id mainnet_chain_id) = Configuration.chain_id Mainnet in let* () = - when_ (chain_id = Constants.chain_id Mainnet) @@ fun () -> + when_ (Ethereum_types.Qty.to_z chain_id = mainnet_chain_id) @@ fun () -> Lwt_result.ok (Floodgate_events.mainnet_experiment ()) in return chain_id diff --git a/etherlink/bin_node/lib_dev/constants.ml b/etherlink/bin_node/lib_dev/constants.ml index c8021c001241..000b2321e487 100644 --- a/etherlink/bin_node/lib_dev/constants.ml +++ b/etherlink/bin_node/lib_dev/constants.ml @@ -11,9 +11,6 @@ let network_name = function | Configuration.Mainnet -> "Mainnet" | Testnet -> "Testnet" -let chain_id network = - match Configuration.chain_id network with Chain_id x -> Ethereum_types.Qty x - let rollup_address network = Tezos_crypto.Hashed.Smart_rollup_address.of_b58check_exn @@ diff --git a/etherlink/bin_node/lib_dev/constants.mli b/etherlink/bin_node/lib_dev/constants.mli index 9482f7d3be7d..b213e334d573 100644 --- a/etherlink/bin_node/lib_dev/constants.mli +++ b/etherlink/bin_node/lib_dev/constants.mli @@ -14,6 +14,4 @@ val network_name : Configuration.supported_network -> string val rollup_address : Configuration.supported_network -> Tezos_crypto.Hashed.Smart_rollup_address.t -val chain_id : Configuration.supported_network -> Ethereum_types.quantity - val latest_snapshot_url : Configuration.supported_network -> string diff --git a/etherlink/bin_node/lib_dev/evm_ro_context.ml b/etherlink/bin_node/lib_dev/evm_ro_context.ml index a88fb2ae1a36..4c468f101b1d 100644 --- a/etherlink/bin_node/lib_dev/evm_ro_context.ml +++ b/etherlink/bin_node/lib_dev/evm_ro_context.ml @@ -32,7 +32,7 @@ let read state path = let network_sanity_check ~network ctxt = let open Lwt_result_syntax in let expected_smart_rollup_address = Constants.rollup_address network in - let (Qty expected_chain_id) = Constants.chain_id network in + let (Chain_id expected_chain_id) = Configuration.chain_id network in let* _, hash = Evm_store.(use ctxt.store Context_hashes.get_latest) in let* evm_state = get_evm_state ctxt hash in -- GitLab From 9896ca37095384e4053eab073bc84dc88b01a3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Tue, 11 Feb 2025 15:44:54 +0100 Subject: [PATCH 6/6] EVM node: use the new chain_id type instead of quantity --- etherlink/bin_floodgate/craft.ml | 2 +- etherlink/bin_floodgate/floodgate_events.ml | 2 +- etherlink/bin_floodgate/floodgate_events.mli | 6 +++--- etherlink/bin_floodgate/network_info.ml | 6 +++--- etherlink/bin_floodgate/network_info.mli | 2 +- etherlink/bin_node/lib_dev/durable_storage.ml | 5 ++++- .../bin_node/lib_dev/encodings/ethereum_types.ml | 12 ++++++++++++ .../bin_node/lib_dev/encodings/ethereum_types.mli | 8 ++++++++ etherlink/bin_node/lib_dev/encodings/transaction.ml | 2 +- etherlink/bin_node/lib_dev/evm_ro_context.ml | 2 +- etherlink/bin_node/lib_dev/rpc_encodings.ml | 4 ++-- etherlink/bin_node/lib_dev/rpc_encodings.mli | 2 +- etherlink/bin_node/lib_dev/services.ml | 4 ++-- etherlink/bin_node/lib_dev/services_backend_sig.ml | 2 +- etherlink/bin_node/lib_dev/validate.ml | 2 +- 15 files changed, 42 insertions(+), 19 deletions(-) diff --git a/etherlink/bin_floodgate/craft.ml b/etherlink/bin_floodgate/craft.ml index 196bdeca5c27..3e8d366aafba 100644 --- a/etherlink/bin_floodgate/craft.ml +++ b/etherlink/bin_floodgate/craft.ml @@ -34,7 +34,7 @@ let prepare_and_forge_tx ?to_ ?data ~gas_limit ~base_fee_per_gas ~chain_id let transfer ?nonce ?to_ ?data ~value ~gas_limit ~infos ~from () = let nonce = Option.value nonce ~default:from.Account.nonce |> Z.to_int in - let (Ethereum_types.Qty chain_id) = infos.Network_info.chain_id in + let (Ethereum_types.Chain_id chain_id) = infos.Network_info.chain_id in let txn = prepare_and_forge_tx ?to_ diff --git a/etherlink/bin_floodgate/floodgate_events.ml b/etherlink/bin_floodgate/floodgate_events.ml index 55c8a06a34dd..af09740786dd 100644 --- a/etherlink/bin_floodgate/floodgate_events.ml +++ b/etherlink/bin_floodgate/floodgate_events.ml @@ -28,7 +28,7 @@ let is_ready = {base_fee_per_gas})" ~level:Notice ~pp2:pp_eth - ("chain_id", Ethereum_types.quantity_encoding) + ("chain_id", Ethereum_types.Chain_id.encoding) ("base_fee_per_gas", Data_encoding.n) let tx_queue_is_ready = diff --git a/etherlink/bin_floodgate/floodgate_events.mli b/etherlink/bin_floodgate/floodgate_events.mli index d549431db907..97bec6f33e05 100644 --- a/etherlink/bin_floodgate/floodgate_events.mli +++ b/etherlink/bin_floodgate/floodgate_events.mli @@ -8,7 +8,7 @@ (** [is_ready chain_id base_fee_per_gas] advertises that Floodgate has started and is ready to spam. *) -val is_ready : Ethereum_types.quantity -> Z.t -> unit Lwt.t +val is_ready : Ethereum_types.chain_id -> Z.t -> unit Lwt.t (** [tx_queue_is_ready ()] advertises that the [Tx_queue] is ready to receive transactions. *) @@ -48,11 +48,11 @@ val reimbursed_controller : Account.t -> unit Lwt.t has been funded and is now used to spam the Etherlink network. *) val setup_completed : unit -> unit Lwt.t -(** [injecting_transactions nb] advertises [nb] transactions are about to be +(** [injecting_transactions nb] advertises [nb] transactions are about to be injected to the relay endpoint with a batch of [eth_sendRawTransaction]. *) val injecting_transactions : int -> unit Lwt.t -(** [deploy_erc20 address] advertises an ERC20 contract as been deployed at +(** [deploy_erc20 address] advertises an ERC20 contract as been deployed at address [address]. *) val deploy_erc20 : string -> unit Lwt.t diff --git a/etherlink/bin_floodgate/network_info.ml b/etherlink/bin_floodgate/network_info.ml index 19ed94a8d9c4..728004ad16fa 100644 --- a/etherlink/bin_floodgate/network_info.ml +++ b/etherlink/bin_floodgate/network_info.ml @@ -6,7 +6,7 @@ (* *) (*****************************************************************************) -type t = {chain_id : Ethereum_types.quantity; base_fee_per_gas : Z.t} +type t = {chain_id : Ethereum_types.chain_id; base_fee_per_gas : Z.t} let get_chain_id ~evm_node_endpoint = let open Lwt_result_syntax in @@ -17,9 +17,9 @@ let get_chain_id ~evm_node_endpoint = ~evm_node_endpoint () in - let (Chain_id mainnet_chain_id) = Configuration.chain_id Mainnet in + let mainnet_chain_id = Configuration.chain_id Mainnet in let* () = - when_ (Ethereum_types.Qty.to_z chain_id = mainnet_chain_id) @@ fun () -> + when_ (chain_id = mainnet_chain_id) @@ fun () -> Lwt_result.ok (Floodgate_events.mainnet_experiment ()) in return chain_id diff --git a/etherlink/bin_floodgate/network_info.mli b/etherlink/bin_floodgate/network_info.mli index 3c3e7e7cab50..87c921633fc2 100644 --- a/etherlink/bin_floodgate/network_info.mli +++ b/etherlink/bin_floodgate/network_info.mli @@ -6,7 +6,7 @@ (* *) (*****************************************************************************) -type t = {chain_id : Ethereum_types.quantity; base_fee_per_gas : Z.t} +type t = {chain_id : Ethereum_types.chain_id; base_fee_per_gas : Z.t} val fetch : rpc_endpoint:Uri.t -> base_fee_factor:float -> t tzresult Lwt.t diff --git a/etherlink/bin_node/lib_dev/durable_storage.ml b/etherlink/bin_node/lib_dev/durable_storage.ml index a02cccb365bf..99441c94f461 100644 --- a/etherlink/bin_node/lib_dev/durable_storage.ml +++ b/etherlink/bin_node/lib_dev/durable_storage.ml @@ -271,7 +271,10 @@ let block_receipts read n = Lwt.return_ok receipts let chain_id read = - inspect_durable_and_decode read Durable_storage_path.chain_id decode_number_le + inspect_durable_and_decode + read + Durable_storage_path.chain_id + Chain_id.decode_le let base_fee_per_gas read = let open Lwt_result_syntax in diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml index dc5a432ee7a5..6ed70377acf1 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.ml @@ -127,6 +127,18 @@ let decode_z_be bytes = type chain_id = Chain_id of Z.t [@@ocaml.unboxed] +module Chain_id = struct + let encoding = + Data_encoding.conv + (fun (Chain_id c) -> z_to_hexa c) + (fun c -> Chain_id (Z.of_string c)) + Data_encoding.string + + let decode_le bytes = Chain_id (decode_z_le bytes) + + let decode_be bytes = Chain_id (decode_z_be bytes) +end + type block_hash = Block_hash of hex [@@ocaml.unboxed] let pp_block_hash fmt (Block_hash (Hex h)) = Format.pp_print_string fmt h diff --git a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli index 92da39b91b6c..ed79c265fed2 100644 --- a/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli +++ b/etherlink/bin_node/lib_dev/encodings/ethereum_types.mli @@ -55,6 +55,14 @@ val hex_of_bytes : bytes -> hex type chain_id = Chain_id of Z.t [@@unboxed] +module Chain_id : sig + val encoding : chain_id Data_encoding.t + + val decode_le : bytes -> chain_id + + val decode_be : bytes -> chain_id +end + (** Ethereum block hash (32 bytes) *) type block_hash = Block_hash of hex [@@unboxed] diff --git a/etherlink/bin_node/lib_dev/encodings/transaction.ml b/etherlink/bin_node/lib_dev/encodings/transaction.ml index f6b1951d272f..9f0e31020729 100644 --- a/etherlink/bin_node/lib_dev/encodings/transaction.ml +++ b/etherlink/bin_node/lib_dev/encodings/transaction.ml @@ -93,7 +93,7 @@ let decode_transaction ?chain_id ~tx_type ~nonce ~max_priority_fee_per_gas else if v = of_int 27 || v = of_int 28 then return None else fail "Chain ID cannot be decoded" | Some chain_id -> - let (Qty chain_id) = decode_number_be chain_id in + let (Chain_id chain_id) = Chain_id.decode_be chain_id in return (Some chain_id) in return diff --git a/etherlink/bin_node/lib_dev/evm_ro_context.ml b/etherlink/bin_node/lib_dev/evm_ro_context.ml index 4c468f101b1d..edd72db7012b 100644 --- a/etherlink/bin_node/lib_dev/evm_ro_context.ml +++ b/etherlink/bin_node/lib_dev/evm_ro_context.ml @@ -40,7 +40,7 @@ let network_sanity_check ~network ctxt = let* () = match chain_id with - | Ok (Qty chain_id) -> + | Ok (Chain_id chain_id) -> unless Compare.Z.(chain_id = expected_chain_id) @@ fun () -> failwith "Local state is inconsistent with selected network %a: incorrect \ diff --git a/etherlink/bin_node/lib_dev/rpc_encodings.ml b/etherlink/bin_node/lib_dev/rpc_encodings.ml index 135f73e6b570..fd8d0f6c1f68 100644 --- a/etherlink/bin_node/lib_dev/rpc_encodings.ml +++ b/etherlink/bin_node/lib_dev/rpc_encodings.ml @@ -224,11 +224,11 @@ end module Chain_id = struct type input = unit - type output = Ethereum_types.quantity + type output = Ethereum_types.chain_id let input_encoding = Data_encoding.unit - let output_encoding = Ethereum_types.quantity_encoding + let output_encoding = Ethereum_types.Chain_id.encoding let method_ = "eth_chainId" diff --git a/etherlink/bin_node/lib_dev/rpc_encodings.mli b/etherlink/bin_node/lib_dev/rpc_encodings.mli index d1679a2b1374..2d776e218671 100644 --- a/etherlink/bin_node/lib_dev/rpc_encodings.mli +++ b/etherlink/bin_node/lib_dev/rpc_encodings.mli @@ -137,7 +137,7 @@ module Kernel_root_hash : module Network_id : METHOD with type input = unit and type output = string module Chain_id : - METHOD with type input = unit and type output = Ethereum_types.quantity + METHOD with type input = unit and type output = Ethereum_types.chain_id module Accounts : METHOD with type input = unit and type output = Ethereum_types.address list diff --git a/etherlink/bin_node/lib_dev/services.ml b/etherlink/bin_node/lib_dev/services.ml index 534e490aa54b..0306337638db 100644 --- a/etherlink/bin_node/lib_dev/services.ml +++ b/etherlink/bin_node/lib_dev/services.ml @@ -442,11 +442,11 @@ let dispatch_request (rpc : Configuration.rpc) (config : Configuration.t) | Network_id.Method -> let f (_ : unit option) = let open Lwt_result_syntax in - let* (Qty chain_id) = Backend_rpc.chain_id () in + let* (Chain_id chain_id) = Backend_rpc.chain_id () in rpc_ok (Z.to_string chain_id) in build ~f module_ parameters - | Chain_id.Method -> + | Rpc_encodings.Chain_id.Method -> let f (_ : unit option) = let* chain_id = Backend_rpc.chain_id () in rpc_ok chain_id diff --git a/etherlink/bin_node/lib_dev/services_backend_sig.ml b/etherlink/bin_node/lib_dev/services_backend_sig.ml index e70800767e17..3a5fc3d75d36 100644 --- a/etherlink/bin_node/lib_dev/services_backend_sig.ml +++ b/etherlink/bin_node/lib_dev/services_backend_sig.ml @@ -46,7 +46,7 @@ module type S = sig Ethereum_types.quantity tzresult Lwt.t (** [chain_id ()] returns chain id defined by the rollup. *) - val chain_id : unit -> Ethereum_types.quantity tzresult Lwt.t + val chain_id : unit -> Ethereum_types.chain_id tzresult Lwt.t (** [base_fee_per_gas ()] returns base fee defined by the rollup. *) val base_fee_per_gas : unit -> Ethereum_types.quantity tzresult Lwt.t diff --git a/etherlink/bin_node/lib_dev/validate.ml b/etherlink/bin_node/lib_dev/validate.ml index 6734e623b008..d18009d1a350 100644 --- a/etherlink/bin_node/lib_dev/validate.ml +++ b/etherlink/bin_node/lib_dev/validate.ml @@ -24,7 +24,7 @@ let validate_chain_id (module Backend_rpc : Services_backend_sig.S) match transaction.chain_id with | None -> return (Ok ()) | Some transaction_chain_id -> - let* (Qty chain_id) = Backend_rpc.chain_id () in + let* (Chain_id chain_id) = Backend_rpc.chain_id () in if Z.equal transaction_chain_id chain_id then return (Ok ()) else return (Error "Invalid chain id") -- GitLab