diff --git a/crates/node/builder/Cargo.toml b/crates/node/builder/Cargo.toml index f0c62f3252a..c1224d35e5a 100644 --- a/crates/node/builder/Cargo.toml +++ b/crates/node/builder/Cargo.toml @@ -19,7 +19,7 @@ reth-cli-util.workspace = true reth-config.workspace = true reth-consensus-debug-client.workspace = true reth-consensus.workspace = true -reth-db = { workspace = true, features = ["mdbx"], optional = true } +reth-db = { workspace = true, features = ["mdbx"] } reth-db-api.workspace = true reth-db-common.workspace = true reth-downloaders.workspace = true @@ -97,7 +97,6 @@ reth-evm-ethereum = { workspace = true, features = ["test-utils"] } default = [] js-tracer = ["reth-rpc/js-tracer"] test-utils = [ - "dep:reth-db", "reth-db/test-utils", "reth-chain-state/test-utils", "reth-chainspec/test-utils", @@ -117,7 +116,7 @@ test-utils = [ "reth-primitives-traits/test-utils", ] op = [ - "reth-db?/op", + "reth-db/op", "reth-db-api/op", "reth-engine-local/op", "reth-evm/op", diff --git a/crates/node/builder/src/node.rs b/crates/node/builder/src/node.rs index 42f023fc4ee..ca44ad9523d 100644 --- a/crates/node/builder/src/node.rs +++ b/crates/node/builder/src/node.rs @@ -1,7 +1,11 @@ +use reth_db::DatabaseEnv; // re-export the node api types pub use reth_node_api::{FullNodeTypes, NodeTypes}; -use crate::{components::NodeComponentsBuilder, rpc::RethRpcAddOns, NodeAdapter, NodeAddOns}; +use crate::{ + components::NodeComponentsBuilder, rpc::RethRpcAddOns, NodeAdapter, NodeAddOns, NodeHandle, + RethFullAdapter, +}; use reth_node_api::{EngineTypes, FullNodeComponents, PayloadTypes}; use reth_node_core::{ dirs::{ChainPath, DataDirPath}, @@ -208,3 +212,11 @@ impl> DerefMut for FullNode> = + FullNode>, >>::AddOns>; + +/// Helper type alias to define [`NodeHandle`] for a given [`Node`]. +pub type NodeHandleFor> = + NodeHandle>, >>::AddOns>; diff --git a/examples/custom-inspector/src/main.rs b/examples/custom-inspector/src/main.rs index 739038ae6de..2a182ed8718 100644 --- a/examples/custom-inspector/src/main.rs +++ b/examples/custom-inspector/src/main.rs @@ -27,7 +27,7 @@ use reth_ethereum::{ interpreter::{interpreter::EthInterpreter, interpreter_types::Jumps, Interpreter}, }, }, - node::{builder::NodeHandle, EthereumNode}, + node::{builder::FullNodeFor, EthereumNode}, pool::TransactionPool, rpc::api::eth::helpers::Call, }; @@ -36,8 +36,10 @@ fn main() { Cli::::parse() .run(|builder, args| async move { // launch the node - let NodeHandle { node, node_exit_future } = - builder.node(EthereumNode::default()).launch().await?; + let handle = builder.node(EthereumNode::default()).launch().await?; + + let node: FullNodeFor = handle.node; + let node_exit_future = handle.node_exit_future; // create a new subscription to pending transactions let mut pending_transactions = node.pool.new_pending_pool_transactions_listener(); diff --git a/examples/exex-subscription/src/main.rs b/examples/exex-subscription/src/main.rs index b234c1c71f9..90f10e4e719 100644 --- a/examples/exex-subscription/src/main.rs +++ b/examples/exex-subscription/src/main.rs @@ -12,7 +12,7 @@ use jsonrpsee::{ }; use reth_ethereum::{ exex::{ExExContext, ExExEvent, ExExNotification}, - node::{api::FullNodeComponents, EthereumNode}, + node::{api::FullNodeComponents, builder::NodeHandleFor, EthereumNode}, }; use std::collections::HashMap; use tokio::sync::{mpsc, oneshot}; @@ -178,7 +178,7 @@ fn main() -> eyre::Result<()> { let rpc = StorageWatcherRpc::new(subscriptions_tx.clone()); - let handle = builder + let handle: NodeHandleFor = builder .node(EthereumNode::default()) .extend_rpc_modules(move |ctx| { ctx.modules.merge_configured(StorageWatcherApiServer::into_rpc(rpc))?;