From f0db4f606ce4dcfc6011d542e1a0113d9ce10b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cauderlier?= Date: Wed, 30 Apr 2025 23:45:14 +0200 Subject: [PATCH] Etherlink/Node/Tx_queue: propagate the Name module This commit is needed to avoid registration conflict when the Tx_container module will be instantiated several times (once for Etherlink and once for Tezlink). Each instantiation of the Tx_container functor leads to the registration of the tx_queue_is_closed error and some events. They need to have a different id each time they are registered, which we can achieve by using different `Name` modules (and in particular different `Name.base` lists). --- etherlink/bin_node/lib_dev/tx_queue.ml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/etherlink/bin_node/lib_dev/tx_queue.ml b/etherlink/bin_node/lib_dev/tx_queue.ml index d339c26cb8ce..d672117f1bd4 100644 --- a/etherlink/bin_node/lib_dev/tx_queue.ml +++ b/etherlink/bin_node/lib_dev/tx_queue.ml @@ -249,7 +249,12 @@ module Address_nonce = struct | None -> return next_nonce end -module Tx_container (Tx : Tx_queue_types.L2_transaction) = struct +module Tx_container + (Tx : Tx_queue_types.L2_transaction) + (ChainName : sig + val chain_name : string + end) = +struct module Transaction_objects = struct open Ethereum_types module S = String.Hashtbl @@ -359,7 +364,7 @@ module Tx_container (Tx : Tx_queue_types.L2_transaction) = struct let encoding = Data_encoding.unit - let base = ["evm_node_worker"; "tx_queue"] + let base = ["evm_node_worker"; "tx_queue"; ChainName.chain_name] let pp _fmt () = () @@ -1056,7 +1061,7 @@ module Tx_container (Tx : Tx_queue_types.L2_transaction) = struct let () = register_error_kind `Permanent - ~id:"tx_queue_is_closed" + ~id:(Format.sprintf "tx_queue_%s_is_closed" ChainName.chain_name) ~title:"Tx_queue_is_closed" ~description:"Failed to add a request to the Tx queue, it's closed." Data_encoding.unit @@ -1197,7 +1202,12 @@ module Tx_container (Tx : Tx_queue_types.L2_transaction) = struct return_unit end -module Eth_tx_container = Tx_container (Tx_queue_types.Eth_transaction_object) +module Eth_tx_container = + Tx_container + (Tx_queue_types.Eth_transaction_object) + (struct + let chain_name = "etherlink" + end) let start = Eth_tx_container.start -- GitLab