diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 52e654678..f9c3e09ae 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -10,7 +10,7 @@ use reth_network_p2p::{ sync::{NetworkSyncUpdater, SyncState}, BlockClient, }; -use reth_node_types::NodeTypesWithDB; +use reth_node_types::NodeTypesWithEngine; use reth_payload_builder::PayloadBuilderHandle; use reth_payload_primitives::{PayloadAttributes, PayloadBuilderAttributes}; use reth_payload_validator::ExecutionPayloadValidator; @@ -87,6 +87,11 @@ const MAX_INVALID_HEADERS: u32 = 512u32; /// If the distance exceeds this threshold, the pipeline will be used for sync. pub const MIN_BLOCKS_FOR_PIPELINE_RUN: u64 = EPOCH_SLOTS; +/// Helper trait expressing requirements for node types to be used in engine. +pub trait EngineNodeTypes: ProviderNodeTypes + NodeTypesWithEngine {} + +impl EngineNodeTypes for T where T: ProviderNodeTypes + NodeTypesWithEngine {} + /// Represents a pending forkchoice update. /// /// This type encapsulates the necessary components for a pending forkchoice update @@ -169,7 +174,7 @@ type PendingForkchoiceUpdate = #[allow(missing_debug_implementations)] pub struct BeaconConsensusEngine where - N: NodeTypesWithDB, + N: EngineNodeTypes, Client: BlockClient, BT: BlockchainTreeEngine + BlockReader @@ -225,7 +230,7 @@ where impl BeaconConsensusEngine where - N: ProviderNodeTypes, + N: EngineNodeTypes, BT: BlockchainTreeEngine + BlockReader + BlockIdReader @@ -1789,7 +1794,7 @@ where /// receiver and forwarding them to the blockchain tree. impl Future for BeaconConsensusEngine where - N: ProviderNodeTypes, + N: EngineNodeTypes, Client: BlockClient + 'static, BT: BlockchainTreeEngine + BlockReader diff --git a/crates/engine/service/src/service.rs b/crates/engine/service/src/service.rs index b69eed9f5..9ce2086e4 100644 --- a/crates/engine/service/src/service.rs +++ b/crates/engine/service/src/service.rs @@ -1,6 +1,6 @@ use futures::{Stream, StreamExt}; use pin_project::pin_project; -use reth_beacon_consensus::{BeaconConsensusEngineEvent, BeaconEngineMessage}; +use reth_beacon_consensus::{BeaconConsensusEngineEvent, BeaconEngineMessage, EngineNodeTypes}; use reth_consensus::Consensus; use reth_engine_tree::{ backfill::PipelineSync, @@ -18,10 +18,7 @@ use reth_network_p2p::BlockClient; use reth_node_types::NodeTypesWithEngine; use reth_payload_builder::PayloadBuilderHandle; use reth_payload_validator::ExecutionPayloadValidator; -use reth_provider::{ - providers::{BlockchainProvider2, ProviderNodeTypes}, - ProviderFactory, -}; +use reth_provider::{providers::BlockchainProvider2, ProviderFactory}; use reth_prune::Pruner; use reth_stages_api::Pipeline; use reth_tasks::TaskSpawner; @@ -50,7 +47,7 @@ type EngineServiceType = ChainOrchestrator< #[allow(missing_debug_implementations)] pub struct EngineService where - N: ProviderNodeTypes, + N: EngineNodeTypes, Client: BlockClient + 'static, E: BlockExecutorProvider + 'static, { @@ -60,7 +57,7 @@ where impl EngineService where - N: ProviderNodeTypes, + N: EngineNodeTypes, Client: BlockClient + 'static, E: BlockExecutorProvider + 'static, { @@ -119,7 +116,7 @@ where impl Stream for EngineService where - N: ProviderNodeTypes, + N: EngineNodeTypes, Client: BlockClient + 'static, E: BlockExecutorProvider + 'static, { diff --git a/crates/node/api/src/node.rs b/crates/node/api/src/node.rs index faabda427..bc59c134a 100644 --- a/crates/node/api/src/node.rs +++ b/crates/node/api/src/node.rs @@ -19,7 +19,7 @@ use crate::ConfigureEvm; /// Its types are configured by node internally and are not intended to be user configurable. pub trait FullNodeTypes: Send + Sync + Unpin + 'static { /// Node's types with the database. - type Types: NodeTypesWithDB; + type Types: NodeTypesWithDB + NodeTypesWithEngine; /// The provider type used to interact with the node. type Provider: FullProvider; } @@ -35,7 +35,7 @@ pub struct FullNodeTypesAdapter { impl FullNodeTypes for FullNodeTypesAdapter where - Types: NodeTypesWithDB, + Types: NodeTypesWithDB + NodeTypesWithEngine, Provider: FullProvider, { type Types = Types; diff --git a/crates/node/builder/src/launch/engine.rs b/crates/node/builder/src/launch/engine.rs index 2d0b19b73..80f4b79cb 100644 --- a/crates/node/builder/src/launch/engine.rs +++ b/crates/node/builder/src/launch/engine.rs @@ -62,7 +62,7 @@ impl EngineNodeLauncher { impl LaunchNode> for EngineNodeLauncher where - Types: NodeTypesWithDB, + Types: NodeTypesWithDB + NodeTypesWithEngine, T: FullNodeTypes>, CB: NodeComponentsBuilder, AO: NodeAddOns< diff --git a/crates/node/builder/src/launch/mod.rs b/crates/node/builder/src/launch/mod.rs index 02f2a8896..e4d57805c 100644 --- a/crates/node/builder/src/launch/mod.rs +++ b/crates/node/builder/src/launch/mod.rs @@ -21,7 +21,9 @@ use reth_consensus_debug_client::{DebugConsensusClient, EtherscanBlockProvider, use reth_engine_util::EngineMessageStreamExt; use reth_exex::ExExManagerHandle; use reth_network::{BlockDownloaderProvider, NetworkEventListenerProvider}; -use reth_node_api::{FullNodeComponents, FullNodeTypes, NodeAddOns, NodeTypesWithDB}; +use reth_node_api::{ + FullNodeComponents, FullNodeTypes, NodeAddOns, NodeTypesWithDB, NodeTypesWithEngine, +}; use reth_node_core::{ dirs::{ChainPath, DataDirPath}, exit::NodeExitFuture, @@ -102,7 +104,7 @@ impl DefaultNodeLauncher { impl LaunchNode> for DefaultNodeLauncher where - Types: NodeTypesWithDB, + Types: NodeTypesWithDB + NodeTypesWithEngine, T: FullNodeTypes, Types = Types>, CB: NodeComponentsBuilder, AO: NodeAddOns< diff --git a/crates/node/types/src/lib.rs b/crates/node/types/src/lib.rs index 5abd31323..2ad2f8abd 100644 --- a/crates/node/types/src/lib.rs +++ b/crates/node/types/src/lib.rs @@ -46,7 +46,7 @@ pub trait NodeTypesWithEngine: NodeTypes { /// node. /// /// Its types are configured by node internally and are not intended to be user configurable. -pub trait NodeTypesWithDB: NodeTypesWithEngine { +pub trait NodeTypesWithDB: NodeTypes { /// Underlying database type used by the node to store and retrieve data. type DB: Database + DatabaseMetrics + DatabaseMetadata + Clone + Unpin + 'static; } @@ -96,7 +96,7 @@ where impl NodeTypesWithDB for NodeTypesWithDBAdapter where - Types: NodeTypesWithEngine, + Types: NodeTypes, DB: Database + DatabaseMetrics + DatabaseMetadata + Clone + Unpin + 'static, { type DB = DB;