mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add SealedBlock in reth-primitives-traits (#13735)
This commit is contained in:
@ -10,7 +10,7 @@ use crate::{
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, TxTy};
|
||||
use reth_node_api::{BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, TxTy};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionPool};
|
||||
use std::{future::Future, marker::PhantomData};
|
||||
@ -310,6 +310,7 @@ where
|
||||
Primitives: NetworkPrimitives<
|
||||
BlockHeader = HeaderTy<Node::Types>,
|
||||
BlockBody = BodyTy<Node::Types>,
|
||||
Block = BlockTy<Node::Types>,
|
||||
>,
|
||||
>,
|
||||
PayloadB: PayloadServiceBuilder<Node, PoolB::Pool>,
|
||||
@ -393,7 +394,11 @@ pub trait NodeComponentsBuilder<Node: FullNodeTypes>: Send {
|
||||
|
||||
impl<Node, N, F, Fut, Pool, EVM, Executor, Cons> NodeComponentsBuilder<Node> for F
|
||||
where
|
||||
N: NetworkPrimitives<BlockHeader = HeaderTy<Node::Types>, BlockBody = BodyTy<Node::Types>>,
|
||||
N: NetworkPrimitives<
|
||||
BlockHeader = HeaderTy<Node::Types>,
|
||||
BlockBody = BodyTy<Node::Types>,
|
||||
Block = BlockTy<Node::Types>,
|
||||
>,
|
||||
Node: FullNodeTypes,
|
||||
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
|
||||
Fut: Future<Output = eyre::Result<Components<Node, N, Pool, EVM, Executor, Cons>>> + Send,
|
||||
|
||||
@ -27,7 +27,9 @@ use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_network::{NetworkHandle, NetworkPrimitives};
|
||||
use reth_network_api::FullNetwork;
|
||||
use reth_node_api::{BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, PayloadBuilder, TxTy};
|
||||
use reth_node_api::{
|
||||
BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, PayloadBuilder, TxTy,
|
||||
};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionPool};
|
||||
|
||||
@ -53,9 +55,7 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
|
||||
+ 'static;
|
||||
|
||||
/// Network API.
|
||||
type Network: FullNetwork<
|
||||
Client: BlockClient<Header = HeaderTy<T::Types>, Body = BodyTy<T::Types>>,
|
||||
>;
|
||||
type Network: FullNetwork<Client: BlockClient<Block = BlockTy<T::Types>>>;
|
||||
|
||||
/// Builds new blocks.
|
||||
type PayloadBuilder: PayloadBuilder<PayloadType = <T::Types as NodeTypesWithEngine>::Engine>
|
||||
@ -102,7 +102,11 @@ pub struct Components<Node: FullNodeTypes, N: NetworkPrimitives, Pool, EVM, Exec
|
||||
impl<Node, Pool, EVM, Executor, Cons, N> NodeComponents<Node>
|
||||
for Components<Node, N, Pool, EVM, Executor, Cons>
|
||||
where
|
||||
N: NetworkPrimitives<BlockHeader = HeaderTy<Node::Types>, BlockBody = BodyTy<Node::Types>>,
|
||||
N: NetworkPrimitives<
|
||||
BlockHeader = HeaderTy<Node::Types>,
|
||||
BlockBody = BodyTy<Node::Types>,
|
||||
Block = BlockTy<Node::Types>,
|
||||
>,
|
||||
Node: FullNodeTypes,
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||
+ Unpin
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::BlockTy;
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use reth_config::{config::StageConfig, PruneConfig};
|
||||
use reth_consensus::{Consensus, ConsensusError};
|
||||
@ -14,7 +15,7 @@ use reth_exex::ExExManagerHandle;
|
||||
use reth_network_p2p::{
|
||||
bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader, BlockClient,
|
||||
};
|
||||
use reth_node_api::{BodyTy, HeaderTy};
|
||||
use reth_node_api::HeaderTy;
|
||||
use reth_provider::{providers::ProviderNodeTypes, ProviderFactory};
|
||||
use reth_stages::{prelude::DefaultStages, stages::ExecutionStage, Pipeline, StageSet};
|
||||
use reth_static_file::StaticFileProducer;
|
||||
@ -27,7 +28,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, Error = ConsensusError>>,
|
||||
consensus: Arc<dyn Consensus<BlockTy<N>, Error = ConsensusError>>,
|
||||
provider_factory: ProviderFactory<N>,
|
||||
task_executor: &TaskExecutor,
|
||||
metrics_tx: reth_stages::MetricEventsSender,
|
||||
@ -39,7 +40,7 @@ pub fn build_networked_pipeline<N, Client, Executor>(
|
||||
) -> eyre::Result<Pipeline<N>>
|
||||
where
|
||||
N: ProviderNodeTypes,
|
||||
Client: BlockClient<Header = HeaderTy<N>, Body = BodyTy<N>> + 'static,
|
||||
Client: BlockClient<Block = BlockTy<N>> + 'static,
|
||||
Executor: BlockExecutorProvider<Primitives = N::Primitives>,
|
||||
{
|
||||
// building network downloaders using the fetch client
|
||||
@ -75,7 +76,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, Error = ConsensusError>>,
|
||||
consensus: Arc<dyn Consensus<BlockTy<N>, Error = ConsensusError>>,
|
||||
max_block: Option<u64>,
|
||||
metrics_tx: reth_stages::MetricEventsSender,
|
||||
prune_config: Option<PruneConfig>,
|
||||
@ -86,7 +87,7 @@ pub fn build_pipeline<N, H, B, Executor>(
|
||||
where
|
||||
N: ProviderNodeTypes,
|
||||
H: HeaderDownloader<Header = HeaderTy<N>> + 'static,
|
||||
B: BodyDownloader<Header = HeaderTy<N>, Body = BodyTy<N>> + 'static,
|
||||
B: BodyDownloader<Block = BlockTy<N>> + 'static,
|
||||
Executor: BlockExecutorProvider<Primitives = N::Primitives>,
|
||||
{
|
||||
let mut builder = Pipeline::<N>::builder();
|
||||
|
||||
Reference in New Issue
Block a user