From d02728bacbea10b28671e5b83831b01b8fab8317 Mon Sep 17 00:00:00 2001 From: Wodann Date: Wed, 31 Jul 2024 21:45:31 +0000 Subject: [PATCH] bump: revm with upstream changes --- Cargo.lock | 8 +++--- crates/edr_eth/Cargo.toml | 4 +-- crates/edr_eth/src/chain_spec.rs | 6 ++--- crates/edr_eth/src/eips/eip1559.rs | 14 +++++------ crates/edr_eth/src/receipt.rs | 4 +-- crates/edr_eth/src/receipt/execution.rs | 4 +-- crates/edr_eth/src/receipt/transaction.rs | 4 +-- crates/edr_evm/Cargo.toml | 2 +- crates/edr_evm/src/block/builder.rs | 14 +++++------ crates/edr_evm/src/chain_spec.rs | 2 +- crates/edr_evm/src/debug.rs | 4 +-- crates/edr_evm/src/debug_trace.rs | 30 +++++++++++------------ crates/edr_evm/src/miner.rs | 10 ++++---- crates/edr_evm/src/precompiles.rs | 2 +- crates/edr_evm/src/runtime.rs | 12 ++++----- crates/edr_evm/src/test_utils.rs | 4 +-- crates/edr_evm/src/trace.rs | 26 ++++++++++---------- crates/edr_evm/src/transaction.rs | 6 ++--- crates/edr_opt/Cargo.toml | 2 +- crates/edr_opt/src/receipt/execution.rs | 4 +-- crates/edr_opt/src/spec.rs | 4 +-- crates/edr_provider/Cargo.toml | 2 +- crates/edr_provider/src/data.rs | 14 +++++------ crates/edr_provider/src/data/call.rs | 4 +-- crates/edr_provider/src/data/gas.rs | 6 ++--- 25 files changed, 96 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f218d0a6f2..1dacc4d5b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2960,7 +2960,7 @@ dependencies = [ [[package]] name = "revm" version = "12.1.0" -source = "git+https://github.com/NomicFoundation/revm?rev=da8175a2#da8175a27a2cc126ab91ce394c650c07ab15e130" +source = "git+https://github.com/Wodann/revm?rev=6d479da#6d479da35cf431da4276f374a39291cc3872b336" dependencies = [ "auto_impl", "derive-where", @@ -2975,7 +2975,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "8.1.0" -source = "git+https://github.com/NomicFoundation/revm?rev=da8175a2#da8175a27a2cc126ab91ce394c650c07ab15e130" +source = "git+https://github.com/Wodann/revm?rev=6d479da#6d479da35cf431da4276f374a39291cc3872b336" dependencies = [ "derive-where", "revm-primitives", @@ -2985,7 +2985,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "9.2.0" -source = "git+https://github.com/NomicFoundation/revm?rev=da8175a2#da8175a27a2cc126ab91ce394c650c07ab15e130" +source = "git+https://github.com/Wodann/revm?rev=6d479da#6d479da35cf431da4276f374a39291cc3872b336" dependencies = [ "aurora-engine-modexp", "c-kzg", @@ -3003,7 +3003,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "7.1.0" -source = "git+https://github.com/NomicFoundation/revm?rev=da8175a2#da8175a27a2cc126ab91ce394c650c07ab15e130" +source = "git+https://github.com/Wodann/revm?rev=6d479da#6d479da35cf431da4276f374a39291cc3872b336" dependencies = [ "alloy-eips", "alloy-primitives 0.7.7", diff --git a/crates/edr_eth/Cargo.toml b/crates/edr_eth/Cargo.toml index b26a81fa4b..5d704748d5 100644 --- a/crates/edr_eth/Cargo.toml +++ b/crates/edr_eth/Cargo.toml @@ -17,8 +17,8 @@ itertools = { version = "0.10.5", default-features = false, features = ["use_all k256 = { version = "0.13.1", default-features = false, features = ["arithmetic", "ecdsa", "pkcs8", ] } log = { version = "0.4.17", default-features = false } once_cell = { version = "1.18.0", default-features = false, features = ["alloc", "race", "std"] } -revm = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde"] } -revm-primitives = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "7.1", default-features = false, features = ["c-kzg", "hashbrown"] } +revm = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde"] } +revm-primitives = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "7.1", default-features = false, features = ["c-kzg", "hashbrown"] } serde = { version = "1.0.147", default-features = false, features = ["derive"], optional = true } sha2 = { version = "0.10.8", default-features = false } sha3 = { version = "0.10.8", default-features = false } diff --git a/crates/edr_eth/src/chain_spec.rs b/crates/edr_eth/src/chain_spec.rs index f9e1a856fe..41b84ff663 100644 --- a/crates/edr_eth/src/chain_spec.rs +++ b/crates/edr_eth/src/chain_spec.rs @@ -9,7 +9,7 @@ use crate::{ #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, RlpEncodable)] pub struct L1ChainSpec; -impl revm::primitives::ChainSpec for L1ChainSpec { +impl revm::primitives::EvmWiring for L1ChainSpec { type Block = revm_primitives::BlockEnv; type Hardfork = revm_primitives::SpecId; @@ -19,7 +19,7 @@ impl revm::primitives::ChainSpec for L1ChainSpec { type Transaction = transaction::Signed; } -impl revm::ChainSpec for L1ChainSpec { +impl revm::EvmWiring for L1ChainSpec { type Context = (); fn handler<'evm, EXT, DB>(hardfork: Self::Hardfork) -> revm::EvmHandler<'evm, Self, EXT, DB> @@ -31,7 +31,7 @@ impl revm::ChainSpec for L1ChainSpec { } /// Constants for constructing Ethereum headers. -pub trait EthHeaderConstants: revm_primitives::ChainSpec { +pub trait EthHeaderConstants: revm_primitives::EvmWiring { /// Parameters for the EIP-1559 base fee calculation. const BASE_FEE_PARAMS: BaseFeeParams; diff --git a/crates/edr_eth/src/eips/eip1559.rs b/crates/edr_eth/src/eips/eip1559.rs index 1de40ced54..c90eee3b5b 100644 --- a/crates/edr_eth/src/eips/eip1559.rs +++ b/crates/edr_eth/src/eips/eip1559.rs @@ -1,15 +1,15 @@ pub use alloy_eips::eip1559::BaseFeeParams as ConstantBaseFeeParams; use derive_where::derive_where; -use revm_primitives::ChainSpec; +use revm_primitives::EvmWiring; /// A mapping of hardfork to [`ConstantBaseFeeParams`]. This is used to specify /// dynamic EIP-1559 parameters for chains like Optimism. #[derive_where(Clone, Debug, PartialEq, Eq; ChainSpecT::Hardfork)] -pub struct ForkBaseFeeParams { +pub struct ForkBaseFeeParams { activations: &'static [(ChainSpecT::Hardfork, ConstantBaseFeeParams)], } -impl ForkBaseFeeParams { +impl ForkBaseFeeParams { /// Constructs a new instance from the provided mapping. pub const fn new( activations: &'static [(ChainSpecT::Hardfork, ConstantBaseFeeParams)], @@ -20,7 +20,7 @@ impl ForkBaseFeeParams { /// Type that allows specifying constant or dynamic EIP-1559 parameters based on /// the active hardfork. -pub enum BaseFeeParams { +pub enum BaseFeeParams { /// Constant [`ConstantBaseFeeParams`]; used for chains that don't have /// dynamic EIP-1559 parameters Constant(ConstantBaseFeeParams), @@ -29,7 +29,7 @@ pub enum BaseFeeParams { Variable(ForkBaseFeeParams), } -impl> BaseFeeParams { +impl> BaseFeeParams { /// Retrieves the [`ConstantBaseFeeParams`] for the given hardfork, if any. pub fn at_hardfork(&self, hardfork: ChainSpecT::Hardfork) -> Option<&ConstantBaseFeeParams> { match self { @@ -44,13 +44,13 @@ impl> BaseFeeParams { } } -impl From for BaseFeeParams { +impl From for BaseFeeParams { fn from(params: ConstantBaseFeeParams) -> Self { Self::Constant(params) } } -impl From> for BaseFeeParams { +impl From> for BaseFeeParams { fn from(params: ForkBaseFeeParams) -> Self { Self::Variable(params) } diff --git a/crates/edr_eth/src/receipt.rs b/crates/edr_eth/src/receipt.rs index 78195c995c..29f9c0a5dc 100644 --- a/crates/edr_eth/src/receipt.rs +++ b/crates/edr_eth/src/receipt.rs @@ -12,7 +12,7 @@ pub mod execution; mod transaction; use revm::db::StateRef; -use revm_primitives::ChainSpec; +use revm_primitives::EvmWiring; pub use self::{block::BlockReceipt, transaction::TransactionReceipt}; use crate::{block::PartialHeader, Bloom, B256}; @@ -28,7 +28,7 @@ pub enum Execution { } /// Trait for a builder that constructs an execution receipt. -pub trait ExecutionReceiptBuilder: Sized { +pub trait ExecutionReceiptBuilder: Sized { /// The receipt type that the builder constructs. type Receipt; diff --git a/crates/edr_eth/src/receipt/execution.rs b/crates/edr_eth/src/receipt/execution.rs index b93f562547..dddf73ac81 100644 --- a/crates/edr_eth/src/receipt/execution.rs +++ b/crates/edr_eth/src/receipt/execution.rs @@ -2,7 +2,7 @@ mod eip658; mod legacy; use alloy_rlp::{RlpDecodable, RlpEncodable}; -use revm_primitives::ChainSpec; +use revm_primitives::EvmWiring; use super::{Execution, ExecutionReceiptBuilder, MapReceiptLogs, Receipt}; use crate::{ @@ -123,7 +123,7 @@ impl ExecutionReceiptBuilder for Builder { fn new_receipt_builder( _pre_execution_state: StateT, - _transaction: &::Transaction, + _transaction: &::Transaction, ) -> Result { Ok(Self) } diff --git a/crates/edr_eth/src/receipt/transaction.rs b/crates/edr_eth/src/receipt/transaction.rs index c6dce48f5e..ca90f88516 100644 --- a/crates/edr_eth/src/receipt/transaction.rs +++ b/crates/edr_eth/src/receipt/transaction.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use alloy_rlp::BufMut; -use revm_primitives::{ChainSpec, ExecutionResult, Output}; +use revm_primitives::{EvmWiring, ExecutionResult, Output}; use super::{MapReceiptLogs, Receipt}; use crate::{ @@ -59,7 +59,7 @@ impl, LogT> TransactionReceipt Self where - ChainSpecT: ChainSpec, + ChainSpecT: EvmWiring, { let contract_address = if let ExecutionResult::Success { output: Output::Create(_, address), diff --git a/crates/edr_evm/Cargo.toml b/crates/edr_evm/Cargo.toml index 04cf5f288d..a9f0265b24 100644 --- a/crates/edr_evm/Cargo.toml +++ b/crates/edr_evm/Cargo.toml @@ -21,7 +21,7 @@ parking_lot = { version = "0.12.1", default-features = false } edr_defaults = { version = "0.3.5", path = "../edr_defaults" } edr_eth = { version = "0.3.5", path = "../edr_eth", features = ["rand", "serde"] } edr_rpc_eth = { version = "0.3.5", path = "../edr_rpc_eth" } -revm = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde", "std"] } +revm = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "12.1", default-features = false, features = ["c-kzg", "dev", "serde", "std"] } rpds = { version = "1.1.0", default-features = false, features = ["std"] } serde = { version = "1.0.158", default-features = false, features = ["std"] } serde_json = { version = "1.0.94", default-features = false, features = ["std"] } diff --git a/crates/edr_evm/src/block/builder.rs b/crates/edr_evm/src/block/builder.rs index 56b93ca813..0f065b210c 100644 --- a/crates/edr_evm/src/block/builder.rs +++ b/crates/edr_evm/src/block/builder.rs @@ -15,7 +15,7 @@ use edr_eth::{ }; use revm::{ db::{DatabaseComponents, StateRef}, - handler::{CfgEnvWithChainSpec, EnvWithChainSpec}, + handler::{CfgEnvWithEvmWiring, EnvWithEvmWiring}, primitives::{ ExecutionResult, ResultAndState, SpecId, Transaction as _, TransactionValidation, MAX_BLOB_GAS_PER_BLOCK, @@ -48,7 +48,7 @@ where #[derive(Debug, thiserror::Error)] pub enum BlockTransactionError where - ChainSpecT: revm::primitives::ChainSpec, + ChainSpecT: revm::primitives::EvmWiring, { /// Transaction has higher gas limit than is remaining in block #[error("Transaction has a higher gas limit than the remaining gas in the block")] @@ -71,7 +71,7 @@ pub struct ExecutionResultWithContext< DebugDataT, StateT: StateRef, > where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { /// The result of executing the transaction. pub result: Result< @@ -92,7 +92,7 @@ pub struct BuildBlockResult { /// A builder for constructing Ethereum blocks. pub struct BlockBuilder { - cfg: CfgEnvWithChainSpec, + cfg: CfgEnvWithEvmWiring, header: PartialHeader, transactions: Vec, state_diff: StateDiff, @@ -108,7 +108,7 @@ where /// Creates an intance of [`BlockBuilder`]. #[cfg_attr(feature = "tracing", tracing::instrument(skip_all))] pub fn new( - cfg: CfgEnvWithChainSpec, + cfg: CfgEnvWithEvmWiring, parent: &dyn SyncBlock, mut options: BlockOptions, ) -> Result> { @@ -148,7 +148,7 @@ where impl BlockBuilder { /// Retrieves the config of the block builder. - pub fn config(&self) -> &CfgEnvWithChainSpec { + pub fn config(&self) -> &CfgEnvWithEvmWiring { &self.cfg } @@ -317,7 +317,7 @@ where } }; - let env = EnvWithChainSpec::new_with_cfg_env(self.cfg.clone(), block, transaction.clone()); + let env = EnvWithEvmWiring::new_with_cfg_env(self.cfg.clone(), block, transaction.clone()); let db = DatabaseComponents { state, diff --git a/crates/edr_evm/src/chain_spec.rs b/crates/edr_evm/src/chain_spec.rs index 8765db72d7..79a05be7b4 100644 --- a/crates/edr_evm/src/chain_spec.rs +++ b/crates/edr_evm/src/chain_spec.rs @@ -23,7 +23,7 @@ use crate::{ pub trait ChainSpec: alloy_rlp::Encodable + EthHeaderConstants - + revm::ChainSpec< + + revm::EvmWiring< Block: BlockEnvConstructor, Transaction: alloy_rlp::Encodable + Clone diff --git a/crates/edr_evm/src/debug.rs b/crates/edr_evm/src/debug.rs index 624874aa29..e6cae1bc4c 100644 --- a/crates/edr_evm/src/debug.rs +++ b/crates/edr_evm/src/debug.rs @@ -20,7 +20,7 @@ pub type HandleRegister<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT> /// `EvmBuilder`. pub struct DebugContext<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT> where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, StateT: StateRef, { /// The contextual data. @@ -31,7 +31,7 @@ where pub struct EvmContext<'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT> where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, StateT: StateRef, { pub debug: Option>, diff --git a/crates/edr_evm/src/debug_trace.rs b/crates/edr_evm/src/debug_trace.rs index f85ef29647..91bc787d83 100644 --- a/crates/edr_evm/src/debug_trace.rs +++ b/crates/edr_evm/src/debug_trace.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, fmt::Debug, marker::PhantomData, sync::Arc}; use edr_eth::{transaction::SignedTransaction as _, utils::u256_to_padded_hex, B256}; use revm::{ db::DatabaseComponents, - handler::{register::EvmHandler, CfgEnvWithChainSpec}, + handler::{register::EvmHandler, CfgEnvWithEvmWiring}, interpreter::{ opcode::{self, DynInstruction, OpCode}, Interpreter, InterpreterResult, @@ -27,7 +27,7 @@ use crate::{ /// EIP-3155 and raw tracers. pub struct Eip3155AndRawTracers where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { eip3155: TracerEip3155, raw: TraceCollector, @@ -35,7 +35,7 @@ where impl Eip3155AndRawTracers where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { /// Creates a new instance. pub fn new(config: DebugTraceConfig, verbose_tracing: bool) -> Self { @@ -48,7 +48,7 @@ where impl GetContextData> for Eip3155AndRawTracers where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { fn get_context_data(&mut self) -> &mut TraceCollector { &mut self.raw @@ -57,7 +57,7 @@ where impl GetContextData> for Eip3155AndRawTracers where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { fn get_context_data(&mut self) -> &mut TracerEip3155 { &mut self.eip3155 @@ -66,7 +66,7 @@ where /// Register EIP-3155 and trace collector handles. pub fn register_eip_3155_and_raw_tracers_handles< - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, DatabaseT: Database, ContextT: GetContextData> + GetContextData>, >( @@ -85,7 +85,7 @@ pub fn debug_trace_transaction( blockchain: &dyn SyncBlockchain, // Take ownership of the state so that we can apply throw-away modifications on it mut state: Box>, - evm_config: CfgEnvWithChainSpec, + evm_config: CfgEnvWithEvmWiring, trace_config: DebugTraceConfig, block: ChainSpecT::Block, transactions: Vec, @@ -165,7 +165,7 @@ pub fn execution_result_to_debug_result( tracer: Eip3155AndRawTracers, ) -> DebugTraceResultWithTraces where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { let Eip3155AndRawTracers { eip3155, raw } = tracer; let traces = raw.into_traces(); @@ -211,7 +211,7 @@ pub struct DebugTraceConfig { #[derive(Debug, thiserror::Error)] pub enum DebugTraceError where - ChainSpecT: revm::primitives::ChainSpec, + ChainSpecT: revm::primitives::EvmWiring, { /// Invalid hardfork spec argument. #[error("Invalid spec id: {spec_id:?}. `debug_traceTransaction` is not supported prior to Spurious Dragon")] @@ -248,7 +248,7 @@ pub struct DebugTraceResult { } /// Result of a `debug_traceTransaction` call with traces. -pub struct DebugTraceResultWithTraces { +pub struct DebugTraceResultWithTraces { /// The result of the transaction. pub result: DebugTraceResult, /// The raw traces of the debugged transaction. @@ -293,7 +293,7 @@ pub struct DebugTraceLogItem { /// Register EIP-3155 tracer handles. pub fn register_eip_3155_tracer_handles< - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, DatabaseT: Database, ContextT: GetContextData>, >( @@ -329,7 +329,7 @@ fn instruction_handler( interpreter: &mut Interpreter, host: &mut Context, ) where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, ContextT: GetContextData>, DatabaseT: Database, { @@ -354,7 +354,7 @@ fn instruction_handler( #[derive(Debug)] pub struct TracerEip3155 where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { config: DebugTraceConfig, logs: Vec, @@ -372,7 +372,7 @@ where impl TracerEip3155 where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { /// Create a new tracer. pub fn new(config: DebugTraceConfig) -> Self { @@ -502,7 +502,7 @@ where impl GetContextData> for TracerEip3155 where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, { fn get_context_data(&mut self) -> &mut TracerEip3155 { self diff --git a/crates/edr_evm/src/miner.rs b/crates/edr_evm/src/miner.rs index 6fffaa25a2..49e7cca46a 100644 --- a/crates/edr_evm/src/miner.rs +++ b/crates/edr_evm/src/miner.rs @@ -8,7 +8,7 @@ use edr_eth::{ U256, }; use revm::{ - handler::CfgEnvWithChainSpec, + handler::CfgEnvWithEvmWiring, primitives::{ExecutionResult, InvalidTransaction, Transaction as _}, }; use serde::{Deserialize, Serialize}; @@ -30,7 +30,7 @@ use crate::{ #[derive(Debug)] pub struct MineBlockResult where - ChainSpecT: revm::primitives::ChainSpec, + ChainSpecT: revm::primitives::EvmWiring, { /// Mined block pub block: Arc>, @@ -42,7 +42,7 @@ where impl Clone for MineBlockResult where - ChainSpecT: revm::primitives::ChainSpec, + ChainSpecT: revm::primitives::EvmWiring, { fn clone(&self) -> Self { Self { @@ -111,7 +111,7 @@ pub fn mine_block<'blockchain, 'evm, BlockchainErrorT, DebugDataT, StateErrorT>( blockchain: &'blockchain dyn SyncBlockchain, mut state: Box>, mem_pool: &MemPool, - cfg: &CfgEnvWithChainSpec, + cfg: &CfgEnvWithEvmWiring, options: BlockOptions, min_gas_price: U256, mine_ordering: MineOrdering, @@ -300,7 +300,7 @@ pub fn mine_block_with_single_transaction< blockchain: &'blockchain dyn SyncBlockchain, state: Box>, transaction: transaction::Signed, - cfg: &CfgEnvWithChainSpec, + cfg: &CfgEnvWithEvmWiring, options: BlockOptions, min_gas_price: U256, reward: U256, diff --git a/crates/edr_evm/src/precompiles.rs b/crates/edr_evm/src/precompiles.rs index b180168721..83a43ae223 100644 --- a/crates/edr_evm/src/precompiles.rs +++ b/crates/edr_evm/src/precompiles.rs @@ -8,7 +8,7 @@ pub fn register_precompiles_handles( handler: &mut EvmHandler<'_, ChainSpecT, ContextT, DatabaseT>, precompiles: HashMap>, ) where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, DatabaseT: Database, { let old_handle = handler.pre_execution.load_precompiles(); diff --git a/crates/edr_evm/src/runtime.rs b/crates/edr_evm/src/runtime.rs index ffc7ec632f..3dfe8639eb 100644 --- a/crates/edr_evm/src/runtime.rs +++ b/crates/edr_evm/src/runtime.rs @@ -7,7 +7,7 @@ use edr_eth::{ Address, HashMap, Precompile, SpecId, }; use revm::{ - handler::{CfgEnvWithChainSpec, EnvWithChainSpec}, + handler::{CfgEnvWithEvmWiring, EnvWithEvmWiring}, ContextPrecompile, DatabaseCommit, Evm, }; @@ -44,7 +44,7 @@ pub fn dry_run< blockchain: &'blockchain dyn SyncBlockchain, state: &'state dyn SyncState, state_overrides: &'overrides StateOverrides, - cfg: CfgEnvWithChainSpec, + cfg: CfgEnvWithEvmWiring, transaction: ChainSpecT::Transaction, block: ChainSpecT::Block, custom_precompiles: &HashMap, @@ -72,7 +72,7 @@ where let state_overrider = StateRefOverrider::new(state_overrides, state); - let env = EnvWithChainSpec::new_with_cfg_env(cfg, block, transaction); + let env = EnvWithEvmWiring::new_with_cfg_env(cfg, block, transaction); let result = { let evm_builder = Evm::builder().with_ref_db(DatabaseComponents { state: state_overrider, @@ -130,7 +130,7 @@ pub fn guaranteed_dry_run< blockchain: &'blockchain dyn SyncBlockchain, state: &'state dyn SyncState, state_overrides: &'overrides StateOverrides, - mut cfg: CfgEnvWithChainSpec, + mut cfg: CfgEnvWithEvmWiring, transaction: ChainSpecT::Transaction, block: ChainSpecT::Block, custom_precompiles: &HashMap, @@ -174,7 +174,7 @@ where pub fn run<'blockchain, 'evm, ChainSpecT, BlockchainErrorT, DebugDataT, StateT>( blockchain: &'blockchain dyn SyncBlockchain, state: StateT, - cfg: CfgEnvWithChainSpec, + cfg: CfgEnvWithEvmWiring, transaction: ChainSpecT::Transaction, block: ChainSpecT::Block, custom_precompiles: &HashMap, @@ -198,7 +198,7 @@ where &transaction, )?; - let env = EnvWithChainSpec::new_with_cfg_env(cfg, block, transaction); + let env = EnvWithEvmWiring::new_with_cfg_env(cfg, block, transaction); let evm_builder = Evm::builder().with_ref_db(DatabaseComponents { state, block_hash: blockchain, diff --git a/crates/edr_evm/src/test_utils.rs b/crates/edr_evm/src/test_utils.rs index d9c6be29c3..ef83575307 100644 --- a/crates/edr_evm/src/test_utils.rs +++ b/crates/edr_evm/src/test_utils.rs @@ -16,7 +16,7 @@ use edr_rpc_eth::client::EthRpcClient; use crate::{ blockchain::{Blockchain as _, ForkedBlockchain}, chain_spec::SyncChainSpec, - evm::handler::CfgEnvWithChainSpec, + evm::handler::CfgEnvWithEvmWiring, state::{AccountTrie, IrregularState, StateError, TrieState}, transaction, Block, BlockBuilder, DebugContext, ExecutionResultWithContext, MemPool, MemPoolAddTransactionError, RandomHashGenerator, RemoteBlock, @@ -218,7 +218,7 @@ pub async fn run_full_block< cfg.chain_id = chain_id; cfg.disable_eip3607 = true; - let cfg = CfgEnvWithChainSpec::::new(cfg, hardfork); + let cfg = CfgEnvWithEvmWiring::::new(cfg, hardfork); let parent = blockchain.last_block()?; diff --git a/crates/edr_evm/src/trace.rs b/crates/edr_evm/src/trace.rs index 4351c154e1..be904bbb15 100644 --- a/crates/edr_evm/src/trace.rs +++ b/crates/edr_evm/src/trace.rs @@ -16,7 +16,7 @@ use crate::debug::GetContextData; /// Registers trace collector handles to the EVM handler. pub fn register_trace_collector_handles< - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, DatabaseT: Database, ContextT: GetContextData>, >( @@ -123,7 +123,7 @@ fn instruction_handler( interpreter: &mut Interpreter, host: &mut Context, ) where - ChainSpecT: revm::ChainSpec, + ChainSpecT: revm::EvmWiring, ContextT: GetContextData>, DatabaseT: Database, { @@ -144,7 +144,7 @@ fn instruction_handler( /// Stack tracing message #[derive(Debug)] -pub enum TraceMessage { +pub enum TraceMessage { /// Event that occurs before a call or create message. Before(BeforeMessage), /// Event that occurs every step of a call or create message. @@ -153,7 +153,7 @@ pub enum TraceMessage { After(AfterMessage), } -impl Clone for TraceMessage { +impl Clone for TraceMessage { fn clone(&self) -> Self { match self { Self::Before(message) => Self::Before(message.clone()), @@ -188,7 +188,7 @@ pub struct BeforeMessage { /// Event that occurs after a call or create message. #[derive(Debug)] -pub struct AfterMessage { +pub struct AfterMessage { /// The execution result pub execution_result: ExecutionResult, /// The newly created contract address if it's a create tx. `None` @@ -196,7 +196,7 @@ pub struct AfterMessage { pub contract_address: Option
, } -impl Clone for AfterMessage { +impl Clone for AfterMessage { fn clone(&self) -> Self { Self { execution_result: self.execution_result.clone(), @@ -207,7 +207,7 @@ impl Clone for AfterMessage /// A trace for an EVM call. #[derive(Debug)] -pub struct Trace { +pub struct Trace { // /// The individual steps of the call // pub steps: Vec, /// Messages @@ -216,7 +216,7 @@ pub struct Trace { pub return_value: Bytes, } -impl Clone for Trace { +impl Clone for Trace { fn clone(&self) -> Self { Self { messages: self.messages.clone(), @@ -225,7 +225,7 @@ impl Clone for Trace { } } -impl Default for Trace { +impl Default for Trace { fn default() -> Self { Self { messages: Vec::new(), @@ -285,7 +285,7 @@ impl Stack { } } -impl Trace { +impl Trace { /// Adds a before message pub fn add_before(&mut self, message: BeforeMessage) { self.messages.push(TraceMessage::Before(message)); @@ -305,14 +305,14 @@ impl Trace { /// Object that gathers trace information during EVM execution and can be turned /// into a trace upon completion. #[derive(Debug)] -pub struct TraceCollector { +pub struct TraceCollector { traces: Vec>, pending_before: Option, is_new_trace: bool, verbose: bool, } -impl TraceCollector { +impl TraceCollector { /// Create a trace collector. If verbose is `true` full stack and memory /// will be recorded. pub fn new(verbose: bool) -> Self { @@ -580,7 +580,7 @@ impl TraceCollector { } } -impl GetContextData> +impl GetContextData> for TraceCollector { fn get_context_data(&mut self) -> &mut TraceCollector { diff --git a/crates/edr_evm/src/transaction.rs b/crates/edr_evm/src/transaction.rs index afd798c0c1..57a7fd179a 100644 --- a/crates/edr_evm/src/transaction.rs +++ b/crates/edr_evm/src/transaction.rs @@ -19,7 +19,7 @@ pub use self::detailed::*; #[derive(thiserror::Error)] pub enum TransactionError where - ChainSpecT: revm::primitives::ChainSpec, + ChainSpecT: revm::primitives::EvmWiring, { /// Blockchain errors #[error(transparent)] @@ -48,7 +48,7 @@ impl Debug for TransactionError where ChainSpecT: - revm::primitives::ChainSpec>, + revm::primitives::EvmWiring>, BlockchainErrorT: Debug, StateErrorT: Debug, { @@ -71,7 +71,7 @@ impl From, ChainSpecT>> for TransactionError where - ChainSpecT: revm::primitives::ChainSpec, + ChainSpecT: revm::primitives::EvmWiring, BlockchainErrorT: Debug + Send, StateErrorT: Debug + Send, { diff --git a/crates/edr_opt/Cargo.toml b/crates/edr_opt/Cargo.toml index 82b3d168c7..1faf9d0310 100644 --- a/crates/edr_opt/Cargo.toml +++ b/crates/edr_opt/Cargo.toml @@ -11,7 +11,7 @@ edr_eth = { path = "../edr_eth", features = ["serde", "std"] } edr_evm = { path = "../edr_evm" } edr_rpc_eth = { path = "../edr_rpc_eth" } log = { version = "0.4.17", default-features = false } -revm = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "12.1", default-features = false, features = ["c-kzg", "dev", "optimism", "serde", "std"] } +revm = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "12.1", default-features = false, features = ["c-kzg", "dev", "optimism", "serde", "std"] } serde = { version = "1.0.147", default-features = false, features = ["derive", "std"] } thiserror = { version = "1.0.37", default-features = false } tokio = { version = "1.21.2", default-features = false, features = ["macros", "rt-multi-thread", "sync"] } diff --git a/crates/edr_opt/src/receipt/execution.rs b/crates/edr_opt/src/receipt/execution.rs index fa9acb30c6..054e7383e6 100644 --- a/crates/edr_opt/src/receipt/execution.rs +++ b/crates/edr_opt/src/receipt/execution.rs @@ -123,9 +123,9 @@ impl ExecutionReceiptBuilder for Builder { fn build_receipt( self, header: &edr_eth::block::PartialHeader, - transaction: &::Transaction, + transaction: &::Transaction, result: &revm::primitives::ExecutionResult, - hardfork: ::Hardfork, + hardfork: ::Hardfork, ) -> Self::Receipt { let logs = result.logs().to_vec(); let logs_bloom = edr_eth::log::logs_to_bloom(&logs); diff --git a/crates/edr_opt/src/spec.rs b/crates/edr_opt/src/spec.rs index e4ef556032..5dbd71a6df 100644 --- a/crates/edr_opt/src/spec.rs +++ b/crates/edr_opt/src/spec.rs @@ -31,14 +31,14 @@ impl RpcSpec for OptimismChainSpec { type RpcTransaction = rpc::Transaction; } -impl revm::primitives::ChainSpec for OptimismChainSpec { +impl revm::primitives::EvmWiring for OptimismChainSpec { type Block = edr_eth::env::BlockEnv; type Transaction = transaction::Signed; type Hardfork = OptimismSpecId; type HaltReason = OptimismHaltReason; } -impl revm::ChainSpec for OptimismChainSpec { +impl revm::EvmWiring for OptimismChainSpec { type Context = revm::optimism::Context; fn handler<'evm, EXT, DB>(hardfork: Self::Hardfork) -> EvmHandler<'evm, Self, EXT, DB> diff --git a/crates/edr_provider/Cargo.toml b/crates/edr_provider/Cargo.toml index a81a51e887..118bf84730 100644 --- a/crates/edr_provider/Cargo.toml +++ b/crates/edr_provider/Cargo.toml @@ -20,7 +20,7 @@ lazy_static = { version = "1.4.0", default-features = false } log = { version = "0.4.20", default-features = false } parking_lot = { version = "0.12.1", default-features = false } rand = { version = "0.8.5", default-features = false } -revm-precompile = { git = "https://github.com/NomicFoundation/revm", rev = "da8175a2", version = "9.2", default-features = false, features = ["c-kzg", "secp256r1", "std"] } +revm-precompile = { git = "https://github.com/Wodann/revm", rev = "6d479da", version = "9.2", default-features = false, features = ["c-kzg", "secp256r1", "std"] } rpds = { version = "1.1.0", default-features = false, features = ["std"] } serde = { version = "1.0.147", default-features = false, features = ["derive"] } serde_json = { version = "1.0.89" } diff --git a/crates/edr_provider/src/data.rs b/crates/edr_provider/src/data.rs index dd283c36ea..77c6741018 100644 --- a/crates/edr_provider/src/data.rs +++ b/crates/edr_provider/src/data.rs @@ -43,7 +43,7 @@ use edr_evm::{ }, chain_spec::ChainSpec, debug_trace_transaction, - evm::handler::CfgEnvWithChainSpec, + evm::handler::CfgEnvWithEvmWiring, execution_result_to_debug_result, mempool, mine_block, mine_block_with_single_transaction, register_eip_3155_and_raw_tracers_handles, state::{ @@ -1148,7 +1148,7 @@ impl ProviderData, - &CfgEnvWithChainSpec, + &CfgEnvWithEvmWiring, BlockOptions, &mut Debugger, ) -> Result< @@ -1943,7 +1943,7 @@ impl ProviderData, - ) -> Result, ProviderError> { + ) -> Result, ProviderError> { let block_number = block_spec .map(|block_spec| self.block_number_by_block_spec(block_spec)) .transpose()? @@ -1964,7 +1964,7 @@ impl ProviderData::new(cfg_env, spec_id)) + Ok(CfgEnvWithEvmWiring::::new(cfg_env, spec_id)) } fn execute_in_block_context( @@ -2010,7 +2010,7 @@ impl ProviderData, - &CfgEnvWithChainSpec, + &CfgEnvWithEvmWiring, BlockOptions, &mut Debugger, ) -> Result< @@ -2059,7 +2059,7 @@ impl ProviderData, + config: &CfgEnvWithEvmWiring, options: BlockOptions, debugger: &mut Debugger, ) -> Result, ProviderError> { @@ -2084,7 +2084,7 @@ impl ProviderData, + config: &CfgEnvWithEvmWiring, options: BlockOptions, transaction: transaction::Signed, debugger: &mut Debugger, diff --git a/crates/edr_provider/src/data/call.rs b/crates/edr_provider/src/data/call.rs index 47274f1df1..132a97cabe 100644 --- a/crates/edr_provider/src/data/call.rs +++ b/crates/edr_provider/src/data/call.rs @@ -9,7 +9,7 @@ use edr_eth::{ }; use edr_evm::{ blockchain::{BlockchainError, SyncBlockchain}, - evm::handler::CfgEnvWithChainSpec, + evm::handler::CfgEnvWithEvmWiring, guaranteed_dry_run, state::{StateError, StateOverrides, StateRefOverrider, SyncState}, transaction, DebugContext, @@ -25,7 +25,7 @@ where pub header: &'a Header, pub state: &'a dyn SyncState, pub state_overrides: &'a StateOverrides, - pub cfg_env: CfgEnvWithChainSpec, + pub cfg_env: CfgEnvWithEvmWiring, pub transaction: transaction::Signed, pub precompiles: &'a HashMap, // `DebugContext` cannot be simplified further diff --git a/crates/edr_provider/src/data/gas.rs b/crates/edr_provider/src/data/gas.rs index f9e6e828a0..941d71a1bf 100644 --- a/crates/edr_provider/src/data/gas.rs +++ b/crates/edr_provider/src/data/gas.rs @@ -11,7 +11,7 @@ use edr_eth::{ }; use edr_evm::{ blockchain::{BlockchainError, SyncBlockchain}, - evm::handler::CfgEnvWithChainSpec, + evm::handler::CfgEnvWithEvmWiring, state::{StateError, StateOverrides, SyncState}, trace::{register_trace_collector_handles, TraceCollector}, transaction, DebugContext, SyncBlock, @@ -28,7 +28,7 @@ pub(super) struct CheckGasLimitArgs<'a> { pub header: &'a Header, pub state: &'a dyn SyncState, pub state_overrides: &'a StateOverrides, - pub cfg_env: CfgEnvWithChainSpec, + pub cfg_env: CfgEnvWithEvmWiring, pub transaction: transaction::Signed, pub gas_limit: u64, pub precompiles: &'a HashMap, @@ -77,7 +77,7 @@ pub(super) struct BinarySearchEstimationArgs<'a> { pub header: &'a Header, pub state: &'a dyn SyncState, pub state_overrides: &'a StateOverrides, - pub cfg_env: CfgEnvWithChainSpec, + pub cfg_env: CfgEnvWithEvmWiring, pub transaction: transaction::Signed, pub lower_bound: u64, pub upper_bound: u64,