diff --git a/cmd/ethrex/cli.rs b/cmd/ethrex/cli.rs index 9d8a2efd070..65710e31b73 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, @@ -223,13 +223,21 @@ 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 = "builder.gas-limit", + default_value_t = DEFAULT_BUILDER_GAS_CEIL, + value_name = "GAS_LIMIT", + help = "Target block gas limit.", + help_heading = "Block building options" + )] + pub gas_limit: u64, } 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: DEFAULT_BUILDER_GAS_CEIL, } } } diff --git a/cmd/ethrex/initializers.rs b/cmd/ethrex/initializers.rs index 96340aad0bd..839e7fc7508 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; diff --git a/crates/networking/rpc/rpc.rs b/crates/networking/rpc/rpc.rs index 18666d22fc2..4d307e75e29 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 9bf286f8ce7..c28998ac90b 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 diff --git a/docs/CLI.md b/docs/CLI.md index 656d5c38301..86f20066611 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. @@ -138,11 +138,16 @@ 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"] + + --builder.gas-limit + Target block gas limit. + + [default: 30000000] ```