From dcd2665b4d0c992a38d997efc20146f6f3b556e2 Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Tue, 15 Apr 2025 13:32:10 +0200 Subject: [PATCH 1/3] EVM/Tezlink/Node: Add support for Tezos bootstrap accounts in kernel configuration --- etherlink/bin_node/lib_dev/kernel_config.ml | 66 +++++++---- etherlink/bin_node/lib_dev/kernel_config.mli | 10 +- .../bin_node/lib_dev/tezlink/tezos_types.ml | 19 +++- .../bin_node/lib_dev/tezlink/tezos_types.mli | 11 +- etherlink/bin_node/main.ml | 107 +++++++++++------- .../evm_sequencer.ml/EVM Node- man.out | 43 +++---- 6 files changed, 168 insertions(+), 88 deletions(-) diff --git a/etherlink/bin_node/lib_dev/kernel_config.ml b/etherlink/bin_node/lib_dev/kernel_config.ml index 74e7abc97b08..ade3afd22380 100644 --- a/etherlink/bin_node/lib_dev/kernel_config.ml +++ b/etherlink/bin_node/lib_dev/kernel_config.ml @@ -82,7 +82,8 @@ let clean_path path = [] (List.rev path) -let make_l2 ~boostrap_balance ?bootstrap_accounts ?minimum_base_fee_per_gas +let make_l2 ~eth_bootstrap_balance ~tez_bootstrap_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 () = @@ -91,18 +92,36 @@ let make_l2 ~boostrap_balance ?bootstrap_accounts ?minimum_base_fee_per_gas | 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 + let balance = padded_32_le_int_bytes eth_bootstrap_balance in List.map (fun (Address (Hex address)) -> 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 -> + List.map + (fun address -> + make_instr + ~path_prefix: + (Tezlink_services_impl.Path.account address + |> String.split_on_char '/' |> clean_path) + (Some + ( "balance", + Data_encoding.Binary.to_string_exn + Tezos_types.Tez.encoding + tez_bootstrap_balance ))) + tez_bootstrap_accounts |> List.flatten in let set_account_code = @@ -147,34 +166,35 @@ let make_l2 ~boostrap_balance ?bootstrap_accounts ?minimum_base_fee_per_gas | Error _ -> raise (Invalid_argument "sequencer_pool_address")) ~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 ~eth_bootstrap_balance ?l2_chain_ids + ?eth_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 -> - let balance = padded_32_le_int_bytes boostrap_balance in + | Some eth_bootstrap_accounts -> + let balance = padded_32_le_int_bytes eth_bootstrap_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 set_account_code = match set_account_code with | None -> [] @@ -254,7 +274,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 @ 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..9d2691a63545 100644 --- a/etherlink/bin_node/lib_dev/kernel_config.mli +++ b/etherlink/bin_node/lib_dev/kernel_config.mli @@ -13,9 +13,9 @@ type evm_version = Shanghai | Cancun [bootstrap_accounts] are provisioned with [bootstrap_balance]. *) val make : mainnet_compat:bool -> - boostrap_balance:Ethereum_types.NonceMap.key -> + eth_bootstrap_balance:Z.t -> ?l2_chain_ids:L2_types.chain_id list -> - ?bootstrap_accounts:Ethereum_types.address list -> + ?eth_bootstrap_accounts:Ethereum_types.address list -> ?kernel_root_hash:string * string -> ?chain_id:string * string -> ?sequencer:string * string -> @@ -51,8 +51,10 @@ val make : generates a configuration file located at [output] for the chain [l2_chain_id], where [bootstrap_accounts] are provisioned with [bootstrap_balance]. *) val make_l2 : - boostrap_balance:Z.t -> - ?bootstrap_accounts:Ethereum_types.address list -> + eth_bootstrap_balance:Z.t -> + tez_bootstrap_balance:Tezos_types.Tez.t -> + ?eth_bootstrap_accounts:Ethereum_types.address list -> + ?tez_bootstrap_accounts:Tezos_types.Contract.t 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/lib_dev/tezlink/tezos_types.ml b/etherlink/bin_node/lib_dev/tezlink/tezos_types.ml index 9fa6eecde15c..899f298bf420 100644 --- a/etherlink/bin_node/lib_dev/tezlink/tezos_types.ml +++ b/etherlink/bin_node/lib_dev/tezlink/tezos_types.ml @@ -51,6 +51,23 @@ module Contract = struct type t = Tezlink_imports.Alpha_context.Contract.t let encoding = Tezlink_imports.Alpha_context.Contract.encoding + + let of_b58check s = + Tezlink_imports.Imported_env.wrap_tzresult + @@ Tezlink_imports.Alpha_context.Contract.of_b58check s + + let to_hex c = + let raw_key = Data_encoding.Binary.to_bytes_exn encoding c in + let (`Hex key) = Hex.of_bytes raw_key in + key end -module Tez = Tezlink_imports.Alpha_context.Tez +module Tez = struct + include Tezlink_imports.Alpha_context.Tez + + let of_string_exn str = + match of_string str with + | None -> + raise (Invalid_argument (Printf.sprintf "Invalid tez value: %s" str)) + | Some s -> s +end diff --git a/etherlink/bin_node/lib_dev/tezlink/tezos_types.mli b/etherlink/bin_node/lib_dev/tezlink/tezos_types.mli index 227364d0b808..259ff01b38cb 100644 --- a/etherlink/bin_node/lib_dev/tezlink/tezos_types.mli +++ b/etherlink/bin_node/lib_dev/tezlink/tezos_types.mli @@ -38,6 +38,15 @@ module Contract : sig type t = Tezlink_imports.Alpha_context.Contract.t val encoding : t Data_encoding.t + + val of_b58check : string -> t tzresult + + (** Convert a contract to a hex string.*) + val to_hex : t -> string end -module Tez = Tezlink_imports.Alpha_context.Tez +module Tez : sig + include module type of Tezlink_imports.Alpha_context.Tez + + val of_string_exn : string -> t +end diff --git a/etherlink/bin_node/main.ml b/etherlink/bin_node/main.ml index 4d2d3665a648..777c5abe3a5a 100644 --- a/etherlink/bin_node/main.ml +++ b/etherlink/bin_node/main.ml @@ -158,7 +158,7 @@ module Params = struct [\"1970-01-01T00:00:00Z\"]) or in number of seconds since \ the {!Time.Protocol.epoch}.")) - let l2_address = + let eth_address = Tezos_clic.parameter (fun _ address -> let open Lwt_result_syntax in let*? (`Hex hex) = Evm_node_lib_dev.Misc.normalize_hex address in @@ -169,6 +169,11 @@ module Params = struct in return (Evm_node_lib_dev_encoding.Ethereum_types.Address (Hex hex))) + let tez_contract = + Tezos_clic.parameter (fun _ contract -> + Lwt.return + (Evm_node_lib_dev_tezlink.Tezos_types.Contract.of_b58check contract)) + let l2_level = Tezos_clic.parameter (fun () s -> Lwt.return_ok @@ -1415,7 +1420,7 @@ let make_sequencer_upgrade_command = @@ Tezos_clic.param ~name:"pool_address" ~desc:"Pool address of the sequencer" - Params.l2_address + Params.eth_address @@ prefixes ["at"; "activation"; "timestamp"] @@ param ~name:"activation_timestamp" @@ -1890,10 +1895,37 @@ 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 an etherlink bootstrap account in the installer config." + in + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.eth_address + +let tez_bootstrap_account_arg = + let long = "tez-bootstrap-account" in + let doc = + Format.sprintf "Add a tezlink bootstrap account in the installer config." + in + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"tz1..." Params.tez_contract + +let eth_bootstrap_balance_arg = + Tezos_clic.default_arg + ~long:"eth-bootstrap-balance" + ~doc:"Balance (in Wei) of the etherlink bootstrap accounts" + ~default:"9999000000000000000000" + ~placeholder:"9999000000000000000000" + @@ Tezos_clic.parameter (fun _ s -> Lwt_result.return @@ Z.of_string s) + +let tez_bootstrap_balance_arg = + Tezos_clic.default_arg + ~long:"tez-bootstrap-balance" + ~doc:"Balance (in tez) of the tezlink bootstrap accounts" + ~default:"3800000" + ~placeholder:"3800000" + @@ Tezos_clic.parameter (fun _ s -> + Lwt.return @@ Error_monad.catch + @@ fun () -> Evm_node_lib_dev_tezlink.Tezos_types.Tez.of_string_exn s) let set_account_code = let long = "set-code" in @@ -1929,20 +1961,17 @@ 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 + (args12 (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...") (config_key_arg ~name:"maximum_gas_per_transaction" ~placeholder:"30000...") - (Tezos_clic.default_arg - ~long:"bootstrap-balance" - ~doc:"Balance of the bootstrap accounts." - ~default:"9999000000000000000000" - ~placeholder:"9999000000000000000000" - @@ Tezos_clic.parameter (fun _ s -> return @@ Z.of_string s)) - bootstrap_account_arg + eth_bootstrap_balance_arg + eth_bootstrap_account_arg + tez_bootstrap_balance_arg + tez_bootstrap_account_arg set_account_code (config_key_arg ~name:"world_state_path" @@ -1969,8 +1998,10 @@ let make_l2_kernel_config_command = da_fee_per_byte, sequencer_pool_address, maximum_gas_per_transaction, - boostrap_balance, - bootstrap_accounts, + eth_bootstrap_balance, + eth_bootstrap_accounts, + tez_bootstrap_balance, + tez_bootstrap_accounts, set_account_code, world_state_path, l2_chain_id, @@ -1986,12 +2017,14 @@ let make_l2_kernel_config_command = | Some l2_chain_id -> return (Chain_id.to_string l2_chain_id) in Evm_node_lib_dev.Kernel_config.make_l2 + ~eth_bootstrap_balance + ~tez_bootstrap_balance + ?eth_bootstrap_accounts + ?tez_bootstrap_accounts ?minimum_base_fee_per_gas ?da_fee_per_byte ?sequencer_pool_address ?maximum_gas_per_transaction - ~boostrap_balance - ?bootstrap_accounts ?set_account_code ?world_state_path ~l2_chain_id @@ -2010,12 +2043,11 @@ let l2_chain_ids_arg = let make_kernel_config_command = let open Tezos_clic in - let open Lwt_result_syntax in command ~group:Groups.kernel ~desc:"Create a configuration for the kernel installer." (merge_options - (args25 + (args23 mainnet_compat_arg (config_key_arg ~name:"kernel_root_hash" ~placeholder:"root hash") (config_key_arg ~name:"chain_id" ~placeholder:"chain id") @@ -2045,18 +2077,12 @@ let make_kernel_config_command = ~name:"max_blueprint_lookahead_in_seconds" ~placeholder:"500") (config_key_flag ~name:"remove_whitelist") - (Tezos_clic.default_arg - ~long:"bootstrap-balance" - ~doc:"Balance of the bootstrap accounts" - ~default:"9999000000000000000000" - ~placeholder:"9999000000000000000000" - @@ Tezos_clic.parameter (fun _ s -> return @@ Z.of_string s)) - bootstrap_account_arg - set_account_code + eth_bootstrap_balance_arg + eth_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 + (args8 + (config_key_flag ~name:"enable_dal") (config_key_flag ~name:"enable_multichain") l2_chain_ids_arg (config_key_arg @@ -2064,7 +2090,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" @@ -2090,22 +2117,23 @@ let make_kernel_config_command = maximum_gas_per_transaction, max_blueprint_lookahead_in_seconds, remove_whitelist, - boostrap_balance, - bootstrap_accounts, - set_account_code, + eth_bootstrap_balance, + eth_bootstrap_accounts, enable_fa_bridge, - enable_dal, dal_slots ), - ( enable_multichain, + ( enable_dal, + enable_multichain, l2_chain_ids, 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 ~mainnet_compat + ~eth_bootstrap_balance ?l2_chain_ids ?kernel_root_hash ?chain_id @@ -2126,8 +2154,7 @@ let make_kernel_config_command = ?maximum_gas_per_transaction ?max_blueprint_lookahead_in_seconds ?remove_whitelist - ~boostrap_balance - ?bootstrap_accounts + ?eth_bootstrap_accounts ?enable_fa_bridge ?enable_dal ?dal_slots @@ -2222,7 +2249,7 @@ let fund_arg = "The address of an account to provide with funds in the sandbox (can be \ repeated to fund multiple accounts)." in - Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.l2_address + Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.eth_address let sandbox_config_args = Tezos_clic.args13 diff --git a/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- man.out b/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- man.out index 06e4daa00622..ac9ae3d344c6 100644 --- a/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- man.out +++ b/etherlink/tezt/tests/expected/evm_sequencer.ml/EVM Node- man.out @@ -702,13 +702,12 @@ Kernel commands: [--sequencer-pool-address <0x...>] [--maximum-allowed-ticks <11000...>] [--maximum-gas-per-transaction <30000...>] [--max-blueprint-lookahead-in-seconds <500>] [--remove-whitelist] - [--bootstrap-balance <9999000000000000000000>] - [--bootstrap-account <0x...>] [--set-code <0x...,0x....>] - [--enable-fa-bridge] [--enable-dal] [--dal-slots <0,1,4,6,...>] - [--enable-multichain] [--l2-chain-id <1>] - [--max-delayed-inbox-blueprint-length <1000>] + [--eth-bootstrap-balance <9999000000000000000000>] + [--eth-bootstrap-account <0x...>] [--enable-fa-bridge] + [--dal-slots <0,1,4,6,...>] [--enable-dal] [--enable-multichain] + [--l2-chain-id <1>] [--max-delayed-inbox-blueprint-length <1000>] [--enable-fast-withdrawal] [--enable-fast-fa-withdrawal] - [--evm-version ] + [--evm-version ] [--set-code <0x...,0x....>] Create a configuration for the kernel installer. : File path where the config will be written to. --mainnet-compat: Generate a configuration compatible with the first @@ -744,16 +743,14 @@ Kernel commands: --max-blueprint-lookahead-in-seconds <500>: Value for max_blueprint_lookahead_in_seconds in the installer config. --remove-whitelist: Enable flag remove_whitelist in the installer config. - --bootstrap-balance <9999000000000000000000>: Balance of the bootstrap - accounts + --eth-bootstrap-balance <9999000000000000000000>: Balance (in Wei) of the + etherlink bootstrap accounts Defaults to `9999000000000000000000`. - --bootstrap-account <0x...>: Add a bootstrap account in the installer - config. - --set-code <0x...,0x....>: Add code to an account in the installer - config. + --eth-bootstrap-account <0x...>: Add an etherlink bootstrap account in + the installer config. --enable-fa-bridge: Enable flag enable_fa_bridge in the installer config. - --enable-dal: Enable flag enable_dal in the installer config. --dal-slots <0,1,4,6,...>: Value for dal_slots in the installer config. + --enable-dal: Enable flag enable_dal in the installer config. --enable-multichain: Enable flag enable_multichain in the installer config. --l2-chain-id <1>: Specify one of the chain ids in the kernel, can be @@ -766,13 +763,16 @@ Kernel commands: installer config. --evm-version : Value for evm_version in the installer config. + --set-code <0x...,0x....>: Add code to an account in the installer + config. make l2 kernel installer config [--minimum-base-fee-per-gas <111...>] [--da-fee-per-byte <111...>] [--sequencer-pool-address <0x...>] [--maximum-gas-per-transaction <30000...>] - [--bootstrap-balance <9999000000000000000000>] - [--bootstrap-account <0x...>] [--set-code <0x...,0x....>] + [--eth-bootstrap-balance <9999000000000000000000>] + [--eth-bootstrap-account <0x...>] [--tez-bootstrap-balance <3800000>] + [--tez-bootstrap-account ] [--set-code <0x...,0x....>] [--world-state-path >] [--l2-chain-id <1>] [--l2-chain-family ] Produce a file containing the part of the kernel configuration @@ -786,11 +786,16 @@ Kernel commands: installer config. --maximum-gas-per-transaction <30000...>: Value for maximum_gas_per_transaction in the installer config. - --bootstrap-balance <9999000000000000000000>: Balance of the bootstrap - accounts. + --eth-bootstrap-balance <9999000000000000000000>: Balance (in Wei) of the + etherlink bootstrap accounts Defaults to `9999000000000000000000`. - --bootstrap-account <0x...>: Add a bootstrap account in the installer - config. + --eth-bootstrap-account <0x...>: Add an etherlink bootstrap account in + the installer config. + --tez-bootstrap-balance <3800000>: Balance (in tez) of the tezlink + bootstrap accounts + Defaults to `3800000`. + --tez-bootstrap-account : Add a tezlink bootstrap account in the + installer config. --set-code <0x...,0x....>: Add code to an account in the installer config. --world-state-path >: Value for -- GitLab From e8a0158ca73c229103c085d42d901c1f16bc39b1 Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Mon, 7 Apr 2025 09:18:02 +0200 Subject: [PATCH 2/3] Tezlink/Tezt : Refactor bootstrap account parameters to support both Ethereum and Tezos accounts --- etherlink/tezt/lib/evm_node.ml | 78 ++++++++++++++++++--------- etherlink/tezt/lib/evm_node.mli | 17 +++--- etherlink/tezt/lib/setup.ml | 57 ++++++++++++-------- etherlink/tezt/lib/setup.mli | 12 +++-- etherlink/tezt/lib/test_helpers.ml | 4 +- etherlink/tezt/lib/test_helpers.mli | 2 +- etherlink/tezt/tests/eth_call.ml | 10 ++-- etherlink/tezt/tests/evm_rollup.ml | 50 ++++++++--------- etherlink/tezt/tests/evm_sequencer.ml | 60 +++++++++++---------- tezt/tests/cloud/dal.ml | 8 +-- 10 files changed, 178 insertions(+), 120 deletions(-) diff --git a/etherlink/tezt/lib/evm_node.ml b/etherlink/tezt/lib/evm_node.ml index 9b38088696df..f089b31fe832 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; @@ -1744,12 +1748,13 @@ 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 + ?(remove_whitelist = false) ?kernel_root_hash ?chain_id + ?eth_bootstrap_balance ?eth_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) @@ -1830,25 +1835,30 @@ let make_kernel_installer_config ?(l2_chain_ids = []) "dal-slots" (fun l -> String.concat "," (List.map string_of_int l)) dal_slots - @ Cli_arg.optional_arg "bootstrap-balance" Wei.to_string bootstrap_balance + @ Cli_arg.optional_arg + "eth-bootstrap-balance" + Wei.to_string + eth_bootstrap_balance @ Cli_arg.optional_arg "evm-version" Evm_version.to_string evm_version @ - match bootstrap_accounts with + match eth_bootstrap_accounts with | None -> [] - | Some bootstrap_accounts -> + | Some eth_bootstrap_accounts -> List.flatten @@ List.map - (fun bootstrap_account -> - ["--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 () = +let make_l2_kernel_installer_config ?chain_id ?chain_family + ?eth_bootstrap_balance ?tez_bootstrap_balance ?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 @@ -1875,16 +1885,34 @@ let make_l2_kernel_installer_config ?chain_id ?chain_family ?bootstrap_balance "maximum-gas-per-transaction" Int64.to_string maximum_gas_per_transaction - @ Cli_arg.optional_arg "bootstrap-balance" Wei.to_string bootstrap_balance + @ Cli_arg.optional_arg + "eth-bootstrap-balance" + Wei.to_string + eth_bootstrap_balance + @ Cli_arg.optional_arg + "tez-bootstrap-balance" + Tez.to_string + tez_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 -> - ["--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 dc8dbd23f102..c744fee8f02b 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 @@ -636,8 +639,10 @@ val wait_termination : t -> unit Lwt.t val make_l2_kernel_installer_config : ?chain_id:int -> ?chain_family:string -> - ?bootstrap_balance:Wei.t -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_balance:Wei.t -> + ?tez_bootstrap_balance:Tez.t -> + ?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 -> @@ -657,8 +662,8 @@ val make_kernel_installer_config : ?remove_whitelist:bool -> ?kernel_root_hash:string -> ?chain_id:int -> - ?bootstrap_balance:Wei.t -> - ?bootstrap_accounts:string list -> + ?eth_bootstrap_balance:Wei.t -> + ?eth_bootstrap_accounts:string list -> ?sequencer:string -> ?delayed_bridge:string -> ?ticketer:string -> diff --git a/etherlink/tezt/lib/setup.ml b/etherlink/tezt/lib/setup.ml index 840bfb1231a8..fb9ba39c1184 100644 --- a/etherlink/tezt/lib/setup.ml +++ b/etherlink/tezt/lib/setup.ml @@ -242,7 +242,7 @@ 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) ?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 +271,7 @@ 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 ~output:output_config ?evm_version ?enable_fa_bridge @@ -294,7 +294,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 +317,7 @@ 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 ) = match l2_setups with | [ { @@ -324,17 +325,23 @@ 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; _; }; ] -> + 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 ) | _ -> assert false in (* In the kernel, the multichain notion was not introduced yet. *) @@ -368,7 +375,7 @@ 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 ~output:rollup_config ?enable_fa_bridge ?evm_version @@ -408,7 +415,7 @@ 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 ?enable_fa_bridge ?evm_version ~preimages_dir @@ -671,8 +678,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 @@ -688,7 +696,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; @@ -745,8 +754,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 @@ -780,7 +790,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 @@ -866,8 +877,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 @@ -892,7 +904,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 @@ -931,8 +944,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 @@ -958,7 +972,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 60c6073ab54d..03101b81aae5 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 f123bcb227e2..3f4d9eb18420 100644 --- a/etherlink/tezt/lib/test_helpers.ml +++ b/etherlink/tezt/lib/test_helpers.ml @@ -425,7 +425,7 @@ 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)) () = @@ -440,7 +440,7 @@ 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 ?evm_version () in diff --git a/etherlink/tezt/lib/test_helpers.mli b/etherlink/tezt/lib/test_helpers.mli index 7f75cd7561ab..bdd6a24b0ac0 100644 --- a/etherlink/tezt/lib/test_helpers.mli +++ b/etherlink/tezt/lib/test_helpers.mli @@ -247,7 +247,7 @@ 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 -> 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 51bb6b238d74..1a0ba357a68e 100644 --- a/etherlink/tezt/tests/evm_rollup.ml +++ b/etherlink/tezt/tests/evm_rollup.ml @@ -298,7 +298,7 @@ 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)) @@ -368,7 +368,7 @@ 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 ?da_fee_per_byte ?minimum_base_fee_per_gas ?ticketer @@ -529,9 +529,9 @@ 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 ?maximum_gas_per_transaction - ?restricted_rpcs ~setup_mode ~enable_dal + ?eth_bootstrap_accounts ?whitelist ?da_fee_per_byte + ?minimum_base_fee_per_gas ?rollup_operator_key ?maximum_allowed_ticks + ?maximum_gas_per_transaction ?restricted_rpcs ~setup_mode ~enable_dal ?(dal_slots = if enable_dal then Some [4] else None) ~enable_multichain ?websockets ?enable_fast_withdrawal ?evm_version ?enable_tx_queue f protocols = @@ -577,7 +577,7 @@ let register_test ~title ~tags ?(kernels = Kernel.all) ?additional_config ?admin ?whitelist ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?rollup_operator_key @@ -600,7 +600,7 @@ 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 + ?admin ?commitment_period ?challenge_window ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist ?rollup_operator_key ?maximum_allowed_ticks ?maximum_gas_per_transaction ?restricted_rpcs ?websockets ?enable_fast_withdrawal ?evm_version f protocols = @@ -614,7 +614,7 @@ let register_proxy ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist @@ -638,7 +638,7 @@ 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 + ?challenge_window ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?time_between_blocks ?whitelist ?rollup_operator_key ?maximum_allowed_ticks ?maximum_gas_per_transaction ?restricted_rpcs ?max_blueprints_ahead ?websockets ?evm_version @@ -653,7 +653,7 @@ let register_sequencer ?(return_sequencer = false) ~title ~tags ?kernels ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist @@ -684,7 +684,7 @@ 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 + ?admin ?commitment_period ?challenge_window ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?time_between_blocks ?whitelist ?rollup_operator_key ?maximum_allowed_ticks ?maximum_gas_per_transaction ?restricted_rpcs ?max_blueprints_ahead ?websockets ?evm_version f protocols @@ -698,7 +698,7 @@ let register_both ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?whitelist @@ -719,7 +719,7 @@ let register_both ~title ~tags ?kernels ?additional_uses ?additional_config ?admin ?commitment_period ?challenge_window - ?bootstrap_accounts + ?eth_bootstrap_accounts ?da_fee_per_byte ?minimum_base_fee_per_gas ?time_between_blocks @@ -984,7 +984,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 @@ -2099,7 +2099,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 \ @@ -2229,7 +2229,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. *) @@ -3273,7 +3273,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 = @@ -3281,7 +3281,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 = { @@ -3299,12 +3299,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 @@ -3536,7 +3536,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; _} -> @@ -3836,7 +3836,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 @@ -3931,7 +3931,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 @@ -4527,7 +4527,7 @@ let test_block_hash_regression = genesis timestamp can be found in tezt/lib_tezos/client.ml *) let* {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) @@ -5688,7 +5688,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 e028badfd7db..e7fd3fbabae9 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 @@ -679,7 +683,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 @@ -687,7 +691,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 @@ -5939,7 +5943,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 -> @@ -5967,7 +5971,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 -> @@ -6906,7 +6910,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 \ @@ -6982,7 +6986,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 @@ -10197,7 +10201,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"] @@ -10334,7 +10338,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] @@ -10660,7 +10664,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) @@ -10734,7 +10738,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) @@ -10793,7 +10797,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) @@ -10829,7 +10833,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) @@ -11106,7 +11110,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) @@ -11156,7 +11160,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 348cefe226ce..22c4c1823a9c 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -2742,7 +2742,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 @@ -2751,7 +2751,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 @@ -2912,7 +2912,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 @@ -2922,7 +2922,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 eb05c30852bd2802c898354b235a6f22b5adffb1 Mon Sep 17 00:00:00 2001 From: Dibassi Brahima Date: Tue, 15 Apr 2025 16:03:49 +0200 Subject: [PATCH 3/3] Tezlink/Tezt : Test balance RPC using bootstrap account --- etherlink/tezt/tests/evm_sequencer.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etherlink/tezt/tests/evm_sequencer.ml b/etherlink/tezt/tests/evm_sequencer.ml index e7fd3fbabae9..d0387f380493 100644 --- a/etherlink/tezt/tests/evm_sequencer.ml +++ b/etherlink/tezt/tests/evm_sequencer.ml @@ -575,7 +575,8 @@ let test_tezlink_balance = let* res = Client.get_balance_for ~endpoint ~account:Constant.bootstrap1.alias client in - Check.((Tez.to_mutez res = 0) int ~error_msg:"Expected %R but got %L") ; + Check.( + (Tez.to_mutez res = 3800000000000) int ~error_msg:"Expected %R but got %L") ; unit let test_tezlink_version = -- GitLab