From 9773b855686a3170c0b1a92e966e7bdcf7d01042 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Tue, 24 Dec 2024 17:04:05 +0400 Subject: [PATCH] chore: relax `EngineNodeLauncher` bounds (#13540) --- Cargo.lock | 1 + crates/node/builder/Cargo.toml | 1 + crates/node/builder/src/launch/common.rs | 11 +++-------- crates/node/builder/src/launch/engine.rs | 9 +++++---- crates/node/events/src/cl.rs | 4 ++-- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c8a73da0d7b1..b8411837417a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8147,6 +8147,7 @@ dependencies = [ name = "reth-node-builder" version = "1.1.4" dependencies = [ + "alloy-consensus", "alloy-eips", "alloy-primitives", "alloy-rpc-types", diff --git a/crates/node/builder/Cargo.toml b/crates/node/builder/Cargo.toml index 51409a6f84c4..ff07d5ee26e1 100644 --- a/crates/node/builder/Cargo.toml +++ b/crates/node/builder/Cargo.toml @@ -59,6 +59,7 @@ reth-tracing.workspace = true reth-transaction-pool.workspace = true ## ethereum +alloy-consensus.workspace = true alloy-primitives.workspace = true alloy-rpc-types = { workspace = true, features = ["engine"] } alloy-eips = { workspace = true, features = ["kzg"] } diff --git a/crates/node/builder/src/launch/common.rs b/crates/node/builder/src/launch/common.rs index a80a80466d54..72dd8f091ed8 100644 --- a/crates/node/builder/src/launch/common.rs +++ b/crates/node/builder/src/launch/common.rs @@ -25,10 +25,7 @@ use reth_evm::noop::NoopBlockExecutorProvider; use reth_fs_util as fs; use reth_invalid_block_hooks::InvalidBlockWitnessHook; use reth_network_p2p::headers::client::HeadersClient; -use reth_node_api::{ - FullNodePrimitives, FullNodeTypes, NodePrimitives, NodeTypes, NodeTypesWithDB, - NodeTypesWithDBAdapter, -}; +use reth_node_api::{FullNodeTypes, NodeTypes, NodeTypesWithDB, NodeTypesWithDBAdapter}; use reth_node_core::{ args::InvalidBlockHookType, dirs::{ChainPath, DataDirPath}, @@ -46,7 +43,7 @@ use reth_node_metrics::{ server::{MetricServer, MetricServerConfig}, version::VersionInfo, }; -use reth_primitives::{Head, TransactionSigned}; +use reth_primitives::Head; use reth_provider::{ providers::{NodeTypesForProvider, ProviderNodeTypes, StaticFileProvider}, BlockHashReader, BlockNumReader, ChainSpecProvider, ProviderError, ProviderFactory, @@ -388,7 +385,6 @@ where pub async fn create_provider_factory(&self) -> eyre::Result> where N: ProviderNodeTypes, - N::Primitives: FullNodePrimitives, { let factory = ProviderFactory::new( self.right().clone(), @@ -455,7 +451,6 @@ where ) -> eyre::Result, ProviderFactory>>> where N: ProviderNodeTypes, - N::Primitives: FullNodePrimitives, { let factory = self.create_provider_factory().await?; let ctx = LaunchContextWith { @@ -879,7 +874,7 @@ impl where T: FullNodeTypes< Provider: StateProviderFactory + ChainSpecProvider, - Types: NodeTypesForProvider>, + Types: NodeTypesForProvider, >, CB: NodeComponentsBuilder, { diff --git a/crates/node/builder/src/launch/engine.rs b/crates/node/builder/src/launch/engine.rs index 3efffa121f70..9d69a29d114e 100644 --- a/crates/node/builder/src/launch/engine.rs +++ b/crates/node/builder/src/launch/engine.rs @@ -1,5 +1,6 @@ //! Engine node related functionality. +use alloy_consensus::BlockHeader; use futures::{future::Either, stream, stream_select, StreamExt}; use reth_beacon_consensus::{ hooks::{EngineHooks, StaticFileHook}, @@ -385,12 +386,12 @@ where ChainEvent::Handler(ev) => { if let Some(head) = ev.canonical_header() { let head_block = Head { - number: head.number, + number: head.number(), hash: head.hash(), - difficulty: head.difficulty, - timestamp: head.timestamp, + difficulty: head.difficulty(), + timestamp: head.timestamp(), total_difficulty: chainspec - .final_paris_total_difficulty(head.number) + .final_paris_total_difficulty(head.number()) .unwrap_or_default(), }; network_handle.update_status(head_block); diff --git a/crates/node/events/src/cl.rs b/crates/node/events/src/cl.rs index dac13fe07631..0acf574738c6 100644 --- a/crates/node/events/src/cl.rs +++ b/crates/node/events/src/cl.rs @@ -26,7 +26,7 @@ pub struct ConsensusLayerHealthEvents { canon_chain: Box>, } -impl fmt::Debug for ConsensusLayerHealthEvents { +impl fmt::Debug for ConsensusLayerHealthEvents { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ConsensusLayerHealthEvents").field("interval", &self.interval).finish() } @@ -41,7 +41,7 @@ impl ConsensusLayerHealthEvents { } } -impl Stream for ConsensusLayerHealthEvents { +impl Stream for ConsensusLayerHealthEvents { type Item = ConsensusLayerHealthEvent; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> {