mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(sdk): introduce PrimitivesTy helper type (#13933)
This commit is contained in:
@ -10,7 +10,7 @@ use crate::{
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, TxTy};
|
||||
use reth_node_api::{BlockTy, BodyTy, HeaderTy, NodeTypesWithEngine, PrimitivesTy, TxTy};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionPool};
|
||||
use std::{future::Future, marker::PhantomData};
|
||||
@ -405,12 +405,10 @@ where
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
EVM: ConfigureEvmFor<<Node::Types as NodeTypes>::Primitives>,
|
||||
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
||||
Cons: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
EVM: ConfigureEvmFor<PrimitivesTy<Node::Types>>,
|
||||
Executor: BlockExecutorProvider<Primitives = PrimitivesTy<Node::Types>>,
|
||||
Cons:
|
||||
FullConsensus<PrimitivesTy<Node::Types>, Error = ConsensusError> + Clone + Unpin + 'static,
|
||||
{
|
||||
type Components = Components<Node, N, Pool, EVM, Executor, Cons>;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
//! Consensus component for the node builder.
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_node_api::NodeTypes;
|
||||
use reth_node_api::PrimitivesTy;
|
||||
|
||||
use crate::{BuilderContext, FullNodeTypes};
|
||||
use std::future::Future;
|
||||
@ -8,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: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
type Consensus: FullConsensus<PrimitivesTy<Node::Types>, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static;
|
||||
@ -23,10 +23,8 @@ pub trait ConsensusBuilder<Node: FullNodeTypes>: Send {
|
||||
impl<Node, F, Fut, Consensus> ConsensusBuilder<Node> for F
|
||||
where
|
||||
Node: FullNodeTypes,
|
||||
Consensus: FullConsensus<<Node::Types as NodeTypes>::Primitives, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
Consensus:
|
||||
FullConsensus<PrimitivesTy<Node::Types>, Error = ConsensusError> + Clone + Unpin + 'static,
|
||||
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
|
||||
Fut: Future<Output = eyre::Result<Consensus>> + Send,
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! EVM component for the node builder.
|
||||
use crate::{BuilderContext, FullNodeTypes};
|
||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_node_api::NodeTypes;
|
||||
use reth_node_api::PrimitivesTy;
|
||||
use std::future::Future;
|
||||
|
||||
/// A type that knows how to build the executor types.
|
||||
@ -9,10 +9,10 @@ pub trait ExecutorBuilder<Node: FullNodeTypes>: Send {
|
||||
/// The EVM config to use.
|
||||
///
|
||||
/// This provides the node with the necessary configuration to configure an EVM.
|
||||
type EVM: ConfigureEvmFor<<Node::Types as NodeTypes>::Primitives>;
|
||||
type EVM: ConfigureEvmFor<PrimitivesTy<Node::Types>>;
|
||||
|
||||
/// The type that knows how to execute blocks.
|
||||
type Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>;
|
||||
type Executor: BlockExecutorProvider<Primitives = PrimitivesTy<Node::Types>>;
|
||||
|
||||
/// Creates the EVM config.
|
||||
fn build_evm(
|
||||
@ -24,8 +24,8 @@ pub trait ExecutorBuilder<Node: FullNodeTypes>: Send {
|
||||
impl<Node, F, Fut, EVM, Executor> ExecutorBuilder<Node> for F
|
||||
where
|
||||
Node: FullNodeTypes,
|
||||
EVM: ConfigureEvmFor<<Node::Types as NodeTypes>::Primitives>,
|
||||
Executor: BlockExecutorProvider<Primitives = <Node::Types as NodeTypes>::Primitives>,
|
||||
EVM: ConfigureEvmFor<PrimitivesTy<Node::Types>>,
|
||||
Executor: BlockExecutorProvider<Primitives = PrimitivesTy<Node::Types>>,
|
||||
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
|
||||
Fut: Future<Output = eyre::Result<(EVM, Executor)>> + Send,
|
||||
{
|
||||
|
||||
@ -28,7 +28,7 @@ use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_network::{NetworkHandle, NetworkPrimitives};
|
||||
use reth_network_api::FullNetwork;
|
||||
use reth_node_api::{
|
||||
BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, PayloadBuilder, TxTy,
|
||||
BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, PayloadBuilder, PrimitivesTy, TxTy,
|
||||
};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionPool};
|
||||
@ -112,11 +112,9 @@ where
|
||||
+ Unpin
|
||||
+ '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, Error = ConsensusError>
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
Executor: BlockExecutorProvider<Primitives = PrimitivesTy<Node::Types>>,
|
||||
Cons:
|
||||
FullConsensus<PrimitivesTy<Node::Types>, Error = ConsensusError> + Clone + Unpin + 'static,
|
||||
{
|
||||
type Pool = Pool;
|
||||
type Evm = EVM;
|
||||
|
||||
@ -9,7 +9,7 @@ use reth_exex::{
|
||||
ExExContext, ExExHandle, ExExManager, ExExManagerHandle, ExExNotificationSource, Wal,
|
||||
DEFAULT_EXEX_MANAGER_CAPACITY,
|
||||
};
|
||||
use reth_node_api::{FullNodeComponents, NodeTypes};
|
||||
use reth_node_api::{FullNodeComponents, NodeTypes, PrimitivesTy};
|
||||
use reth_primitives::Head;
|
||||
use reth_provider::CanonStateSubscriptions;
|
||||
use reth_tracing::tracing::{debug, info};
|
||||
@ -42,7 +42,7 @@ impl<Node: FullNodeComponents + Clone> ExExLauncher<Node> {
|
||||
/// installed.
|
||||
pub async fn launch(
|
||||
self,
|
||||
) -> eyre::Result<Option<ExExManagerHandle<<Node::Types as NodeTypes>::Primitives>>> {
|
||||
) -> eyre::Result<Option<ExExManagerHandle<PrimitivesTy<Node::Types>>>> {
|
||||
let Self { head, extensions, components, config_container } = self;
|
||||
|
||||
if extensions.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user