From 960fbe6f9563570d0fac94792a6cc6af40281a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Mon, 23 Jun 2025 08:47:53 +0200 Subject: [PATCH 1/7] Etherlink/Node: move ex_tx_container to Services_backend_sig This will allow reusing it for the block producer and blueprint publisher workers. --- etherlink/bin_node/lib_dev/evm_context.ml | 7 ++----- etherlink/bin_node/lib_dev/services_backend_sig.ml | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/etherlink/bin_node/lib_dev/evm_context.ml b/etherlink/bin_node/lib_dev/evm_context.ml index b4dac7fba49f..b5000d1c3d0d 100644 --- a/etherlink/bin_node/lib_dev/evm_context.ml +++ b/etherlink/bin_node/lib_dev/evm_context.ml @@ -19,9 +19,6 @@ type head = { pending_sequencer_upgrade : Evm_events.Sequencer_upgrade.t option; } -type ex_tx_container = - | Ex_tx_container : _ Services_backend_sig.tx_container -> ex_tx_container - type parameters = { configuration : Configuration.t; kernel_path : Wasm_debugger.kernel option; @@ -30,7 +27,7 @@ type parameters = { store_perm : Sqlite.perm; sequencer_wallet : (Client_keys.sk_uri * Client_context.wallet) option; snapshot_url : string option; - tx_container : ex_tx_container; + tx_container : Services_backend_sig.ex_tx_container; } type session_state = { @@ -55,7 +52,7 @@ type t = { session : session_state; sequencer_wallet : (Client_keys.sk_uri * Client_context.wallet) option; legacy_block_storage : bool; - tx_container : ex_tx_container; + tx_container : Services_backend_sig.ex_tx_container; } let is_sequencer t = Option.is_some t.sequencer_wallet diff --git a/etherlink/bin_node/lib_dev/services_backend_sig.ml b/etherlink/bin_node/lib_dev/services_backend_sig.ml index b034c21a22db..451a20007344 100644 --- a/etherlink/bin_node/lib_dev/services_backend_sig.ml +++ b/etherlink/bin_node/lib_dev/services_backend_sig.ml @@ -320,3 +320,5 @@ let tx_container_module (type f) (tx_container : f tx_container) = match tx_container with | Evm_tx_container m -> (m :> (module Tx_container)) | Michelson_tx_container m -> (m :> (module Tx_container)) + +type ex_tx_container = Ex_tx_container : _ tx_container -> ex_tx_container -- GitLab From 39249d310e6d22da4e6132c89ec9f9129efafe2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Thu, 26 Jun 2025 00:00:13 +0200 Subject: [PATCH 2/7] Etherlink/Node: extract validate_and_add_tx from sequencer loop --- etherlink/bin_node/lib_dev/sequencer.ml | 35 ++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index fc814569f51a..2792a423c90a 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -37,12 +37,27 @@ let install_finalizer_seq ~(tx_container : _ Services_backend_sig.tx_container) let* () = Signals_publisher.shutdown () in return_unit +let validate_and_add_tx backend + ~(tx_container : + L2_types.evm_chain_family Services_backend_sig.tx_container) raw_tx = + let open Lwt_result_syntax in + let (Evm_tx_container (module Tx_container)) = tx_container in + let* res = Validate.is_tx_valid backend ~mode:Minimal raw_tx in + match res with + | Ok (next_nonce, txn_obj) -> + let raw_tx = Ethereum_types.hex_of_utf8 raw_tx in + let* _ = Tx_container.add ~next_nonce txn_obj ~raw_tx in + return_unit + | Error reason -> + let hash = Ethereum_types.hash_raw_tx raw_tx in + let*! () = Events.replicate_transaction_dropped hash reason in + return_unit + let loop_sequencer multichain backend ~(tx_container : L2_types.evm_chain_family Services_backend_sig.tx_container) ?sandbox_config time_between_blocks = let open Lwt_result_syntax in - let (Evm_tx_container (module Tx_container)) = tx_container in match sandbox_config with | Some {parent_chain = Some evm_node_endpoint; _} -> let*! head = Evm_context.head_info () in @@ -69,23 +84,7 @@ let loop_sequencer multichain backend in let txns = List.filter_map snd all_txns in let* () = - List.iter_es - (fun raw_tx -> - let* res = - Validate.is_tx_valid backend ~mode:Minimal raw_tx - in - match res with - | Ok (next_nonce, txn_obj) -> - let raw_tx = Ethereum_types.hex_of_utf8 raw_tx in - let* _ = Tx_container.add ~next_nonce txn_obj ~raw_tx in - return_unit - | Error reason -> - let hash = Ethereum_types.hash_raw_tx raw_tx in - let*! () = - Events.replicate_transaction_dropped hash reason - in - return_unit) - txns + List.iter_es (validate_and_add_tx backend ~tx_container) txns in let* _ = Block_producer.produce_block -- GitLab From d0847ebf6020a7664ddb1a4aee32d92c2545aa6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Thu, 26 Jun 2025 00:03:23 +0200 Subject: [PATCH 3/7] Etherlink/Node: support Tezlink validate_and_add In the case of Tezlink, we skip the validation. --- etherlink/bin_node/lib_dev/sequencer.ml | 33 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index 2792a423c90a..ed04f62366b5 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -37,7 +37,7 @@ let install_finalizer_seq ~(tx_container : _ Services_backend_sig.tx_container) let* () = Signals_publisher.shutdown () in return_unit -let validate_and_add_tx backend +let validate_and_add_etherlink_tx backend ~(tx_container : L2_types.evm_chain_family Services_backend_sig.tx_container) raw_tx = let open Lwt_result_syntax in @@ -53,10 +53,35 @@ let validate_and_add_tx backend let*! () = Events.replicate_transaction_dropped hash reason in return_unit -let loop_sequencer multichain backend +(* TODO: https://gitlab.com/tezos/tezos/-/issues/8007 + Validate Tezlink operations before adding them to the queue. *) +let validate_and_add_tezlink_operation ~(tx_container : - L2_types.evm_chain_family Services_backend_sig.tx_container) - ?sandbox_config time_between_blocks = + L2_types.michelson_chain_family Services_backend_sig.tx_container) raw_tx + = + let open Lwt_result_syntax in + let (Michelson_tx_container (module Tx_container)) = tx_container in + let*? (op : Tezos_types.Operation.t) = + raw_tx |> Bytes.of_string |> Tezos_types.Operation.decode + in + let raw_tx = Ethereum_types.hex_of_utf8 raw_tx in + let* _ = + Tx_container.add ~next_nonce:(Ethereum_types.Qty op.counter) op ~raw_tx + in + return_unit + +let validate_and_add_tx (type f) backend + ~(tx_container : f Services_backend_sig.tx_container) : + string -> unit tzresult Lwt.t = + match tx_container with + | Evm_tx_container _ as tx_container -> + validate_and_add_etherlink_tx backend ~tx_container + | Michelson_tx_container _ as tx_container -> + validate_and_add_tezlink_operation ~tx_container + +let loop_sequencer (type f) multichain backend + ~(tx_container : f Services_backend_sig.tx_container) ?sandbox_config + time_between_blocks = let open Lwt_result_syntax in match sandbox_config with | Some {parent_chain = Some evm_node_endpoint; _} -> -- GitLab From 4c8986ff9fb9bd594ebe38b5c08cd1275dd3fca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Mon, 23 Jun 2025 08:50:59 +0200 Subject: [PATCH 4/7] Etherlink/Node: support Tezlink in blueprints publisher worker --- etherlink/bin_node/lib_dev/blueprints_publisher.ml | 13 +++++++------ etherlink/bin_node/lib_dev/blueprints_publisher.mli | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/etherlink/bin_node/lib_dev/blueprints_publisher.ml b/etherlink/bin_node/lib_dev/blueprints_publisher.ml index 4555b1947872..0a2fbe23dc4f 100644 --- a/etherlink/bin_node/lib_dev/blueprints_publisher.ml +++ b/etherlink/bin_node/lib_dev/blueprints_publisher.ml @@ -18,7 +18,7 @@ type parameters = { keep_alive : bool; drop_duplicate : bool; order_enabled : bool; - tx_container : L2_types.evm_chain_family Services_backend_sig.tx_container; + tx_container : Services_backend_sig.ex_tx_container; } type state = { @@ -39,7 +39,7 @@ type state = { mutable cooldown : int; (** Do not try to catch-up if [cooldown] is not equal to 0 *) enable_dal : bool; - tx_container : L2_types.evm_chain_family Services_backend_sig.tx_container; + tx_container : Services_backend_sig.ex_tx_container; } module Types = struct @@ -169,8 +169,9 @@ module Worker = struct match rollup_is_lagging_behind self with | No_lag | Needs_republish -> return_unit | Needs_lock -> + let (Ex_tx_container tx_container) = tx_container self in let (module Tx_container) = - Services_backend_sig.tx_container_module (tx_container self) + Services_backend_sig.tx_container_module tx_container in Tx_container.lock_transactions () @@ -331,9 +332,9 @@ module Handlers = struct Worker.decrement_cooldown self ; (* If there is no lag or the worker just needs to republish we unlock the transaction pool in case it was locked. *) + let (Ex_tx_container tx_container) = Worker.tx_container self in let (module Tx_container) = - Services_backend_sig.tx_container_module - (Worker.tx_container self) + Services_backend_sig.tx_container_module tx_container in Tx_container.unlock_transactions ()) @@ -377,7 +378,7 @@ let start ~blueprints_range ~rollup_node_endpoint ~config ~latest_level_seen keep_alive; drop_duplicate; order_enabled; - tx_container; + tx_container = Ex_tx_container tx_container; } (module Handlers) in diff --git a/etherlink/bin_node/lib_dev/blueprints_publisher.mli b/etherlink/bin_node/lib_dev/blueprints_publisher.mli index b11d27891dcb..d7f01d571eb9 100644 --- a/etherlink/bin_node/lib_dev/blueprints_publisher.mli +++ b/etherlink/bin_node/lib_dev/blueprints_publisher.mli @@ -18,7 +18,7 @@ val start : keep_alive:bool -> drop_duplicate:bool -> order_enabled:bool -> - tx_container:L2_types.evm_chain_family Services_backend_sig.tx_container -> + tx_container:_ Services_backend_sig.tx_container -> unit -> unit tzresult Lwt.t -- GitLab From b1807d7bb227307046d61209d3bb563b9416a718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Mon, 23 Jun 2025 10:26:19 +0200 Subject: [PATCH 5/7] Etherlink/Block producer: move low-key optim to Etherlink branch The block producer short circuits transaction fetching once the blueprint under construction is full (remaining available space is less than the minimum size of a transaction). This is an Etherlink-specific optimization because it depends on the minimum size of an Ethereum transaction. This commit moves it to the Etherlink branch of pop_valid_tx. --- etherlink/bin_node/lib_dev/block_producer.ml | 86 ++++++++++---------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/etherlink/bin_node/lib_dev/block_producer.ml b/etherlink/bin_node/lib_dev/block_producer.ml index bc26514213c4..78416155f9dc 100644 --- a/etherlink/bin_node/lib_dev/block_producer.ml +++ b/etherlink/bin_node/lib_dev/block_producer.ml @@ -234,39 +234,48 @@ let pop_valid_tx (type f) ~(chain_family : f L2_types.chain_family) ~validate_tx:(fun () _ _ -> return (`Keep ())) ~initial_validation_state | EVM -> - let read = Evm_state.read head_info.evm_state in - let* minimum_base_fee_per_gas = - Etherlink_durable_storage.minimum_base_fee_per_gas read - in - let* base_fee_per_gas = Etherlink_durable_storage.base_fee_per_gas read in - let* maximum_gas_limit = - Etherlink_durable_storage.maximum_gas_per_transaction read - in - let* da_fee_per_byte = Etherlink_durable_storage.da_fee_per_byte read in - let config = - Validate. - { - minimum_base_fee_per_gas = Qty minimum_base_fee_per_gas; - base_fee_per_gas; - maximum_gas_limit; - da_fee_per_byte; - next_nonce = (fun addr -> Etherlink_durable_storage.nonce read addr); - balance = (fun addr -> Etherlink_durable_storage.balance read addr); - } - in - let initial_validation_state = - ( 0, + (* Low key optimization to avoid even checking the txpool if there is not + enough space for the smallest transaction. *) + if maximum_cumulative_size <= minimum_ethereum_transaction_size then + return [] + else + let read = Evm_state.read head_info.evm_state in + let* minimum_base_fee_per_gas = + Etherlink_durable_storage.minimum_base_fee_per_gas read + in + let* base_fee_per_gas = + Etherlink_durable_storage.base_fee_per_gas read + in + let* maximum_gas_limit = + Etherlink_durable_storage.maximum_gas_per_transaction read + in + let* da_fee_per_byte = Etherlink_durable_storage.da_fee_per_byte read in + let config = Validate. { - config; - addr_balance = String.Map.empty; - addr_nonce = String.Map.empty; - } ) - in - Tx_container.pop_transactions - ~maximum_cumulative_size - ~validate_tx:(validate_tx ~maximum_cumulative_size) - ~initial_validation_state + minimum_base_fee_per_gas = Qty minimum_base_fee_per_gas; + base_fee_per_gas; + maximum_gas_limit; + da_fee_per_byte; + next_nonce = + (fun addr -> Etherlink_durable_storage.nonce read addr); + balance = + (fun addr -> Etherlink_durable_storage.balance read addr); + } + in + let initial_validation_state = + ( 0, + Validate. + { + config; + addr_balance = String.Map.empty; + addr_nonce = String.Map.empty; + } ) + in + Tx_container.pop_transactions + ~maximum_cumulative_size + ~validate_tx:(validate_tx ~maximum_cumulative_size) + ~initial_validation_state (** Produces a block if we find at least one valid transaction in the transaction pool or if [force] is true. *) @@ -277,16 +286,11 @@ let produce_block_if_needed ~cctxt ~chain_family ~smart_rollup_address let open Lwt_result_syntax in let (Evm_tx_container (module Tx_container)) = tx_container in let* transactions_and_objects = - (* Low key optimization to avoid even checking the txpool if there is not - enough space for the smallest transaction. *) - if remaining_cumulative_size <= minimum_ethereum_transaction_size then - return [] - else - pop_valid_tx - ~chain_family - ~tx_container - head_info - ~maximum_cumulative_size:remaining_cumulative_size + pop_valid_tx + ~chain_family + ~tx_container + head_info + ~maximum_cumulative_size:remaining_cumulative_size in let n = List.length transactions_and_objects + List.length delayed_hashes in if force || n > 0 then -- GitLab From ee171f239e8cd70c3fae7bcb4ff4a7e0cc4f4d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Mon, 23 Jun 2025 09:21:55 +0200 Subject: [PATCH 6/7] Etherlink/Node: support Tezlink in block producer --- etherlink/bin_node/lib_dev/block_producer.ml | 117 ++++++++++++------ etherlink/bin_node/lib_dev/block_producer.mli | 3 +- etherlink/bin_node/lib_dev/sequencer.ml | 3 +- 3 files changed, 80 insertions(+), 43 deletions(-) diff --git a/etherlink/bin_node/lib_dev/block_producer.ml b/etherlink/bin_node/lib_dev/block_producer.ml index 78416155f9dc..c00fc2391693 100644 --- a/etherlink/bin_node/lib_dev/block_producer.ml +++ b/etherlink/bin_node/lib_dev/block_producer.ml @@ -10,8 +10,7 @@ type parameters = { smart_rollup_address : string; sequencer_key : Client_keys.sk_uri; maximum_number_of_chunks : int; - chain_family : L2_types.ex_chain_family; - tx_container : L2_types.evm_chain_family Services_backend_sig.tx_container; + tx_container : Services_backend_sig.ex_tx_container; } (* The size of a delayed transaction is overapproximated to the maximum size @@ -136,12 +135,12 @@ let take_delayed_transactions maximum_number_of_chunks = return (delayed_transactions, remaining_cumulative_size) let produce_block_with_transactions ~sequencer_key ~cctxt ~timestamp - ~smart_rollup_address ~transactions_and_objects ~delayed_hashes head_info = + ~smart_rollup_address ~transactions_and_objects ~delayed_hashes + ~hash_of_tx_object head_info = let open Lwt_result_syntax in let transactions, tx_hashes = List.to_seq transactions_and_objects - |> Seq.map (fun (raw, (obj : Ethereum_types.legacy_transaction_object)) -> - (raw, obj.hash)) + |> Seq.map (fun (raw, obj) -> (raw, hash_of_tx_object obj)) |> Seq.split |> fun (l, r) -> (List.of_seq l, List.of_seq r) in @@ -192,6 +191,38 @@ let produce_block_with_transactions ~sequencer_key ~cctxt ~timestamp in return confirmed_txs +type _ transaction_object_list = + | Evm_tx_objects : + (string * Ethereum_types.legacy_transaction_object) list + -> L2_types.evm_chain_family transaction_object_list + | Michelson_tx_objects : + (string * Tezos_types.Operation.t) list + -> L2_types.michelson_chain_family transaction_object_list + +let produce_block_with_transactions (type f) + ~(transactions_and_objects : f transaction_object_list option) + ~(tx_container : f Services_backend_sig.tx_container) = + match tx_container with + | Evm_tx_container (module Tx_container) -> + let transactions_and_objects = + match transactions_and_objects with + | None -> [] + | Some (Evm_tx_objects l) -> l + in + produce_block_with_transactions + ~transactions_and_objects + ~hash_of_tx_object: + Tx_queue_types.Eth_transaction_object.hash_of_tx_object + | Michelson_tx_container (module Tx_container) -> + let transactions_and_objects = + match transactions_and_objects with + | None -> [] + | Some (Michelson_tx_objects l) -> l + in + produce_block_with_transactions + ~transactions_and_objects + ~hash_of_tx_object:Tx_queue_types.Tezlink_operation.hash_of_tx_object + let validate_tx ~maximum_cumulative_size (current_size, validation_state) raw_tx (tx_object : Ethereum_types.legacy_transaction_object) = let open Lwt_result_syntax in @@ -219,25 +250,26 @@ let validate_tx ~maximum_cumulative_size (current_size, validation_state) raw_tx in return `Drop -let pop_valid_tx (type f) ~(chain_family : f L2_types.chain_family) - ~(tx_container : - L2_types.evm_chain_family Services_backend_sig.tx_container) - (head_info : Evm_context.head) ~maximum_cumulative_size = +let pop_valid_tx (type f) ~(tx_container : f Services_backend_sig.tx_container) + (head_info : Evm_context.head) ~maximum_cumulative_size : + f transaction_object_list tzresult Lwt.t = let open Lwt_result_syntax in - let (Evm_tx_container (module Tx_container)) = tx_container in (* Skip validation if chain_family is Michelson. *) - match chain_family with - | L2_types.Michelson -> + match tx_container with + | Michelson_tx_container (module Tx_container) -> let initial_validation_state = () in - Tx_container.pop_transactions - ~maximum_cumulative_size - ~validate_tx:(fun () _ _ -> return (`Keep ())) - ~initial_validation_state - | EVM -> + let* l = + Tx_container.pop_transactions + ~maximum_cumulative_size + ~validate_tx:(fun () _ _ -> return (`Keep ())) + ~initial_validation_state + in + return (Michelson_tx_objects l) + | Evm_tx_container (module Tx_container) -> (* Low key optimization to avoid even checking the txpool if there is not enough space for the smallest transaction. *) if maximum_cumulative_size <= minimum_ethereum_transaction_size then - return [] + return (Evm_tx_objects []) else let read = Evm_state.read head_info.evm_state in let* minimum_base_fee_per_gas = @@ -272,27 +304,32 @@ let pop_valid_tx (type f) ~(chain_family : f L2_types.chain_family) addr_nonce = String.Map.empty; } ) in - Tx_container.pop_transactions - ~maximum_cumulative_size - ~validate_tx:(validate_tx ~maximum_cumulative_size) - ~initial_validation_state + let* l = + Tx_container.pop_transactions + ~maximum_cumulative_size + ~validate_tx:(validate_tx ~maximum_cumulative_size) + ~initial_validation_state + in + return (Evm_tx_objects l) (** Produces a block if we find at least one valid transaction in the transaction pool or if [force] is true. *) -let produce_block_if_needed ~cctxt ~chain_family ~smart_rollup_address - ~sequencer_key ~force ~timestamp ~delayed_hashes ~remaining_cumulative_size - ~(tx_container : - L2_types.evm_chain_family Services_backend_sig.tx_container) head_info = +let produce_block_if_needed (type f) ~cctxt ~smart_rollup_address ~sequencer_key + ~force ~timestamp ~delayed_hashes ~remaining_cumulative_size + ~(tx_container : f Services_backend_sig.tx_container) head_info = let open Lwt_result_syntax in - let (Evm_tx_container (module Tx_container)) = tx_container in let* transactions_and_objects = pop_valid_tx - ~chain_family ~tx_container head_info ~maximum_cumulative_size:remaining_cumulative_size in - let n = List.length transactions_and_objects + List.length delayed_hashes in + let n_txs = + match transactions_and_objects with + | Evm_tx_objects l -> List.length l + | Michelson_tx_objects l -> List.length l + in + let n = n_txs + List.length delayed_hashes in if force || n > 0 then let* confirmed_txs = produce_block_with_transactions @@ -300,10 +337,14 @@ let produce_block_if_needed ~cctxt ~chain_family ~smart_rollup_address ~cctxt ~timestamp ~smart_rollup_address - ~transactions_and_objects + ~transactions_and_objects:(Some transactions_and_objects) ~delayed_hashes + ~tx_container head_info in + let (module Tx_container) = + Services_backend_sig.tx_container_module tx_container + in let* () = Tx_container.confirm_transactions ~clear_pending_queue_after:true @@ -330,9 +371,9 @@ let head_info_and_delayed_transactions ~with_delayed_transactions let*! head_info = Evm_context.head_info () in return (head_info, delayed_hashes, remaining_cumulative_size) -let produce_block ~chain_family ~cctxt ~smart_rollup_address ~sequencer_key - ~force ~timestamp ~maximum_number_of_chunks ~with_delayed_transactions - ~tx_container = +let produce_block (type f) ~cctxt ~smart_rollup_address ~sequencer_key ~force + ~timestamp ~maximum_number_of_chunks ~with_delayed_transactions + ~(tx_container : f Services_backend_sig.tx_container) = let open Lwt_result_syntax in let (module Tx_container) = Services_backend_sig.tx_container_module tx_container @@ -360,16 +401,16 @@ let produce_block ~chain_family ~cctxt ~smart_rollup_address ~sequencer_key ~cctxt ~timestamp ~smart_rollup_address - ~transactions_and_objects:[] + ~transactions_and_objects:None ~delayed_hashes:[] + ~tx_container head_info in - (* Is always be zero, only to be "future" proof *) + (* (Seq.length hashes) is always zero, this is only to be "future" proof *) return (`Block_produced (Seq.length hashes)) else produce_block_if_needed ~cctxt - ~chain_family ~sequencer_key ~timestamp ~smart_rollup_address @@ -396,13 +437,11 @@ module Handlers = struct smart_rollup_address; sequencer_key; maximum_number_of_chunks; - chain_family = Ex_chain_family chain_family; - tx_container; + tx_container = Ex_tx_container tx_container; } = state in produce_block - ~chain_family ~cctxt ~smart_rollup_address ~sequencer_key diff --git a/etherlink/bin_node/lib_dev/block_producer.mli b/etherlink/bin_node/lib_dev/block_producer.mli index 1087f05b5926..c4f143769b3f 100644 --- a/etherlink/bin_node/lib_dev/block_producer.mli +++ b/etherlink/bin_node/lib_dev/block_producer.mli @@ -10,8 +10,7 @@ type parameters = { smart_rollup_address : string; sequencer_key : Client_keys.sk_uri; maximum_number_of_chunks : int; - chain_family : L2_types.ex_chain_family; - tx_container : L2_types.evm_chain_family Services_backend_sig.tx_container; + tx_container : Services_backend_sig.ex_tx_container; } (** [start parameters] starts the events follower. *) diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index ed04f62366b5..1b3e17cabf92 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -404,8 +404,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt smart_rollup_address = smart_rollup_address_b58; sequencer_key = sequencer_config.sequencer; maximum_number_of_chunks = sequencer_config.max_number_of_chunks; - chain_family = Ex_chain_family chain_family; - tx_container; + tx_container = Ex_tx_container tx_container; } in let* () = -- GitLab From 66e018fcdf280971d4d6bf1f4d08917afd45b946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Mon, 23 Jun 2025 08:50:59 +0200 Subject: [PATCH 7/7] Etherlink/Node/Sequencer: support Tezlink --- etherlink/bin_node/lib_dev/sequencer.ml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index 1b3e17cabf92..cd6363d01c5c 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -208,6 +208,13 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt init_from_snapshot | None -> Result.return_none in + (* TODO: https://gitlab.com/tezos/tezos/-/issues/7859 + For now we assume that there is a single L2 chain. We should + iterate when multichain *) + let (Ex_chain_family chain_family) = + Configuration.retrieve_chain_family + ~l2_chains:configuration.experimental_features.l2_chains + in (* The Tx_pool parameters are ignored by the start function when a Tx_queue is configured. @@ -216,7 +223,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt let open Result_syntax in match configuration.experimental_features.enable_tx_queue with | Some tx_queue_config -> - let start, tx_container = Tx_queue.tx_container ~chain_family:EVM in + let start, tx_container = Tx_queue.tx_container ~chain_family in return ( (fun ~tx_pool_parameters:_ -> start @@ -225,7 +232,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt ()), tx_container ) | None -> - let* tx_container = Tx_pool.tx_container ~chain_family:EVM in + let* tx_container = Tx_pool.tx_container ~chain_family in return (Tx_pool.start, tx_container) in let (module Tx_container) = @@ -342,11 +349,6 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt in let* () = if status = Created then - (* TODO: We should iterate when multichain https://gitlab.com/tezos/tezos/-/issues/7859 *) - let (Ex_chain_family chain_family) = - Configuration.retrieve_chain_family - ~l2_chains:configuration.experimental_features.l2_chains - in (* Create the first empty block. *) let* genesis_chunks = Sequencer_blueprint.prepare @@ -375,7 +377,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt let backend = Evm_ro_context.ro_backend ro_ctxt configuration in let* enable_multichain = Evm_ro_context.read_enable_multichain_flag ro_ctxt in - let* l2_chain_id, Ex_chain_family chain_family = + let* l2_chain_id, _chain_family = let (module Backend) = backend in Backend.single_chain_id_and_family ~config:configuration ~enable_multichain in @@ -433,7 +435,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt ~data_dir ~rpc_server_family: (if enable_multichain then Rpc_types.Multichain_sequencer_rpc_server - else Rpc_types.Single_chain_node_rpc_server EVM) + else Rpc_types.Single_chain_node_rpc_server chain_family) (* When the tx_queue is enabled the validation is done in the block_producer instead of in the RPC. This allows for a more accurate validation as it's delayed up to when the block is @@ -447,7 +449,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt Rpc_server.start_private_server ~rpc_server_family: (if enable_multichain then Rpc_types.Multichain_sequencer_rpc_server - else Rpc_types.Single_chain_node_rpc_server EVM) + else Rpc_types.Single_chain_node_rpc_server chain_family) ~block_production:`Single_node configuration tx_container -- GitLab