mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: move node builder trait helpers to separate module (#13883)
This commit is contained in:
56
crates/node/builder/src/aliases.rs
Normal file
56
crates/node/builder/src/aliases.rs
Normal file
@ -0,0 +1,56 @@
|
||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BlockBody, NodePrimitives};
|
||||
use reth_provider::BlockReader;
|
||||
|
||||
/// This is a type alias to make type bounds simpler, when we have a [`NetworkPrimitives`] and need
|
||||
/// a [`BlockReader`] whose associated types match the [`NetworkPrimitives`] associated types.
|
||||
pub trait BlockReaderFor<N: NetworkPrimitives>:
|
||||
BlockReader<
|
||||
Block = N::Block,
|
||||
Header = N::BlockHeader,
|
||||
Transaction = <N::BlockBody as BlockBody>::Transaction,
|
||||
Receipt = N::Receipt,
|
||||
>
|
||||
{
|
||||
}
|
||||
|
||||
impl<N, T> BlockReaderFor<N> for T
|
||||
where
|
||||
N: NetworkPrimitives,
|
||||
T: BlockReader<
|
||||
Block = N::Block,
|
||||
Header = N::BlockHeader,
|
||||
Transaction = <N::BlockBody as BlockBody>::Transaction,
|
||||
Receipt = N::Receipt,
|
||||
>,
|
||||
{
|
||||
}
|
||||
|
||||
/// 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>,
|
||||
{
|
||||
}
|
||||
@ -38,6 +38,10 @@ pub mod rpc;
|
||||
|
||||
pub mod setup;
|
||||
|
||||
/// Type aliases for traits that are often used together
|
||||
pub mod aliases;
|
||||
pub use aliases::*;
|
||||
|
||||
/// Support for installing the ExExs (execution extensions) in a node.
|
||||
pub mod exex;
|
||||
|
||||
|
||||
@ -7,15 +7,13 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
|
||||
use reth_network::NetworkPrimitives;
|
||||
use reth_node_api::{BlockBody, EngineTypes, FullNodeComponents, NodePrimitives};
|
||||
use reth_node_api::{EngineTypes, FullNodeComponents};
|
||||
use reth_node_core::{
|
||||
dirs::{ChainPath, DataDirPath},
|
||||
node_config::NodeConfig,
|
||||
};
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_provider::{BlockReader, ChainSpecProvider};
|
||||
use reth_provider::ChainSpecProvider;
|
||||
use reth_rpc_api::EngineApiClient;
|
||||
use reth_rpc_builder::{auth::AuthServerHandle, RpcServerHandle};
|
||||
use reth_tasks::TaskExecutor;
|
||||
@ -212,55 +210,3 @@ impl<Node: FullNodeComponents, AddOns: NodeAddOns<Node>> DerefMut for FullNode<N
|
||||
&mut self.add_ons_handle
|
||||
}
|
||||
}
|
||||
|
||||
/// This is a type alias to make type bounds simpler, when we have a [`NetworkPrimitives`] and need
|
||||
/// a [`BlockReader`] whose associated types match the [`NetworkPrimitives`] associated types.
|
||||
pub trait BlockReaderFor<N: NetworkPrimitives>:
|
||||
BlockReader<
|
||||
Block = N::Block,
|
||||
Header = N::BlockHeader,
|
||||
Transaction = <N::BlockBody as BlockBody>::Transaction,
|
||||
Receipt = N::Receipt,
|
||||
>
|
||||
{
|
||||
}
|
||||
|
||||
impl<N, T> BlockReaderFor<N> for T
|
||||
where
|
||||
N: NetworkPrimitives,
|
||||
T: BlockReader<
|
||||
Block = N::Block,
|
||||
Header = N::BlockHeader,
|
||||
Transaction = <N::BlockBody as BlockBody>::Transaction,
|
||||
Receipt = N::Receipt,
|
||||
>,
|
||||
{
|
||||
}
|
||||
|
||||
/// 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>,
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user