feat: add ConfigureEvmFor, ConfigureEvmEnvFor helper traits (#13865)

This commit is contained in:
Dan Cline
2025-01-20 07:26:45 -05:00
committed by GitHub
parent d2ad477b0e
commit 6cc660c7f0

View File

@ -7,8 +7,9 @@ use std::{
sync::Arc,
};
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
use reth_network::NetworkPrimitives;
use reth_node_api::{BlockBody, EngineTypes, FullNodeComponents};
use reth_node_api::{BlockBody, EngineTypes, FullNodeComponents, NodePrimitives};
use reth_node_core::{
dirs::{ChainPath, DataDirPath},
node_config::NodeConfig,
@ -235,3 +236,31 @@ 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>,
{
}