mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: move and integrate ConfigureEvmFor (#13896)
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
//! Traits for configuring a node.
|
||||
|
||||
use crate::ConfigureEvm;
|
||||
use alloy_rpc_types_engine::JwtSecret;
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_db_api::{
|
||||
@ -8,10 +7,10 @@ use reth_db_api::{
|
||||
Database,
|
||||
};
|
||||
use reth_engine_primitives::BeaconConsensusEngineHandle;
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_network_api::FullNetwork;
|
||||
use reth_node_core::node_config::NodeConfig;
|
||||
use reth_node_types::{HeaderTy, NodeTypes, NodeTypesWithDBAdapter, NodeTypesWithEngine, TxTy};
|
||||
use reth_node_types::{NodeTypes, NodeTypesWithDBAdapter, NodeTypesWithEngine, TxTy};
|
||||
use reth_payload_builder_primitives::PayloadBuilder;
|
||||
use reth_provider::FullProvider;
|
||||
use reth_tasks::TaskExecutor;
|
||||
@ -52,7 +51,7 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static {
|
||||
type Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Self::Types>>> + Unpin;
|
||||
|
||||
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
|
||||
type Evm: ConfigureEvm<Header = HeaderTy<Self::Types>, Transaction = TxTy<Self::Types>>;
|
||||
type Evm: ConfigureEvmFor<<Self::Types as NodeTypes>::Primitives>;
|
||||
|
||||
/// The type that knows how to execute blocks.
|
||||
type Executor: BlockExecutorProvider<Primitives = <Self::Types as NodeTypes>::Primitives>;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BlockBody, NodePrimitives};
|
||||
use reth_node_api::BlockBody;
|
||||
use reth_provider::BlockReader;
|
||||
|
||||
/// This is a type alias to make type bounds simpler, when we have a [`NetworkPrimitives`] and need
|
||||
@ -26,31 +25,3 @@ where
|
||||
>,
|
||||
{
|
||||
}
|
||||
|
||||
/// This is a type alias to make type bounds simpler when we have a [`NodePrimitives`] and need a
|
||||
/// [`ConfigureEvmEnv`] whose associated types match the [`NodePrimitives`] associated types.
|
||||
pub trait ConfigureEvmEnvFor<N: NodePrimitives>:
|
||||
ConfigureEvmEnv<Header = N::BlockHeader, Transaction = N::SignedTx>
|
||||
{
|
||||
}
|
||||
|
||||
impl<N, C> ConfigureEvmEnvFor<N> for C
|
||||
where
|
||||
N: NodePrimitives,
|
||||
C: ConfigureEvmEnv<Header = N::BlockHeader, Transaction = N::SignedTx>,
|
||||
{
|
||||
}
|
||||
|
||||
/// This is a type alias to make type bounds simpler when we have a [`NodePrimitives`] and need a
|
||||
/// [`ConfigureEvm`] whose associated types match the [`NodePrimitives`] associated types.
|
||||
pub trait ConfigureEvmFor<N: NodePrimitives>:
|
||||
ConfigureEvm<Header = N::BlockHeader, Transaction = N::SignedTx>
|
||||
{
|
||||
}
|
||||
|
||||
impl<N, C> ConfigureEvmFor<N> for C
|
||||
where
|
||||
N: NodePrimitives,
|
||||
C: ConfigureEvm<Header = N::BlockHeader, Transaction = N::SignedTx>,
|
||||
{
|
||||
}
|
||||
|
||||
@ -5,10 +5,10 @@ use crate::{
|
||||
Components, ConsensusBuilder, ExecutorBuilder, NetworkBuilder, NodeComponents,
|
||||
PayloadServiceBuilder, PoolBuilder,
|
||||
},
|
||||
BuilderContext, ConfigureEvm, FullNodeTypes,
|
||||
BuilderContext, FullNodeTypes,
|
||||
};
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BlockTy, BodyTy, HeaderTy, NodeTypes, NodeTypesWithEngine, TxTy};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
@ -405,7 +405,7 @@ where
|
||||
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<Node::Types>>>
|
||||
+ Unpin
|
||||
+ 'static,
|
||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||
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
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! EVM component for the node builder.
|
||||
use crate::{BuilderContext, FullNodeTypes};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_node_api::{ConfigureEvm, HeaderTy, TxTy};
|
||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_node_api::NodeTypes;
|
||||
use std::future::Future;
|
||||
|
||||
/// A type that knows how to build the executor types.
|
||||
@ -9,7 +9,7 @@ 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: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>;
|
||||
type EVM: ConfigureEvmFor<<Node::Types as NodeTypes>::Primitives>;
|
||||
|
||||
/// The type that knows how to execute blocks.
|
||||
type Executor: BlockExecutorProvider<
|
||||
@ -26,7 +26,7 @@ pub trait ExecutorBuilder<Node: FullNodeTypes>: Send {
|
||||
impl<Node, F, Fut, EVM, Executor> ExecutorBuilder<Node> for F
|
||||
where
|
||||
Node: FullNodeTypes,
|
||||
EVM: ConfigureEvm<Header = HeaderTy<Node::Types>, Transaction = TxTy<Node::Types>>,
|
||||
EVM: ConfigureEvmFor<<Node::Types as NodeTypes>::Primitives>,
|
||||
Executor:
|
||||
BlockExecutorProvider<Primitives = <Node::Types as reth_node_api::NodeTypes>::Primitives>,
|
||||
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
|
||||
|
||||
@ -24,7 +24,7 @@ use reth_network_p2p::BlockClient;
|
||||
|
||||
use crate::{ConfigureEvm, FullNodeTypes};
|
||||
use reth_consensus::{ConsensusError, FullConsensus};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_evm::{execute::BlockExecutorProvider, ConfigureEvmFor};
|
||||
use reth_network::{NetworkHandle, NetworkPrimitives};
|
||||
use reth_network_api::FullNetwork;
|
||||
use reth_node_api::{
|
||||
@ -43,7 +43,7 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
|
||||
type Pool: TransactionPool<Transaction: PoolTransaction<Consensus = TxTy<T::Types>>> + Unpin;
|
||||
|
||||
/// The node's EVM configuration, defining settings for the Ethereum Virtual Machine.
|
||||
type Evm: ConfigureEvm<Header = HeaderTy<T::Types>, Transaction = TxTy<T::Types>>;
|
||||
type Evm: ConfigureEvmFor<<T::Types as NodeTypes>::Primitives>;
|
||||
|
||||
/// The type that knows how to execute blocks.
|
||||
type Executor: BlockExecutorProvider<Primitives = <T::Types as NodeTypes>::Primitives>;
|
||||
|
||||
Reference in New Issue
Block a user