mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: Consensus trait error type (#13655)
This commit is contained in:
@ -7,7 +7,7 @@ use crate::{
|
||||
},
|
||||
BuilderContext, ConfigureEvm, FullNodeTypes,
|
||||
};
|
||||
use reth_consensus::FullConsensus;
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, TxTy};
|
||||
@ -402,7 +402,10 @@ where
|
||||
+ 'static,
|
||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static,
|
||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
{
|
||||
type Components = Components<Node, N, Pool, EVM, Executor, Cons>;
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
//! Consensus component for the node builder.
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_node_api::NodeTypes;
|
||||
|
||||
use crate::{BuilderContext, FullNodeTypes};
|
||||
@ -7,7 +8,7 @@ use std::future::Future;
|
||||
/// A type that knows how to build the consensus implementation.
|
||||
pub trait ConsensusBuilder<Node: FullNodeTypes>: Send {
|
||||
/// The consensus implementation to build.
|
||||
type Consensus: reth_consensus::FullConsensus<<Node::Types as NodeTypes>::Primitives>
|
||||
type Consensus: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static;
|
||||
@ -22,7 +23,7 @@ pub trait ConsensusBuilder<Node: FullNodeTypes>: Send {
|
||||
impl<Node, F, Fut, Consensus> ConsensusBuilder<Node> for F
|
||||
where
|
||||
Node: FullNodeTypes,
|
||||
Consensus: reth_consensus::FullConsensus<<Node::Types as NodeTypes>::Primitives>
|
||||
Consensus: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
|
||||
@ -23,7 +23,7 @@ pub use pool::*;
|
||||
use reth_network_p2p::BlockClient;
|
||||
|
||||
use crate::{ConfigureEvm, FullNodeTypes};
|
||||
use reth_consensus::FullConsensus;
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_network::{NetworkHandle, NetworkPrimitives};
|
||||
use reth_network_api::FullNetwork;
|
||||
@ -47,7 +47,10 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
|
||||
type Executor: BlockExecutorProvider<Primitives = <T::Types as NodeTypes>::Primitives>;
|
||||
|
||||
/// The consensus type of the node.
|
||||
type Consensus: FullConsensus<<T::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static;
|
||||
type Consensus: FullConsensus<<T::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static;
|
||||
|
||||
/// Network API.
|
||||
type Network: FullNetwork<
|
||||
@ -106,7 +109,10 @@ where
|
||||
+ 'static,
|
||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives> + Clone + Unpin + 'static,
|
||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
{
|
||||
type Pool = Pool;
|
||||
type Evm = EVM;
|
||||
|
||||
@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use reth_config::{config::StageConfig, PruneConfig};
|
||||
use reth_consensus::Consensus;
|
||||
use reth_consensus::{Consensus, ConsensusError};
|
||||
use reth_downloaders::{
|
||||
bodies::bodies::BodiesDownloaderBuilder,
|
||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||
@ -27,7 +27,7 @@ use tokio::sync::watch;
|
||||
pub fn build_networked_pipeline<N, Client, Executor>(
|
||||
config: &StageConfig,
|
||||
client: Client,
|
||||
consensus: Arc<dyn Consensus<Client::Header, Client::Body>>,
|
||||
consensus: Arc<dyn Consensus<Client::Header, Client::Body, Error = ConsensusError>>,
|
||||
provider_factory: ProviderFactory<N>,
|
||||
task_executor: &TaskExecutor,
|
||||
metrics_tx: reth_stages::MetricEventsSender,
|
||||
@ -75,7 +75,7 @@ pub fn build_pipeline<N, H, B, Executor>(
|
||||
stage_config: &StageConfig,
|
||||
header_downloader: H,
|
||||
body_downloader: B,
|
||||
consensus: Arc<dyn Consensus<H::Header, B::Body>>,
|
||||
consensus: Arc<dyn Consensus<H::Header, B::Body, Error = ConsensusError>>,
|
||||
max_block: Option<u64>,
|
||||
metrics_tx: reth_stages::MetricEventsSender,
|
||||
prune_config: Option<PruneConfig>,
|
||||
|
||||
Reference in New Issue
Block a user