Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd/ethrex/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -230,6 +230,14 @@ pub struct Options {
help_heading = "Block producer options"
)]
pub extra_data: String,
#[arg(
long = "block-producer.gas-limit",
default_value_t = DEFAULT_BUILDER_GAS_CEIL,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this? Isn't the default gas ceil different depending on the fork? I understand if you want to overwrite it but, isnt the default different for each fork?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The default gas limit is set by each client independently of the network. For example, geth currently has a default of 60M:

https://github.com/ethereum/go-ethereum/blob/6608a2aafd3603afe59f95fa7b2a8ec00b8eaa19/miner/miner.go#L54-L55

I think we should bump this default to 60M, but I didn't change that in this PR since it's important enough to merit its own PR and discussion.

value_name = "GAS_LIMIT",
help = "Target block gas limit.",
help_heading = "Block producer options"
)]
pub gas_limit: u64,
}

impl Options {
Expand Down Expand Up @@ -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,
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions cmd/ethrex/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:agite:

pub async fn init_rpc_api(
opts: &Options,
peer_handler: PeerHandler,
Expand All @@ -141,8 +141,6 @@ pub async fn init_rpc_api(
cancel_token: CancellationToken,
tracker: TaskTracker,
log_filter_handler: Option<reload::Handle<EnvFilter, Registry>>,
gas_ceil: Option<u64>,
extra_data: String,
) {
init_datadir(&opts.datadir);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 2 additions & 3 deletions crates/networking/rpc/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -210,7 +209,7 @@ pub async fn start_api(
peer_handler: PeerHandler,
client_version: String,
log_filter_handler: Option<reload::Handle<EnvFilter, Registry>>,
gas_ceil: Option<u64>,
gas_ceil: u64,
extra_data: String,
) -> Result<(), RpcErr> {
// TODO: Refactor how filters are handled,
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion crates/networking/rpc/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ pub mod test_utils {
PeerHandler::dummy(),
"ethrex/test".to_string(),
None,
None,
DEFAULT_BUILDER_GAS_CEIL,
String::new(),
)
.await
Expand Down
7 changes: 6 additions & 1 deletion docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ P2P options:
UDP port for P2P discovery.

[default: 30303]

--p2p.tx-broadcasting-interval <INTERVAL_MS>
Transaction Broadcasting Time Interval (ms) for batching transactions before broadcasting them.

Expand Down Expand Up @@ -143,6 +143,11 @@ Block producer options:
Block extra data message.

[default: "ethrex 4.0.0"]

--block-producer.gas-limit <GAS_LIMIT>
Target block gas limit.

[default: 30000000]
```

<!-- END_CLI_HELP -->
Expand Down
Loading