Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bin/ev-reth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ fn main() {
}

if let Err(err) =
Cli::<EvolveChainSpecParser, EvolveArgs>::parse().run(|builder, _evolve_args| async move {
Cli::<EvolveChainSpecParser, EvolveArgs>::parse().run(|builder, evolve_args| async move {
log_startup();
let handle = builder
.node(EvolveNode::new())
.node(EvolveNode::new(evolve_args.eden_hardfork_height))
.extend_rpc_modules(move |ctx| {
// Build custom txpool RPC with config + optional CLI/env override
let evolve_cfg = EvolveConfig::default();
Expand Down
1 change: 1 addition & 0 deletions crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ reth-rpc-api.workspace = true
reth-rpc-engine-api.workspace = true
reth-engine-primitives.workspace = true
reth-ethereum-primitives.workspace = true
revm.workspace = true

# Alloy dependencies
alloy-rpc-types.workspace = true
Expand Down
8 changes: 6 additions & 2 deletions crates/node/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use clap::Args;

/// Evolve CLI arguments (currently empty; reserved for future toggles).
/// Evolve CLI arguments.
#[derive(Debug, Clone, Default, Args)]
pub struct EvolveArgs {}
pub struct EvolveArgs {
/// Block height at which the Eden WTIA storage hardfork activates.
#[arg(long)]
pub eden_hardfork_height: Option<u64>,
}
7 changes: 3 additions & 4 deletions crates/node/src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
use crate::config::EvolvePayloadBuilderConfig;
use alloy_consensus::transaction::Transaction;
use alloy_evm::eth::EthEvmFactory;
use alloy_primitives::Address;
use ev_revm::EvEvmFactory;
use evolve_ev_reth::EvolvePayloadAttributes;
use reth_chainspec::{ChainSpec, ChainSpecProvider};
use reth_errors::RethError;
use reth_evm::{
execute::{BlockBuilder, BlockBuilderOutcome},
ConfigureEvm, NextBlockEnvAttributes,
};
use reth_evm_ethereum::EthEvmConfig;
use reth_payload_builder_primitives::PayloadBuilderError;
use reth_primitives::{transaction::SignedTransaction, Header, SealedBlock, SealedHeader};
use reth_provider::{HeaderProvider, StateProviderFactory};
use reth_revm::{database::StateProviderDatabase, State};
use std::sync::Arc;
use tracing::{debug, info};

type EvolveEthEvmConfig = EthEvmConfig<ChainSpec, EvEvmFactory<EthEvmFactory>>;
use crate::hardfork::EdenEvmConfig;

type EvolveEthEvmConfig = EdenEvmConfig;

/// Payload builder for Evolve Reth node
#[derive(Debug)]
Expand Down
31 changes: 24 additions & 7 deletions crates/node/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use reth_ethereum_forks::Hardforks;
use reth_node_builder::PayloadBuilderConfig;
use tracing::info;

use crate::{config::EvolvePayloadBuilderConfig, EvolveNode};
use crate::{config::EvolvePayloadBuilderConfig, hardfork::EdenEvmConfig, EvolveNode};

/// Type alias for the EV-aware EVM config we install into the node.
/// Type alias for the EV-aware EVM config (without Eden hardfork wrapper).
pub type EvolveEvmConfig = EthEvmConfig<ChainSpec, EvEvmFactory<EthEvmFactory>>;

/// Builds the EV-aware EVM configuration by wrapping the default config with the EV handler.
Expand Down Expand Up @@ -88,18 +88,35 @@ where
}

/// Thin wrapper so we can plug the EV executor into the node components builder.
#[derive(Debug, Default, Clone, Copy)]
#[non_exhaustive]
pub struct EvolveExecutorBuilder;
#[derive(Debug, Clone, Copy)]
pub struct EvolveExecutorBuilder {
eden_hardfork_height: Option<u64>,
}

impl EvolveExecutorBuilder {
/// Creates a new executor builder with the given hardfork height.
pub const fn new(eden_hardfork_height: Option<u64>) -> Self {
Self {
eden_hardfork_height,
}
}
}

impl Default for EvolveExecutorBuilder {
fn default() -> Self {
Self::new(None)
}
}

impl<Node> RethExecutorBuilder<Node> for EvolveExecutorBuilder
where
Node: FullNodeTypes<Types = EvolveNode>,
ChainSpec: Hardforks + EthExecutorSpec + EthereumHardforks,
{
type EVM = EvolveEvmConfig;
type EVM = EdenEvmConfig;

async fn build_evm(self, ctx: &BuilderContext<Node>) -> eyre::Result<Self::EVM> {
build_evm_config(ctx)
let inner = build_evm_config(ctx)?;
Ok(EdenEvmConfig::new(inner, self.eden_hardfork_height))
}
}
Loading