From b4223b2bd3801968450a5b1d3622de3e203b987c Mon Sep 17 00:00:00 2001 From: Thomas Letan Date: Fri, 25 Apr 2025 00:23:25 +0200 Subject: [PATCH] EVM Node: Add `--disable-da-fees` to the sandbox mode --- etherlink/CHANGES_NODE.md | 2 ++ etherlink/bin_node/lib_dev/sequencer.ml | 11 ++++++++++- etherlink/bin_node/main.ml | 7 +++++-- .../tests/expected/evm_sequencer.ml/EVM Node- man.out | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/etherlink/CHANGES_NODE.md b/etherlink/CHANGES_NODE.md index 7d7435ea274a..080da573ab54 100644 --- a/etherlink/CHANGES_NODE.md +++ b/etherlink/CHANGES_NODE.md @@ -21,6 +21,8 @@ from command-line. (!17762) - Adds `--replicate` to `run sandbox` to provide an easy way to make local tests on a local endpoint with realistic traffic. (!17845) +- Adds `--disable-da-fees` to `run sandbox` to provide an easy way to disable + DA fees in the local sandbox. (!17852) - Previously when submitting the same transaction multiple times, if the first fails to be included by the sequencer then all following will fails. Now when submitting multiple time the same transaction, diff --git a/etherlink/bin_node/lib_dev/sequencer.ml b/etherlink/bin_node/lib_dev/sequencer.ml index dc2c7f946b4b..9775f3c0e3c1 100644 --- a/etherlink/bin_node/lib_dev/sequencer.ml +++ b/etherlink/bin_node/lib_dev/sequencer.ml @@ -13,6 +13,7 @@ type sandbox_config = { network : Configuration.supported_network option; funded_addresses : Ethereum_types.address list; parent_chain : Uri.t option; + disable_da_fees : bool; } let install_finalizer_seq server_public_finalizer server_private_finalizer @@ -150,7 +151,7 @@ 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; funded_addresses; disable_da_fees; _} -> 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) @@ -177,6 +178,14 @@ let main ~data_dir ?(genesis_timestamp = Misc.now ()) ~cctxt | _ -> return_unit) kernel in + let* () = + when_ disable_da_fees @@ fun () -> + Evm_context.patch_state + ~key:"/evm/world_state/fees/da_fee_per_byte" + ~value: + Ethereum_types.(encode_u256_le (Qty Z.zero) |> String.of_bytes) + () + in return_unit | None -> return_unit in diff --git a/etherlink/bin_node/main.ml b/etherlink/bin_node/main.ml index 71a51146e78c..d64ce0662cea 100644 --- a/etherlink/bin_node/main.ml +++ b/etherlink/bin_node/main.ml @@ -2283,7 +2283,7 @@ let fund_arg = Tezos_clic.multiple_arg ~long ~doc ~placeholder:"0x..." Params.eth_address let sandbox_config_args = - Tezos_clic.args14 + Tezos_clic.args15 preimages_arg preimages_endpoint_arg native_execution_policy_arg @@ -2298,6 +2298,7 @@ let sandbox_config_args = init_from_snapshot_arg fund_arg replicate_arg + disable_da_fees_arg let sequencer_command = let open Tezos_clic in @@ -2425,7 +2426,8 @@ let sandbox_command = network, init_from_snapshot, funded_addresses, - main_endpoint ) ) + main_endpoint, + disable_da_fees ) ) () -> let open Lwt_result_syntax in let* restricted_rpcs = @@ -2459,6 +2461,7 @@ let sandbox_command = network; funded_addresses = Option.value ~default:[] funded_addresses; parent_chain; + disable_da_fees; } in let config_file = config_filename ~data_dir config_file in 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 0cb6875f6d78..1b073069b34d 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 @@ -47,7 +47,7 @@ Run commands: [--kernel ] [-d --wallet-dir ] [-f --password-filename ] [--network ] [--init-from-snapshot [snapshot url]] [--fund <0x...>] - [--replicate [url]] + [--replicate [url]] [--disable-da-fees] Start the EVM node in sandbox mode. The sandbox mode is a sequencer-like mode that produces blocks with a fake key and no rollup node connection. --data-dir : The path to the EVM node data directory. @@ -129,6 +129,7 @@ Run commands: --replicate [url]: Replicate a chain in real time from the EVM node whose address is provided. Defaults to `the official relay endpoint if --network is used`. + --disable-da-fees: Disable DA fees for this replay. run proxy [--data-dir ] [--config-file ] [--rpc-addr ] [--rpc-port ] [--rpc-batch-limit ] -- GitLab