Skip to content

Commit

Permalink
feat: add ConfigureEvmFor, ConfigureEvmEnvFor helper traits (#13865)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Jan 20, 2025
1 parent d2ad477 commit 6cc660c
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion crates/node/builder/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>,
{
}

0 comments on commit 6cc660c

Please sign in to comment.