Skip to content
Merged
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
5 changes: 3 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ee-tests = { path = "crates/ee-tests", package = "revm-ee-tests", version = "0.1
# alloy
alloy-eip2930 = { version = "0.2.1", default-features = false }
alloy-eip7702 = { version = "0.6.1", default-features = false }
alloy-eip7928 = { version = "0.2.0", default-features = false, git = "https://github.com/rakita/alloy-eips.git", rev = "734beaf" }
alloy-eip7928 = { version = "0.3.0", default-features = false }
alloy-primitives = { version = "1.5.0", default-features = false }

# alloy in examples, revme or feature flagged.
Expand Down
6 changes: 3 additions & 3 deletions bins/revme/src/cmd/blockchaintest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ fn print_error_with_state(

// Print configuration environment
eprintln!("\n📋 Configuration Environment:");
eprintln!(" Spec ID: {:?}", debug_info.cfg_env.spec);
eprintln!(" Spec ID: {:?}", debug_info.cfg_env.spec());
eprintln!(" Chain ID: {}", debug_info.cfg_env.chain_id);
eprintln!(
" Limit contract code size: {:?}",
Expand Down Expand Up @@ -714,7 +714,7 @@ fn execute_blockchain_test(
// Setup configuration based on fork
let spec_id = fork_to_spec_id(test_case.network);
let mut cfg = CfgEnv::default();
cfg.spec = spec_id;
cfg.set_spec_and_mainnet_gas_params(spec_id);

// Genesis block is not used yet.
let mut parent_block_hash = Some(test_case.genesis_block_header.hash);
Expand Down Expand Up @@ -764,7 +764,7 @@ fn execute_blockchain_test(
// Create EVM context for each transaction to ensure fresh state access
let evm_context = Context::mainnet()
.with_block(&block_env)
.with_cfg(&cfg)
.with_cfg(cfg.clone())
.with_db(&mut state);

// Build and execute with EVM - always use inspector when JSON output is enabled
Expand Down
24 changes: 11 additions & 13 deletions bins/revme/src/cmd/statetest/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use crate::cmd::statetest::merkle_trie::{compute_test_roots, TestValidationResul
use indicatif::{ProgressBar, ProgressDrawTarget};
use revm::{
context::{block::BlockEnv, cfg::CfgEnv, tx::TxEnv},
context_interface::{
result::{EVMError, ExecutionResult, HaltReason, InvalidTransaction},
Cfg,
},
context_interface::result::{EVMError, ExecutionResult, HaltReason, InvalidTransaction},
database::{self, bal::EvmDatabaseError},
database_interface::EmptyDB,
inspector::{inspectors::TracerEip3155, InspectCommitEvm},
Expand Down Expand Up @@ -340,12 +337,12 @@ pub fn execute_test_suite(
continue;
}

cfg.spec = spec_name.to_spec_id();
cfg.set_spec_and_mainnet_gas_params(spec_name.to_spec_id());

// Configure max blobs per spec
if cfg.spec.is_enabled_in(SpecId::OSAKA) {
if cfg.spec().is_enabled_in(SpecId::OSAKA) {
cfg.set_max_blobs_per_tx(6);
} else if cfg.spec.is_enabled_in(SpecId::PRAGUE) {
} else if cfg.spec().is_enabled_in(SpecId::PRAGUE) {
cfg.set_max_blobs_per_tx(9);
} else {
cfg.set_max_blobs_per_tx(6);
Expand Down Expand Up @@ -421,7 +418,8 @@ pub fn execute_test_suite(
fn execute_single_test(ctx: TestExecutionContext) -> Result<(), TestErrorKind> {
// Prepare state
let mut cache = ctx.cache_state.clone();
cache.set_state_clear_flag(ctx.cfg.spec.is_enabled_in(SpecId::SPURIOUS_DRAGON));
let spec = ctx.cfg.spec();
cache.set_state_clear_flag(spec.is_enabled_in(SpecId::SPURIOUS_DRAGON));
let mut state = database::State::builder()
.with_cached_prestate(cache)
.with_bundle_update()
Expand All @@ -430,7 +428,7 @@ fn execute_single_test(ctx: TestExecutionContext) -> Result<(), TestErrorKind> {
let evm_context = Context::mainnet()
.with_block(ctx.block)
.with_tx(ctx.tx)
.with_cfg(ctx.cfg)
.with_cfg(ctx.cfg.clone())
.with_db(&mut state);

// Execute
Expand All @@ -457,7 +455,7 @@ fn execute_single_test(ctx: TestExecutionContext) -> Result<(), TestErrorKind> {
ctx.name,
&exec_result,
db,
ctx.cfg.spec(),
*ctx.cfg.spec(),
ctx.print_json_outcome,
)
}
Expand All @@ -467,7 +465,7 @@ fn debug_failed_test(ctx: DebugContext) {

// Re-run with tracing
let mut cache = ctx.cache_state.clone();
cache.set_state_clear_flag(ctx.cfg.spec.is_enabled_in(SpecId::SPURIOUS_DRAGON));
cache.set_state_clear_flag(ctx.cfg.spec().is_enabled_in(SpecId::SPURIOUS_DRAGON));
let mut state = database::State::builder()
.with_cached_prestate(cache)
.with_bundle_update()
Expand All @@ -477,7 +475,7 @@ fn debug_failed_test(ctx: DebugContext) {
.with_db(&mut state)
.with_block(ctx.block)
.with_tx(ctx.tx)
.with_cfg(ctx.cfg)
.with_cfg(ctx.cfg.clone())
.build_mainnet_with_inspector(TracerEip3155::buffered(stderr()).without_summary());

let exec_result = evm.inspect_tx_commit(ctx.tx);
Expand All @@ -489,7 +487,7 @@ fn debug_failed_test(ctx: DebugContext) {
"\nState after:\n{}",
evm.ctx.journaled_state.database.cache.pretty_print()
);
println!("\nSpecification: {:?}", ctx.cfg.spec);
println!("\nSpecification: {:?}", ctx.cfg.spec());
println!("\nTx: {:#?}", ctx.tx);
println!("Block: {:#?}", ctx.block);
println!("Cfg: {:#?}", ctx.cfg);
Expand Down
9 changes: 9 additions & 0 deletions crates/context/interface/src/cfg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
//! Configuration for the EVM. Containing [`SpecId`].

pub mod gas;
pub mod gas_params;

pub use gas_params::{GasId, GasParams};

use auto_impl::auto_impl;
use core::{fmt::Debug, hash::Hash};
use primitives::{hardfork::SpecId, Address, TxKind, U256};
Expand Down Expand Up @@ -66,6 +72,9 @@ pub trait Cfg {

/// Returns the limit in bytes for the memory buffer.
fn memory_limit(&self) -> u64;

/// Returns the gas params for the EVM.
fn gas_params(&self) -> &GasParams;
}

/// What bytecode analysis to perform
Expand Down
Loading
Loading