mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
feat: make Eth node launcher generic (#10218)
This commit is contained in:
11
Cargo.lock
generated
11
Cargo.lock
generated
@@ -7688,6 +7688,8 @@ dependencies = [
|
||||
"reth-db-api",
|
||||
"reth-db-common",
|
||||
"reth-downloaders",
|
||||
"reth-engine-service",
|
||||
"reth-engine-tree",
|
||||
"reth-engine-util",
|
||||
"reth-evm",
|
||||
"reth-exex",
|
||||
@@ -7712,6 +7714,7 @@ dependencies = [
|
||||
"reth-stages",
|
||||
"reth-static-file",
|
||||
"reth-tasks",
|
||||
"reth-tokio-util",
|
||||
"reth-tracing",
|
||||
"reth-transaction-pool",
|
||||
"secp256k1",
|
||||
@@ -7783,13 +7786,10 @@ dependencies = [
|
||||
"reth-auto-seal-consensus",
|
||||
"reth-basic-payload-builder",
|
||||
"reth-beacon-consensus",
|
||||
"reth-blockchain-tree",
|
||||
"reth-chainspec",
|
||||
"reth-consensus",
|
||||
"reth-db",
|
||||
"reth-e2e-test-utils",
|
||||
"reth-engine-service",
|
||||
"reth-engine-tree",
|
||||
"reth-ethereum-engine-primitives",
|
||||
"reth-ethereum-payload-builder",
|
||||
"reth-evm-ethereum",
|
||||
@@ -7798,19 +7798,14 @@ dependencies = [
|
||||
"reth-node-api",
|
||||
"reth-node-builder",
|
||||
"reth-node-core",
|
||||
"reth-node-events",
|
||||
"reth-payload-builder",
|
||||
"reth-provider",
|
||||
"reth-rpc",
|
||||
"reth-rpc-engine-api",
|
||||
"reth-rpc-types",
|
||||
"reth-tasks",
|
||||
"reth-tokio-util",
|
||||
"reth-tracing",
|
||||
"reth-transaction-pool",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -24,7 +24,8 @@ pub struct EngineArgs {
|
||||
fn main() {
|
||||
use clap::Parser;
|
||||
use reth::cli::Cli;
|
||||
use reth_node_ethereum::{launch::EthNodeLauncher, node::EthereumAddOns, EthereumNode};
|
||||
use reth_node_builder::EngineNodeLauncher;
|
||||
use reth_node_ethereum::{node::EthereumAddOns, EthereumNode};
|
||||
use reth_provider::providers::BlockchainProvider2;
|
||||
|
||||
reth_cli_util::sigsegv_handler::install();
|
||||
@@ -43,7 +44,7 @@ fn main() {
|
||||
.with_components(EthereumNode::components())
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch_with_fn(|builder| {
|
||||
let launcher = EthNodeLauncher::new(
|
||||
let launcher = EngineNodeLauncher::new(
|
||||
builder.task_executor().clone(),
|
||||
builder.config().datadir(),
|
||||
);
|
||||
|
||||
@@ -14,7 +14,6 @@ workspace = true
|
||||
# reth
|
||||
reth-payload-builder.workspace = true
|
||||
reth-ethereum-engine-primitives.workspace = true
|
||||
reth-engine-service.workspace = true
|
||||
reth-basic-payload-builder.workspace = true
|
||||
reth-ethereum-payload-builder.workspace = true
|
||||
reth-node-builder.workspace = true
|
||||
@@ -27,22 +26,10 @@ reth-consensus.workspace = true
|
||||
reth-auto-seal-consensus.workspace = true
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-rpc.workspace = true
|
||||
reth-rpc-types.workspace = true
|
||||
reth-rpc-engine-api.workspace = true
|
||||
reth-node-api.workspace = true
|
||||
reth-tasks.workspace = true
|
||||
reth-tokio-util.workspace = true
|
||||
reth-node-events.workspace = true
|
||||
reth-node-core.workspace = true
|
||||
reth-exex.workspace = true
|
||||
reth-blockchain-tree.workspace = true
|
||||
reth-engine-tree.workspace = true
|
||||
|
||||
# misc
|
||||
eyre.workspace = true
|
||||
tokio = { workspace = true , features = ["sync"]}
|
||||
tokio-stream.workspace = true
|
||||
futures.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
reth.workspace = true
|
||||
@@ -52,6 +39,8 @@ reth-exex.workspace = true
|
||||
reth-node-api.workspace = true
|
||||
reth-node-core.workspace = true
|
||||
reth-e2e-test-utils.workspace = true
|
||||
reth-tasks.workspace = true
|
||||
futures.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-genesis.workspace = true
|
||||
tokio.workspace = true
|
||||
|
||||
@@ -15,5 +15,3 @@ pub use evm::{EthEvmConfig, EthExecutorProvider};
|
||||
|
||||
pub mod node;
|
||||
pub use node::EthereumNode;
|
||||
|
||||
pub mod launch;
|
||||
|
||||
@@ -6,11 +6,8 @@ use reth_db::{
|
||||
test_utils::{create_test_rw_db, TempDatabase},
|
||||
DatabaseEnv,
|
||||
};
|
||||
use reth_node_builder::{FullNodeComponents, NodeBuilder, NodeConfig};
|
||||
use reth_node_ethereum::{
|
||||
launch::EthNodeLauncher,
|
||||
node::{EthereumAddOns, EthereumNode},
|
||||
};
|
||||
use reth_node_builder::{EngineNodeLauncher, FullNodeComponents, NodeBuilder, NodeConfig};
|
||||
use reth_node_ethereum::node::{EthereumAddOns, EthereumNode};
|
||||
use reth_provider::providers::BlockchainProvider2;
|
||||
use reth_tasks::TaskManager;
|
||||
|
||||
@@ -55,7 +52,7 @@ async fn test_eth_launcher() {
|
||||
.with_components(EthereumNode::components())
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch_with_fn(|builder| {
|
||||
let launcher = EthNodeLauncher::new(tasks.executor(), builder.config.datadir());
|
||||
let launcher = EngineNodeLauncher::new(tasks.executor(), builder.config.datadir());
|
||||
builder.launch_with(launcher)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@ reth-cli-util.workspace = true
|
||||
reth-rpc-eth-types.workspace = true
|
||||
reth-network-api.workspace = true
|
||||
reth-payload-validator.workspace = true
|
||||
reth-engine-service.workspace = true
|
||||
reth-tokio-util.workspace = true
|
||||
reth-engine-tree.workspace = true
|
||||
|
||||
## async
|
||||
futures.workspace = true
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
//! Launch the Ethereum node.
|
||||
//! Engine node related functionality.
|
||||
|
||||
use crate::{
|
||||
components::NodeComponents,
|
||||
hooks::NodeHooks,
|
||||
launch::{LaunchContext, LaunchNode},
|
||||
rpc::{launch_rpc_servers, EthApiBuilderProvider},
|
||||
setup::build_networked_pipeline,
|
||||
AddOns, ExExLauncher, FullNode, NodeAdapter, NodeBuilderWithComponents, NodeComponentsBuilder,
|
||||
NodeHandle, NodeTypesAdapter,
|
||||
};
|
||||
use futures::{future::Either, stream, stream_select, StreamExt};
|
||||
use reth_beacon_consensus::{
|
||||
hooks::{EngineHooks, StaticFileHook},
|
||||
@@ -8,18 +17,10 @@ use reth_beacon_consensus::{
|
||||
use reth_blockchain_tree::BlockchainTreeConfig;
|
||||
use reth_engine_service::service::{ChainEvent, EngineService};
|
||||
use reth_engine_tree::tree::TreeConfig;
|
||||
use reth_ethereum_engine_primitives::EthEngineTypes;
|
||||
use reth_exex::ExExManagerHandle;
|
||||
use reth_network::{
|
||||
BlockDownloaderProvider, NetworkEventListenerProvider, NetworkSyncUpdater, SyncState,
|
||||
};
|
||||
use reth_network::{NetworkSyncUpdater, SyncState};
|
||||
use reth_network_api::{BlockDownloaderProvider, NetworkEventListenerProvider};
|
||||
use reth_node_api::{FullNodeTypes, NodeAddOns};
|
||||
use reth_node_builder::{
|
||||
hooks::NodeHooks,
|
||||
rpc::{launch_rpc_servers, EthApiBuilderProvider},
|
||||
AddOns, ExExLauncher, FullNode, LaunchContext, LaunchNode, NodeAdapter,
|
||||
NodeBuilderWithComponents, NodeComponents, NodeComponentsBuilder, NodeHandle, NodeTypesAdapter,
|
||||
};
|
||||
use reth_node_core::{
|
||||
dirs::{ChainPath, DataDirPath},
|
||||
exit::NodeExitFuture,
|
||||
@@ -37,26 +38,23 @@ use reth_tracing::tracing::{debug, error, info};
|
||||
use tokio::sync::{mpsc::unbounded_channel, oneshot};
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
|
||||
/// The Ethereum node launcher.
|
||||
/// The engine node launcher.
|
||||
#[derive(Debug)]
|
||||
pub struct EthNodeLauncher {
|
||||
pub struct EngineNodeLauncher {
|
||||
/// The task executor for the node.
|
||||
pub ctx: LaunchContext,
|
||||
}
|
||||
|
||||
impl EthNodeLauncher {
|
||||
impl EngineNodeLauncher {
|
||||
/// Create a new instance of the ethereum node launcher.
|
||||
pub const fn new(task_executor: TaskExecutor, data_dir: ChainPath<DataDirPath>) -> Self {
|
||||
Self { ctx: LaunchContext::new(task_executor, data_dir) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, CB, AO> LaunchNode<NodeBuilderWithComponents<T, CB, AO>> for EthNodeLauncher
|
||||
impl<T, CB, AO> LaunchNode<NodeBuilderWithComponents<T, CB, AO>> for EngineNodeLauncher
|
||||
where
|
||||
T: FullNodeTypes<
|
||||
Provider = BlockchainProvider2<<T as FullNodeTypes>::DB>,
|
||||
Engine = EthEngineTypes,
|
||||
>,
|
||||
T: FullNodeTypes<Provider = BlockchainProvider2<<T as FullNodeTypes>::DB>>,
|
||||
CB: NodeComponentsBuilder<T>,
|
||||
AO: NodeAddOns<NodeAdapter<T, CB::Components>>,
|
||||
AO::EthApi:
|
||||
@@ -146,7 +144,7 @@ where
|
||||
// Configure the pipeline
|
||||
let pipeline_exex_handle =
|
||||
exex_manager_handle.clone().unwrap_or_else(ExExManagerHandle::empty);
|
||||
let pipeline = reth_node_builder::setup::build_networked_pipeline(
|
||||
let pipeline = build_networked_pipeline(
|
||||
&ctx.toml_config().stages,
|
||||
network_client.clone(),
|
||||
ctx.consensus(),
|
||||
@@ -3,6 +3,8 @@
|
||||
pub mod common;
|
||||
mod exex;
|
||||
|
||||
pub(crate) mod engine;
|
||||
|
||||
pub use common::LaunchContext;
|
||||
pub use exex::ExExLauncher;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ pub use builder::{
|
||||
};
|
||||
|
||||
mod launch;
|
||||
pub use launch::*;
|
||||
pub use launch::{engine::EngineNodeLauncher, *};
|
||||
|
||||
mod handle;
|
||||
pub use handle::NodeHandle;
|
||||
|
||||
Reference in New Issue
Block a user