From 3874c660a9ce38f48edfacd60d931f19ad0bb22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 21 Oct 2025 11:05:08 -0300 Subject: [PATCH 1/4] feat(l1): allow setting a target gas limit --- cmd/ethrex/cli.rs | 9 +++++++++ cmd/ethrex/initializers.rs | 11 +++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmd/ethrex/cli.rs b/cmd/ethrex/cli.rs index 9d8a2efd07..5465a2bfc4 100644 --- a/cmd/ethrex/cli.rs +++ b/cmd/ethrex/cli.rs @@ -230,6 +230,14 @@ pub struct Options { help_heading = "Block producer options" )] pub extra_data: String, + #[arg( + long = "block-producer.gas-limit", + default_value = None, + value_name = "GAS_LIMIT", + help = "Target block gas limit.", + help_heading = "Block producer options" + )] + pub gas_limit: Option, } impl Options { @@ -302,6 +310,7 @@ impl Default for Options { tx_broadcasting_time_interval: Default::default(), target_peers: Default::default(), extra_data: get_minimal_client_version(), + gas_limit: None, } } } diff --git a/cmd/ethrex/initializers.rs b/cmd/ethrex/initializers.rs index 96340aad0b..839e7fc750 100644 --- a/cmd/ethrex/initializers.rs +++ b/cmd/ethrex/initializers.rs @@ -130,7 +130,7 @@ pub fn init_blockchain(store: Store, blockchain_opts: BlockchainOptions) -> Arc< Blockchain::new(store, blockchain_opts).into() } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub async fn init_rpc_api( opts: &Options, peer_handler: PeerHandler, @@ -141,8 +141,6 @@ pub async fn init_rpc_api( cancel_token: CancellationToken, tracker: TaskTracker, log_filter_handler: Option>, - gas_ceil: Option, - extra_data: String, ) { init_datadir(&opts.datadir); @@ -182,8 +180,8 @@ pub async fn init_rpc_api( peer_handler, get_client_version(), log_filter_handler, - gas_ceil, - extra_data, + opts.gas_limit, + opts.extra_data.clone(), ); tracker.spawn(rpc_api); @@ -463,9 +461,6 @@ pub async fn init_l1( cancel_token.clone(), tracker.clone(), log_filter_handler, - // TODO (#4482): Make this configurable. - None, - opts.extra_data.clone(), ) .await; From f87fe21fdcad039f0c0859b3911b42661ed7ff10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:19:05 -0300 Subject: [PATCH 2/4] refactor: change gas limit to show the default --- cmd/ethrex/cli.rs | 8 ++++---- crates/networking/rpc/rpc.rs | 5 ++--- crates/networking/rpc/utils.rs | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/ethrex/cli.rs b/cmd/ethrex/cli.rs index 5465a2bfc4..1915ddb80e 100644 --- a/cmd/ethrex/cli.rs +++ b/cmd/ethrex/cli.rs @@ -7,7 +7,7 @@ use std::{ use clap::{ArgAction, Parser as ClapParser, Subcommand as ClapSubcommand}; use ethrex_blockchain::{BlockchainOptions, BlockchainType, error::ChainError}; -use ethrex_common::types::{Block, Genesis, fee_config::FeeConfig}; +use ethrex_common::types::{Block, DEFAULT_BUILDER_GAS_CEIL, Genesis, fee_config::FeeConfig}; use ethrex_p2p::{ discv4::peer_table::TARGET_PEERS, sync::SyncMode, tx_broadcaster::BROADCAST_INTERVAL_MS, types::Node, @@ -232,12 +232,12 @@ pub struct Options { pub extra_data: String, #[arg( long = "block-producer.gas-limit", - default_value = None, + default_value_t = DEFAULT_BUILDER_GAS_CEIL, value_name = "GAS_LIMIT", help = "Target block gas limit.", help_heading = "Block producer options" )] - pub gas_limit: Option, + pub gas_limit: u64, } impl Options { @@ -310,7 +310,7 @@ impl Default for Options { tx_broadcasting_time_interval: Default::default(), target_peers: Default::default(), extra_data: get_minimal_client_version(), - gas_limit: None, + gas_limit: DEFAULT_BUILDER_GAS_CEIL, } } } diff --git a/crates/networking/rpc/rpc.rs b/crates/networking/rpc/rpc.rs index 18666d22fc..4d307e75e2 100644 --- a/crates/networking/rpc/rpc.rs +++ b/crates/networking/rpc/rpc.rs @@ -53,7 +53,6 @@ use axum_extra::{ }; use bytes::Bytes; use ethrex_blockchain::Blockchain; -use ethrex_common::types::DEFAULT_BUILDER_GAS_CEIL; use ethrex_p2p::peer_handler::PeerHandler; use ethrex_p2p::sync_manager::SyncManager; use ethrex_p2p::types::Node; @@ -210,7 +209,7 @@ pub async fn start_api( peer_handler: PeerHandler, client_version: String, log_filter_handler: Option>, - gas_ceil: Option, + gas_ceil: u64, extra_data: String, ) -> Result<(), RpcErr> { // TODO: Refactor how filters are handled, @@ -231,7 +230,7 @@ pub async fn start_api( }, gas_tip_estimator: Arc::new(TokioMutex::new(GasTipEstimator::new())), log_filter_handler, - gas_ceil: gas_ceil.unwrap_or(DEFAULT_BUILDER_GAS_CEIL), + gas_ceil, }; // Periodically clean up the active filters for the filters endpoints. diff --git a/crates/networking/rpc/utils.rs b/crates/networking/rpc/utils.rs index 9bf286f8ce..c28998ac90 100644 --- a/crates/networking/rpc/utils.rs +++ b/crates/networking/rpc/utils.rs @@ -398,7 +398,7 @@ pub mod test_utils { PeerHandler::dummy(), "ethrex/test".to_string(), None, - None, + DEFAULT_BUILDER_GAS_CEIL, String::new(), ) .await From d29457752915412ecc8682a93b466a4bf4761a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 21 Oct 2025 13:59:57 -0300 Subject: [PATCH 3/4] docs: update CLI reference --- docs/CLI.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/CLI.md b/docs/CLI.md index 656d5c3830..5279681c3c 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -82,7 +82,7 @@ P2P options: UDP port for P2P discovery. [default: 30303] - + --p2p.tx-broadcasting-interval Transaction Broadcasting Time Interval (ms) for batching transactions before broadcasting them. @@ -143,6 +143,11 @@ Block producer options: Block extra data message. [default: "ethrex 4.0.0"] + + --block-producer.gas-limit + Target block gas limit. + + [default: 30000000] ``` From 510f969d2f5ef0fc6628562f10f4b77d2d9477fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Tue, 21 Oct 2025 15:24:43 -0300 Subject: [PATCH 4/4] refactor: rename namespace to `builder` --- cmd/ethrex/cli.rs | 8 ++++---- docs/CLI.md | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/ethrex/cli.rs b/cmd/ethrex/cli.rs index 1915ddb80e..65710e31b7 100644 --- a/cmd/ethrex/cli.rs +++ b/cmd/ethrex/cli.rs @@ -223,19 +223,19 @@ pub struct Options { )] pub target_peers: usize, #[arg( - long = "block-producer.extra-data", + long = "builder.extra-data", default_value = get_minimal_client_version(), value_name = "EXTRA_DATA", help = "Block extra data message.", - help_heading = "Block producer options" + help_heading = "Block building options" )] pub extra_data: String, #[arg( - long = "block-producer.gas-limit", + long = "builder.gas-limit", default_value_t = DEFAULT_BUILDER_GAS_CEIL, value_name = "GAS_LIMIT", help = "Target block gas limit.", - help_heading = "Block producer options" + help_heading = "Block building options" )] pub gas_limit: u64, } diff --git a/docs/CLI.md b/docs/CLI.md index 5279681c3c..86f2006661 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -138,13 +138,13 @@ RPC options: [default: jwt.hex] -Block producer options: - --block-producer.extra-data +Block building options: + --builder.extra-data Block extra data message. [default: "ethrex 4.0.0"] - --block-producer.gas-limit + --builder.gas-limit Target block gas limit. [default: 30000000]