feat: relax EthereumNode ChainSpec bounds (#17106)

This commit is contained in:
Arsenii Kulikov
2025-06-27 18:26:16 +03:00
committed by GitHub
parent b2000155de
commit e89ea409e4
2 changed files with 21 additions and 9 deletions

View File

@@ -76,6 +76,13 @@ pub struct EthEvmConfig<C = ChainSpec, EvmFactory = EthEvmFactory> {
}
impl EthEvmConfig {
/// Creates a new Ethereum EVM configuration for the ethereum mainnet.
pub fn mainnet() -> Self {
Self::ethereum(MAINNET.clone())
}
}
impl<ChainSpec> EthEvmConfig<ChainSpec> {
/// Creates a new Ethereum EVM configuration with the given chain spec.
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
Self::ethereum(chain_spec)
@@ -85,11 +92,6 @@ impl EthEvmConfig {
pub fn ethereum(chain_spec: Arc<ChainSpec>) -> Self {
Self::new_with_evm_factory(chain_spec, EthEvmFactory::default())
}
/// Creates a new Ethereum EVM configuration for the ethereum mainnet.
pub fn mainnet() -> Self {
Self::ethereum(MAINNET.clone())
}
}
impl<ChainSpec, EvmFactory> EthEvmConfig<ChainSpec, EvmFactory> {

View File

@@ -12,7 +12,9 @@ use reth_ethereum_engine_primitives::{
EthBuiltPayload, EthPayloadAttributes, EthPayloadBuilderAttributes,
};
use reth_ethereum_primitives::{EthPrimitives, TransactionSigned};
use reth_evm::{ConfigureEvm, EvmFactory, EvmFactoryFor, NextBlockEnvAttributes};
use reth_evm::{
eth::spec::EthExecutorSpec, ConfigureEvm, EvmFactory, EvmFactoryFor, NextBlockEnvAttributes,
};
use reth_network::{primitives::BasicNetworkPrimitives, NetworkHandle, PeersInfo};
use reth_node_api::{
AddOnsContext, FullNodeComponents, NodeAddOns, NodePrimitives, PrimitivesTy, TxTy,
@@ -61,7 +63,12 @@ impl EthereumNode {
EthereumConsensusBuilder,
>
where
Node: FullNodeTypes<Types: NodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives>>,
Node: FullNodeTypes<
Types: NodeTypes<
ChainSpec: Hardforks + EthereumHardforks + EthExecutorSpec,
Primitives = EthPrimitives,
>,
>,
<Node::Types as NodeTypes>::Payload: PayloadTypes<
BuiltPayload = EthBuiltPayload,
PayloadAttributes = EthPayloadAttributes,
@@ -340,10 +347,13 @@ pub struct EthereumExecutorBuilder;
impl<Types, Node> ExecutorBuilder<Node> for EthereumExecutorBuilder
where
Types: NodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives>,
Types: NodeTypes<
ChainSpec: Hardforks + EthExecutorSpec + EthereumHardforks,
Primitives = EthPrimitives,
>,
Node: FullNodeTypes<Types = Types>,
{
type EVM = EthEvmConfig;
type EVM = EthEvmConfig<Types::ChainSpec>;
async fn build_evm(self, ctx: &BuilderContext<Node>) -> eyre::Result<Self::EVM> {
let evm_config = EthEvmConfig::new(ctx.chain_spec())