Skip to content

Commit 6cc660c

Browse files
authored
feat: add ConfigureEvmFor, ConfigureEvmEnvFor helper traits (#13865)
1 parent d2ad477 commit 6cc660c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

crates/node/builder/src/node.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ use std::{
77
sync::Arc,
88
};
99

10+
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
1011
use reth_network::NetworkPrimitives;
11-
use reth_node_api::{BlockBody, EngineTypes, FullNodeComponents};
12+
use reth_node_api::{BlockBody, EngineTypes, FullNodeComponents, NodePrimitives};
1213
use reth_node_core::{
1314
dirs::{ChainPath, DataDirPath},
1415
node_config::NodeConfig,
@@ -235,3 +236,31 @@ where
235236
>,
236237
{
237238
}
239+
240+
/// This is a type alias to make type bounds simpler when we have a [`NodePrimitives`] and need a
241+
/// [`ConfigureEvmEnv`] whose associated types match the [`NodePrimitives`] associated types.
242+
pub trait ConfigureEvmEnvFor<N: NodePrimitives>:
243+
ConfigureEvmEnv<Header = N::BlockHeader, Transaction = N::SignedTx>
244+
{
245+
}
246+
247+
impl<N, C> ConfigureEvmEnvFor<N> for C
248+
where
249+
N: NodePrimitives,
250+
C: ConfigureEvmEnv<Header = N::BlockHeader, Transaction = N::SignedTx>,
251+
{
252+
}
253+
254+
/// This is a type alias to make type bounds simpler when we have a [`NodePrimitives`] and need a
255+
/// [`ConfigureEvm`] whose associated types match the [`NodePrimitives`] associated types.
256+
pub trait ConfigureEvmFor<N: NodePrimitives>:
257+
ConfigureEvm<Header = N::BlockHeader, Transaction = N::SignedTx>
258+
{
259+
}
260+
261+
impl<N, C> ConfigureEvmFor<N> for C
262+
where
263+
N: NodePrimitives,
264+
C: ConfigureEvm<Header = N::BlockHeader, Transaction = N::SignedTx>,
265+
{
266+
}

0 commit comments

Comments
 (0)