From 7fd4f64784109b2585ab7017f0cb1664d1886292 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 22 Aug 2023 12:01:55 -0400 Subject: [PATCH 01/12] chore: bump revm --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 949d33496f888..9ce767349dda5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5300,7 +5300,7 @@ dependencies = [ [[package]] name = "revm" version = "3.3.0" -source = "git+https://github.com/bluealloy/revm/?rev=eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2#eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2" +source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" dependencies = [ "auto_impl", "once_cell", @@ -5314,7 +5314,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?rev=eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2#eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2" +source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" dependencies = [ "derive_more", "enumn", @@ -5326,7 +5326,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.3" -source = "git+https://github.com/bluealloy/revm/?rev=eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2#eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2" +source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" dependencies = [ "k256", "num", @@ -5342,7 +5342,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?rev=eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2#eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2" +source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" dependencies = [ "auto_impl", "bitflags 2.4.0", diff --git a/Cargo.toml b/Cargo.toml index 59b5c182f8fa4..8ac47212875ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -154,4 +154,4 @@ solang-parser = "=0.3.1" #ethers-solc = { path = "../ethers-rs/ethers-solc" } [patch.crates-io] -revm = { git = "https://github.com/bluealloy/revm/", rev = "eb6a9f09e8ac2227bc1c353b698ad9e68a9574b2" } +revm = { git = "https://github.com/evalir/revm/", branch = "evalir/add-hash-contract" } From 7e56b7158d540bce2af327a24ac219da2fcbedae Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 22 Aug 2023 12:02:09 -0400 Subject: [PATCH 02/12] chore: fix breaking changes --- crates/anvil/src/config.rs | 23 ++++++++++--------- crates/evm/src/executor/fork/init.rs | 19 ++++++++------- crates/evm/src/executor/inspector/coverage.rs | 4 ++-- crates/evm/src/executor/opts.rs | 22 +++++++++--------- crates/forge/src/lib.rs | 5 ++-- 5 files changed, 37 insertions(+), 36 deletions(-) diff --git a/crates/anvil/src/config.rs b/crates/anvil/src/config.rs index f262cfb0c5595..653847839a279 100644 --- a/crates/anvil/src/config.rs +++ b/crates/anvil/src/config.rs @@ -781,18 +781,19 @@ impl NodeConfig { /// *Note*: only memory based backend for now pub(crate) async fn setup(&mut self) -> mem::Backend { // configure the revm environment + + let mut cfg = CfgEnv::default(); + cfg.spec_id = self.get_hardfork().into(); + cfg.chain_id = rU256::from(self.get_chain_id()); + cfg.limit_contract_code_size = self.code_size_limit; + // EIP-3607 rejects transactions from senders with deployed code. + // If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the + // caller is a contract. So we disable the check by default. + cfg.disable_eip3607 = true; + cfg.disable_block_gas_limit = self.disable_block_gas_limit; + let mut env = revm::primitives::Env { - cfg: CfgEnv { - spec_id: self.get_hardfork().into(), - chain_id: rU256::from(self.get_chain_id()), - limit_contract_code_size: self.code_size_limit, - // EIP-3607 rejects transactions from senders with deployed code. - // If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the - // caller is a contract. So we disable the check by default. - disable_eip3607: true, - disable_block_gas_limit: self.disable_block_gas_limit, - ..Default::default() - }, + cfg, block: BlockEnv { gas_limit: self.gas_limit.into(), basefee: self.get_base_fee().into(), diff --git a/crates/evm/src/executor/fork/init.rs b/crates/evm/src/executor/fork/init.rs index 849b46f51cf00..886129053b1e5 100644 --- a/crates/evm/src/executor/fork/init.rs +++ b/crates/evm/src/executor/fork/init.rs @@ -58,17 +58,16 @@ where eyre::bail!("Failed to get block for block number: {}", block_number) }; + let mut cfg = CfgEnv::default(); + cfg.chain_id = u256_to_ru256(override_chain_id.unwrap_or(rpc_chain_id.as_u64()).into()); + cfg.memory_limit = memory_limit; + cfg.limit_contract_code_size = Some(usize::MAX); + // EIP-3607 rejects transactions from senders with deployed code. + // If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the caller + // is a contract. So we disable the check by default. + cfg.disable_eip3607 = true; let mut env = Env { - cfg: CfgEnv { - chain_id: u256_to_ru256(override_chain_id.unwrap_or(rpc_chain_id.as_u64()).into()), - memory_limit, - limit_contract_code_size: Some(usize::MAX), - // EIP-3607 rejects transactions from senders with deployed code. - // If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the caller - // is a contract. So we disable the check by default. - disable_eip3607: true, - ..Default::default() - }, + cfg, block: BlockEnv { number: u256_to_ru256(block.number.expect("block number not found").as_u64().into()), timestamp: block.timestamp.into(), diff --git a/crates/evm/src/executor/inspector/coverage.rs b/crates/evm/src/executor/inspector/coverage.rs index 32a1f29839ad4..1a549de04e95d 100644 --- a/crates/evm/src/executor/inspector/coverage.rs +++ b/crates/evm/src/executor/inspector/coverage.rs @@ -21,7 +21,7 @@ impl Inspector for CoverageCollector { interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, ) -> InstructionResult { - let hash = b256_to_h256(interpreter.contract.bytecode.clone().unlock().hash_slow()); + let hash = b256_to_h256(interpreter.contract.hash); self.maps.entry(hash).or_insert_with(|| { HitMap::new(Bytes::copy_from_slice( interpreter.contract.bytecode.original_bytecode_slice(), @@ -37,7 +37,7 @@ impl Inspector for CoverageCollector { interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, ) -> InstructionResult { - let hash = b256_to_h256(interpreter.contract.bytecode.clone().unlock().hash_slow()); + let hash = b256_to_h256(interpreter.contract.hash); self.maps.entry(hash).and_modify(|map| map.hit(interpreter.program_counter())); InstructionResult::Continue diff --git a/crates/evm/src/executor/opts.rs b/crates/evm/src/executor/opts.rs index 944a46206dfe0..e572ff81dbf9b 100644 --- a/crates/evm/src/executor/opts.rs +++ b/crates/evm/src/executor/opts.rs @@ -93,6 +93,16 @@ impl EvmOpts { /// Returns the `revm::Env` configured with only local settings pub fn local_evm_env(&self) -> revm::primitives::Env { + let mut cfg = CfgEnv::default(); + cfg.chain_id = rU256::from(self.env.chain_id.unwrap_or(foundry_common::DEV_CHAIN_ID)); + cfg.spec_id = SpecId::MERGE; + cfg.limit_contract_code_size = self.env.code_size_limit.or(Some(usize::MAX)); + cfg.memory_limit = self.memory_limit; + // EIP-3607 rejects transactions from senders with deployed code. + // If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the + // caller is a contract. So we disable the check by default. + cfg.disable_eip3607 = true; + revm::primitives::Env { block: BlockEnv { number: rU256::from(self.env.block_number), @@ -103,17 +113,7 @@ impl EvmOpts { basefee: rU256::from(self.env.block_base_fee_per_gas), gas_limit: self.gas_limit().into(), }, - cfg: CfgEnv { - chain_id: rU256::from(self.env.chain_id.unwrap_or(foundry_common::DEV_CHAIN_ID)), - spec_id: SpecId::MERGE, - limit_contract_code_size: self.env.code_size_limit.or(Some(usize::MAX)), - memory_limit: self.memory_limit, - // EIP-3607 rejects transactions from senders with deployed code. - // If EIP-3607 is enabled it can cause issues during fuzz/invariant tests if the - // caller is a contract. So we disable the check by default. - disable_eip3607: true, - ..Default::default() - }, + cfg, tx: TxEnv { gas_price: rU256::from(self.env.gas_price.unwrap_or_default()), gas_limit: self.gas_limit().as_u64(), diff --git a/crates/forge/src/lib.rs b/crates/forge/src/lib.rs index 24bebfd7c1380..330fa5da9527e 100644 --- a/crates/forge/src/lib.rs +++ b/crates/forge/src/lib.rs @@ -3,6 +3,7 @@ use foundry_config::{ validate_profiles, Config, FuzzConfig, InlineConfig, InlineConfigError, InlineConfigParser, InvariantConfig, NatSpec, }; +use itertools::Itertools; use proptest::test_runner::{RngAlgorithm, TestRng, TestRunner}; use std::path::Path; @@ -56,7 +57,7 @@ impl TestOptions { base_fuzz: FuzzConfig, base_invariant: InvariantConfig, ) -> Result { - let natspecs: Vec = NatSpec::parse(output, root); + let natspecs: Vec = NatSpec::parse(output, &root); let mut inline_invariant = InlineConfig::::default(); let mut inline_fuzz = InlineConfig::::default(); @@ -67,7 +68,7 @@ impl TestOptions { InvariantConfig::validate_configs(&natspec)?; // Apply in-line configurations for the current profile - let configs: Vec = natspec.current_profile_configs().collect(); + let configs: Vec = natspec.current_profile_configs().into_iter().collect_vec(); let c: &str = &natspec.contract; let f: &str = &natspec.function; let line: String = natspec.debug_context(); From e98870ca47137b43a3dc6de90d60d5ef274badfb Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 22 Aug 2023 12:02:19 -0400 Subject: [PATCH 03/12] feat: add coverage test --- crates/forge/tests/cli/coverage.rs | 6 ++++++ crates/forge/tests/cli/main.rs | 1 + 2 files changed, 7 insertions(+) create mode 100644 crates/forge/tests/cli/coverage.rs diff --git a/crates/forge/tests/cli/coverage.rs b/crates/forge/tests/cli/coverage.rs new file mode 100644 index 0000000000000..05b76a06fdf1c --- /dev/null +++ b/crates/forge/tests/cli/coverage.rs @@ -0,0 +1,6 @@ +use foundry_test_utils::{forgetest, TestCommand, TestProject}; + +forgetest!(basic_coverage, |_prj: TestProject, mut cmd: TestCommand| { + cmd.args(["coverage"]); + cmd.assert_success(); +}); diff --git a/crates/forge/tests/cli/main.rs b/crates/forge/tests/cli/main.rs index 0a05fe038be88..69868c93a7c8e 100644 --- a/crates/forge/tests/cli/main.rs +++ b/crates/forge/tests/cli/main.rs @@ -4,6 +4,7 @@ pub mod utils; mod cache; mod cmd; mod config; +mod coverage; mod create; mod doc; mod multi_script; From f9461c7e69c9541029c5ce72dc9fd4381f804374 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 22 Aug 2023 16:57:42 -0400 Subject: [PATCH 04/12] chore: clippy --- crates/forge/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/forge/src/lib.rs b/crates/forge/src/lib.rs index 330fa5da9527e..02ad086f32251 100644 --- a/crates/forge/src/lib.rs +++ b/crates/forge/src/lib.rs @@ -57,7 +57,7 @@ impl TestOptions { base_fuzz: FuzzConfig, base_invariant: InvariantConfig, ) -> Result { - let natspecs: Vec = NatSpec::parse(output, &root); + let natspecs: Vec = NatSpec::parse(output, root); let mut inline_invariant = InlineConfig::::default(); let mut inline_fuzz = InlineConfig::::default(); @@ -68,7 +68,7 @@ impl TestOptions { InvariantConfig::validate_configs(&natspec)?; // Apply in-line configurations for the current profile - let configs: Vec = natspec.current_profile_configs().into_iter().collect_vec(); + let configs: Vec = natspec.current_profile_configs().collect_vec(); let c: &str = &natspec.contract; let f: &str = &natspec.function; let line: String = natspec.debug_context(); From 220e1f2a91827eb859ff108e80faec4ec3bff0a1 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 10:18:58 -0400 Subject: [PATCH 05/12] chore: switch revm to latest main --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ce767349dda5..d3f00198ad48b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5300,7 +5300,7 @@ dependencies = [ [[package]] name = "revm" version = "3.3.0" -source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" +source = "git+https://github.com/bluealloy/revm/?rev=6b55b9c0ab264c000e087c2f54f2d8dc24b869aa#6b55b9c0ab264c000e087c2f54f2d8dc24b869aa" dependencies = [ "auto_impl", "once_cell", @@ -5314,7 +5314,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.1.2" -source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" +source = "git+https://github.com/bluealloy/revm/?rev=6b55b9c0ab264c000e087c2f54f2d8dc24b869aa#6b55b9c0ab264c000e087c2f54f2d8dc24b869aa" dependencies = [ "derive_more", "enumn", @@ -5326,7 +5326,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.3" -source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" +source = "git+https://github.com/bluealloy/revm/?rev=6b55b9c0ab264c000e087c2f54f2d8dc24b869aa#6b55b9c0ab264c000e087c2f54f2d8dc24b869aa" dependencies = [ "k256", "num", @@ -5342,7 +5342,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.1.2" -source = "git+https://github.com/evalir/revm/?branch=evalir/add-hash-contract#5097894b0c3a129c6a81621394ef96d277ee7ee1" +source = "git+https://github.com/bluealloy/revm/?rev=6b55b9c0ab264c000e087c2f54f2d8dc24b869aa#6b55b9c0ab264c000e087c2f54f2d8dc24b869aa" dependencies = [ "auto_impl", "bitflags 2.4.0", diff --git a/Cargo.toml b/Cargo.toml index 8ac47212875ce..daa47cfd0170c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -154,4 +154,4 @@ solang-parser = "=0.3.1" #ethers-solc = { path = "../ethers-rs/ethers-solc" } [patch.crates-io] -revm = { git = "https://github.com/evalir/revm/", branch = "evalir/add-hash-contract" } +revm = { git = "https://github.com/bluealloy/revm/", rev = "6b55b9c0ab264c000e087c2f54f2d8dc24b869aa" } From cdcfd23402564fb6782cda8143d776b0498af731 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 10:40:56 -0400 Subject: [PATCH 06/12] Revert "Revert "feat(evm): Use latest revm main commit (#5669)" (#5695)" This reverts commit f8a07c3d089dc57c39d15fb97f579d89a5e0b709. --- crates/anvil/src/eth/backend/mem/inspector.rs | 21 +++++---------- crates/anvil/src/eth/error.rs | 8 +++++- crates/anvil/src/genesis.rs | 2 +- crates/evm/src/executor/backend/mod.rs | 2 +- crates/evm/src/executor/fork/cache.rs | 17 +++++++----- .../evm/src/executor/inspector/access_list.rs | 1 - .../executor/inspector/cheatcodes/mapping.rs | 2 +- .../src/executor/inspector/cheatcodes/mod.rs | 8 ++---- .../src/executor/inspector/chisel_state.rs | 1 - crates/evm/src/executor/inspector/coverage.rs | 2 -- crates/evm/src/executor/inspector/debugger.rs | 3 --- crates/evm/src/executor/inspector/fuzzer.rs | 3 --- crates/evm/src/executor/inspector/logs.rs | 1 - crates/evm/src/executor/inspector/printer.rs | 10 ++----- crates/evm/src/executor/inspector/stack.rs | 26 +++++-------------- crates/evm/src/executor/inspector/tracer.rs | 10 +------ crates/evm/src/fuzz/strategies/state.rs | 2 +- crates/forge/tests/cli/coverage.rs | 6 ----- crates/forge/tests/cli/main.rs | 1 - 19 files changed, 40 insertions(+), 86 deletions(-) delete mode 100644 crates/forge/tests/cli/coverage.rs diff --git a/crates/anvil/src/eth/backend/mem/inspector.rs b/crates/anvil/src/eth/backend/mem/inspector.rs index ca409b734a1f3..9ca7686c618b5 100644 --- a/crates/anvil/src/eth/backend/mem/inspector.rs +++ b/crates/anvil/src/eth/backend/mem/inspector.rs @@ -53,23 +53,17 @@ impl revm::Inspector for Inspector { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!([&mut self.tracer], |inspector| { - inspector.initialize_interp(interp, data, is_static); + inspector.initialize_interp(interp, data); }); InstructionResult::Continue } #[inline] - 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!([&mut self.tracer], |inspector| { - inspector.step(interp, data, is_static); + inspector.step(interp, data); }); InstructionResult::Continue } @@ -92,11 +86,10 @@ impl revm::Inspector for Inspector { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, eval: InstructionResult, ) -> InstructionResult { call_inspectors!([&mut self.tracer], |inspector| { - inspector.step_end(interp, data, is_static, eval); + inspector.step_end(interp, data, eval); }); eval } @@ -106,10 +99,9 @@ impl revm::Inspector for Inspector { &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!([&mut self.tracer, Some(&mut self.log_collector)], |inspector| { - inspector.call(data, call, is_static); + inspector.call(data, call); }); (InstructionResult::Continue, Gas::new(call.gas_limit), Bytes::new()) @@ -123,10 +115,9 @@ impl revm::Inspector for Inspector { remaining_gas: Gas, ret: InstructionResult, out: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!([&mut self.tracer], |inspector| { - 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/crates/anvil/src/eth/error.rs b/crates/anvil/src/eth/error.rs index 888f185d5647a..8289fd289b375 100644 --- a/crates/anvil/src/eth/error.rs +++ b/crates/anvil/src/eth/error.rs @@ -181,6 +181,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 { @@ -203,7 +206,7 @@ impl From for InvalidTransactionError { }) } InvalidTransaction::RejectCallerWithCode => InvalidTransactionError::SenderNoEOA, - InvalidTransaction::LackOfFundForGasLimit { .. } => { + InvalidTransaction::LackOfFundForMaxFee { .. } => { InvalidTransactionError::InsufficientFunds } InvalidTransaction::OverflowPaymentInTransaction => { @@ -217,6 +220,9 @@ impl From for InvalidTransactionError { } InvalidTransaction::NonceTooHigh { .. } => InvalidTransactionError::NonceTooHigh, InvalidTransaction::NonceTooLow { .. } => InvalidTransactionError::NonceTooLow, + InvalidTransaction::AccessListNotSupported => { + InvalidTransactionError::AccessListNotSupported + } } } } diff --git a/crates/anvil/src/genesis.rs b/crates/anvil/src/genesis.rs index 3ab285a1018ad..71b64feebd682 100644 --- a/crates/anvil/src/genesis.rs +++ b/crates/anvil/src/genesis.rs @@ -146,7 +146,7 @@ impl From for AccountInfo { AccountInfo { balance: balance.into(), nonce: nonce.unwrap_or_default(), - code_hash: code.as_ref().map(|code| code.hash).unwrap_or(KECCAK_EMPTY), + code_hash: code.as_ref().map(|code| code.hash_slow()).unwrap_or(KECCAK_EMPTY), code, } } diff --git a/crates/evm/src/executor/backend/mod.rs b/crates/evm/src/executor/backend/mod.rs index d286cb8a84b76..3e468f2235133 100644 --- a/crates/evm/src/executor/backend/mod.rs +++ b/crates/evm/src/executor/backend/mod.rs @@ -1099,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, diff --git a/crates/evm/src/executor/fork/cache.rs b/crates/evm/src/executor/fork/cache.rs index dbd4cfe747c8e..bf1429589a0f4 100644 --- a/crates/evm/src/executor/fork/cache.rs +++ b/crates/evm/src/executor/fork/cache.rs @@ -1,9 +1,10 @@ //! Cache related abstraction use crate::executor::backend::snapshot::StateSnapshot; -use hashbrown::HashMap as Map; 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}; @@ -256,13 +257,17 @@ 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 { // insert account - if let Some(code_hash) = - acc.info.code.as_ref().filter(|code| !code.is_empty()).map(|code| code.hash) + if let Some(code_hash) = acc + .info + .code + .as_ref() + .filter(|code| !code.is_empty()) + .map(|code| code.hash_slow()) { acc.info.code_hash = code_hash; } else if acc.info.code_hash.is_zero() { @@ -271,7 +276,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/crates/evm/src/executor/inspector/access_list.rs b/crates/evm/src/executor/inspector/access_list.rs index 88619de35da01..65e15c300addb 100644 --- a/crates/evm/src/executor/inspector/access_list.rs +++ b/crates/evm/src/executor/inspector/access_list.rs @@ -56,7 +56,6 @@ impl Inspector for AccessListTracer { &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/crates/evm/src/executor/inspector/cheatcodes/mapping.rs b/crates/evm/src/executor/inspector/cheatcodes/mapping.rs index cf81dc447eb1c..0ae5439a938b2 100644 --- a/crates/evm/src/executor/inspector/cheatcodes/mapping.rs +++ b/crates/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/crates/evm/src/executor/inspector/cheatcodes/mod.rs b/crates/evm/src/executor/inspector/cheatcodes/mod.rs index 2a0a24b7b06e5..e8900054929a6 100644 --- a/crates/evm/src/executor/inspector/cheatcodes/mod.rs +++ b/crates/evm/src/executor/inspector/cheatcodes/mod.rs @@ -294,7 +294,6 @@ impl Inspector for Cheatcodes { &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. @@ -312,7 +311,6 @@ impl Inspector for Cheatcodes { &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { self.pc = interpreter.program_counter(); @@ -513,7 +511,7 @@ impl Inspector for Cheatcodes { (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), @@ -568,7 +566,6 @@ impl Inspector for Cheatcodes { &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); @@ -677,7 +674,7 @@ impl Inspector for Cheatcodes { // 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) @@ -742,7 +739,6 @@ impl Inspector for Cheatcodes { 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/crates/evm/src/executor/inspector/chisel_state.rs b/crates/evm/src/executor/inspector/chisel_state.rs index cb7a2a6c17e75..958e33cb5cd9a 100644 --- a/crates/evm/src/executor/inspector/chisel_state.rs +++ b/crates/evm/src/executor/inspector/chisel_state.rs @@ -26,7 +26,6 @@ impl Inspector for ChiselState { &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/crates/evm/src/executor/inspector/coverage.rs b/crates/evm/src/executor/inspector/coverage.rs index 4ba53e4e3cdce..1a549de04e95d 100644 --- a/crates/evm/src/executor/inspector/coverage.rs +++ b/crates/evm/src/executor/inspector/coverage.rs @@ -20,7 +20,6 @@ impl Inspector for CoverageCollector { &mut self, interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { let hash = b256_to_h256(interpreter.contract.hash); self.maps.entry(hash).or_insert_with(|| { @@ -37,7 +36,6 @@ impl Inspector for CoverageCollector { &mut self, interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { let hash = b256_to_h256(interpreter.contract.hash); self.maps.entry(hash).and_modify(|map| map.hit(interpreter.program_counter())); diff --git a/crates/evm/src/executor/inspector/debugger.rs b/crates/evm/src/executor/inspector/debugger.rs index e051ad73cf532..a21a0f3247a8c 100644 --- a/crates/evm/src/executor/inspector/debugger.rs +++ b/crates/evm/src/executor/inspector/debugger.rs @@ -55,7 +55,6 @@ impl Inspector for Debugger { &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { let pc = interpreter.program_counter(); let op = interpreter.contract.bytecode.bytecode()[pc]; @@ -98,7 +97,6 @@ impl Inspector for Debugger { &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - _: bool, ) -> (InstructionResult, Gas, Bytes) { self.enter( data.journaled_state.depth() as usize, @@ -126,7 +124,6 @@ impl Inspector for Debugger { gas: Gas, status: InstructionResult, retdata: Bytes, - _: bool, ) -> (InstructionResult, Gas, Bytes) { self.exit(); diff --git a/crates/evm/src/executor/inspector/fuzzer.rs b/crates/evm/src/executor/inspector/fuzzer.rs index 17926e887f1d4..a7363614a01a2 100644 --- a/crates/evm/src/executor/inspector/fuzzer.rs +++ b/crates/evm/src/executor/inspector/fuzzer.rs @@ -25,7 +25,6 @@ impl Inspector for Fuzzer { &mut self, interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, - _: bool, ) -> InstructionResult { // We only collect `stack` and `memory` data before and after calls. if self.collect { @@ -40,7 +39,6 @@ impl Inspector for Fuzzer { &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 @@ impl Inspector for Fuzzer { 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/crates/evm/src/executor/inspector/logs.rs b/crates/evm/src/executor/inspector/logs.rs index c848e329c9f77..a4124d4695a62 100644 --- a/crates/evm/src/executor/inspector/logs.rs +++ b/crates/evm/src/executor/inspector/logs.rs @@ -57,7 +57,6 @@ impl Inspector for LogCollector { &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/crates/evm/src/executor/inspector/printer.rs b/crates/evm/src/executor/inspector/printer.rs index 6b694f12f0eea..0f8d9127bf87b 100644 --- a/crates/evm/src/executor/inspector/printer.rs +++ b/crates/evm/src/executor/inspector/printer.rs @@ -12,12 +12,7 @@ pub struct TracePrinter; impl Inspector for TracePrinter { // 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>, - _: 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]; let gas_remaining = interp.gas.remaining(); @@ -43,13 +38,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(), ); diff --git a/crates/evm/src/executor/inspector/stack.rs b/crates/evm/src/executor/inspector/stack.rs index 7c22a4d65d55f..d626fc3d4e33a 100644 --- a/crates/evm/src/executor/inspector/stack.rs +++ b/crates/evm/src/executor/inspector/stack.rs @@ -326,7 +326,6 @@ impl InspectorStack { remaining_gas: Gas, status: InstructionResult, retdata: Bytes, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!( [ @@ -339,14 +338,8 @@ impl InspectorStack { &mut self.printer ], |inspector| { - 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 @@ -367,7 +360,6 @@ impl Inspector for InspectorStack { &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!( [ @@ -379,7 +371,7 @@ impl Inspector for InspectorStack { &mut self.printer ], |inspector| { - 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 { @@ -395,7 +387,6 @@ impl Inspector for InspectorStack { &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, ) -> InstructionResult { call_inspectors!( [ @@ -408,7 +399,7 @@ impl Inspector for InspectorStack { &mut self.printer ], |inspector| { - let status = inspector.step(interpreter, data, is_static); + let status = inspector.step(interpreter, data); // Allow inspectors to exit early if status != InstructionResult::Continue { @@ -439,7 +430,6 @@ impl Inspector for InspectorStack { &mut self, interpreter: &mut Interpreter, data: &mut EVMData<'_, DB>, - is_static: bool, status: InstructionResult, ) -> InstructionResult { call_inspectors!( @@ -452,7 +442,7 @@ impl Inspector for InspectorStack { &mut self.chisel_state ], |inspector| { - 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 { @@ -468,7 +458,6 @@ impl Inspector for InspectorStack { &mut self, data: &mut EVMData<'_, DB>, call: &mut CallInputs, - is_static: bool, ) -> (InstructionResult, Gas, Bytes) { call_inspectors!( [ @@ -481,7 +470,7 @@ impl Inspector for InspectorStack { &mut self.printer ], |inspector| { - 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 { @@ -500,9 +489,8 @@ impl Inspector for InspectorStack { 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/crates/evm/src/executor/inspector/tracer.rs b/crates/evm/src/executor/inspector/tracer.rs index 5d5c80ba6b55c..c8851edf7ec75 100644 --- a/crates/evm/src/executor/inspector/tracer.rs +++ b/crates/evm/src/executor/inspector/tracer.rs @@ -150,12 +150,7 @@ impl Tracer { impl Inspector for Tracer { #[inline] - 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 { self.start_step(interp, data); } @@ -167,7 +162,6 @@ impl Inspector for Tracer { &mut self, interp: &mut Interpreter, data: &mut EVMData<'_, DB>, - _: bool, status: InstructionResult, ) -> InstructionResult { if self.record_steps { @@ -189,7 +183,6 @@ impl Inspector for Tracer { &mut self, data: &mut EVMData<'_, DB>, inputs: &mut CallInputs, - _: bool, ) -> (InstructionResult, Gas, Bytes) { let (from, to) = match inputs.context.scheme { CallScheme::DelegateCall | CallScheme::CallCode => { @@ -218,7 +211,6 @@ impl Inspector for Tracer { gas: Gas, status: InstructionResult, retdata: Bytes, - _: bool, ) -> (InstructionResult, Gas, Bytes) { self.fill_trace( status, diff --git a/crates/evm/src/fuzz/strategies/state.rs b/crates/evm/src/fuzz/strategies/state.rs index 2cad56de24988..ba62a0eb22564 100644 --- a/crates/evm/src/fuzz/strategies/state.rs +++ b/crates/evm/src/fuzz/strategies/state.rs @@ -268,7 +268,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/crates/forge/tests/cli/coverage.rs b/crates/forge/tests/cli/coverage.rs deleted file mode 100644 index 05b76a06fdf1c..0000000000000 --- a/crates/forge/tests/cli/coverage.rs +++ /dev/null @@ -1,6 +0,0 @@ -use foundry_test_utils::{forgetest, TestCommand, TestProject}; - -forgetest!(basic_coverage, |_prj: TestProject, mut cmd: TestCommand| { - cmd.args(["coverage"]); - cmd.assert_success(); -}); diff --git a/crates/forge/tests/cli/main.rs b/crates/forge/tests/cli/main.rs index 69868c93a7c8e..0a05fe038be88 100644 --- a/crates/forge/tests/cli/main.rs +++ b/crates/forge/tests/cli/main.rs @@ -4,7 +4,6 @@ pub mod utils; mod cache; mod cmd; mod config; -mod coverage; mod create; mod doc; mod multi_script; From 9ed5d593e4dcc6c2ba640d9c4b577df94667d4dc Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 10:42:10 -0400 Subject: [PATCH 07/12] re-add coverage test --- crates/forge/tests/cli/coverage.rs | 6 ++++++ crates/forge/tests/cli/main.rs | 1 + 2 files changed, 7 insertions(+) create mode 100644 crates/forge/tests/cli/coverage.rs diff --git a/crates/forge/tests/cli/coverage.rs b/crates/forge/tests/cli/coverage.rs new file mode 100644 index 0000000000000..8364244a09d2b --- /dev/null +++ b/crates/forge/tests/cli/coverage.rs @@ -0,0 +1,6 @@ +use foundry_test_utils::{forgetest, TestCommand, TestProject}; + +forgetest!(basic_coverage, |_prj: TestProject, mut cmd: TestCommand| { + cmd.args(["coverage"]); + cmd.assert_success(); +}); \ No newline at end of file diff --git a/crates/forge/tests/cli/main.rs b/crates/forge/tests/cli/main.rs index 0a05fe038be88..69868c93a7c8e 100644 --- a/crates/forge/tests/cli/main.rs +++ b/crates/forge/tests/cli/main.rs @@ -4,6 +4,7 @@ pub mod utils; mod cache; mod cmd; mod config; +mod coverage; mod create; mod doc; mod multi_script; From 50690d98e5337b5c0ea36c1e1d4c69737c5d98e7 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 10:43:18 -0400 Subject: [PATCH 08/12] fmt --- crates/forge/tests/cli/coverage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/forge/tests/cli/coverage.rs b/crates/forge/tests/cli/coverage.rs index 8364244a09d2b..05b76a06fdf1c 100644 --- a/crates/forge/tests/cli/coverage.rs +++ b/crates/forge/tests/cli/coverage.rs @@ -3,4 +3,4 @@ use foundry_test_utils::{forgetest, TestCommand, TestProject}; forgetest!(basic_coverage, |_prj: TestProject, mut cmd: TestCommand| { cmd.args(["coverage"]); cmd.assert_success(); -}); \ No newline at end of file +}); From 5b64316b92897b57903050cbced2121e6681cd5a Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 11:59:16 -0400 Subject: [PATCH 09/12] chore: clippy --- crates/forge/bin/cmd/inspect.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/forge/bin/cmd/inspect.rs b/crates/forge/bin/cmd/inspect.rs index c4c955f6486f2..1359067578b90 100644 --- a/crates/forge/bin/cmd/inspect.rs +++ b/crates/forge/bin/cmd/inspect.rs @@ -275,7 +275,7 @@ macro_rules! impl_value_enum { (enum $name:ident { $($field:ident => $main:literal $(| $alias:literal)*),+ $(,)? }) => { impl $name { /// All the variants of this enum. - pub const ALL: &[Self] = &[$(Self::$field),+]; + pub const ALL: &'static [Self] = &[$(Self::$field),+]; /// Returns the string representation of `self`. #[inline] From 686dab14fd870afea0c0b845a6624cfea6864441 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 12:10:19 -0400 Subject: [PATCH 10/12] chore: fix test --- crates/evm/test-data/storage.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/evm/test-data/storage.json b/crates/evm/test-data/storage.json index 41114b2cc39be..7544ef1be56c7 100644 --- a/crates/evm/test-data/storage.json +++ b/crates/evm/test-data/storage.json @@ -1 +1 @@ -{"meta":{"cfg_env":{"chain_id":"0x1","spec_id":"LATEST","perf_all_precompiles_have_balance":false,"memory_limit":4294967295, "perf_analyse_created_bytecodes":"Analyse", "limit_contract_code_size": 24576},"block_env":{"number":"0xdc42b8","coinbase":"0x0000000000000000000000000000000000000000","timestamp":"0x1","difficulty":"0x0","basefee":"0x0","gas_limit":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"},"hosts":["mainnet.infura.io"]},"accounts":{"0x63091244180ae240c87d1f528f5f269134cb07b3":{"balance":"0x0","code_hash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","code":null,"nonce":0}},"storage":{"0x63091244180ae240c87d1f528f5f269134cb07b3":{"0x0":"0x0","0x1":"0x0","0x2":"0x0","0x3":"0x0","0x4":"0x0","0x5":"0x0","0x6":"0x0","0x7":"0x0","0x8":"0x0","0x9":"0x0"}},"block_hashes":{}} \ No newline at end of file +{"meta":{"cfg_env":{"chain_id":"0x1","spec_id":"LATEST","perf_all_precompiles_have_balance":false,"memory_limit":4294967295, "perf_analyse_created_bytecodes":"Analyse", "limit_contract_code_size": 24576, "disable_coinbase_tip": false},"block_env":{"number":"0xdc42b8","coinbase":"0x0000000000000000000000000000000000000000","timestamp":"0x1","difficulty":"0x0","basefee":"0x0","gas_limit":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"},"hosts":["mainnet.infura.io"]},"accounts":{"0x63091244180ae240c87d1f528f5f269134cb07b3":{"balance":"0x0","code_hash":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470","code":null,"nonce":0}},"storage":{"0x63091244180ae240c87d1f528f5f269134cb07b3":{"0x0":"0x0","0x1":"0x0","0x2":"0x0","0x3":"0x0","0x4":"0x0","0x5":"0x0","0x6":"0x0","0x7":"0x0","0x8":"0x0","0x9":"0x0"}},"block_hashes":{}} \ No newline at end of file From 008c9accfa35a374891b25311f83c90ab255c979 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 12:28:26 -0400 Subject: [PATCH 11/12] chore: fix test --- crates/evm/src/executor/fork/cache.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/evm/src/executor/fork/cache.rs b/crates/evm/src/executor/fork/cache.rs index bf1429589a0f4..8a5f18dc6edfa 100644 --- a/crates/evm/src/executor/fork/cache.rs +++ b/crates/evm/src/executor/fork/cache.rs @@ -479,6 +479,7 @@ mod tests { "chain_id": "0x539", "spec_id": "LATEST", "perf_all_precompiles_have_balance": false, + "disable_coinbase_tip": false, "perf_analyse_created_bytecodes": "Analyse", "limit_contract_code_size": 18446744073709551615, "memory_limit": 4294967295 From c1fc1c1f56333041de707506e5056a62d543a570 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Wed, 23 Aug 2023 13:03:05 -0400 Subject: [PATCH 12/12] chore: remove unused/unnecessary stuff --- crates/forge/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/forge/src/lib.rs b/crates/forge/src/lib.rs index 02ad086f32251..99af3a7e9841c 100644 --- a/crates/forge/src/lib.rs +++ b/crates/forge/src/lib.rs @@ -3,7 +3,7 @@ use foundry_config::{ validate_profiles, Config, FuzzConfig, InlineConfig, InlineConfigError, InlineConfigParser, InvariantConfig, NatSpec, }; -use itertools::Itertools; + use proptest::test_runner::{RngAlgorithm, TestRng, TestRunner}; use std::path::Path; @@ -68,7 +68,7 @@ impl TestOptions { InvariantConfig::validate_configs(&natspec)?; // Apply in-line configurations for the current profile - let configs: Vec = natspec.current_profile_configs().collect_vec(); + let configs: Vec = natspec.current_profile_configs().collect(); let c: &str = &natspec.contract; let f: &str = &natspec.function; let line: String = natspec.debug_context();