From 2b61962a3514bbc88a05e5e185a6e081cf69cbe4 Mon Sep 17 00:00:00 2001 From: arnaud Date: Wed, 2 Apr 2025 14:26:41 +0200 Subject: [PATCH 01/11] Etherlink/Kernel: Kernel correction Use the to_bytes function to produce the hash of a Tezos block and add a missing '}' for Michelson chain family --- etherlink/kernel_latest/kernel/src/chains.rs | 2 +- etherlink/kernel_latest/tezos/src/block.rs | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/etherlink/kernel_latest/kernel/src/chains.rs b/etherlink/kernel_latest/kernel/src/chains.rs index 911a973aaa90..7f82548251e7 100644 --- a/etherlink/kernel_latest/kernel/src/chains.rs +++ b/etherlink/kernel_latest/kernel/src/chains.rs @@ -136,7 +136,7 @@ impl std::fmt::Display for ChainConfig { ChainConfig::Michelson(chain_config) => { write!( f, - "{{Chain id: {}, Chain family: {}", + "{{Chain id: {}, Chain family: {}}}", chain_config.chain_id, ChainFamily::Michelson ) diff --git a/etherlink/kernel_latest/tezos/src/block.rs b/etherlink/kernel_latest/tezos/src/block.rs index 64725fb67b78..85de6ceff40f 100644 --- a/etherlink/kernel_latest/tezos/src/block.rs +++ b/etherlink/kernel_latest/tezos/src/block.rs @@ -25,17 +25,8 @@ impl TezBlock { } fn hash(&self) -> H256 { - let Self { - hash: _, - number, - timestamp, - previous_hash, - } = self; - let mut data = number.to_string(); - data.push_str(×tamp.i64().to_string()); - data.push_str(&previous_hash.to_string()); - let encoded_data = hex::encode(&data); - let hashed_data = digest_256(encoded_data.as_bytes()); + let encoded_data = self.to_bytes(); + let hashed_data = digest_256(&encoded_data); H256::from_slice(&hashed_data) } -- GitLab From 8ae01cb708b6df9b0e06233899909aa85fb82a22 Mon Sep 17 00:00:00 2001 From: arnaud Date: Mon, 17 Mar 2025 18:13:46 +0100 Subject: [PATCH 02/11] Evm/Tezlink/Node: apply_blueprint takes a chain_family to know how the block should be decoded --- etherlink/bin_node/config/configuration.ml | 6 ++++++ etherlink/bin_node/config/configuration.mli | 7 +++++++ etherlink/bin_node/lib_dev/evm_context.ml | 6 ++++++ etherlink/bin_node/lib_dev/evm_ro_context.ml | 1 + etherlink/bin_node/lib_dev/evm_state.ml | 7 ++++--- etherlink/bin_node/lib_dev/evm_state.mli | 1 + 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/etherlink/bin_node/config/configuration.ml b/etherlink/bin_node/config/configuration.ml index 03ca84194df8..4276d412fcdf 100644 --- a/etherlink/bin_node/config/configuration.ml +++ b/etherlink/bin_node/config/configuration.ml @@ -229,6 +229,12 @@ type t = { let is_tx_queue_enabled {experimental_features = {enable_tx_queue; _}; _} = Option.is_some enable_tx_queue +let retrieve_chain_family ~l2_chains = + match l2_chains with + | Some [l2_chain] -> l2_chain.chain_family + | None -> L2_types.EVM + | _ -> assert false + let default_filter_config ?max_nb_blocks ?max_nb_logs ?chunk_size () = { max_nb_blocks = Option.value ~default:100 max_nb_blocks; diff --git a/etherlink/bin_node/config/configuration.mli b/etherlink/bin_node/config/configuration.mli index bf0f7f62548f..3c266e6d9ca8 100644 --- a/etherlink/bin_node/config/configuration.mli +++ b/etherlink/bin_node/config/configuration.mli @@ -201,6 +201,13 @@ type t = { val is_tx_queue_enabled : t -> bool +(** [chain_family_from_l2_chains t] returns the chain_family in + the experimental feature if there's only one chain. + + This function will be removed when multichain is implemented *) +val retrieve_chain_family : + l2_chains:l2_chain list option -> L2_types.chain_family + val history_mode_encoding : history_mode Data_encoding.t val pp_history_mode_debug : Format.formatter -> history_mode -> unit diff --git a/etherlink/bin_node/lib_dev/evm_context.ml b/etherlink/bin_node/lib_dev/evm_context.ml index 360722d9b463..42d0c7b16336 100644 --- a/etherlink/bin_node/lib_dev/evm_context.ml +++ b/etherlink/bin_node/lib_dev/evm_context.ml @@ -673,6 +673,11 @@ module State = struct let time_processed = ref Ptime.Span.zero in + (* TODO: We should iterate when multichain https://gitlab.com/tezos/tezos/-/issues/7859 *) + let chain_family = + Configuration.retrieve_chain_family + ~l2_chains:ctxt.configuration.experimental_features.l2_chains + in let* try_apply = Misc.with_timing (fun time -> Lwt.return (time_processed := time)) @@ -682,6 +687,7 @@ module State = struct ctxt.configuration.kernel_execution.native_execution_policy ~wasm_pvm_fallback:(not @@ List.is_empty delayed_transactions) ~data_dir + ~chain_family ~config ctxt.session.evm_state payload) diff --git a/etherlink/bin_node/lib_dev/evm_ro_context.ml b/etherlink/bin_node/lib_dev/evm_ro_context.ml index 7259149cd5d2..097439e05a21 100644 --- a/etherlink/bin_node/lib_dev/evm_ro_context.ml +++ b/etherlink/bin_node/lib_dev/evm_ro_context.ml @@ -435,6 +435,7 @@ let replay ctxt ?(log_file = "replay") ?profile ~log_file ?profile ~data_dir:ctxt.data_dir + ~chain_family:EVM ~config:(pvm_config ctxt) ~native_execution_policy:ctxt.native_execution_policy evm_state diff --git a/etherlink/bin_node/lib_dev/evm_state.ml b/etherlink/bin_node/lib_dev/evm_state.ml index b27c6cf8224e..031927fa6a24 100644 --- a/etherlink/bin_node/lib_dev/evm_state.ml +++ b/etherlink/bin_node/lib_dev/evm_state.ml @@ -305,8 +305,9 @@ type apply_result = } | Apply_failure -let apply_blueprint ?wasm_pvm_fallback ?log_file ?profile ~data_dir ~config - ~native_execution_policy evm_state (blueprint : Blueprint_types.payload) = +let apply_blueprint ?wasm_pvm_fallback ?log_file ?profile ~data_dir + ~chain_family ~config ~native_execution_policy evm_state + (blueprint : Blueprint_types.payload) = let open Lwt_result_syntax in let exec_inputs = List.map @@ -331,7 +332,7 @@ let apply_blueprint ?wasm_pvm_fallback ?log_file ?profile ~data_dir ~config let*! bytes = inspect evm_state (Durable_storage_path.Block.by_hash block_hash) in - return (Option.map (L2_types.block_from_bytes ~chain_family:EVM) bytes) + return (Option.map (L2_types.block_from_bytes ~chain_family) bytes) in let export_gas_used (Qty gas) = match (profile, log_file) with diff --git a/etherlink/bin_node/lib_dev/evm_state.mli b/etherlink/bin_node/lib_dev/evm_state.mli index 48e3c21b463a..a2fd006904a2 100644 --- a/etherlink/bin_node/lib_dev/evm_state.mli +++ b/etherlink/bin_node/lib_dev/evm_state.mli @@ -99,6 +99,7 @@ val apply_blueprint : ?log_file:string -> ?profile:bool -> data_dir:string -> + chain_family:L2_types.chain_family -> config:Wasm_debugger.config -> native_execution_policy:Configuration.native_execution_policy -> t -> -- GitLab From 40d37db13fed93222d8705f8d1af6f4290767076 Mon Sep 17 00:00:00 2001 From: arnaud Date: Tue, 18 Mar 2025 11:28:14 +0100 Subject: [PATCH 03/11] Evm/Tezlink/Node: Load the context takes a list of chains In the future when the evm_node will be able to support multichain, instead of returning one current hash, it should return the list of current hash for all chains supported by the node --- etherlink/bin_node/lib_dev/evm_context.ml | 35 +++++++++++++++++++---- etherlink/bin_node/lib_dev/evm_state.ml | 6 ++-- etherlink/bin_node/lib_dev/evm_state.mli | 5 +++- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/etherlink/bin_node/lib_dev/evm_context.ml b/etherlink/bin_node/lib_dev/evm_context.ml index 42d0c7b16336..34f7e31f01a3 100644 --- a/etherlink/bin_node/lib_dev/evm_context.ml +++ b/etherlink/bin_node/lib_dev/evm_context.ml @@ -249,16 +249,20 @@ module State = struct Lwt.wakeup head_info_waker first_head end - let load ~data_dir ~store_perm:perm index = + let load ~l2_chains ~data_dir ~store_perm:perm index = let open Lwt_result_syntax in let* store = Evm_store.init ~data_dir ~perm () in Evm_store.use store @@ fun conn -> let* latest = Evm_store.Context_hashes.find_latest conn in + (* TODO: We should iterate when multichain https://gitlab.com/tezos/tezos/-/issues/7859 *) + let chain_family = Configuration.retrieve_chain_family ~l2_chains in match latest with | Some (Qty latest_blueprint_number, checkpoint) -> let*! context = Irmin_context.checkout_exn index checkpoint in let*! evm_state = Irmin_context.PVMState.get context in - let+ current_block_hash = Evm_state.current_block_hash evm_state in + let+ current_block_hash = + Evm_state.current_block_hash ~chain_family evm_state + in ( store, context, Ethereum_types.Qty Z.(succ latest_blueprint_number), @@ -266,11 +270,12 @@ module State = struct Loaded ) | None -> let context = Irmin_context.empty index in + let genesis_parent_hash = L2_types.genesis_parent_hash ~chain_family in return ( store, context, Ethereum_types.Qty Z.zero, - L2_types.genesis_parent_hash ~chain_family:EVM, + genesis_parent_hash, Created ) let commit store (context : Irmin_context.rw) evm_state number = @@ -475,7 +480,14 @@ module State = struct let* pending_upgrade = Evm_store.Kernel_upgrades.find_latest_pending conn in (* Update mutable session values. *) let next_blueprint_number = Ethereum_types.Qty.next l2_level in - let* current_block_hash = Evm_state.current_block_hash evm_state in + (* TODO: We should iterate when multichain https://gitlab.com/tezos/tezos/-/issues/7859 *) + let chain_family = + Configuration.retrieve_chain_family + ~l2_chains:ctxt.configuration.experimental_features.l2_chains + in + let* current_block_hash = + Evm_state.current_block_hash ~chain_family evm_state + in ctxt.session.next_blueprint_number <- next_blueprint_number ; ctxt.session.evm_state <- evm_state ; ctxt.session.current_block_hash <- current_block_hash ; @@ -1135,8 +1147,15 @@ module State = struct let* () = clear_head_delayed_inbox ctxt in (* Prepare an event list to be reapplied on current head *) let events = Evm_events.of_parts delayed_transactions lost_upgrade in + (* TODO: We should iterate when multichain https://gitlab.com/tezos/tezos/-/issues/7859 *) + let chain_family = + Configuration.retrieve_chain_family + ~l2_chains:ctxt.configuration.experimental_features.l2_chains + in (* Prepare a blueprint payload signed by the sequencer to execute locally. *) - let* parent_hash = Evm_state.current_block_hash ctxt.session.evm_state in + let* parent_hash = + Evm_state.current_block_hash ~chain_family ctxt.session.evm_state + in let* payload = prepare_local_flushed_blueprint ctxt parent_hash flushed_blueprint in @@ -1352,7 +1371,11 @@ module State = struct let* index = irmin_load ?snapshot_url ~data_dir configuration in let* store, context, next_blueprint_number, current_block_hash, init_status = - load ~data_dir ~store_perm index + load + ~l2_chains:configuration.experimental_features.l2_chains + ~data_dir + ~store_perm + index in Evm_store.use store @@ fun conn -> let* () = diff --git a/etherlink/bin_node/lib_dev/evm_state.ml b/etherlink/bin_node/lib_dev/evm_state.ml index 031927fa6a24..aad863899b2c 100644 --- a/etherlink/bin_node/lib_dev/evm_state.ml +++ b/etherlink/bin_node/lib_dev/evm_state.ml @@ -221,14 +221,14 @@ let current_block_height evm_state = let (Qty current_block_number) = decode_number_le current_block_number in return (Qty current_block_number) -let current_block_hash evm_state = +let current_block_hash ~chain_family evm_state = let open Lwt_result_syntax in let*! current_hash = inspect evm_state Durable_storage_path.Block.current_hash in match current_hash with | Some h -> return (decode_block_hash h) - | None -> return (L2_types.genesis_parent_hash ~chain_family:EVM) + | None -> return (L2_types.genesis_parent_hash ~chain_family) (* The Fast Execution engine relies on Lwt_preemptive to execute Wasmer in dedicated worker threads (`Lwt_preemptive.detach`), while pushing to lwt @@ -327,7 +327,7 @@ let apply_blueprint ?wasm_pvm_fallback ?log_file ?profile ~data_dir evm_state exec_inputs in - let* block_hash = current_block_hash evm_state in + let* block_hash = current_block_hash ~chain_family evm_state in let* block = let*! bytes = inspect evm_state (Durable_storage_path.Block.by_hash block_hash) diff --git a/etherlink/bin_node/lib_dev/evm_state.mli b/etherlink/bin_node/lib_dev/evm_state.mli index a2fd006904a2..efe5fe75fb31 100644 --- a/etherlink/bin_node/lib_dev/evm_state.mli +++ b/etherlink/bin_node/lib_dev/evm_state.mli @@ -77,7 +77,10 @@ val execute_and_inspect : val current_block_height : t -> Ethereum_types.quantity Lwt.t (** Same as {!current_block_height} for the block hash. *) -val current_block_hash : t -> Ethereum_types.block_hash tzresult Lwt.t +val current_block_hash : + chain_family:L2_types.chain_family -> + t -> + Ethereum_types.block_hash tzresult Lwt.t type apply_result = | Apply_success of { -- GitLab From 6c984b0918d16f4b8651b581260162275915da0b Mon Sep 17 00:00:00 2001 From: arnaud Date: Tue, 18 Mar 2025 11:34:39 +0100 Subject: [PATCH 04/11] Evm/Tezlink/Node: Generating the right genesis chunks depending on the chain family Later in multichain, this should produce multiple genesis chunks (one for each chain) --- etherlink/bin_node/lib_dev/sequencer.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index 482e5f0d1dfe..76eac22422f2 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -170,6 +170,11 @@ 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 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 @@ -179,7 +184,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt ~transactions:[] ~delayed_transactions:[] ~number:Ethereum_types.(Qty Z.zero) - ~parent_hash:(L2_types.genesis_parent_hash ~chain_family:EVM) + ~parent_hash:(L2_types.genesis_parent_hash ~chain_family) in let genesis_payload = Sequencer_blueprint.create_inbox_payload -- GitLab From c48393c515a51614d346ddacd6f859e2565dff02 Mon Sep 17 00:00:00 2001 From: arnaud Date: Tue, 18 Mar 2025 11:47:50 +0100 Subject: [PATCH 05/11] EVM/Tezlink/Node: Get irmin hash takes a chain family to know how it should decode the block This commit parametrize get_irmin_hash_from_block_hash but the call to get_irmin_hash force the node to think it's in etherlink mode. The variant branch Block_hash where get_irmin_hash is call is a parameter specific to ethereum so we are naturally in EVM mode. For tezlink we'll call get_irmin_hash in another function. --- etherlink/bin_node/lib_dev/evm_ro_context.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etherlink/bin_node/lib_dev/evm_ro_context.ml b/etherlink/bin_node/lib_dev/evm_ro_context.ml index 097439e05a21..df9656a4c9ae 100644 --- a/etherlink/bin_node/lib_dev/evm_ro_context.ml +++ b/etherlink/bin_node/lib_dev/evm_ro_context.ml @@ -156,7 +156,7 @@ let get_irmin_hash_from_number ctxt number = Ethereum_types.pp_quantity number -let get_irmin_hash_from_block_hash ctxt hash = +let get_irmin_hash_from_block_hash ~chain_family ctxt hash = let open Lwt_result_syntax in (* we use the latest state to read the contents of the block *) let* latest_hash = find_latest_hash ctxt in @@ -166,7 +166,7 @@ let get_irmin_hash_from_block_hash ctxt hash = in match res with | Some block_bytes -> - let block = L2_types.block_from_bytes ~chain_family:EVM block_bytes in + let block = L2_types.block_from_bytes ~chain_family block_bytes in get_irmin_hash_from_number ctxt (L2_types.block_number block) | None -> failwith "Unknown block %a" Ethereum_types.pp_block_hash hash @@ -203,7 +203,7 @@ let find_irmin_hash ctxt (block : Ethereum_types.Block_parameter.extended) = match context_hash_opt with | Some context_hash -> return context_hash | None -> failwith "Unknown block %a" Ethereum_types.pp_block_hash hash - else get_irmin_hash_from_block_hash ctxt hash + else get_irmin_hash_from_block_hash ~chain_family:L2_types.EVM ctxt hash module MakeBackend (Ctxt : sig val ctxt : t -- GitLab From 11f980709776107310c5c0ac13313ea07d5d4272 Mon Sep 17 00:00:00 2001 From: arnaud Date: Wed, 19 Mar 2025 17:29:21 +0100 Subject: [PATCH 06/11] EVM/Tezlink/Node: Deactivate pop_transactions if chain_family is Michelson Pass the l2_chains in the parameter of block_producer worker --- etherlink/bin_node/lib_dev/block_producer.ml | 18 ++++++--- etherlink/bin_node/lib_dev/block_producer.mli | 1 + etherlink/bin_node/lib_dev/sequencer.ml | 1 + etherlink/bin_node/lib_dev/tx_pool.ml | 39 +++++++++++-------- etherlink/bin_node/lib_dev/tx_pool.mli | 8 ++-- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/etherlink/bin_node/lib_dev/block_producer.ml b/etherlink/bin_node/lib_dev/block_producer.ml index 2debcf02a78f..7b86cbc979ff 100644 --- a/etherlink/bin_node/lib_dev/block_producer.ml +++ b/etherlink/bin_node/lib_dev/block_producer.ml @@ -11,6 +11,7 @@ type parameters = { sequencer_key : Client_keys.sk_uri; maximum_number_of_chunks : int; uses_tx_queue : bool; + l2_chains : Configuration.l2_chain list option; } (* The size of a delayed transaction is overapproximated to the maximum size @@ -244,9 +245,9 @@ let tx_queue_pop_valid_tx (head_info : Evm_context.head) (** 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 ~smart_rollup_address ~sequencer_key ~force - ~timestamp ~delayed_hashes ~remaining_cumulative_size ~uses_tx_queue - head_info = +let produce_block_if_needed ~cctxt ~l2_chains ~smart_rollup_address + ~sequencer_key ~force ~timestamp ~delayed_hashes ~remaining_cumulative_size + ~uses_tx_queue head_info = let open Lwt_result_syntax in let* transactions_and_objects = (* Low key optimization to avoid even checking the txpool if there is not @@ -258,7 +259,10 @@ let produce_block_if_needed ~cctxt ~smart_rollup_address ~sequencer_key ~force head_info ~maximum_cumulative_size:remaining_cumulative_size else + (* TODO: We should iterate when multichain https://gitlab.com/tezos/tezos/-/issues/7859 *) + let chain_family = Configuration.retrieve_chain_family ~l2_chains in Tx_pool.pop_transactions + ~chain_family ~maximum_cumulative_size:remaining_cumulative_size in let n = List.length transactions_and_objects + List.length delayed_hashes in @@ -301,8 +305,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 ~uses_tx_queue ~cctxt ~smart_rollup_address ~sequencer_key - ~force ~timestamp ~maximum_number_of_chunks ~with_delayed_transactions = +let produce_block ~l2_chains ~uses_tx_queue ~cctxt ~smart_rollup_address + ~sequencer_key ~force ~timestamp ~maximum_number_of_chunks + ~with_delayed_transactions = let open Lwt_result_syntax in let* is_locked = if uses_tx_queue then Tx_queue.is_locked () else Tx_pool.is_locked () @@ -338,6 +343,7 @@ let produce_block ~uses_tx_queue ~cctxt ~smart_rollup_address ~sequencer_key else produce_block_if_needed ~cctxt + ~l2_chains ~sequencer_key ~timestamp ~smart_rollup_address @@ -365,10 +371,12 @@ module Handlers = struct sequencer_key; maximum_number_of_chunks; uses_tx_queue; + l2_chains; } = state in produce_block + ~l2_chains ~uses_tx_queue ~cctxt ~smart_rollup_address diff --git a/etherlink/bin_node/lib_dev/block_producer.mli b/etherlink/bin_node/lib_dev/block_producer.mli index 39ad2455b48a..877f1b1857f2 100644 --- a/etherlink/bin_node/lib_dev/block_producer.mli +++ b/etherlink/bin_node/lib_dev/block_producer.mli @@ -11,6 +11,7 @@ type parameters = { sequencer_key : Client_keys.sk_uri; maximum_number_of_chunks : int; uses_tx_queue : bool; + l2_chains : Configuration.l2_chain list option; } (** [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 76eac22422f2..509a1dc4e602 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -240,6 +240,7 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt sequencer_key = sequencer_config.sequencer; maximum_number_of_chunks = sequencer_config.max_number_of_chunks; uses_tx_queue = Configuration.is_tx_queue_enabled configuration; + l2_chains = configuration.experimental_features.l2_chains; } in let* () = diff --git a/etherlink/bin_node/lib_dev/tx_pool.ml b/etherlink/bin_node/lib_dev/tx_pool.ml index b0d5914032ff..7a1c86a4a9f3 100644 --- a/etherlink/bin_node/lib_dev/tx_pool.ml +++ b/etherlink/bin_node/lib_dev/tx_pool.ml @@ -268,7 +268,11 @@ module Request = struct Ethereum_types.legacy_transaction_object * string -> ((Ethereum_types.hash, string) result, tztrace) t | Pop_transactions : - int + (* TODO: https://gitlab.com/tezos/tezos/-/issues/7889 *) + (* We need the chain_family to verify if we are in Tezlink mode *) + (* If so, deactivate the pop_transactions and returns an empty list *) + L2_types.chain_family + * int -> ((string * Ethereum_types.legacy_transaction_object) list, tztrace) t | Pop_and_inject_transactions : (unit, tztrace) t | Lock_transactions : (unit, tztrace) t @@ -306,15 +310,16 @@ module Request = struct case (Tag 1) ~title:"Pop_transactions" - (obj2 + (obj3 (req "request" (constant "pop_transactions")) + (req "chain_family" L2_types.Chain_family.encoding) (req "maximum_cumulatize_size" int31)) (function - | View (Pop_transactions maximum_cumulative_size) -> - Some ((), maximum_cumulative_size) + | View (Pop_transactions (chain_family, maximum_cumulative_size)) -> + Some ((), chain_family, maximum_cumulative_size) | _ -> None) - (fun ((), maximum_cumulative_size) -> - View (Pop_transactions maximum_cumulative_size)); + (fun ((), chain_family, maximum_cumulative_size) -> + View (Pop_transactions (chain_family, maximum_cumulative_size))); case (Tag 2) ~title:"Pop_and_inject_transactions" @@ -368,7 +373,7 @@ module Request = struct ppf "Add tx [%s] to tx-pool" (Hex.of_string tx_raw |> Hex.show) - | Pop_transactions maximum_cumulative_size -> + | Pop_transactions (_chain_family, maximum_cumulative_size) -> Format.fprintf ppf "Popping transactions of maximum cumulative size %d bytes" @@ -488,7 +493,7 @@ let transaction_timed_out ~tx_timeout_limit ~current_timestamp ~inclusion_timestamp = Time.Protocol.diff current_timestamp inclusion_timestamp >= tx_timeout_limit -let pop_transactions state ~maximum_cumulative_size = +let pop_transactions state ~chain_family ~maximum_cumulative_size = let open Lwt_result_syntax in let Types. { @@ -500,7 +505,7 @@ let pop_transactions state ~maximum_cumulative_size = } = state in - if locked then return [] + if locked || chain_family = L2_types.Michelson then return [] else (* Get all the addresses in the tx-pool. *) let addresses = Pool.addresses pool in @@ -618,7 +623,7 @@ let clear_popped_transactions state = state.Types.popped_txs <- [] are forwarded to a rollup node, in observer mode to the next evm node. The sequencer is not supposed to use this function, using it would make transaction disappear from the tx pool. *) -let pop_and_inject_transactions state = +let pop_and_inject_transactions ~chain_family state = let open Lwt_result_syntax in let open Types in (* We over approximate the number of transactions to pop in proxy and @@ -629,7 +634,7 @@ let pop_and_inject_transactions state = Sequencer_blueprint.maximum_usable_space_in_blueprint Sequencer_blueprint.maximum_chunks_per_l1_level in - let* txs = pop_transactions state ~maximum_cumulative_size in + let* txs = pop_transactions state ~chain_family ~maximum_cumulative_size in if not (List.is_empty txs) then let (module Backend : Services_backend_sig.S) = state.backend in let*! hashes = @@ -710,10 +715,12 @@ module Handlers = struct let* res = insert_valid_transaction state txn transaction_object in let* () = relay_self_inject_request w in return res - | Request.Pop_transactions maximum_cumulative_size -> - protect @@ fun () -> pop_transactions state ~maximum_cumulative_size + | Request.Pop_transactions (chain_family, maximum_cumulative_size) -> + protect @@ fun () -> + pop_transactions state ~chain_family ~maximum_cumulative_size | Request.Pop_and_inject_transactions -> - protect @@ fun () -> pop_and_inject_transactions state + protect @@ fun () -> + pop_and_inject_transactions ~chain_family:L2_types.EVM state | Request.Lock_transactions -> protect @@ fun () -> return (lock_transactions state) | Request.Unlock_transactions -> return (unlock_transactions state) @@ -830,12 +837,12 @@ let nonce pkey = in Pool.next_nonce pkey current_nonce pool -let pop_transactions ~maximum_cumulative_size = +let pop_transactions ~chain_family ~maximum_cumulative_size = let open Lwt_result_syntax in let*? worker = Lazy.force worker in Worker.Queue.push_request_and_wait worker - (Request.Pop_transactions maximum_cumulative_size) + (Request.Pop_transactions (chain_family, maximum_cumulative_size)) |> handle_request_error let pop_and_inject_transactions () = diff --git a/etherlink/bin_node/lib_dev/tx_pool.mli b/etherlink/bin_node/lib_dev/tx_pool.mli index 76f6fac292a0..f5c47df8c24b 100644 --- a/etherlink/bin_node/lib_dev/tx_pool.mli +++ b/etherlink/bin_node/lib_dev/tx_pool.mli @@ -44,10 +44,12 @@ val add : if no transactions are in the pool. *) val nonce : Ethereum_types.Address.t -> Ethereum_types.quantity tzresult Lwt.t -(** [pop_transactions maximum_cumulative_size] pops as much valid transactions - as possible from the pool, until their cumulative size exceeds - `maximum_cumulative_size`. Returns no transactions if the pool is locked. *) +(** [pop_transactions chain_family maximum_cumulative_size] pops as much + valid transactions as possible from the pool, until their cumulative + size exceeds `maximum_cumulative_size`. If the pool is locked or node + in tezlink mode, returns no transactions. *) val pop_transactions : + chain_family:L2_types.chain_family -> maximum_cumulative_size:int -> (string * Ethereum_types.legacy_transaction_object) list tzresult Lwt.t -- GitLab From 5dd520e18fd2fb1a20c3b49abf8cd67217824025 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 13 Mar 2025 13:34:18 +0100 Subject: [PATCH 07/11] Tezlink/Tezt: A tezt that setup the kernel and noe in tezlink and make the chain progress For now we need to patch the node configuration to force the node to expect tezlink block (otherwise apply blueprint function would fail because it can't decode the produced block) --- etherlink/tezt/lib/setup.ml | 8 ++++++++ etherlink/tezt/tests/evm_sequencer.ml | 27 ++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/etherlink/tezt/lib/setup.ml b/etherlink/tezt/lib/setup.ml index 7aa83c189986..e907c76962fb 100644 --- a/etherlink/tezt/lib/setup.ml +++ b/etherlink/tezt/lib/setup.ml @@ -337,8 +337,16 @@ let setup_kernel_multichain ~(l2_setups : Evm_node.l2_setup list) ~l1_contracts else bootstrap_accounts ) | _ -> assert false in + (* In the kernel, the multichain notion was not introduced yet. *) + (* The kernel rely on its chain id to know the chain_family. *) + (* We need to keep this as long as we register test as multichain + just for tezlink (and not real multichain) *) + let chain_id = + match l2_chain_ids with [chain_id] -> Some chain_id | _ -> None + in let*! () = Evm_node.make_kernel_installer_config + ?chain_id ~l2_chain_ids ?max_delayed_inbox_blueprint_length ~mainnet_compat diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index 074f824d1e1f..8a1366afc268 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -439,6 +439,7 @@ let register_upgrade_all ~title ~tags ~genesis_timestamp let register_tezlink_test ~title ~tags scenario protocols = register_all + ~kernels:[Kernel.Latest] ~title ~tags:("tezlink" :: tags) ~l2_setups: @@ -997,6 +998,29 @@ let test_observer_reset = unit +let test_tezlink_produceBlock = + register_tezlink_test + ~title:"Test Tezlink production block" + ~tags:["kernel"; "produce_block"] + @@ fun {sequencer; _} _protocol -> + let rpc_current_level_head sequencer = + let path = "/tezlink/chains/main/blocks/head/helpers/current_level" in + let* res = + Curl.get_raw ~args:["-v"] (Evm_node.endpoint sequencer ^ path) + |> Runnable.run + in + let json = JSON.parse ~origin:"curl_current_level" res in + return @@ JSON.(json |-> "level" |> as_int) + in + let* start_level = rpc_current_level_head sequencer in + let*@ _ = produce_block sequencer in + let*@ _ = produce_block sequencer in + let*@ _ = produce_block sequencer in + let* end_level = rpc_current_level_head sequencer in + Check.((start_level + 3 = end_level) int) + ~error_msg:"Expected new block number to be %L, but got: %R" ; + unit + module Protocol = struct include Protocol @@ -12609,4 +12633,5 @@ let () = test_block_producer_validation [Alpha] ; test_tezlink_current_level [Alpha] ; test_tezlink_protocols [Alpha] ; - test_tezlink_version [Alpha] + test_tezlink_version [Alpha] ; + test_tezlink_produceBlock [Alpha] -- GitLab From 04104993243a6df52bd55d2a7d231df0042bff85 Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Tue, 1 Apr 2025 14:08:09 +0200 Subject: [PATCH 08/11] =?UTF-8?q?EVM/Node=20Refactor=20account=20handling:?= =?UTF-8?q?=20Introduce=20separate=20balance=20provisioning=20functions=20?= =?UTF-8?q?for=20=20EVM=20and=20Tezos=20Co-authored-by:=20Rapha=C3=ABl=20C?= =?UTF-8?q?auderlier=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etherlink/bin_node/lib_dev/durable_storage.ml | 12 ++++--- .../bin_node/lib_dev/durable_storage_path.ml | 32 +++++++++++++++++-- .../bin_node/lib_dev/durable_storage_path.mli | 24 ++++++++++++-- .../bin_node/lib_dev/encodings/tezos_types.ml | 5 +++ .../lib_dev/encodings/tezos_types.mli | 4 +++ etherlink/bin_node/lib_dev/evm_context.ml | 18 +++++++++-- etherlink/bin_node/lib_dev/evm_context.mli | 16 +++++++--- etherlink/bin_node/lib_dev/sequencer.ml | 26 +++++++++++---- etherlink/bin_node/lib_dev/state_override.ml | 14 +++++--- etherlink/bin_node/main.ml | 5 +-- 10 files changed, 126 insertions(+), 30 deletions(-) diff --git a/etherlink/bin_node/lib_dev/durable_storage.ml b/etherlink/bin_node/lib_dev/durable_storage.ml index 233bf3a01ec5..234081634238 100644 --- a/etherlink/bin_node/lib_dev/durable_storage.ml +++ b/etherlink/bin_node/lib_dev/durable_storage.ml @@ -43,13 +43,13 @@ let balance read address = inspect_durable_and_decode_default ~default:(Ethereum_types.Qty Z.zero) read - (Durable_storage_path.Accounts.balance address) + (Durable_storage_path.Eth_accounts.balance address) decode_number_le let nonce read address = inspect_durable_and_decode_opt read - (Durable_storage_path.Accounts.nonce address) + (Durable_storage_path.Eth_accounts.nonce address) decode_number_le let code read address = @@ -61,7 +61,7 @@ let code read address = let* answer = inspect_durable_and_decode_opt read - (Durable_storage_path.Accounts.code address) + (Durable_storage_path.Eth_accounts.code address) decode in match answer with @@ -70,7 +70,7 @@ let code read address = let* hash_opt = inspect_durable_and_decode_opt read - (Durable_storage_path.Accounts.code_hash address) + (Durable_storage_path.Eth_accounts.code_hash address) (fun bytes -> Hex.of_bytes bytes |> Hex.show |> Ethereum_types.hash_of_string) in @@ -350,7 +350,9 @@ let storage_at read address (Qty pos) = String.make (64 - len) '0' ^ s in let index = Z.format "#x" pos |> pad32left0 in - let+ answer = read (Durable_storage_path.Accounts.storage address index) in + let+ answer = + read (Durable_storage_path.Eth_accounts.storage address index) + in match answer with | Some bytes -> Bytes.to_string bytes |> Hex.of_string |> Hex.show diff --git a/etherlink/bin_node/lib_dev/durable_storage_path.ml b/etherlink/bin_node/lib_dev/durable_storage_path.ml index d61fee12a473..221bf383cef1 100644 --- a/etherlink/bin_node/lib_dev/durable_storage_path.ml +++ b/etherlink/bin_node/lib_dev/durable_storage_path.ml @@ -8,8 +8,6 @@ (* *) (*****************************************************************************) -open Ethereum_types - type path = string let reboot_counter = "/readonly/kernel/env/reboot_counter" @@ -22,6 +20,12 @@ module EVM = struct let make s = root ^ s end +module Tezlink = struct + let root = "/tezlink" + + let make s = root ^ s +end + module World_state = struct let root = "/world_state" @@ -52,7 +56,19 @@ let sequencer_key = EVM.make "/sequencer" let maximum_gas_per_transaction = EVM.make "/maximum_gas_per_transaction" -module Accounts = struct +module Tez_accounts = struct + let accounts_path = Tezlink.make "/context/contracts/index/" + + let balance_path = "/balance" + + let account addr = accounts_path ^ Signature.Public_key_hash.to_string addr + + let balance addr = account addr ^ balance_path +end + +module Eth_accounts = struct + open Ethereum_types + let accounts_path = World_state.make "/eth_accounts" let balance_path = "/balance" @@ -126,6 +142,8 @@ module Accounts = struct end module Code = struct + open Ethereum_types + let codes = World_state.make "/eth_codes" let code_storage (Hash (Hex hash)) = codes ^ "/" ^ hash @@ -136,6 +154,8 @@ module Code = struct end module Block = struct + open Ethereum_types + type number = Current | Nth of Z.t let blocks = World_state.make "/blocks" @@ -164,18 +184,24 @@ module Indexes = struct end module Transaction_receipt = struct + open Ethereum_types + let receipts = World_state.make "/transactions_receipts" let receipt (Hash (Hex tx_hash)) = receipts ^ "/" ^ tx_hash end module Transaction_object = struct + open Ethereum_types + let objects = World_state.make "/transactions_objects" let object_ (Hash (Hex tx_hash)) = objects ^ "/" ^ tx_hash end module Delayed_transaction = struct + open Ethereum_types + let hashes = EVM.make "/delayed-inbox" let transaction (Hash (Hex tx_hash)) = hashes ^ "/" ^ tx_hash ^ "/data" diff --git a/etherlink/bin_node/lib_dev/durable_storage_path.mli b/etherlink/bin_node/lib_dev/durable_storage_path.mli index 7c7d48b2c55c..abf6397f438c 100644 --- a/etherlink/bin_node/lib_dev/durable_storage_path.mli +++ b/etherlink/bin_node/lib_dev/durable_storage_path.mli @@ -8,8 +8,6 @@ (* *) (*****************************************************************************) -open Ethereum_types - type path = string val reboot_counter : string @@ -41,7 +39,9 @@ val sequencer_key : path val maximum_gas_per_transaction : path (** Paths related to accounts. *) -module Accounts : sig +module Eth_accounts : sig + open Ethereum_types + (** Path to the account's balance. *) val balance : address -> path @@ -75,12 +75,24 @@ module Accounts : sig val storage_dir_e : address -> path tzresult end +module Tez_accounts : sig + open Tezos_types + + val account : address -> path + + val balance : address -> path +end + module Code : sig + open Ethereum_types + val code : hash -> path end (** Paths related to blocks. *) module Block : sig + open Ethereum_types + (** Block number is either the current head or a specific height. *) type number = Current | Nth of Z.t @@ -100,6 +112,8 @@ module Indexes : sig end module Transaction_receipt : sig + open Ethereum_types + val receipts : path (** Path to the given transaction receipt. *) @@ -107,6 +121,8 @@ module Transaction_receipt : sig end module Transaction_object : sig + open Ethereum_types + val objects : path (** Path to the given transaction object. *) @@ -114,6 +130,8 @@ module Transaction_object : sig end module Delayed_transaction : sig + open Ethereum_types + (** Path to the list of hashes of the delayed inbox. *) val hashes : path diff --git a/etherlink/bin_node/lib_dev/encodings/tezos_types.ml b/etherlink/bin_node/lib_dev/encodings/tezos_types.ml index 6c5403e5e2fc..08ba2b29420a 100644 --- a/etherlink/bin_node/lib_dev/encodings/tezos_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/tezos_types.ml @@ -40,3 +40,8 @@ let block_from_binary bytes = in {number; hash; timestamp; parent_hash = parent}) else raise (Invalid_argument "Expected a string of length 44") + +(* We don't yet support smart contracts so all addresses are implicit accounts. *) +type address = Signature.public_key_hash + +type quantity = Ethereum_types.quantity diff --git a/etherlink/bin_node/lib_dev/encodings/tezos_types.mli b/etherlink/bin_node/lib_dev/encodings/tezos_types.mli index 25a0c2f62add..f527b876d19e 100644 --- a/etherlink/bin_node/lib_dev/encodings/tezos_types.mli +++ b/etherlink/bin_node/lib_dev/encodings/tezos_types.mli @@ -17,3 +17,7 @@ val decode_block_hash : bytes -> Ethereum_types.block_hash val genesis_parent_hash : Ethereum_types.block_hash val block_from_binary : bytes -> block + +type address = Signature.public_key_hash + +type quantity = Ethereum_types.quantity diff --git a/etherlink/bin_node/lib_dev/evm_context.ml b/etherlink/bin_node/lib_dev/evm_context.ml index 34f7e31f01a3..f54b63d47e4b 100644 --- a/etherlink/bin_node/lib_dev/evm_context.ml +++ b/etherlink/bin_node/lib_dev/evm_context.ml @@ -2190,12 +2190,12 @@ let patch_sequencer_key ?block_number pk = block_number; }) -let provision_balance ?block_number address value = +let provision_balance ?block_number address value balance_path = worker_wait_for_request (Patch_state { commit = false; - key = Durable_storage_path.Accounts.balance address; + key = balance_path address; patch = (let open Ethereum_types in function @@ -2209,6 +2209,20 @@ let provision_balance ?block_number address value = block_number; }) +let tez_provision_balance ?block_number address value = + provision_balance + ?block_number + address + value + Durable_storage_path.Tez_accounts.balance + +let eth_provision_balance ?block_number address value = + provision_balance + ?block_number + address + value + Durable_storage_path.Eth_accounts.balance + let patch_state ?block_number ~key ~value () = worker_wait_for_request (Patch_state diff --git a/etherlink/bin_node/lib_dev/evm_context.mli b/etherlink/bin_node/lib_dev/evm_context.mli index 2444b9bd382d..e8ac58afb532 100644 --- a/etherlink/bin_node/lib_dev/evm_context.mli +++ b/etherlink/bin_node/lib_dev/evm_context.mli @@ -111,16 +111,24 @@ val patch_kernel : Wasm_debugger.kernel -> unit tzresult Lwt.t -(** [provision_balance address value] modifies the state of the current head of - the EVM node to increase the balance of [address] by [value]. - +(** [eth_provision_balance address value] modifies the state of the current head of + the EVM node to increase the balance of an etherlink [address] by [value]. [block_number] can be provided to modify another block. *) -val provision_balance : +val eth_provision_balance : ?block_number:Ethereum_types.quantity -> Ethereum_types.address -> Ethereum_types.quantity -> unit tzresult Lwt.t +(** [tez_provision_balance address value] modifies the state of the current head of + the EVM node to increase the balance of a tezlink [address] by [value]. + [block_number] can be provided to modify another block. *) +val tez_provision_balance : + ?block_number:Ethereum_types.quantity -> + Tezos_types.address -> + Tezos_types.quantity -> + unit tzresult Lwt.t + (** [patch_sequencer_key public_key] modifies the in memory state of the EVM node to replace the sequencer key with [public_key]. It does not modify the current head. *) diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index 509a1dc4e602..bcd8219a4aa4 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -11,7 +11,8 @@ type sandbox_config = { secret_key : Signature.secret_key; init_from_snapshot : string option; network : Configuration.supported_network option; - funded_addresses : Ethereum_types.address list; + eth_funded_addresses : Ethereum_types.address list; + tez_funded_addresses : Tezos_types.address list; } let install_finalizer_seq server_public_finalizer server_private_finalizer @@ -102,15 +103,28 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt let smart_rollup_address_b58 = Address.to_string smart_rollup_address_typed in let* () = match sandbox_config with - | Some {public_key = pk; funded_addresses; _} -> + | Some {public_key = pk; eth_funded_addresses; tez_funded_addresses; _} -> let* () = Evm_context.patch_sequencer_key pk in - let new_balance = - Ethereum_types.quantity_of_z Z.(of_int 10_000 * pow (of_int 10) 18) + let new_balance = Int64.of_int 10_000 in + let eth_new_balance = + Ethereum_types.quantity_of_z + Z.(of_int64 new_balance * pow (of_int 10) 18) + in + let tez_new_balance = + let open Tezos_types.Tez in + mul_exn (of_mutez_exn new_balance) 1_000_000 + in + let* () = + List.iter_es + (fun address -> + Evm_context.eth_provision_balance address eth_new_balance) + eth_funded_addresses in let* () = List.iter_es - (fun address -> Evm_context.provision_balance address new_balance) - funded_addresses + (fun address -> + Evm_context.tez_provision_balance address tez_new_balance) + tez_funded_addresses in let* () = Option.iter_es diff --git a/etherlink/bin_node/lib_dev/state_override.ml b/etherlink/bin_node/lib_dev/state_override.ml index 2b1573ece151..a3fbe7c53924 100644 --- a/etherlink/bin_node/lib_dev/state_override.ml +++ b/etherlink/bin_node/lib_dev/state_override.ml @@ -41,7 +41,7 @@ let update_storage address state_diff state = let (Hex key) = key in let (Hex value) = value in if String.length value = 64 then - let*? key = Durable_storage_path.Accounts.storage_e address key in + let*? key = Durable_storage_path.Eth_accounts.storage_e address key in let*! state = Evm_state.modify ~key ~value:(hex_to_bytes (Hex value)) state in @@ -55,7 +55,7 @@ let replace_storage address state_override state = match state_override with | None -> return state | Some state_override -> - let*? key = Durable_storage_path.Accounts.storage_dir_e address in + let*? key = Durable_storage_path.Eth_accounts.storage_dir_e address in let*! state = Evm_state.delete ~kind:Tezos_scoru_wasm.Durable.Directory state key in @@ -82,19 +82,23 @@ let update_account address state_override evm_state = let* evm_state = update state_override.balance - (Accounts.balance address) + (Eth_accounts.balance address) durable_balance evm_state in let* evm_state = update state_override.nonce - (Accounts.nonce address) + (Eth_accounts.nonce address) durable_nonce evm_state in let* evm_state = - update state_override.code (Accounts.code address) durable_code evm_state + update + state_override.code + (Eth_accounts.code address) + durable_code + evm_state in let* evm_state = update_storage address state_override.state_diff evm_state diff --git a/etherlink/bin_node/main.ml b/etherlink/bin_node/main.ml index 21a514d00de1..a8a5bc9951b5 100644 --- a/etherlink/bin_node/main.ml +++ b/etherlink/bin_node/main.ml @@ -2316,7 +2316,7 @@ let sandbox_command = password_filename, network, init_from_snapshot, - funded_addresses ) ) + eth_funded_addresses ) ) () -> let open Lwt_result_syntax in let* restricted_rpcs = @@ -2336,7 +2336,8 @@ let sandbox_command = secret_key = sk; init_from_snapshot; network; - funded_addresses = Option.value ~default:[] funded_addresses; + eth_funded_addresses = Option.value ~default:[] eth_funded_addresses; + tez_funded_addresses = []; } in let config_file = config_filename ~data_dir config_file in -- GitLab From 2fc1f76137513a61905e2d934bc31fa23c860737 Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Tue, 1 Apr 2025 14:13:51 +0200 Subject: [PATCH 09/11] EVM/Tezlink/Node: Add support for Tezos bootstrap accounts in kernel configuration --- etherlink/bin_node/lib_dev/kernel_config.ml | 88 ++++++++++++++------ etherlink/bin_node/lib_dev/kernel_config.mli | 6 +- etherlink/bin_node/main.ml | 82 ++++++++++++------ etherlink/tezt/lib/evm_node.ml | 18 +++- 4 files changed, 140 insertions(+), 54 deletions(-) diff --git a/etherlink/bin_node/lib_dev/kernel_config.ml b/etherlink/bin_node/lib_dev/kernel_config.ml index 25e16c2e1783..74cafd7e0e0e 100644 --- a/etherlink/bin_node/lib_dev/kernel_config.ml +++ b/etherlink/bin_node/lib_dev/kernel_config.ml @@ -82,19 +82,19 @@ let clean_path path = [] (List.rev path) -let make_l2 ~boostrap_balance ?bootstrap_accounts ?minimum_base_fee_per_gas - ?da_fee_per_byte ?sequencer_pool_address ?maximum_gas_per_transaction - ?set_account_code ?world_state_path ~l2_chain_id ~l2_chain_family ~output () - = +let make_l2 ~boostrap_balance ?eth_bootstrap_accounts ?tez_bootstrap_accounts + ?minimum_base_fee_per_gas ?da_fee_per_byte ?sequencer_pool_address + ?maximum_gas_per_transaction ?set_account_code ?world_state_path + ~l2_chain_id ~l2_chain_family ~output () = let world_state_prefix = match world_state_path with | None -> ["evm"; "world_state"; l2_chain_id] | Some (_, value) -> clean_path (String.split_on_char '/' value) in - let bootstrap_accounts = - match bootstrap_accounts with + let eth_bootstrap_accounts = + match eth_bootstrap_accounts with | None -> [] - | Some bootstrap_accounts -> + | Some eth_bootstrap_accounts -> let open Ethereum_types in let balance = padded_32_le_int_bytes boostrap_balance in List.map @@ -102,7 +102,27 @@ let make_l2 ~boostrap_balance ?bootstrap_accounts ?minimum_base_fee_per_gas make_instr ~path_prefix:(world_state_prefix @ ["eth_accounts"; address]) (Some ("balance", balance))) - bootstrap_accounts + eth_bootstrap_accounts + |> List.flatten + in + let tez_bootstrap_accounts = + match tez_bootstrap_accounts with + | None -> [] + | Some tez_bootstrap_accounts -> + let balance = padded_32_le_int_bytes boostrap_balance in + List.map + (fun address -> + make_instr + ~path_prefix: + [ + "tezlink"; + "context"; + "contracts"; + "index"; + Signature.Public_key_hash.to_string address; + ] + (Some ("balance", balance))) + tez_bootstrap_accounts |> List.flatten in let set_account_code = @@ -146,32 +166,52 @@ let make_l2 ~boostrap_balance ?bootstrap_accounts ?minimum_base_fee_per_gas Hex.to_bytes_exn (`Hex addr) |> String.of_bytes) ~path_prefix:world_state_prefix sequencer_pool_address - @ bootstrap_accounts @ set_account_code + @ eth_bootstrap_accounts @ tez_bootstrap_accounts @ set_account_code in Installer_config.to_file (config_instrs @ world_state_instrs) ~output -let make ~mainnet_compat ~boostrap_balance ?l2_chain_ids ?bootstrap_accounts - ?kernel_root_hash ?chain_id ?sequencer ?delayed_bridge ?ticketer ?admin - ?sequencer_governance ?kernel_governance ?kernel_security_governance - ?minimum_base_fee_per_gas ?da_fee_per_byte ?delayed_inbox_timeout - ?delayed_inbox_min_levels ?sequencer_pool_address ?maximum_allowed_ticks - ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds - ?remove_whitelist ?enable_fa_bridge ?enable_dal ?dal_slots - ?enable_fast_withdrawal ?enable_fast_fa_withdrawal ?enable_multichain - ?set_account_code ?max_delayed_inbox_blueprint_length ?evm_version ~output - () = - let bootstrap_accounts = +let make ~mainnet_compat ~boostrap_balance ?l2_chain_ids ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?kernel_root_hash ?chain_id ?sequencer + ?delayed_bridge ?ticketer ?admin ?sequencer_governance ?kernel_governance + ?kernel_security_governance ?minimum_base_fee_per_gas ?da_fee_per_byte + ?delayed_inbox_timeout ?delayed_inbox_min_levels ?sequencer_pool_address + ?maximum_allowed_ticks ?maximum_gas_per_transaction + ?max_blueprint_lookahead_in_seconds ?remove_whitelist ?enable_fa_bridge + ?enable_dal ?dal_slots ?enable_fast_withdrawal ?enable_fast_fa_withdrawal + ?enable_multichain ?set_account_code ?max_delayed_inbox_blueprint_length + ?evm_version ~output () = + let eth_bootstrap_accounts = let open Ethereum_types in - match bootstrap_accounts with + match eth_bootstrap_accounts with | None -> [] - | Some bootstrap_accounts -> + | Some eth_bootstrap_accounts -> let balance = padded_32_le_int_bytes boostrap_balance in List.map (fun (Address (Hex address)) -> make_instr ~path_prefix:["evm"; "world_state"; "eth_accounts"; address] (Some ("balance", balance))) - bootstrap_accounts + eth_bootstrap_accounts + |> List.flatten + in + let tez_bootstrap_accounts = + match tez_bootstrap_accounts with + | None -> [] + | Some tez_bootstrap_accounts -> + let balance = padded_32_le_int_bytes boostrap_balance in + List.map + (fun address -> + make_instr + ~path_prefix: + [ + "tezlink"; + "context"; + "contracts"; + "index"; + Signature.Public_key_hash.to_string address; + ] + (Some ("balance", balance))) + tez_bootstrap_accounts |> List.flatten in let set_account_code = @@ -252,7 +292,7 @@ let make ~mainnet_compat ~boostrap_balance ?l2_chain_ids ?bootstrap_accounts @ make_instr ~convert:le_int64_bytes maximum_allowed_ticks @ make_instr ~convert:le_int64_bytes maximum_gas_per_transaction @ make_instr ~convert:le_int64_bytes max_blueprint_lookahead_in_seconds - @ bootstrap_accounts @ set_account_code + @ eth_bootstrap_accounts @ tez_bootstrap_accounts @ set_account_code @ make_instr remove_whitelist @ make_instr ~path_prefix:["evm"; "feature_flags"] enable_fa_bridge @ make_instr ~path_prefix:["evm"; "feature_flags"] enable_dal diff --git a/etherlink/bin_node/lib_dev/kernel_config.mli b/etherlink/bin_node/lib_dev/kernel_config.mli index 95bec428cf8c..266155bb4d9d 100644 --- a/etherlink/bin_node/lib_dev/kernel_config.mli +++ b/etherlink/bin_node/lib_dev/kernel_config.mli @@ -15,7 +15,8 @@ val make : mainnet_compat:bool -> boostrap_balance:Ethereum_types.NonceMap.key -> ?l2_chain_ids:L2_types.chain_id list -> - ?bootstrap_accounts:Ethereum_types.address list -> + ?eth_bootstrap_accounts:Ethereum_types.address list -> + ?tez_bootstrap_accounts:Tezos_types.address list -> ?kernel_root_hash:string * string -> ?chain_id:string * string -> ?sequencer:string * string -> @@ -52,7 +53,8 @@ val make : where [bootstrap_accounts] are provisioned with [bootstrap_balance]. *) val make_l2 : boostrap_balance:Z.t -> - ?bootstrap_accounts:Ethereum_types.address list -> + ?eth_bootstrap_accounts:Ethereum_types.address list -> + ?tez_bootstrap_accounts:Tezos_types.address list -> ?minimum_base_fee_per_gas:string * string -> ?da_fee_per_byte:string * string -> ?sequencer_pool_address:string * string -> diff --git a/etherlink/bin_node/main.ml b/etherlink/bin_node/main.ml index a8a5bc9951b5..aecaae8ef8b4 100644 --- a/etherlink/bin_node/main.ml +++ b/etherlink/bin_node/main.ml @@ -150,7 +150,7 @@ module Params = struct [\"1970-01-01T00:00:00Z\"]) or in number of seconds since \ the {!Time.Protocol.epoch}.")) - let l2_address = + let eth_l2_address = Tezos_clic.parameter (fun _ address -> let open Lwt_result_syntax in let hex = Evm_node_lib_dev.Misc.normalize_addr address in @@ -162,6 +162,10 @@ module Params = struct in return (Evm_node_lib_dev_encoding.Ethereum_types.Address (Hex hex))) + let tez_l2_address = + Tezos_clic.parameter (fun _ address -> + Lwt.return (Signature.Public_key_hash.of_b58check address)) + let l2_level = Tezos_clic.parameter (fun () s -> Lwt.return_ok @@ -1417,7 +1421,7 @@ let make_sequencer_upgrade_command = @@ Tezos_clic.param ~name:"pool_address" ~desc:"Pool address of the sequencer" - Params.l2_address + Params.eth_l2_address @@ prefixes ["at"; "activation"; "timestamp"] @@ param ~name:"activation_timestamp" @@ -1842,10 +1846,20 @@ let config_key_flag ~name = if enable then return_some (name, "") else return_none) @@ Tezos_clic.switch ~long ~doc () -let bootstrap_account_arg = - let long = "bootstrap-account" in - let doc = Format.sprintf "Add a bootstrap account in the installer config." in - Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.l2_address +let eth_bootstrap_account_arg = + let long = "eth-bootstrap-account" in + let doc = + Format.sprintf + "Add a bootstrap account in the installer config for etherlink" + in + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.eth_l2_address + +let tez_bootstrap_account_arg = + let long = "tez-bootstrap-account" in + let doc = + Format.sprintf "Add a bootstrap account in the installer config for tezlink" + in + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"tz1..." Params.tez_l2_address let set_account_code = let long = "set-code" in @@ -1880,7 +1894,7 @@ let make_l2_kernel_config_command = ~desc: "Produce a file containing the part of the kernel configuration \ instructions related to a particular L2 chain." - (args10 + (args11 (config_key_arg ~name:"minimum_base_fee_per_gas" ~placeholder:"111...") (config_key_arg ~name:"da_fee_per_byte" ~placeholder:"111...") (config_key_arg ~name:"sequencer_pool_address" ~placeholder:"0x...") @@ -1893,7 +1907,8 @@ let make_l2_kernel_config_command = ~default:"9999000000000000000000" ~placeholder:"9999000000000000000000" @@ Tezos_clic.parameter (fun _ s -> return @@ Z.of_string s)) - bootstrap_account_arg + eth_bootstrap_account_arg + tez_bootstrap_account_arg set_account_code (config_key_arg ~name:"world_state_path" @@ -1921,7 +1936,8 @@ let make_l2_kernel_config_command = sequencer_pool_address, maximum_gas_per_transaction, boostrap_balance, - bootstrap_accounts, + eth_bootstrap_accounts, + tez_bootstrap_accounts, set_account_code, world_state_path, l2_chain_id, @@ -1942,7 +1958,8 @@ let make_l2_kernel_config_command = ?sequencer_pool_address ?maximum_gas_per_transaction ~boostrap_balance - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?set_account_code ?world_state_path ~l2_chain_id @@ -2002,12 +2019,12 @@ let make_kernel_config_command = ~default:"9999000000000000000000" ~placeholder:"9999000000000000000000" @@ Tezos_clic.parameter (fun _ s -> return @@ Z.of_string s)) - bootstrap_account_arg - set_account_code + eth_bootstrap_account_arg + tez_bootstrap_account_arg (config_key_flag ~name:"enable_fa_bridge") (config_key_flag ~name:"enable_dal") (config_key_arg ~name:"dal_slots" ~placeholder:"0,1,4,6,...")) - (args6 + (args7 (config_key_flag ~name:"enable_multichain") l2_chain_ids_arg (config_key_arg @@ -2015,7 +2032,8 @@ let make_kernel_config_command = ~placeholder:"1000") (config_key_flag ~name:"enable_fast_withdrawal") (config_key_flag ~name:"enable_fast_fa_withdrawal") - evm_version_arg)) + evm_version_arg + set_account_code)) (prefixes ["make"; "kernel"; "installer"; "config"] @@ param ~name:"kernel config file" @@ -2042,8 +2060,8 @@ let make_kernel_config_command = max_blueprint_lookahead_in_seconds, remove_whitelist, boostrap_balance, - bootstrap_accounts, - set_account_code, + eth_bootstrap_accounts, + tez_bootstrap_accounts, enable_fa_bridge, enable_dal, dal_slots ), @@ -2052,7 +2070,8 @@ let make_kernel_config_command = max_delayed_inbox_blueprint_length, enable_fast_withdrawal, enable_fast_fa_withdrawal, - evm_version ) ) + evm_version, + set_account_code ) ) output () -> Evm_node_lib_dev.Kernel_config.make @@ -2078,15 +2097,16 @@ let make_kernel_config_command = ?max_blueprint_lookahead_in_seconds ?remove_whitelist ~boostrap_balance - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?enable_fa_bridge ?enable_dal ?dal_slots ?enable_multichain - ?set_account_code ?max_delayed_inbox_blueprint_length ?enable_fast_withdrawal ?enable_fast_fa_withdrawal + ?set_account_code ~output ()) @@ -2167,16 +2187,24 @@ let sequencer_config_args = (Client_config.password_filename_arg ()) dal_slots_arg -let fund_arg = +let eth_fund_arg = + let long = "fund" in + let doc = + "The address of an account to provide with funds in the sandbox (can be \ + repeated to fund multiple etherlink accounts)." + in + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.eth_l2_address + +let tez_fund_arg = let long = "fund" in let doc = "The address of an account to provide with funds in the sandbox (can be \ - repeated to fund multiple accounts)." + repeated to fund multiple tezlink accounts)." in - Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.l2_address + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"tz1..." Params.tez_l2_address let sandbox_config_args = - Tezos_clic.args13 + Tezos_clic.args14 preimages_arg preimages_endpoint_arg native_execution_policy_arg @@ -2189,7 +2217,8 @@ let sandbox_config_args = (Client_config.password_filename_arg ()) (supported_network_arg ()) init_from_snapshot_arg - fund_arg + eth_fund_arg + tez_fund_arg let sequencer_command = let open Tezos_clic in @@ -2316,7 +2345,8 @@ let sandbox_command = password_filename, network, init_from_snapshot, - eth_funded_addresses ) ) + eth_funded_addresses, + tez_funded_addresses ) ) () -> let open Lwt_result_syntax in let* restricted_rpcs = @@ -2337,7 +2367,7 @@ let sandbox_command = init_from_snapshot; network; eth_funded_addresses = Option.value ~default:[] eth_funded_addresses; - tez_funded_addresses = []; + tez_funded_addresses = Option.value ~default:[] tez_funded_addresses; } in let config_file = config_filename ~data_dir config_file in diff --git a/etherlink/tezt/lib/evm_node.ml b/etherlink/tezt/lib/evm_node.ml index 7e45a9a5388c..cc3d23a24d74 100644 --- a/etherlink/tezt/lib/evm_node.ml +++ b/etherlink/tezt/lib/evm_node.ml @@ -1835,7 +1835,14 @@ let make_kernel_installer_config ?(l2_chain_ids = []) List.flatten @@ List.map (fun bootstrap_account -> - ["--bootstrap-account"; bootstrap_account]) + [ + (if + String.starts_with ~prefix:"0x" + @@ String.lowercase_ascii bootstrap_account + then "--eth-bootstrap-account" + else "--tez-bootstrap-account"); + bootstrap_account; + ]) bootstrap_accounts in let process = Process.spawn (Uses.path Constant.octez_evm_node) cmd in @@ -1879,7 +1886,14 @@ let make_l2_kernel_installer_config ?chain_id ?chain_family ?bootstrap_balance List.flatten @@ List.map (fun bootstrap_account -> - ["--bootstrap-account"; bootstrap_account]) + [ + (if + String.starts_with ~prefix:"0x" + @@ String.lowercase_ascii bootstrap_account + then "--eth-bootstrap-account" + else "--tez-bootstrap-account"); + bootstrap_account; + ]) bootstrap_accounts in let process = Process.spawn (Uses.path Constant.octez_evm_node) cmd in -- GitLab From d29628da91343a08c58ed16fcbf6e2f68fb8d6f5 Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Wed, 2 Apr 2025 16:48:03 +0200 Subject: [PATCH 10/11] EVM/Tezt/Node: Split bootstrap_accounts to eth_bootstrap_accounts and tez_bootstrap_accounts --- etherlink/tezt/lib/evm_node.ml | 85 ++++++++++++++++----------- etherlink/tezt/lib/evm_node.mli | 13 ++-- etherlink/tezt/lib/setup.ml | 64 +++++++++++++------- etherlink/tezt/lib/setup.mli | 12 ++-- etherlink/tezt/lib/test_helpers.ml | 8 ++- etherlink/tezt/lib/test_helpers.mli | 3 +- etherlink/tezt/tests/eth_call.ml | 10 ++-- etherlink/tezt/tests/evm_rollup.ml | 76 +++++++++++++----------- etherlink/tezt/tests/evm_sequencer.ml | 60 ++++++++++--------- tezt/tests/cloud/dal.ml | 8 +-- 10 files changed, 201 insertions(+), 138 deletions(-) diff --git a/etherlink/tezt/lib/evm_node.ml b/etherlink/tezt/lib/evm_node.ml index cc3d23a24d74..96870f128609 100644 --- a/etherlink/tezt/lib/evm_node.ml +++ b/etherlink/tezt/lib/evm_node.ml @@ -34,24 +34,28 @@ type l2_setup = { l2_chain_id : int; l2_chain_family : string; world_state_path : string option; - bootstrap_accounts : string list option; + eth_bootstrap_accounts : string list option; + tez_bootstrap_accounts : Account.key list option; sequencer_pool_address : string option; minimum_base_fee_per_gas : Wei.t option; da_fee_per_byte : Wei.t option; maximum_gas_per_transaction : int64 option; } -let default_bootstrap_accounts = +let eth_default_bootstrap_accounts = List.map (fun account -> account.Eth_account.address) (Array.to_list Eth_account.bootstrap_accounts) +let tez_default_bootstrap_accounts = Array.to_list Account.Bootstrap.keys + let default_l2_setup ~l2_chain_id = { l2_chain_id; l2_chain_family = "EVM"; world_state_path = Some "/evm/world_state"; - bootstrap_accounts = Some default_bootstrap_accounts; + eth_bootstrap_accounts = Some eth_default_bootstrap_accounts; + tez_bootstrap_accounts = Some tez_default_bootstrap_accounts; sequencer_pool_address = None; minimum_base_fee_per_gas = None; da_fee_per_byte = None; @@ -1741,11 +1745,12 @@ let ten_years_in_seconds = 3600 * 24 * 365 * 10 |> Int64.of_int let make_kernel_installer_config ?(l2_chain_ids = []) ?max_delayed_inbox_blueprint_length ?(mainnet_compat = false) ?(remove_whitelist = false) ?kernel_root_hash ?chain_id ?bootstrap_balance - ?bootstrap_accounts ?sequencer ?delayed_bridge ?ticketer ?administrator - ?sequencer_governance ?kernel_governance ?kernel_security_governance - ?minimum_base_fee_per_gas ?(da_fee_per_byte = Wei.zero) - ?delayed_inbox_timeout ?delayed_inbox_min_levels ?sequencer_pool_address - ?maximum_allowed_ticks ?maximum_gas_per_transaction + ?eth_bootstrap_accounts ?tez_bootstrap_accounts ?sequencer ?delayed_bridge + ?ticketer ?administrator ?sequencer_governance ?kernel_governance + ?kernel_security_governance ?minimum_base_fee_per_gas + ?(da_fee_per_byte = Wei.zero) ?delayed_inbox_timeout + ?delayed_inbox_min_levels ?sequencer_pool_address ?maximum_allowed_ticks + ?maximum_gas_per_transaction ?(max_blueprint_lookahead_in_seconds = ten_years_in_seconds) ?(set_account_code = []) ?(enable_fa_bridge = false) ?(enable_dal = false) ?dal_slots ?(enable_fast_withdrawal = false) @@ -1828,30 +1833,35 @@ let make_kernel_installer_config ?(l2_chain_ids = []) dal_slots @ Cli_arg.optional_arg "bootstrap-balance" Wei.to_string bootstrap_balance @ Cli_arg.optional_arg "evm-version" Evm_version.to_string evm_version + @ (match tez_bootstrap_accounts with + | None -> [] + | Some tez_bootstrap_accounts -> + List.flatten + @@ List.map + (fun tez_bootstrap_account -> + [ + "--tez-bootstrap-account"; + tez_bootstrap_account.Account.public_key_hash; + ]) + tez_bootstrap_accounts) @ - match bootstrap_accounts with + match eth_bootstrap_accounts with | None -> [] - | Some bootstrap_accounts -> + | Some eth_bootstrap_accounts -> List.flatten @@ List.map - (fun bootstrap_account -> - [ - (if - String.starts_with ~prefix:"0x" - @@ String.lowercase_ascii bootstrap_account - then "--eth-bootstrap-account" - else "--tez-bootstrap-account"); - bootstrap_account; - ]) - bootstrap_accounts + (fun eth_bootstrap_account -> + ["--eth-bootstrap-account"; eth_bootstrap_account]) + eth_bootstrap_accounts in let process = Process.spawn (Uses.path Constant.octez_evm_node) cmd in Runnable.{value = process; run = Process.check} let make_l2_kernel_installer_config ?chain_id ?chain_family ?bootstrap_balance - ?bootstrap_accounts ?minimum_base_fee_per_gas ?(da_fee_per_byte = Wei.zero) - ?sequencer_pool_address ?maximum_gas_per_transaction - ?(set_account_code = []) ?world_state_path ~output () = + ?eth_bootstrap_accounts ?tez_bootstrap_accounts ?minimum_base_fee_per_gas + ?(da_fee_per_byte = Wei.zero) ?sequencer_pool_address + ?maximum_gas_per_transaction ?(set_account_code = []) ?world_state_path + ~output () = let set_account_code = List.flatten @@ List.map @@ -1879,23 +1889,28 @@ let make_l2_kernel_installer_config ?chain_id ?chain_family ?bootstrap_balance Int64.to_string maximum_gas_per_transaction @ Cli_arg.optional_arg "bootstrap-balance" Wei.to_string bootstrap_balance + @ (match tez_bootstrap_accounts with + | None -> [] + | Some tez_bootstrap_accounts -> + List.flatten + @@ List.map + (fun tez_bootstrap_account -> + [ + "--tez-bootstrap-account"; + tez_bootstrap_account.Account.public_key_hash; + ]) + tez_bootstrap_accounts) @ - match bootstrap_accounts with + match eth_bootstrap_accounts with | None -> [] - | Some bootstrap_accounts -> + | Some eth_bootstrap_accounts -> List.flatten @@ List.map - (fun bootstrap_account -> - [ - (if - String.starts_with ~prefix:"0x" - @@ String.lowercase_ascii bootstrap_account - then "--eth-bootstrap-account" - else "--tez-bootstrap-account"); - bootstrap_account; - ]) - bootstrap_accounts + (fun eth_bootstrap_account -> + ["--eth-bootstrap-account"; eth_bootstrap_account]) + eth_bootstrap_accounts in + let process = Process.spawn (Uses.path Constant.octez_evm_node) cmd in Runnable.{value = process; run = Process.check} diff --git a/etherlink/tezt/lib/evm_node.mli b/etherlink/tezt/lib/evm_node.mli index f3560f65fd47..9e521e996d06 100644 --- a/etherlink/tezt/lib/evm_node.mli +++ b/etherlink/tezt/lib/evm_node.mli @@ -33,14 +33,17 @@ type l2_setup = { l2_chain_id : int; l2_chain_family : string; world_state_path : string option; - bootstrap_accounts : string list option; + eth_bootstrap_accounts : string list option; + tez_bootstrap_accounts : Account.key list option; sequencer_pool_address : string option; minimum_base_fee_per_gas : Wei.t option; da_fee_per_byte : Wei.t option; maximum_gas_per_transaction : int64 option; } -val default_bootstrap_accounts : string list +val eth_default_bootstrap_accounts : string list + +val tez_default_bootstrap_accounts : Account.key list val default_l2_setup : l2_chain_id:int -> l2_setup @@ -641,7 +644,8 @@ val make_l2_kernel_installer_config : ?chain_id:int -> ?chain_family:string -> ?bootstrap_balance:Wei.t -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> ?minimum_base_fee_per_gas:Wei.t -> ?da_fee_per_byte:Wei.t -> ?sequencer_pool_address:string -> @@ -662,7 +666,8 @@ val make_kernel_installer_config : ?kernel_root_hash:string -> ?chain_id:int -> ?bootstrap_balance:Wei.t -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> ?sequencer:string -> ?delayed_bridge:string -> ?ticketer:string -> diff --git a/etherlink/tezt/lib/setup.ml b/etherlink/tezt/lib/setup.ml index e907c76962fb..db958a3ca69c 100644 --- a/etherlink/tezt/lib/setup.ml +++ b/etherlink/tezt/lib/setup.ml @@ -242,7 +242,8 @@ let run_new_observer_node ?(finalized_view = false) ?(patch_config = Fun.id) let setup_kernel_singlechain ~l1_contracts ?max_delayed_inbox_blueprint_length ~mainnet_compat ?delayed_inbox_timeout ?delayed_inbox_min_levels - ?(bootstrap_accounts = Evm_node.default_bootstrap_accounts) + ?(eth_bootstrap_accounts = Evm_node.eth_default_bootstrap_accounts) + ?(tez_bootstrap_accounts = Evm_node.tez_default_bootstrap_accounts) ?sequencer_pool_address ?da_fee_per_byte ?minimum_base_fee_per_gas ?maximum_allowed_ticks ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge @@ -271,7 +272,8 @@ let setup_kernel_singlechain ~l1_contracts ?max_delayed_inbox_blueprint_length ?dal_slots ~enable_multichain:false ?max_blueprint_lookahead_in_seconds - ~bootstrap_accounts + ~eth_bootstrap_accounts + ~tez_bootstrap_accounts ~output:output_config ?evm_version ?enable_fa_bridge @@ -294,7 +296,8 @@ let generate_l2_kernel_config (l2_setup : Evm_node.l2_setup) = ?sequencer_pool_address:l2_setup.sequencer_pool_address ?minimum_base_fee_per_gas:l2_setup.minimum_base_fee_per_gas ?da_fee_per_byte:l2_setup.da_fee_per_byte - ?bootstrap_accounts:l2_setup.bootstrap_accounts + ?eth_bootstrap_accounts:l2_setup.eth_bootstrap_accounts + ?tez_bootstrap_accounts:l2_setup.tez_bootstrap_accounts ?world_state_path:l2_setup.world_state_path ~output:l2_config () @@ -316,7 +319,8 @@ let setup_kernel_multichain ~(l2_setups : Evm_node.l2_setup list) ~l1_contracts da_fee_per_byte, sequencer_pool_address, maximum_gas_per_transaction, - bootstrap_accounts ) = + eth_bootstrap_accounts, + tez_bootstrap_accounts ) = match l2_setups with | [ { @@ -324,17 +328,25 @@ let setup_kernel_multichain ~(l2_setups : Evm_node.l2_setup list) ~l1_contracts da_fee_per_byte; sequencer_pool_address; maximum_gas_per_transaction; - bootstrap_accounts; world_state_path; + eth_bootstrap_accounts; + tez_bootstrap_accounts; _; }; ] -> + let eth_bootstrap_accounts = + (* If `world_state_path` is `/evm/world_state`, it means the bootstrap accounts have already been written to that path. + To avoid duplicating this information in the configuration file — which would unnecessarily bloat the rollup origination + operation and cause an error — we skip including them here. *) + if world_state_path = Some "/evm/world_state" then None + else eth_bootstrap_accounts + in ( minimum_base_fee_per_gas, da_fee_per_byte, sequencer_pool_address, maximum_gas_per_transaction, - if world_state_path = Some "/evm/world_state" then None - else bootstrap_accounts ) + eth_bootstrap_accounts, + tez_bootstrap_accounts ) | _ -> assert false in (* In the kernel, the multichain notion was not introduced yet. *) @@ -368,7 +380,8 @@ let setup_kernel_multichain ~(l2_setups : Evm_node.l2_setup list) ~l1_contracts ?dal_slots ~enable_multichain:true ?max_blueprint_lookahead_in_seconds - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ~output:rollup_config ?enable_fa_bridge ?evm_version @@ -408,7 +421,8 @@ let setup_kernel ~enable_multichain ~l2_chains ~l1_contracts ?enable_fast_fa_withdrawal ?dal_slots ?max_blueprint_lookahead_in_seconds - ?bootstrap_accounts:chain_config.Evm_node.bootstrap_accounts + ?eth_bootstrap_accounts:chain_config.Evm_node.eth_bootstrap_accounts + ?tez_bootstrap_accounts:chain_config.Evm_node.tez_bootstrap_accounts ?enable_fa_bridge ?evm_version ~preimages_dir @@ -649,8 +663,9 @@ let setup_sequencer ?max_delayed_inbox_blueprint_length ?next_wasm_runtime ?max_blueprints_ahead ?max_blueprints_catchup ?catchup_cooldown ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks ?commitment_period ?challenge_window - ?(bootstrap_accounts = Evm_node.default_bootstrap_accounts) ?sequencer - ?sequencer_pool_address ?kernel ?da_fee ?minimum_base_fee_per_gas + ?(eth_bootstrap_accounts = Evm_node.eth_default_bootstrap_accounts) + ?(tez_bootstrap_accounts = Evm_node.tez_default_bootstrap_accounts) + ?sequencer ?sequencer_pool_address ?kernel ?da_fee ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?enable_fast_withdrawal ?enable_fast_fa_withdrawal ?threshold_encryption @@ -664,7 +679,8 @@ let setup_sequencer ?max_delayed_inbox_blueprint_length ?next_wasm_runtime { (Evm_node.default_l2_setup ~l2_chain_id:1) with sequencer_pool_address; - bootstrap_accounts = Some bootstrap_accounts; + eth_bootstrap_accounts = Some eth_bootstrap_accounts; + tez_bootstrap_accounts = Some tez_bootstrap_accounts; da_fee_per_byte = da_fee; minimum_base_fee_per_gas; maximum_gas_per_transaction; @@ -720,8 +736,9 @@ let register_multichain_test ~__FILE__ ?max_delayed_inbox_blueprint_length ?time_between_blocks ?max_blueprints_lag ?max_blueprints_ahead ?max_blueprints_catchup ?catchup_cooldown ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ?(bootstrap_accounts = Evm_node.default_bootstrap_accounts) ?sequencer - ?sequencer_pool_address ~kernel ?da_fee ?minimum_base_fee_per_gas + ?(eth_bootstrap_accounts = Evm_node.eth_default_bootstrap_accounts) + ?(tez_bootstrap_accounts = Evm_node.tez_default_bootstrap_accounts) + ?sequencer ?sequencer_pool_address ~kernel ?da_fee ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?enable_fast_withdrawal ?enable_fast_fa_withdrawal ?commitment_period @@ -755,7 +772,8 @@ let register_multichain_test ~__FILE__ ?max_delayed_inbox_blueprint_length sequencer_pool_address; minimum_base_fee_per_gas; maximum_gas_per_transaction; - bootstrap_accounts = Some bootstrap_accounts; + eth_bootstrap_accounts = Some eth_bootstrap_accounts; + tez_bootstrap_accounts = Some tez_bootstrap_accounts; }; ] | Some l2_chains -> l2_chains @@ -841,8 +859,9 @@ let register_test ~__FILE__ ?max_delayed_inbox_blueprint_length ?time_between_blocks ?max_blueprints_lag ?max_blueprints_ahead ?max_blueprints_catchup ?catchup_cooldown ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ?(bootstrap_accounts = Evm_node.default_bootstrap_accounts) ?sequencer - ?sequencer_pool_address ~kernel ?da_fee ?minimum_base_fee_per_gas + ?(eth_bootstrap_accounts = Evm_node.eth_default_bootstrap_accounts) + ?(tez_bootstrap_accounts = Evm_node.tez_default_bootstrap_accounts) + ?sequencer ?sequencer_pool_address ~kernel ?da_fee ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?enable_fast_withdrawal ?enable_fast_fa_withdrawal ?commitment_period @@ -867,7 +886,8 @@ let register_test ~__FILE__ ?max_delayed_inbox_blueprint_length ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ~bootstrap_accounts + ~eth_bootstrap_accounts + ~tez_bootstrap_accounts ?sequencer ?sequencer_pool_address ~kernel @@ -906,8 +926,9 @@ let register_test_for_kernels ~__FILE__ ?max_delayed_inbox_blueprint_length ?time_between_blocks ?max_blueprints_lag ?max_blueprints_ahead ?max_blueprints_catchup ?catchup_cooldown ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ?(bootstrap_accounts = Evm_node.default_bootstrap_accounts) ?sequencer - ?sequencer_pool_address ?(kernels = Kernel.all) ?da_fee + ?(eth_bootstrap_accounts = Evm_node.eth_default_bootstrap_accounts) + ?(tez_bootstrap_accounts = Evm_node.tez_default_bootstrap_accounts) + ?sequencer ?sequencer_pool_address ?(kernels = Kernel.all) ?da_fee ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?rollup_history_mode ?commitment_period ?challenge_window @@ -933,7 +954,8 @@ let register_test_for_kernels ~__FILE__ ?max_delayed_inbox_blueprint_length ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ~bootstrap_accounts + ~eth_bootstrap_accounts + ~tez_bootstrap_accounts ?sequencer ?sequencer_pool_address ~kernel diff --git a/etherlink/tezt/lib/setup.mli b/etherlink/tezt/lib/setup.mli index e969faf95158..556c9cbf49a3 100644 --- a/etherlink/tezt/lib/setup.mli +++ b/etherlink/tezt/lib/setup.mli @@ -91,7 +91,8 @@ val register_test : ?delayed_inbox_timeout:int -> ?delayed_inbox_min_levels:int -> ?max_number_of_chunks:int -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> ?sequencer:Account.key -> ?sequencer_pool_address:string -> kernel:Kernel.t -> @@ -140,7 +141,8 @@ val register_multichain_test : ?delayed_inbox_timeout:int -> ?delayed_inbox_min_levels:int -> ?max_number_of_chunks:int -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> ?sequencer:Account.key -> ?sequencer_pool_address:string -> kernel:Kernel.t -> @@ -192,7 +194,8 @@ val register_test_for_kernels : ?delayed_inbox_timeout:int -> ?delayed_inbox_min_levels:int -> ?max_number_of_chunks:int -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> ?sequencer:Account.key -> ?sequencer_pool_address:string -> ?kernels:Kernel.t list -> @@ -243,7 +246,8 @@ val setup_sequencer : ?max_number_of_chunks:int -> ?commitment_period:int -> ?challenge_window:int -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> ?sequencer:Account.key -> ?sequencer_pool_address:string -> ?kernel:Uses.t -> diff --git a/etherlink/tezt/lib/test_helpers.ml b/etherlink/tezt/lib/test_helpers.ml index 6929040be252..ecc90af8254f 100644 --- a/etherlink/tezt/lib/test_helpers.ml +++ b/etherlink/tezt/lib/test_helpers.ml @@ -425,10 +425,11 @@ let init_sequencer_sandbox ?maximum_gas_per_transaction ?genesis_timestamp ?tx_pool_tx_per_addr_limit ?set_account_code ?da_fee_per_byte ?minimum_base_fee_per_gas ?history_mode ?patch_config ?(kernel = Constant.WASM.evm_kernel) ?evm_version - ?(bootstrap_accounts = + ?(eth_bootstrap_accounts = List.map (fun account -> account.Eth_account.address) - (Array.to_list Eth_account.bootstrap_accounts)) () = + (Array.to_list Eth_account.bootstrap_accounts)) + ?(tez_bootstrap_accounts = Array.to_list Account.Bootstrap.keys) () = let wallet_dir = Temp.dir "wallet" in let output_config = Temp.file "config.yaml" in let preimages_dir = Temp.dir "wasm_2_0_0" in @@ -440,7 +441,8 @@ let init_sequencer_sandbox ?maximum_gas_per_transaction ?genesis_timestamp ?da_fee_per_byte ?minimum_base_fee_per_gas ~output:output_config - ~bootstrap_accounts + ~eth_bootstrap_accounts + ~tez_bootstrap_accounts ?evm_version () in diff --git a/etherlink/tezt/lib/test_helpers.mli b/etherlink/tezt/lib/test_helpers.mli index 7f75cd7561ab..091075fba59c 100644 --- a/etherlink/tezt/lib/test_helpers.mli +++ b/etherlink/tezt/lib/test_helpers.mli @@ -247,7 +247,8 @@ val init_sequencer_sandbox : ?patch_config:(JSON.t -> JSON.t) -> ?kernel:Uses.t -> ?evm_version:Evm_version.t -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_accounts:string list -> + ?tez_bootstrap_accounts:Account.key list -> unit -> Evm_node.t Lwt.t diff --git a/etherlink/tezt/tests/eth_call.ml b/etherlink/tezt/tests/eth_call.ml index a3d0b50107e7..d0bc1e9783e0 100644 --- a/etherlink/tezt/tests/eth_call.ml +++ b/etherlink/tezt/tests/eth_call.ml @@ -20,14 +20,16 @@ open Setup open Test_helpers -let register ?genesis_timestamp ?bootstrap_accounts ?(kernels = Kernel.all) - ?preimages_dir ?maximum_allowed_ticks ?enable_fa_bridge ?rollup_history_mode - ?additional_uses ~title ~tags body protocols = +let register ?genesis_timestamp ?eth_bootstrap_accounts ?tez_bootstrap_accounts + ?(kernels = Kernel.all) ?preimages_dir ?maximum_allowed_ticks + ?enable_fa_bridge ?rollup_history_mode ?additional_uses ~title ~tags body + protocols = register_test_for_kernels ~__FILE__ ~time_between_blocks:Nothing ?genesis_timestamp - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ~kernels ?preimages_dir ?maximum_allowed_ticks diff --git a/etherlink/tezt/tests/evm_rollup.ml b/etherlink/tezt/tests/evm_rollup.ml index ae5164363d76..7ffb32e082ea 100644 --- a/etherlink/tezt/tests/evm_rollup.ml +++ b/etherlink/tezt/tests/evm_rollup.ml @@ -297,10 +297,11 @@ let setup_evm_kernel ?additional_config ?(setup_kernel_root_hash = true) ?(kernel = Kernel.Latest) ?evm_version ?(originator_key = Constant.bootstrap1.public_key_hash) ?(rollup_operator_key = Constant.bootstrap1.public_key_hash) ?chain_id - ?(bootstrap_accounts = + ?(eth_bootstrap_accounts = List.map (fun account -> account.Eth_account.address) (Array.to_list Eth_account.bootstrap_accounts)) + ?(tez_bootstrap_accounts = Array.to_list Account.Bootstrap.keys) ?(with_administrator = true) ?da_fee_per_byte ?minimum_base_fee_per_gas ~admin ?sequencer_admin ?commitment_period ?challenge_window ?timestamp ?tx_pool_timeout_limit ?tx_pool_addr_limit ?tx_pool_tx_per_addr_limit @@ -367,7 +368,8 @@ let setup_evm_kernel ?additional_config ?(setup_kernel_root_hash = true) ~mainnet_compat:false ~remove_whitelist:Option.(is_some whitelist) ?kernel_root_hash - ~bootstrap_accounts + ~eth_bootstrap_accounts + ~tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?ticketer @@ -521,11 +523,11 @@ let setup_evm_kernel ?additional_config ?(setup_kernel_root_hash = true) let register_test ~title ~tags ?(kernels = Kernel.all) ?additional_config ?admin ?(additional_uses = []) ?commitment_period ?challenge_window - ?bootstrap_accounts ?whitelist ?da_fee_per_byte ?minimum_base_fee_per_gas - ?rollup_operator_key ?maximum_allowed_ticks ?restricted_rpcs ~setup_mode - ~enable_dal ?(dal_slots = if enable_dal then Some [4] else None) - ~enable_multichain ?websockets ?enable_fast_withdrawal ?evm_version f - protocols = + ?eth_bootstrap_accounts ?tez_bootstrap_accounts ?whitelist ?da_fee_per_byte + ?minimum_base_fee_per_gas ?rollup_operator_key ?maximum_allowed_ticks + ?restricted_rpcs ~setup_mode ~enable_dal + ?(dal_slots = if enable_dal then Some [4] else None) ~enable_multichain + ?websockets ?enable_fast_withdrawal ?evm_version f protocols = let extra_tag = match setup_mode with | Setup_proxy -> "proxy" @@ -568,7 +570,8 @@ let register_test ~title ~tags ?(kernels = Kernel.all) ?additional_config ?admin ?whitelist ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?rollup_operator_key @@ -589,10 +592,10 @@ let register_test ~title ~tags ?(kernels = Kernel.all) ?additional_config ?admin kernels let register_proxy ~title ~tags ?kernels ?additional_uses ?additional_config - ?admin ?commitment_period ?challenge_window ?bootstrap_accounts - ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist ?rollup_operator_key - ?maximum_allowed_ticks ?restricted_rpcs ?websockets ?enable_fast_withdrawal - ?evm_version f protocols = + ?admin ?commitment_period ?challenge_window ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas + ?whitelist ?rollup_operator_key ?maximum_allowed_ticks ?restricted_rpcs + ?websockets ?enable_fast_withdrawal ?evm_version f protocols = let register ~enable_dal ~enable_multichain : unit = register_test ~title @@ -603,7 +606,8 @@ let register_proxy ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist @@ -626,8 +630,8 @@ let register_proxy ~title ~tags ?kernels ?additional_uses ?additional_config let register_sequencer ?(return_sequencer = false) ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period - ?challenge_window ?bootstrap_accounts ?da_fee_per_byte - ?minimum_base_fee_per_gas ?time_between_blocks ?whitelist + ?challenge_window ?eth_bootstrap_accounts ?tez_bootstrap_accounts + ?da_fee_per_byte ?minimum_base_fee_per_gas ?time_between_blocks ?whitelist ?rollup_operator_key ?maximum_allowed_ticks ?restricted_rpcs ?max_blueprints_ahead ?websockets ?evm_version f protocols = let register ~enable_dal ~enable_multichain : unit = @@ -640,7 +644,8 @@ let register_sequencer ?(return_sequencer = false) ~title ~tags ?kernels ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist @@ -668,10 +673,11 @@ let register_sequencer ?(return_sequencer = false) ~title ~tags ?kernels register ~enable_dal:true ~enable_multichain:true let register_both ~title ~tags ?kernels ?additional_uses ?additional_config - ?admin ?commitment_period ?challenge_window ?bootstrap_accounts - ?da_fee_per_byte ?minimum_base_fee_per_gas ?time_between_blocks ?whitelist - ?rollup_operator_key ?maximum_allowed_ticks ?restricted_rpcs - ?max_blueprints_ahead ?websockets ?evm_version f protocols : unit = + ?admin ?commitment_period ?challenge_window ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas + ?time_between_blocks ?whitelist ?rollup_operator_key ?maximum_allowed_ticks + ?restricted_rpcs ?max_blueprints_ahead ?websockets ?evm_version f protocols + : unit = register_proxy ~title ~tags @@ -681,7 +687,8 @@ let register_both ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist @@ -701,7 +708,8 @@ let register_both ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?time_between_blocks @@ -965,7 +973,7 @@ let test_rpc_getBlockReceipts_aux ?websocket {evm_node; produce_block; _} = let test_rpc_getBlockReceipts = register_both ~time_between_blocks:Nothing - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~tags:["evm"; "rpc"; "get_block_receipts"] ~title:"RPC method eth_getBlockReceipts" ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx @@ -2077,7 +2085,7 @@ let test_simulate = let test_full_blocks = register_proxy - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~tags:["evm"; "full_blocks"] ~title: "Check `eth_getBlockByNumber` with full blocks returns the correct \ @@ -2207,7 +2215,7 @@ let test_inject_100_transactions = register_proxy ~tags:["evm"; "bigger_blocks"] ~title:"Check blocks can contain more than 64 transactions" - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx @@ fun ~protocol:_ ~evm_setup:{evm_node; produce_block; _} -> (* Retrieves all the messages and prepare them for the current rollup. *) @@ -3251,7 +3259,7 @@ let test_rpc_getTransactionByBlockHashAndIndex = ~tags:["evm"; "rpc"; "get_transaction_by"; "block_hash_and_index"] ~title:"RPC method eth_getTransactionByBlockHashAndIndex" ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address @@ fun ~protocol:_ -> test_rpc_getTransactionByBlockArgAndIndex ~by:`Hash let test_rpc_getTransactionByBlockNumberAndIndex = @@ -3259,7 +3267,7 @@ let test_rpc_getTransactionByBlockNumberAndIndex = ~tags:["evm"; "rpc"; "get_transaction_by"; "block_number_and_index"] ~title:"RPC method eth_getTransactionByBlockNumberAndIndex" ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address @@ fun ~protocol:_ -> test_rpc_getTransactionByBlockArgAndIndex ~by:`Number type storage_migration_results = { @@ -3277,12 +3285,12 @@ type storage_migration_results = { on master. - everytime a new path/rpc/object is stored in the kernel, a new sanity check MUST be generated. *) -let gen_kernel_migration_test ~from ~to_ ?bootstrap_accounts ?chain_id +let gen_kernel_migration_test ~from ~to_ ?eth_bootstrap_accounts ?chain_id ?(admin = Constant.bootstrap5) ~scenario_prior ~scenario_after protocol = let* evm_setup = setup_evm_kernel ?chain_id - ?bootstrap_accounts + ?eth_bootstrap_accounts ~da_fee_per_byte:Wei.zero ~minimum_base_fee_per_gas:(Wei.of_string "21000") ~kernel:from @@ -3512,7 +3520,7 @@ let test_cannot_prepayed_leads_to_no_inclusion = ~tags:["evm"; "prepay"; "inclusion"] ~title: "Not being able to prepay a transaction leads to it not being included." - ~bootstrap_accounts:[] + ~eth_bootstrap_accounts:[] ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx (* No bootstrap accounts, so no one has funds. *) @@ fun ~protocol:_ ~evm_setup:{evm_node; _} -> @@ -3812,7 +3820,7 @@ let test_transaction_storage_before_and_after_migration = gen_kernel_migration_test ~from:Ghostnet ~to_:Latest - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~scenario_prior ~scenario_after protocol @@ -3907,7 +3915,7 @@ let test_rpc_getBlockTransactionCountBy = ~title: "RPC methods eth_getBlockTransactionCountByHash and \ eth_getBlockTransactionCountByNumber" - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx @@ fun ~protocol:_ ~evm_setup -> let {produce_block; evm_node; _} = evm_setup in @@ -4503,7 +4511,7 @@ let test_block_hash_regression = The genesis timestamp can be found in tezt/lib_tezos/client.ml *) let* {produce_block; evm_node; _} = setup_evm_kernel - ~bootstrap_accounts: + ~eth_bootstrap_accounts: (List.map (fun account -> account.Eth_account.address) (Array.to_list Eth_account.bootstrap_accounts) @@ -5642,7 +5650,7 @@ let test_reveal_storage = ~admin:None ~additional_config ~force_install_kernel:false - ~bootstrap_accounts:[] + ~eth_bootstrap_accounts:[] protocol in diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index 8a1366afc268..a92342d706ad 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -244,12 +244,13 @@ let register_all ?max_delayed_inbox_blueprint_length ?sequencer_rpc_port ?sequencer_private_rpc_port ?genesis_timestamp ?time_between_blocks ?max_blueprints_lag ?max_blueprints_ahead ?max_blueprints_catchup ?catchup_cooldown ?delayed_inbox_timeout ?delayed_inbox_min_levels - ?max_number_of_chunks ?bootstrap_accounts ?sequencer ?sequencer_pool_address - ?(kernels = Kernel.all) ?da_fee ?minimum_base_fee_per_gas ?preimages_dir - ?maximum_allowed_ticks ?maximum_gas_per_transaction - ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?rollup_history_mode - ?commitment_period ?challenge_window ?additional_uses ?rpc_server - ?websockets ?enable_fast_withdrawal ?enable_fast_fa_withdrawal ?history_mode + ?max_number_of_chunks ?eth_bootstrap_accounts ?tez_bootstrap_accounts + ?sequencer ?sequencer_pool_address ?(kernels = Kernel.all) ?da_fee + ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks + ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds + ?enable_fa_bridge ?rollup_history_mode ?commitment_period ?challenge_window + ?additional_uses ?rpc_server ?websockets ?enable_fast_withdrawal + ?enable_fast_fa_withdrawal ?history_mode ?(use_threshold_encryption = default_threshold_encryption_registration) ?(use_dal = default_dal_registration) ?(use_multichain = default_multichain_registration) ?enable_tx_queue @@ -306,7 +307,8 @@ let register_all ?max_delayed_inbox_blueprint_length ?sequencer_rpc_port ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?sequencer ?sequencer_pool_address ~kernels @@ -344,12 +346,13 @@ let register_multichain_all ?max_delayed_inbox_blueprint_length ?sequencer_rpc_port ?sequencer_private_rpc_port ?genesis_timestamp ?time_between_blocks ?max_blueprints_lag ?max_blueprints_ahead ?max_blueprints_catchup ?catchup_cooldown ?delayed_inbox_timeout - ?delayed_inbox_min_levels ?max_number_of_chunks ?bootstrap_accounts - ?sequencer ?sequencer_pool_address ?da_fee ?minimum_base_fee_per_gas - ?preimages_dir ?maximum_allowed_ticks ?maximum_gas_per_transaction - ?max_blueprint_lookahead_in_seconds ?enable_fa_bridge ?rollup_history_mode - ?commitment_period ?challenge_window ?additional_uses ?rpc_server - ?websockets ?enable_fast_withdrawal ?history_mode + ?delayed_inbox_min_levels ?max_number_of_chunks ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?sequencer ?sequencer_pool_address ?da_fee + ?minimum_base_fee_per_gas ?preimages_dir ?maximum_allowed_ticks + ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds + ?enable_fa_bridge ?rollup_history_mode ?commitment_period ?challenge_window + ?additional_uses ?rpc_server ?websockets ?enable_fast_withdrawal + ?history_mode ?(use_threshold_encryption = default_threshold_encryption_registration) ?(use_dal = default_dal_registration) ~l2_setups ~title ~tags body protocols = @@ -389,7 +392,8 @@ let register_multichain_all ?max_delayed_inbox_blueprint_length ?delayed_inbox_timeout ?delayed_inbox_min_levels ?max_number_of_chunks - ?bootstrap_accounts + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?sequencer ?sequencer_pool_address ?da_fee @@ -616,7 +620,7 @@ let test_make_l2_kernel_installer_config chain_family = ~chain_id:chain_id_1 ~chain_family ~world_state_path - ~bootstrap_accounts:[address] + ~eth_bootstrap_accounts:[address] ~output:l2_config_1 () in @@ -624,7 +628,7 @@ let test_make_l2_kernel_installer_config chain_family = Evm_node.make_l2_kernel_installer_config ~chain_id:chain_id_2 ~chain_family - ~bootstrap_accounts:[address] + ~eth_bootstrap_accounts:[address] ~output:l2_config_2 () in @@ -5868,7 +5872,7 @@ let test_external_transaction_to_delayed_inbox_fails = register_all ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx ~time_between_blocks:Nothing - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~tags:["evm"; "sequencer"; "delayed_inbox"; "external"] ~title:"Sending an external transaction to the delayed inbox fails" @@ fun {client; sequencer; proxy; sc_rollup_node; _} _protocol -> @@ -5896,7 +5900,7 @@ let test_proxy_node_can_forward_to_evm_endpoint = register_all ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx ~time_between_blocks:Nothing - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~tags:["proxy"; "evm_node_endpoint"] ~title:"Proxy node can forward transactions to another EVM node" @@ fun {sequencer; proxy; sc_rollup_node; client; _} _protocol -> @@ -6835,7 +6839,7 @@ let test_blueprint_is_limited_in_size = ~time_between_blocks:Nothing ~max_number_of_chunks:2 ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~tags:["evm"; "sequencer"; "blueprint"; "limit"] ~title: "Checks the sequencer doesn't produce blueprint bigger than the given \ @@ -6911,7 +6915,7 @@ let test_blueprint_is_limited_in_size = let test_blueprint_limit_with_delayed_inbox = register_all - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~sequencer:Constant.bootstrap1 ~time_between_blocks:Nothing ~max_number_of_chunks:2 @@ -9842,7 +9846,7 @@ let test_rpc_mode_while_block_are_produced = let test_batch_limit_size_rpc = register_all - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx ~title:"Test batch size limit" ~tags:["rpc"; "batch_limit"] @@ -9961,7 +9965,7 @@ let test_describe_endpoint = let test_relay_restricted_rpcs = register_all - ~bootstrap_accounts:Eth_account.lots_of_address + ~eth_bootstrap_accounts:Eth_account.lots_of_address ~minimum_base_fee_per_gas:base_fee_for_hardcoded_tx ~time_between_blocks:Nothing ~kernels:[Latest] @@ -10287,7 +10291,7 @@ let test_websocket_rpcs = ~tags:["evm"; "rpc"; "websocket"] ~title:"RPC methods over websocket" ~time_between_blocks:Nothing - ~bootstrap_accounts: + ~eth_bootstrap_accounts: ((Array.to_list Eth_account.bootstrap_accounts |> List.map (fun a -> a.Eth_account.address)) @ Eth_account.lots_of_address) @@ -10361,7 +10365,7 @@ let test_websocket_subscription_rpcs_cant_be_called_via_http_requests = ~title: "Check that subscriptions rpcs can't be called via regular http requests" ~time_between_blocks:Nothing - ~bootstrap_accounts: + ~eth_bootstrap_accounts: ((Array.to_list Eth_account.bootstrap_accounts |> List.map (fun a -> a.Eth_account.address)) @ Eth_account.lots_of_address) @@ -10420,7 +10424,7 @@ let test_websocket_newHeads_event = ~tags:["evm"; "rpc"; "websocket"; "new_heads"] ~title:"Check that websocket event `newHeads` is behaving correctly" ~time_between_blocks:Nothing - ~bootstrap_accounts: + ~eth_bootstrap_accounts: ((Array.to_list Eth_account.bootstrap_accounts |> List.map (fun a -> a.Eth_account.address)) @ Eth_account.lots_of_address) @@ -10456,7 +10460,7 @@ let test_websocket_cleanup = ~tags:["evm"; "rpc"; "websocket"; "cleanup"] ~title:"Check that websocket subscriptions are cleaned up on close" ~time_between_blocks:Nothing - ~bootstrap_accounts: + ~eth_bootstrap_accounts: ((Array.to_list Eth_account.bootstrap_accounts |> List.map (fun a -> a.Eth_account.address)) @ Eth_account.lots_of_address) @@ -10568,7 +10572,7 @@ let test_websocket_newPendingTransactions_event = "Check that websocket event `newPendingTransactions` is behaving \ correctly" ~time_between_blocks:Nothing - ~bootstrap_accounts: + ~eth_bootstrap_accounts: ((Array.to_list Eth_account.bootstrap_accounts |> List.map (fun a -> a.Eth_account.address)) @ Eth_account.lots_of_address) @@ -10618,7 +10622,7 @@ let test_websocket_logs_event = ~tags:["evm"; "rpc"; "websocket"; "logs"] ~title:"Check that websocket event `logs` is behaving correctly" ~time_between_blocks:Nothing - ~bootstrap_accounts: + ~eth_bootstrap_accounts: ((Array.to_list Eth_account.bootstrap_accounts |> List.map (fun a -> a.Eth_account.address)) @ Eth_account.lots_of_address) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index baccf6458899..3532e5c0af33 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -2709,7 +2709,7 @@ let init_etherlink_operator_setup cloud configuration etherlink_configuration (* A configuration is generated locally by the orchestrator. The resulting kernel will be pushed to Etherlink. *) let output_config = Temp.file "config.yaml" in - let bootstrap_accounts = + let eth_bootstrap_accounts = Tezt_etherlink.Eth_account.bootstrap_accounts |> Array.to_list |> List.map (fun account -> account.Tezt_etherlink.Eth_account.address) in @@ -2718,7 +2718,7 @@ let init_etherlink_operator_setup cloud configuration etherlink_configuration let () = toplog "Init Etherlink: configuring the kernel" in Tezt_etherlink.Evm_node.make_kernel_installer_config ?sequencer - ~bootstrap_accounts + ~eth_bootstrap_accounts ~output:output_config ~enable_dal:(Option.is_some dal_slots) ?chain_id:etherlink_configuration.chain_id @@ -2879,7 +2879,7 @@ let init_etherlink_producer_setup operator name ~bootstrap ~rpc_external cloud (* A configuration is generated locally by the orchestrator. The resulting kernel will be pushed to Etherlink. *) let output_config = Temp.file "config.yaml" in - let bootstrap_accounts = + let eth_bootstrap_accounts = Tezt_etherlink.Eth_account.bootstrap_accounts |> Array.to_list |> List.map (fun account -> account.Tezt_etherlink.Eth_account.address) in @@ -2889,7 +2889,7 @@ let init_etherlink_producer_setup operator name ~bootstrap ~rpc_external cloud in Tezt_etherlink.Evm_node.make_kernel_installer_config ?sequencer - ~bootstrap_accounts + ~eth_bootstrap_accounts ~output:output_config () in -- GitLab From 653859e9815fb44c8d86df8041bcc56ead10fb6b Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Wed, 2 Apr 2025 18:08:52 +0200 Subject: [PATCH 11/11] EVM/Tezlink/Node: Integrate Tezos protocol 021-PsQuebec --- .../bin_node/lib_dev/durable_storage_path.ml | 4 +- etherlink/bin_node/lib_dev/encodings/dune | 3 +- .../bin_node/lib_dev/encodings/tezos_types.ml | 18 +++++++- .../lib_dev/encodings/tezos_types.mli | 10 ++++- etherlink/bin_node/lib_dev/evm_context.ml | 42 ++++++++++++------- etherlink/bin_node/lib_dev/evm_context.mli | 2 +- etherlink/bin_node/lib_dev/kernel_config.ml | 6 ++- etherlink/bin_node/main.ml | 2 +- manifest/product_etherlink.ml | 31 +++++++------- opam/octez-evm-node-libs.opam | 2 +- 10 files changed, 78 insertions(+), 42 deletions(-) diff --git a/etherlink/bin_node/lib_dev/durable_storage_path.ml b/etherlink/bin_node/lib_dev/durable_storage_path.ml index 221bf383cef1..b7e17abb3f24 100644 --- a/etherlink/bin_node/lib_dev/durable_storage_path.ml +++ b/etherlink/bin_node/lib_dev/durable_storage_path.ml @@ -57,11 +57,13 @@ let sequencer_key = EVM.make "/sequencer" let maximum_gas_per_transaction = EVM.make "/maximum_gas_per_transaction" module Tez_accounts = struct + open Tezos_types + let accounts_path = Tezlink.make "/context/contracts/index/" let balance_path = "/balance" - let account addr = accounts_path ^ Signature.Public_key_hash.to_string addr + let account addr = accounts_path ^ address_to_string addr let balance addr = account addr ^ balance_path end diff --git a/etherlink/bin_node/lib_dev/encodings/dune b/etherlink/bin_node/lib_dev/encodings/dune index 1fda77e6749d..7013d6ffb122 100644 --- a/etherlink/bin_node/lib_dev/encodings/dune +++ b/etherlink/bin_node/lib_dev/encodings/dune @@ -10,7 +10,8 @@ octez-smart-rollup-wasm-debugger-plugin octez-evm-node-libs.websocket re - uuidm) + uuidm + octez-protocol-021-PsQuebec-libs.plugin) (flags (:standard) -open Tezos_base.TzPervasives)) diff --git a/etherlink/bin_node/lib_dev/encodings/tezos_types.ml b/etherlink/bin_node/lib_dev/encodings/tezos_types.ml index 08ba2b29420a..16558ea90812 100644 --- a/etherlink/bin_node/lib_dev/encodings/tezos_types.ml +++ b/etherlink/bin_node/lib_dev/encodings/tezos_types.ml @@ -5,6 +5,8 @@ (* *) (*****************************************************************************) +module Imported_protocol = Tezos_protocol_021_PsQuebec + (* WIP: Minimal Block Tezos (should be equal to shell_block header) *) type block = { number : Ethereum_types.quantity; @@ -42,6 +44,18 @@ let block_from_binary bytes = else raise (Invalid_argument "Expected a string of length 44") (* We don't yet support smart contracts so all addresses are implicit accounts. *) -type address = Signature.public_key_hash +type address = Signature.V1.public_key_hash + +let address_to_bytes = + Data_encoding.Binary.to_bytes_exn + Imported_protocol.Protocol.Alpha_context.Contract.implicit_encoding + +let address_to_string s = Bytes.to_string (address_to_bytes s) + +let address_of_string s = + let bytes = Bytes.of_string s in + Data_encoding.Binary.of_bytes_exn + Imported_protocol.Protocol.Alpha_context.Contract.implicit_encoding + bytes -type quantity = Ethereum_types.quantity +module Tez = Imported_protocol.Protocol.Alpha_context.Tez diff --git a/etherlink/bin_node/lib_dev/encodings/tezos_types.mli b/etherlink/bin_node/lib_dev/encodings/tezos_types.mli index f527b876d19e..1bdfcbb7f036 100644 --- a/etherlink/bin_node/lib_dev/encodings/tezos_types.mli +++ b/etherlink/bin_node/lib_dev/encodings/tezos_types.mli @@ -5,6 +5,8 @@ (* *) (*****************************************************************************) +module Imported_protocol = Tezos_protocol_021_PsQuebec + type block = { number : Ethereum_types.quantity; hash : Ethereum_types.block_hash; @@ -18,6 +20,10 @@ val genesis_parent_hash : Ethereum_types.block_hash val block_from_binary : bytes -> block -type address = Signature.public_key_hash +type address = Signature.V1.public_key_hash + +val address_to_string : address -> string + +val address_of_string : string -> address -type quantity = Ethereum_types.quantity +module Tez = Imported_protocol.Protocol.Alpha_context.Tez diff --git a/etherlink/bin_node/lib_dev/evm_context.ml b/etherlink/bin_node/lib_dev/evm_context.ml index f54b63d47e4b..e0ff46d91ffe 100644 --- a/etherlink/bin_node/lib_dev/evm_context.ml +++ b/etherlink/bin_node/lib_dev/evm_context.ml @@ -2190,12 +2190,36 @@ let patch_sequencer_key ?block_number pk = block_number; }) -let provision_balance ?block_number address value balance_path = +let tez_provision_balance ?block_number address value = + worker_wait_for_request + (Patch_state + { + commit = false; + key = Durable_storage_path.Tez_accounts.balance address; + patch = + (let open Tezos_types in + let open Tez in + function + | Some old_balance -> ( + let old_balance = + match Tez.of_string old_balance with + | None -> Tez.zero + | Some v -> v + in + let add_res = value +? old_balance in + match add_res with + | Ok x -> Some (Tez.to_string x) + | Error _ -> Some (Tez.to_string value)) + | None -> Some (Tez.to_string value)); + block_number; + }) + +let eth_provision_balance ?block_number address value = worker_wait_for_request (Patch_state { commit = false; - key = balance_path address; + key = Durable_storage_path.Eth_accounts.balance address; patch = (let open Ethereum_types in function @@ -2209,20 +2233,6 @@ let provision_balance ?block_number address value balance_path = block_number; }) -let tez_provision_balance ?block_number address value = - provision_balance - ?block_number - address - value - Durable_storage_path.Tez_accounts.balance - -let eth_provision_balance ?block_number address value = - provision_balance - ?block_number - address - value - Durable_storage_path.Eth_accounts.balance - let patch_state ?block_number ~key ~value () = worker_wait_for_request (Patch_state diff --git a/etherlink/bin_node/lib_dev/evm_context.mli b/etherlink/bin_node/lib_dev/evm_context.mli index e8ac58afb532..506fa641c55e 100644 --- a/etherlink/bin_node/lib_dev/evm_context.mli +++ b/etherlink/bin_node/lib_dev/evm_context.mli @@ -126,7 +126,7 @@ val eth_provision_balance : val tez_provision_balance : ?block_number:Ethereum_types.quantity -> Tezos_types.address -> - Tezos_types.quantity -> + Tezos_types.Tez.t -> unit tzresult Lwt.t (** [patch_sequencer_key public_key] modifies the in memory state of the diff --git a/etherlink/bin_node/lib_dev/kernel_config.ml b/etherlink/bin_node/lib_dev/kernel_config.ml index 74cafd7e0e0e..6e7fd6c10349 100644 --- a/etherlink/bin_node/lib_dev/kernel_config.ml +++ b/etherlink/bin_node/lib_dev/kernel_config.ml @@ -109,6 +109,7 @@ let make_l2 ~boostrap_balance ?eth_bootstrap_accounts ?tez_bootstrap_accounts match tez_bootstrap_accounts with | None -> [] | Some tez_bootstrap_accounts -> + let open Tezos_types in let balance = padded_32_le_int_bytes boostrap_balance in List.map (fun address -> @@ -119,7 +120,7 @@ let make_l2 ~boostrap_balance ?eth_bootstrap_accounts ?tez_bootstrap_accounts "context"; "contracts"; "index"; - Signature.Public_key_hash.to_string address; + address_to_string address; ] (Some ("balance", balance))) tez_bootstrap_accounts @@ -198,6 +199,7 @@ let make ~mainnet_compat ~boostrap_balance ?l2_chain_ids ?eth_bootstrap_accounts match tez_bootstrap_accounts with | None -> [] | Some tez_bootstrap_accounts -> + let open Tezos_types in let balance = padded_32_le_int_bytes boostrap_balance in List.map (fun address -> @@ -208,7 +210,7 @@ let make ~mainnet_compat ~boostrap_balance ?l2_chain_ids ?eth_bootstrap_accounts "context"; "contracts"; "index"; - Signature.Public_key_hash.to_string address; + address_to_string address; ] (Some ("balance", balance))) tez_bootstrap_accounts diff --git a/etherlink/bin_node/main.ml b/etherlink/bin_node/main.ml index aecaae8ef8b4..0ae372fe1af7 100644 --- a/etherlink/bin_node/main.ml +++ b/etherlink/bin_node/main.ml @@ -164,7 +164,7 @@ module Params = struct let tez_l2_address = Tezos_clic.parameter (fun _ address -> - Lwt.return (Signature.Public_key_hash.of_b58check address)) + Lwt.return (Signature.V1.Public_key_hash.of_b58check address)) let l2_level = Tezos_clic.parameter (fun () s -> diff --git a/manifest/product_etherlink.ml b/manifest/product_etherlink.ml index 0e9ee87b1dfc..b7e7a3da6123 100644 --- a/manifest/product_etherlink.ml +++ b/manifest/product_etherlink.ml @@ -23,6 +23,19 @@ include Product (struct let source = ["etherlink"; "src"] @ Product_websocket.product_source end) +let quebec = + List.find (fun proto -> Protocol.short_hash proto = "PsQuebec") Protocol.all + +let tezos_protocol_plugin = + match Protocol.plugin quebec with + | Some target -> target + | None -> (* unreachable *) assert false + +let tezos_protocol_parameters = + match Protocol.parameters quebec with + | Some target -> target + | None -> (* unreachable *) assert false + let tezt_etherlink = private_lib "tezt_etherlink" @@ -222,6 +235,7 @@ let evm_node_lib_dev_encoding = websocket; re; uuidm; + tezos_protocol_plugin; ] let evm_node_config = @@ -241,19 +255,6 @@ let evm_node_config = ] let evm_node_lib_dev = - let quebec = - List.find (fun proto -> Protocol.short_hash proto = "PsQuebec") Protocol.all - in - let plugin = - match Protocol.plugin quebec with - | Some target -> target - | None -> (* unreachable *) assert false - in - let parameters = - match Protocol.parameters quebec with - | Some target -> target - | None -> (* unreachable *) assert false - in octez_evm_node_lib "evm_node_lib_dev" ~path:"etherlink/bin_node/lib_dev" @@ -293,8 +294,8 @@ let evm_node_lib_dev = supported_installers; wasm_runtime; performance_metrics; - plugin; - parameters; + tezos_protocol_plugin; + tezos_protocol_parameters; octez_version; octez_shell_services; ] diff --git a/opam/octez-evm-node-libs.opam b/opam/octez-evm-node-libs.opam index 936ce9006061..296734d5ca65 100644 --- a/opam/octez-evm-node-libs.opam +++ b/opam/octez-evm-node-libs.opam @@ -24,6 +24,7 @@ depends: [ "re" { >= "1.10.0" } "octez-smart-rollup-wasm-debugger-plugin" "uuidm" { >= "0.9.9" } + "octez-protocol-021-PsQuebec-libs" "octez-shell-libs" "dream" { >= "1.0.0~alpha7" } "octez-version" @@ -32,7 +33,6 @@ depends: [ "octez-smart-rollup-wasm-debugger-lib" "tezos-dal-node-services" "octez-performance-metrics" - "octez-protocol-021-PsQuebec-libs" "tezos-protocol-021-PsQuebec" ] conflicts: [ -- GitLab