Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reth-builder): Remove duplicate engine extra arguments. #453

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Changes from all 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
88 changes: 16 additions & 72 deletions crates/reth-rbuilder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use reth::{
cli::Cli,
primitives::Header,
};
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher};
use reth_node_ethereum::{node::EthereumAddOns, EthereumNode};
use reth_provider::{
providers::BlockchainProvider, BlockReader, ChainSpecProvider, DatabaseProviderFactory,
Expand All @@ -25,7 +24,7 @@ use reth_provider::{
use reth_transaction_pool::{blobstore::DiskFileBlobStore, EthTransactionPool};
use std::{path::PathBuf, process};
use tokio::task;
use tracing::{error, info, warn};
use tracing::error;

// Prefer jemalloc for performance reasons.
#[cfg(all(feature = "jemalloc", unix))]
Expand All @@ -37,33 +36,6 @@ pub struct ExtraArgs {
/// Path of the rbuilder config to use
#[arg(long = "rbuilder.config")]
pub rbuilder_config: PathBuf,

/// Enable the experimental engine features on reth binary
///
/// DEPRECATED: experimental engine is default now, use --engine.legacy to enable the legacy
/// functionality
#[arg(long = "engine.experimental", default_value = "false")]
pub experimental: bool,

/// Enable the legacy engine on reth binary
#[arg(long = "engine.legacy", default_value = "false")]
pub legacy: bool,

/// Configure persistence threshold for engine experimental.
#[arg(
long = "engine.persistence-threshold",
conflicts_with = "legacy",
default_value_t = 0
)]
pub persistence_threshold: u64,

/// Configure the target number of blocks to keep in memory.
#[arg(
long = "engine.memory-block-buffer-target",
conflicts_with = "legacy",
default_value_t = 0
)]
pub memory_block_buffer_target: u64,
}

fn main() {
Expand All @@ -76,49 +48,21 @@ fn main() {

if let Err(err) =
Cli::<EthereumChainSpecParser, ExtraArgs>::parse().run(|builder, extra_args| async move {
if extra_args.experimental {
warn!(target: "reth::cli", "Experimental engine is default now, and the --engine.experimental flag is deprecated. To enable the legacy functionality, use --engine.legacy.");
}

let use_legacy_engine = extra_args.legacy;
match use_legacy_engine {
false => {
let engine_tree_config = TreeConfig::default()
.with_persistence_threshold(extra_args.persistence_threshold)
.with_memory_block_buffer_target(extra_args.memory_block_buffer_target);
let handle = builder
.with_types_and_provider::<EthereumNode, BlockchainProvider<_>>()
.with_components(EthereumNode::components())
.with_add_ons(EthereumAddOns::default())
.on_node_started(move |node| {
spawn_rbuilder(node.provider().clone(), node.pool().clone(), extra_args.rbuilder_config);
Ok(())
})
.launch_with_fn(|builder| {
let launcher = EngineNodeLauncher::new(
builder.task_executor().clone(),
builder.config().datadir(),
engine_tree_config,
);
builder.launch_with(launcher)
})
.await?;
handle.node_exit_future.await
}
true => {
info!(target: "reth::cli", "Running with legacy engine");
let handle = builder
.with_types_and_provider::<EthereumNode, BlockchainProvider<_>>()
.with_components(EthereumNode::components())
.with_add_ons::<EthereumAddOns<_>>(Default::default())
.on_node_started(move |node| {
spawn_rbuilder(node.provider().clone(), node.pool().clone(), extra_args.rbuilder_config);
Ok(())
})
.launch().await?;
handle.node_exit_future.await
}
}
let handle = builder
.with_types_and_provider::<EthereumNode, BlockchainProvider<_>>()
.with_components(EthereumNode::components())
.with_add_ons(EthereumAddOns::default())
.on_node_started(move |node| {
spawn_rbuilder(
node.provider().clone(),
node.pool().clone(),
extra_args.rbuilder_config,
);
Ok(())
})
.launch()
.await?;
handle.node_exit_future.await
})
{
eprintln!("Error: {err:?}");
Expand Down
Loading