diff --git a/crates/reth-rbuilder/src/main.rs b/crates/reth-rbuilder/src/main.rs index 1e0b2f20..3dc978b5 100644 --- a/crates/reth-rbuilder/src/main.rs +++ b/crates/reth-rbuilder/src/main.rs @@ -10,6 +10,7 @@ use rbuilder::{ live_builder::{base_config::load_config_toml_and_env, cli::LiveBuilderConfig, config::Config}, telemetry, }; +use reth::rpc::builder::config::RethRpcServerConfig; use reth::{chainspec::EthereumChainSpecParser, cli::Cli}; use reth_db_api::Database; use reth_node_builder::{ @@ -83,7 +84,12 @@ fn main() { .with_components(EthereumNode::components()) .with_add_ons(EthereumAddOns::default()) .on_rpc_started(move |ctx, _| { - spawn_rbuilder(ctx.provider().clone(), extra_args.rbuilder_config); + let ipc_path = if ctx.config().rpc.is_ipc_enabled() { + Some(PathBuf::from(ctx.config().rpc.ipc_path())) + } else { + None + }; + spawn_rbuilder(ctx.provider().clone(), extra_args.rbuilder_config, ipc_path); Ok(()) }) .launch_with_fn(|builder| { @@ -95,7 +101,8 @@ fn main() { builder.launch_with(launcher) }) .await?; - handle.node_exit_future.await + + handle.node_exit_future.await } true => { info!(target: "reth::cli", "Running with legacy engine"); @@ -104,7 +111,13 @@ fn main() { .with_components(EthereumNode::components()) .with_add_ons::>(Default::default()) .on_rpc_started(move |ctx, _| { - spawn_rbuilder(ctx.provider().clone(), extra_args.rbuilder_config); + let ipc_path = if ctx.config().rpc.is_ipc_enabled() { + Some(PathBuf::from(ctx.config().rpc.ipc_path())) + } else { + None + }; + + spawn_rbuilder(ctx.provider().clone(), extra_args.rbuilder_config, ipc_path); Ok(()) }) .launch().await?; @@ -121,7 +134,7 @@ fn main() { /// Spawns a tokio rbuilder task. /// /// Takes down the entire process if the rbuilder errors or stops. -fn spawn_rbuilder(provider: P, config_path: PathBuf) +fn spawn_rbuilder(provider: P, config_path: PathBuf, ipc_path: Option) where DB: Database + Clone + 'static, P: DatabaseProviderFactory @@ -132,7 +145,10 @@ where { let _handle = task::spawn(async move { let result = async { - let config: Config = load_config_toml_and_env(config_path)?; + let mut config: Config = load_config_toml_and_env(config_path)?; + if let Some(ipc_path) = ipc_path { + config.base_config.el_node_ipc_path = ipc_path; + } // Spawn redacted server that is safe for tdx builders to expose telemetry::servers::redacted::spawn(