diff --git a/Cargo.lock b/Cargo.lock index b5a351a1f4909..77b559363bb46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,6 +78,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "ammonia" version = "3.3.0" @@ -510,6 +516,9 @@ name = "bitflags" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -3068,6 +3077,11 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash 0.8.3", + "allocator-api2", + "serde", +] [[package]] name = "hashers" @@ -5164,7 +5178,7 @@ dependencies = [ [[package]] name = "revm" version = "3.3.0" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#14787244394c46e49ca59e32d7de1ebc95e66892" dependencies = [ "auto_impl", "revm-interpreter", @@ -5176,7 +5190,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#14787244394c46e49ca59e32d7de1ebc95e66892" dependencies = [ "derive_more", "enumn", @@ -5188,7 +5202,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.3" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#14787244394c46e49ca59e32d7de1ebc95e66892" dependencies = [ "k256", "num", @@ -5204,15 +5218,16 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?branch=release/v25#88337924f4d16ed1f5e4cde12a03d0cb755cd658" +source = "git+https://github.com/bluealloy/revm/#14787244394c46e49ca59e32d7de1ebc95e66892" dependencies = [ "auto_impl", + "bitflags 2.3.3", "bitvec 1.0.1", "bytes", "derive_more", "enumn", "fixed-hash", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "hex", "hex-literal", "primitive-types", diff --git a/Cargo.toml b/Cargo.toml index 251b2ce171a7d..a564ad2f52f85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,4 +87,4 @@ solang-parser = "=0.3.1" #ethers-solc = { path = "../ethers-rs/ethers-solc" } [patch.crates-io] -revm = { git = "https://github.com/bluealloy/revm/", branch = "release/v25" } +revm = { git = "https://github.com/bluealloy/revm/" } diff --git a/anvil/src/eth/backend/mem/inspector.rs b/anvil/src/eth/backend/mem/inspector.rs index 17f1231257873..07c30b04390df 100644 --- a/anvil/src/eth/backend/mem/inspector.rs +++ b/anvil/src/eth/backend/mem/inspector.rs @@ -61,27 +61,21 @@ impl revm::Inspector for Inspector { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!( inspector, [&mut self.gas.as_deref().map(|gas| gas.borrow_mut()), &mut self.tracer], - { inspector.initialize_interp(interp, data, is_static) } + { inspector.initialize_interp(interp, data) } ); InstructionResult::Continue } - fn step( - &mut self, - interp: &mut Interpreter, - data: &mut EVMData<'_, DB>, - is_static: bool, - ) -> InstructionResult { + fn step(&mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>) -> InstructionResult { call_inspectors!( inspector, [&mut self.gas.as_deref().map(|gas| gas.borrow_mut()), &mut self.tracer], { - inspector.step(interp, data, is_static); + inspector.step(interp, data); } ); InstructionResult::Continue @@ -111,14 +105,13 @@ impl revm::Inspector for Inspector { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, eval: InstructionResult, ) -> InstructionResult { call_inspectors!( inspector, [&mut self.gas.as_deref().map(|gas| gas.borrow_mut()), &mut self.tracer], { - inspector.step_end(interp, data, is_static, eval); + inspector.step_end(interp, data, eval); } ); eval @@ -128,7 +121,6 @@ impl revm::Inspector for Inspector { &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!( inspector, @@ -138,7 +130,7 @@ impl revm::Inspector for Inspector { Some(&mut self.log_collector) ], { - inspector.call(data, call, is_static); + inspector.call(data, call); } ); @@ -152,13 +144,12 @@ impl revm::Inspector for Inspector { remaining_gas: Gas, ret: InstructionResult, out: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!( inspector, [&mut self.gas.as_deref().map(|gas| gas.borrow_mut()), &mut self.tracer], { - inspector.call_end(data, inputs, remaining_gas, ret, out.clone(), is_static); + inspector.call_end(data, inputs, remaining_gas, ret, out.clone()); } ); (ret, remaining_gas, out) diff --git a/anvil/src/eth/backend/mem/mod.rs b/anvil/src/eth/backend/mem/mod.rs index 8928e9fd308c6..b3761b286688c 100644 --- a/anvil/src/eth/backend/mem/mod.rs +++ b/anvil/src/eth/backend/mem/mod.rs @@ -57,7 +57,6 @@ use ethers::{ use flate2::{read::GzDecoder, write::GzEncoder, Compression}; use forge::{ executor::inspector::AccessListTracer, - hashbrown, revm::{ interpreter::{return_ok, InstructionResult}, primitives::{BlockEnv, ExecutionResult}, @@ -707,7 +706,7 @@ impl Backend { Err(e) => return Err(e.into()), }; let state = result_and_state.state; - let state: hashbrown::HashMap = + let state: revm::primitives::HashMap = state.into_iter().map(|kv| (kv.0.into(), kv.1)).collect(); let (exit_reason, gas_used, out, logs) = match result_and_state.result { ExecutionResult::Success { reason, gas_used, logs, output, .. } => { @@ -1067,7 +1066,7 @@ impl Backend { }, }; let state = result_and_state.state; - let state: hashbrown::HashMap = + let state: revm::primitives::HashMap = state.into_iter().map(|kv| (kv.0.into(), kv.1)).collect(); let (exit_reason, gas_used, out) = match result_and_state.result { ExecutionResult::Success { reason, gas_used, output, .. } => { diff --git a/anvil/src/eth/error.rs b/anvil/src/eth/error.rs index c45d20bb4b591..282fb30d49911 100644 --- a/anvil/src/eth/error.rs +++ b/anvil/src/eth/error.rs @@ -179,6 +179,9 @@ pub enum InvalidTransactionError { /// Thrown when a legacy tx was signed for a different chain #[error("Incompatible EIP-155 transaction, signed for another chain")] IncompatibleEIP155, + /// Thrown when an access list is used before the berlin hard fork. + #[error("Access lists are not supported before the Berlin hardfork")] + AccessListNotSupported, } impl From for InvalidTransactionError { @@ -201,7 +204,7 @@ impl From for InvalidTransactionError { }) } InvalidTransaction::RejectCallerWithCode => InvalidTransactionError::SenderNoEOA, - InvalidTransaction::LackOfFundForGasLimit { .. } => { + InvalidTransaction::LackOfFundForMaxFee { .. } => { InvalidTransactionError::InsufficientFunds } InvalidTransaction::OverflowPaymentInTransaction => { @@ -215,6 +218,9 @@ impl From for InvalidTransactionError { } InvalidTransaction::NonceTooHigh { .. } => InvalidTransactionError::NonceTooHigh, InvalidTransaction::NonceTooLow { .. } => InvalidTransactionError::NonceTooLow, + InvalidTransaction::AccessListNotSupported => { + InvalidTransactionError::AccessListNotSupported + } } } } diff --git a/evm/src/executor/backend/in_memory_db.rs b/evm/src/executor/backend/in_memory_db.rs index 4b3dcaf1a868b..0340d2de770cf 100644 --- a/evm/src/executor/backend/in_memory_db.rs +++ b/evm/src/executor/backend/in_memory_db.rs @@ -1,9 +1,8 @@ //! The in memory DB use crate::executor::backend::error::DatabaseError; -use hashbrown::HashMap as Map; use revm::{ db::{CacheDB, DatabaseRef, EmptyDB}, - primitives::{Account, AccountInfo, Bytecode, B160, B256, U256}, + primitives::{Account, AccountInfo, Bytecode, HashMap as Map, B160, B256, U256}, Database, DatabaseCommit, }; diff --git a/evm/src/executor/backend/mod.rs b/evm/src/executor/backend/mod.rs index bb5f730cf50f2..3e468f2235133 100644 --- a/evm/src/executor/backend/mod.rs +++ b/evm/src/executor/backend/mod.rs @@ -14,14 +14,13 @@ use ethers::{ types::{Address, BlockNumber, Transaction, U64}, utils::keccak256, }; -use hashbrown::HashMap as Map; pub use in_memory_db::MemDb; use revm::{ db::{CacheDB, DatabaseRef}, precompile::{Precompiles, SpecId}, primitives::{ - Account, AccountInfo, Bytecode, CreateScheme, Env, Log, ResultAndState, TransactTo, B160, - B256, KECCAK_EMPTY, U256 as rU256, + Account, AccountInfo, Bytecode, CreateScheme, Env, HashMap as Map, Log, ResultAndState, + TransactTo, B160, B256, KECCAK_EMPTY, U256 as rU256, }, Database, DatabaseCommit, Inspector, JournaledState, EVM, }; @@ -1100,7 +1099,7 @@ impl DatabaseExt for Backend { // prevent issues in the new journalstate, e.g. assumptions that accounts are loaded // if the account is not touched, we reload it, if it's touched we clone it for (addr, acc) in journaled_state.state.iter() { - if acc.is_touched { + if acc.is_touched() { merge_journaled_state_data( b160_to_h160(*addr), journaled_state, @@ -1806,7 +1805,7 @@ fn commit_transaction( /// Applies the changeset of a transaction to the active journaled state and also commits it in the /// forked db fn apply_state_changeset( - state: hashbrown::HashMap, + state: Map, journaled_state: &mut JournaledState, fork: &mut Fork, ) { diff --git a/evm/src/executor/backend/snapshot.rs b/evm/src/executor/backend/snapshot.rs index b38689737c1a0..36f1aa611788c 100644 --- a/evm/src/executor/backend/snapshot.rs +++ b/evm/src/executor/backend/snapshot.rs @@ -1,6 +1,5 @@ -use hashbrown::HashMap as Map; use revm::{ - primitives::{AccountInfo, Env, B160, B256, U256}, + primitives::{AccountInfo, Env, HashMap as Map, B160, B256, U256}, JournaledState, }; use serde::{Deserialize, Serialize}; diff --git a/evm/src/executor/fork/cache.rs b/evm/src/executor/fork/cache.rs index 7e8a0caa87472..eacf8b2c63994 100644 --- a/evm/src/executor/fork/cache.rs +++ b/evm/src/executor/fork/cache.rs @@ -1,8 +1,10 @@ //! Cache related abstraction -use crate::{executor::backend::snapshot::StateSnapshot, HashMap as Map}; +use crate::executor::backend::snapshot::StateSnapshot; use parking_lot::RwLock; use revm::{ - primitives::{Account, AccountInfo, B160, B256, KECCAK_EMPTY, U256}, + primitives::{ + Account, AccountInfo, AccountStatus, HashMap as Map, B160, B256, KECCAK_EMPTY, U256, + }, DatabaseCommit, }; use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer}; @@ -249,7 +251,7 @@ impl MemDb { let mut storage = self.storage.write(); let mut accounts = self.accounts.write(); for (add, mut acc) in changes { - if acc.is_empty() || acc.is_destroyed { + if acc.is_empty() || acc.is_selfdestructed() { accounts.remove(&add); storage.remove(&add); } else { @@ -264,7 +266,7 @@ impl MemDb { accounts.insert(add, acc.info); let acc_storage = storage.entry(add).or_default(); - if acc.storage_cleared { + if acc.status.contains(AccountStatus::Created) { acc_storage.clear(); } for (index, value) in acc.storage { diff --git a/evm/src/executor/fork/database.rs b/evm/src/executor/fork/database.rs index 152d6144cac03..c9b58c839de89 100644 --- a/evm/src/executor/fork/database.rs +++ b/evm/src/executor/fork/database.rs @@ -9,11 +9,10 @@ use crate::{ revm::db::CacheDB, }; use ethers::{prelude::U256, types::BlockId}; -use hashbrown::HashMap as Map; use parking_lot::Mutex; use revm::{ db::DatabaseRef, - primitives::{Account, AccountInfo, Bytecode, B160, B256, U256 as rU256}, + primitives::{Account, AccountInfo, Bytecode, HashMap as Map, B160, B256, U256 as rU256}, Database, DatabaseCommit, }; use std::sync::Arc; diff --git a/evm/src/executor/inspector/access_list.rs b/evm/src/executor/inspector/access_list.rs index 2dbd4a3dfb4a4..86c674960f13d 100644 --- a/evm/src/executor/inspector/access_list.rs +++ b/evm/src/executor/inspector/access_list.rs @@ -58,7 +58,6 @@ where &mut self, interpreter: &mut Interpreter, _data: &mut EVMData<'_, DB>, - _is_static: bool, ) -> InstructionResult { let pc = interpreter.program_counter(); let op = interpreter.contract.bytecode.bytecode()[pc]; diff --git a/evm/src/executor/inspector/cheatcodes/mapping.rs b/evm/src/executor/inspector/cheatcodes/mapping.rs index cf81dc447eb1c..0ae5439a938b2 100644 --- a/evm/src/executor/inspector/cheatcodes/mapping.rs +++ b/evm/src/executor/inspector/cheatcodes/mapping.rs @@ -91,7 +91,7 @@ pub fn on_evm_step( _data: &mut EVMData<'_, DB>, ) { match interpreter.contract.bytecode.bytecode()[interpreter.program_counter()] { - opcode::SHA3 => { + opcode::KECCAK256 => { if interpreter.stack.peek(1) == Ok(revm::primitives::U256::from(0x40)) { let address = interpreter.contract.address; let offset = interpreter.stack.peek(0).expect("stack size > 1").to::(); diff --git a/evm/src/executor/inspector/cheatcodes/mod.rs b/evm/src/executor/inspector/cheatcodes/mod.rs index afc14138d9a44..23b3bd32cfad3 100644 --- a/evm/src/executor/inspector/cheatcodes/mod.rs +++ b/evm/src/executor/inspector/cheatcodes/mod.rs @@ -303,7 +303,6 @@ where &mut self, _: &mut Interpreter, data: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { // When the first interpreter is initialized we've circumvented the balance and gas checks, // so we apply our actual block data with the correct fees and all. @@ -321,7 +320,6 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { self.pc = interpreter.program_counter(); @@ -522,7 +520,7 @@ where (CALLCODE, 5, 6, true), (STATICCALL, 4, 5, true), (DELEGATECALL, 4, 5, true), - (SHA3, 0, 1, false), + (KECCAK256, 0, 1, false), (LOG0, 0, 1, false), (LOG1, 0, 1, false), (LOG2, 0, 1, false), @@ -577,7 +575,6 @@ where &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, bytes::Bytes) { if call.contract == h160_to_b160(CHEATCODE_ADDRESS) { let gas = Gas::new(call.gas_limit); @@ -686,7 +683,7 @@ where // because we only need the from, to, value, and data. We can later change this // into 1559, in the cli package, relatively easily once we // know the target chain supports EIP-1559. - if !is_static { + if !call.is_static { if let Err(err) = data .journaled_state .load_account(h160_to_b160(broadcast.new_origin), data.db) @@ -751,7 +748,6 @@ where remaining_gas: Gas, status: InstructionResult, retdata: bytes::Bytes, - _: bool, ) -> (InstructionResult, Gas, bytes::Bytes) { if call.contract == h160_to_b160(CHEATCODE_ADDRESS) || call.contract == h160_to_b160(HARDHAT_CONSOLE_ADDRESS) diff --git a/evm/src/executor/inspector/chisel_state.rs b/evm/src/executor/inspector/chisel_state.rs index e10720bba85a2..6ddd443a37797 100644 --- a/evm/src/executor/inspector/chisel_state.rs +++ b/evm/src/executor/inspector/chisel_state.rs @@ -26,7 +26,6 @@ where &mut self, interp: &mut Interpreter, _: &mut revm::EVMData<'_, DB>, - _: bool, eval: InstructionResult, ) -> InstructionResult { // If we are at the final pc of the REPL contract execution, set the state. diff --git a/evm/src/executor/inspector/coverage.rs b/evm/src/executor/inspector/coverage.rs index d3fa0fd812f45..5da786035706c 100644 --- a/evm/src/executor/inspector/coverage.rs +++ b/evm/src/executor/inspector/coverage.rs @@ -22,7 +22,6 @@ where &mut self, interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { self.maps.entry(b256_to_h256(interpreter.contract.bytecode.hash())).or_insert_with(|| { HitMap::new(Bytes::copy_from_slice( @@ -37,7 +36,6 @@ where &mut self, interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, - _is_static: bool, ) -> InstructionResult { self.maps .entry(b256_to_h256(interpreter.contract.bytecode.hash())) diff --git a/evm/src/executor/inspector/debugger.rs b/evm/src/executor/inspector/debugger.rs index 3f6a344aabaee..19b0c3672d107 100644 --- a/evm/src/executor/inspector/debugger.rs +++ b/evm/src/executor/inspector/debugger.rs @@ -70,7 +70,6 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - _is_static: bool, ) -> InstructionResult { let pc = interpreter.program_counter(); let op = interpreter.contract.bytecode.bytecode()[pc]; @@ -112,7 +111,6 @@ where &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - _: bool, ) -> (InstructionResult, Gas, Bytes) { self.enter( data.journaled_state.depth() as usize, @@ -139,7 +137,6 @@ where gas: Gas, status: InstructionResult, retdata: Bytes, - _: bool, ) -> (InstructionResult, Gas, Bytes) { self.exit(); diff --git a/evm/src/executor/inspector/fuzzer.rs b/evm/src/executor/inspector/fuzzer.rs index e40c6bc238240..dd17557b64d22 100644 --- a/evm/src/executor/inspector/fuzzer.rs +++ b/evm/src/executor/inspector/fuzzer.rs @@ -27,7 +27,6 @@ where &mut self, interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, - _is_static: bool, ) -> InstructionResult { // We only collect `stack` and `memory` data before and after calls. if self.collect { @@ -41,7 +40,6 @@ where &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - _: bool, ) -> (InstructionResult, Gas, Bytes) { // We don't want to override the very first call made to the test contract. if self.call_generator.is_some() && data.env.tx.caller != call.context.caller { @@ -62,7 +60,6 @@ where remaining_gas: Gas, status: InstructionResult, retdata: Bytes, - _: bool, ) -> (InstructionResult, Gas, Bytes) { if let Some(ref mut call_generator) = self.call_generator { call_generator.used = false; diff --git a/evm/src/executor/inspector/logs.rs b/evm/src/executor/inspector/logs.rs index 5c92d2a355a53..c378316783a6d 100644 --- a/evm/src/executor/inspector/logs.rs +++ b/evm/src/executor/inspector/logs.rs @@ -60,7 +60,6 @@ where &mut self, _: &mut EVMData<'_, DB>, call: &mut CallInputs, - _: bool, ) -> (InstructionResult, Gas, Bytes) { if call.contract == h160_to_b160(HARDHAT_CONSOLE_ADDRESS) { let (status, reason) = self.hardhat_log(call.input.to_vec()); diff --git a/evm/src/executor/inspector/printer.rs b/evm/src/executor/inspector/printer.rs index b9a1abc7f19d6..ed2448bfdf205 100644 --- a/evm/src/executor/inspector/printer.rs +++ b/evm/src/executor/inspector/printer.rs @@ -16,20 +16,14 @@ impl Inspector for TracePrinter { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { - self.gas_inspector.initialize_interp(interp, data, is_static); + self.gas_inspector.initialize_interp(interp, data); InstructionResult::Continue } // get opcode by calling `interp.contract.opcode(interp.program_counter())`. // all other information can be obtained from interp. - fn step( - &mut self, - interp: &mut Interpreter, - data: &mut EVMData<'_, DB>, - is_static: bool, - ) -> InstructionResult { + fn step(&mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>) -> InstructionResult { let opcode = interp.current_opcode(); let opcode_str = opcode::OPCODE_JUMPMAP[opcode as usize]; @@ -50,7 +44,7 @@ impl Inspector for TracePrinter { hex::encode(interp.memory.data()), ); - self.gas_inspector.step(interp, data, is_static); + self.gas_inspector.step(interp, data); InstructionResult::Continue } @@ -59,10 +53,9 @@ impl Inspector for TracePrinter { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, eval: InstructionResult, ) -> InstructionResult { - self.gas_inspector.step_end(interp, data, is_static, eval); + self.gas_inspector.step_end(interp, data, eval); InstructionResult::Continue } @@ -70,13 +63,12 @@ impl Inspector for TracePrinter { &mut self, _data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { println!( "SM CALL: {:?},context:{:?}, is_static:{:?}, transfer:{:?}, input_size:{:?}", inputs.contract, inputs.context, - is_static, + inputs.is_static, inputs.transfer, inputs.input.len(), ); @@ -90,9 +82,8 @@ impl Inspector for TracePrinter { remaining_gas: Gas, ret: InstructionResult, out: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { - self.gas_inspector.call_end(data, inputs, remaining_gas, ret, out.clone(), is_static); + self.gas_inspector.call_end(data, inputs, remaining_gas, ret, out.clone()); (ret, remaining_gas, out) } diff --git a/evm/src/executor/inspector/stack.rs b/evm/src/executor/inspector/stack.rs index 2a3763ce53924..6801b7e4616ab 100644 --- a/evm/src/executor/inspector/stack.rs +++ b/evm/src/executor/inspector/stack.rs @@ -92,7 +92,6 @@ impl InspectorStack { remaining_gas: Gas, status: InstructionResult, retdata: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!( inspector, @@ -107,14 +106,8 @@ impl InspectorStack { &mut self.printer ], { - let (new_status, new_gas, new_retdata) = inspector.call_end( - data, - call, - remaining_gas, - status, - retdata.clone(), - is_static, - ); + let (new_status, new_gas, new_retdata) = + inspector.call_end(data, call, remaining_gas, status, retdata.clone()); // If the inspector returns a different status or a revert with a non-empty message, // we assume it wants to tell us something @@ -138,7 +131,6 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!( inspector, @@ -152,7 +144,7 @@ where &mut self.printer ], { - let status = inspector.initialize_interp(interpreter, data, is_static); + let status = inspector.initialize_interp(interpreter, data); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -168,7 +160,6 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!( inspector, @@ -183,7 +174,7 @@ where &mut self.printer ], { - let status = inspector.step(interpreter, data, is_static); + let status = inspector.step(interpreter, data); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -215,7 +206,6 @@ where &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, status: InstructionResult, ) -> InstructionResult { call_inspectors!( @@ -230,7 +220,7 @@ where &mut self.chisel_state ], { - let status = inspector.step_end(interpreter, data, is_static, status); + let status = inspector.step_end(interpreter, data, status); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -246,7 +236,6 @@ where &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!( inspector, @@ -261,7 +250,7 @@ where &mut self.printer ], { - let (status, gas, retdata) = inspector.call(data, call, is_static); + let (status, gas, retdata) = inspector.call(data, call); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -280,9 +269,8 @@ where remaining_gas: Gas, status: InstructionResult, retdata: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { - let res = self.do_call_end(data, call, remaining_gas, status, retdata, is_static); + let res = self.do_call_end(data, call, remaining_gas, status, retdata); if matches!(res.0, return_revert!()) { // Encountered a revert, since cheatcodes may have altered the evm state in such a way diff --git a/evm/src/executor/inspector/tracer.rs b/evm/src/executor/inspector/tracer.rs index 8e91f2f28b870..d28453de68f76 100644 --- a/evm/src/executor/inspector/tracer.rs +++ b/evm/src/executor/inspector/tracer.rs @@ -162,12 +162,7 @@ impl Inspector for Tracer where DB: Database, { - fn step( - &mut self, - interp: &mut Interpreter, - data: &mut EVMData<'_, DB>, - _is_static: bool, - ) -> InstructionResult { + fn step(&mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>) -> InstructionResult { if !self.record_steps { return InstructionResult::Continue } @@ -188,7 +183,6 @@ where &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - _is_static: bool, status: InstructionResult, ) -> InstructionResult { if !self.record_steps { @@ -204,7 +198,6 @@ where &mut self, data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - _is_static: bool, ) -> (InstructionResult, Gas, Bytes) { let (from, to) = match inputs.context.scheme { CallScheme::DelegateCall | CallScheme::CallCode => { @@ -232,7 +225,6 @@ where gas: Gas, status: InstructionResult, retdata: Bytes, - _is_static: bool, ) -> (InstructionResult, Gas, Bytes) { self.fill_trace( status, diff --git a/evm/src/executor/mod.rs b/evm/src/executor/mod.rs index c8b4591c71f9d..3de78fbc868a3 100644 --- a/evm/src/executor/mod.rs +++ b/evm/src/executor/mod.rs @@ -21,7 +21,6 @@ use ethers::{ types::Log, }; use foundry_common::{abi::IntoFunction, evm::Breakpoints}; -use hashbrown::HashMap; use revm::primitives::hex_literal::hex; /// Reexport commonly used revm types pub use revm::primitives::{Env, SpecId}; @@ -29,8 +28,8 @@ pub use revm::{ db::{DatabaseCommit, DatabaseRef}, interpreter::{return_ok, CreateScheme, InstructionResult, Memory, Stack}, primitives::{ - Account, BlockEnv, Bytecode, ExecutionResult, Output, ResultAndState, TransactTo, TxEnv, - B160, U256 as rU256, + Account, BlockEnv, Bytecode, ExecutionResult, HashMap, Output, ResultAndState, TransactTo, + TxEnv, B160, U256 as rU256, }, }; use std::collections::BTreeMap; diff --git a/evm/src/fuzz/invariant/executor.rs b/evm/src/fuzz/invariant/executor.rs index 5530f4cd6123a..619ba3aca5580 100644 --- a/evm/src/fuzz/invariant/executor.rs +++ b/evm/src/fuzz/invariant/executor.rs @@ -26,13 +26,15 @@ use ethers::{ use eyre::ContextCompat; use foundry_common::contracts::{ContractsByAddress, ContractsByArtifact}; use foundry_config::{FuzzDictionaryConfig, InvariantConfig}; -use hashbrown::HashMap; use parking_lot::{Mutex, RwLock}; use proptest::{ strategy::{BoxedStrategy, Strategy, ValueTree}, test_runner::{TestCaseError, TestRunner}, }; -use revm::{primitives::B160, DatabaseCommit}; +use revm::{ + primitives::{HashMap, B160}, + DatabaseCommit, +}; use std::{cell::RefCell, collections::BTreeMap, sync::Arc}; /// Alias for (Dictionary for fuzzing, initial contracts to fuzz and an InvariantStrategy). diff --git a/evm/src/fuzz/strategies/state.rs b/evm/src/fuzz/strategies/state.rs index 67c6c569e4e1c..9faea06d8bb35 100644 --- a/evm/src/fuzz/strategies/state.rs +++ b/evm/src/fuzz/strategies/state.rs @@ -260,7 +260,7 @@ pub fn collect_created_contracts( for (address, account) in state_changeset { if !setup_contracts.contains_key(&b160_to_h160(*address)) { - if let (true, Some(code)) = (&account.is_touched, &account.info.code) { + if let (true, Some(code)) = (&account.is_touched(), &account.info.code) { if !code.is_empty() { if let Some((artifact, (abi, _))) = project_contracts.find_by_code(code.bytes()) { diff --git a/evm/src/lib.rs b/evm/src/lib.rs index e0326fa6e7144..ada871210e912 100644 --- a/evm/src/lib.rs +++ b/evm/src/lib.rs @@ -28,9 +28,9 @@ pub mod utils; // Re-exports pub use ethers::types::Address; -pub use hashbrown::{self, HashMap}; -pub use revm; +pub use hashbrown::{self}; use revm::interpreter::{CallScheme, CreateScheme}; +pub use revm::{self, primitives::HashMap}; use serde::{Deserialize, Serialize}; /// Stores the caller address to be used as _sender_ account for: