diff --git a/Cargo.lock b/Cargo.lock index cf3db4fc15ae9..56c0548a44cf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5326,9 +5326,11 @@ dependencies = [ [[package]] name = "revm" version = "3.3.0" -source = "git+https://github.com/bluealloy/revm/?rev=14787244394c46e49ca59e32d7de1ebc95e66892#14787244394c46e49ca59e32d7de1ebc95e66892" +source = "git+https://github.com/bluealloy/revm/?rev=bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab#bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab" dependencies = [ "auto_impl", + "once_cell", + "rayon", "revm-interpreter", "revm-precompile", "serde", @@ -5338,7 +5340,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?rev=14787244394c46e49ca59e32d7de1ebc95e66892#14787244394c46e49ca59e32d7de1ebc95e66892" +source = "git+https://github.com/bluealloy/revm/?rev=bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab#bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab" dependencies = [ "derive_more", "enumn", @@ -5350,7 +5352,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.3" -source = "git+https://github.com/bluealloy/revm/?rev=14787244394c46e49ca59e32d7de1ebc95e66892#14787244394c46e49ca59e32d7de1ebc95e66892" +source = "git+https://github.com/bluealloy/revm/?rev=bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab#bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab" dependencies = [ "k256", "num", @@ -5366,7 +5368,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.1.2" -source = "git+https://github.com/bluealloy/revm/?rev=14787244394c46e49ca59e32d7de1ebc95e66892#14787244394c46e49ca59e32d7de1ebc95e66892" +source = "git+https://github.com/bluealloy/revm/?rev=bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab#bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab" dependencies = [ "auto_impl", "bitflags 2.3.3", @@ -5383,6 +5385,7 @@ dependencies = [ "ruint", "serde", "sha3", + "to-binary", ] [[package]] @@ -6611,6 +6614,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "to-binary" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4424552bc848fd1afbcd81f0e8a54b7401b90fd81bb418655ad6dc6d0823bbe3" +dependencies = [ + "hex", +] + [[package]] name = "tokio" version = "1.30.0" diff --git a/Cargo.toml b/Cargo.toml index 89622ba512f69..ca461e348805d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -134,4 +134,4 @@ solang-parser = "=0.3.1" #ethers-solc = { path = "../ethers-rs/ethers-solc" } [patch.crates-io] -revm = { git = "https://github.com/bluealloy/revm/", rev = "14787244394c46e49ca59e32d7de1ebc95e66892" } +revm = { git = "https://github.com/bluealloy/revm/", rev = "bc4d203bf0b5f5c01868477c8e98d3abd6bb92ab" } diff --git a/anvil/src/genesis.rs b/anvil/src/genesis.rs index d455f9e35b5ac..6e96783be2f65 100644 --- a/anvil/src/genesis.rs +++ b/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/evm/src/executor/fork/cache.rs b/evm/src/executor/fork/cache.rs index eacf8b2c63994..5553bded9d160 100644 --- a/evm/src/executor/fork/cache.rs +++ b/evm/src/executor/fork/cache.rs @@ -256,8 +256,12 @@ impl MemDb { 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() { diff --git a/evm/src/executor/inspector/coverage.rs b/evm/src/executor/inspector/coverage.rs index 5da786035706c..9d1f29e4eb69a 100644 --- a/evm/src/executor/inspector/coverage.rs +++ b/evm/src/executor/inspector/coverage.rs @@ -23,7 +23,8 @@ where interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, ) -> InstructionResult { - self.maps.entry(b256_to_h256(interpreter.contract.bytecode.hash())).or_insert_with(|| { + let hash = b256_to_h256(interpreter.contract.bytecode.clone().unlock().hash_slow()); + self.maps.entry(hash).or_insert_with(|| { HitMap::new(Bytes::copy_from_slice( interpreter.contract.bytecode.original_bytecode_slice(), )) @@ -37,9 +38,8 @@ where interpreter: &mut Interpreter, _: &mut EVMData<'_, DB>, ) -> InstructionResult { - self.maps - .entry(b256_to_h256(interpreter.contract.bytecode.hash())) - .and_modify(|map| map.hit(interpreter.program_counter())); + let hash = b256_to_h256(interpreter.contract.bytecode.clone().unlock().hash_slow()); + self.maps.entry(hash).and_modify(|map| map.hit(interpreter.program_counter())); InstructionResult::Continue } diff --git a/evm/src/fuzz/strategies/param.rs b/evm/src/fuzz/strategies/param.rs index aae40a42cc24a..f251466971418 100644 --- a/evm/src/fuzz/strategies/param.rs +++ b/evm/src/fuzz/strategies/param.rs @@ -133,7 +133,7 @@ mod tests { let f = "function testArray(uint64[2] calldata values)"; let func = HumanReadableParser::parse_function(f).unwrap(); - let db = CacheDB::new(EmptyDB()); + let db = CacheDB::new(EmptyDB::default()); let state = build_initial_state(&db, &FuzzDictionaryConfig::default()); let strat = proptest::strategy::Union::new_weighted(vec![