diff --git a/Cargo.lock b/Cargo.lock index abfef46415528..676208216ad53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.16.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4042e855163839443cba91147fb7737c4aba02df4767cb322b0e8cea5a77642c" +checksum = "ff4d88e267e4b599e944e1d32fbbfeaf4b8ea414e54da27306ede37c0798684d" dependencies = [ "alloy-consensus", "alloy-eips", @@ -334,9 +334,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.16.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c0bc6a883d3198c43c4018aa952448a303dec265439fa1c2e7c4397beeb289" +checksum = "ead219a54943c27b0bb568401cbfa6afe04398b97a76fd33b29745d0c0f35b43" dependencies = [ "alloy-consensus", "alloy-eips", @@ -4785,9 +4785,9 @@ dependencies = [ [[package]] name = "foundry-fork-db" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bdf390c3633b0eb14c6bb26a0aeb63ea0200f1350ccbe07493f23148f58c4a5" +checksum = "c27c4edfa7aa67dd25e4125d0eb12206d9bb2d5149df62e02fd90fedb79b84ca" dependencies = [ "alloy-chains", "alloy-consensus", @@ -6905,11 +6905,11 @@ dependencies = [ [[package]] name = "op-revm" -version = "8.1.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "9.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6889cdfed74c6c924a54b2357982fce232e06473c6bb73b9a0c71a9151bfabd" dependencies = [ "auto_impl", - "once_cell", "revm", "serde", ] @@ -8010,8 +8010,9 @@ dependencies = [ [[package]] name = "revm" -version = "27.1.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "28.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee5d3f7d031e90ab47c7488061bdc4875abc4e9dcea6c18f5dee09732d0436fb" dependencies = [ "revm-bytecode", "revm-context", @@ -8028,11 +8029,11 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "6.1.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "6.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d800e6c2119457ded5b0af71634eb2468040bf97de468eee5a730272a106da0" dependencies = [ "bitvec", - "once_cell", "phf", "revm-primitives", "serde", @@ -8040,9 +8041,11 @@ dependencies = [ [[package]] name = "revm-context" -version = "8.0.4" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "9.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c63485b4d1b0e67f342f9a8c0e9f78b6b5f1750863a39bdf6ceabdbaaf4aed1" dependencies = [ + "bitvec", "cfg-if", "derive-where", "revm-bytecode", @@ -8055,8 +8058,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "9.0.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "550cb8b9465e00bdb0a384922b69f864c5bcc228bed19c8ecbfa69fff2256382" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -8070,8 +8074,9 @@ dependencies = [ [[package]] name = "revm-database" -version = "7.0.2" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "7.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40000c7d917c865f6c232a78581b78e70c43f52db17282bd1b52d4f0565bc8a2" dependencies = [ "alloy-eips", "revm-bytecode", @@ -8083,8 +8088,9 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "7.0.2" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "7.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4ccea7a168cba1196b1e57dd3e22c36047208c135f600f8e58cbe7d49957dba" dependencies = [ "auto_impl", "either", @@ -8095,8 +8101,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "8.1.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "9.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cb09d07e6799823ce5a344f1604236b53fe1a92bacd7122c0b16286f92254c2" dependencies = [ "auto_impl", "derive-where", @@ -8113,8 +8120,9 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "8.1.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "9.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2770c0d7e9f4f23660dc0b8b954b7a1eee8989ec97f936ebce366c78b6d7b915" dependencies = [ "auto_impl", "either", @@ -8130,9 +8138,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aad27cab355b0aa905d0744f3222e716b40ad48b32276ac4b0a615f2c3364c97" +checksum = "3a76ba086ca57a718368e46e792a81c5eb7a30366956aa6293adbcec8b1181ce" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -8150,8 +8158,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "24.0.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "25.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c938c0d4d617c285203cad8aba1cefeec383fcff2fdf94a4469f588ab979b5" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -8161,8 +8170,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "25.0.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "26.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7bb5e8b92891c5ac9dd8dae157bd1d90aab01973ad4f99d4135d507facc3e7" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -8176,7 +8186,6 @@ dependencies = [ "cfg-if", "k256", "libsecp256k1", - "once_cell", "p256", "revm-primitives", "ripemd", @@ -8187,18 +8196,21 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "20.1.0" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa29d9da06fe03b249b6419b33968ecdf92ad6428e2f012dc57bcd619b5d94e" dependencies = [ "alloy-primitives", "num_enum", + "once_cell", "serde", ] [[package]] name = "revm-state" -version = "7.0.2" -source = "git+https://github.com/bluealloy/revm.git?rev=d9cda3a#d9cda3ad8ce75ed772072bc3b55cdf3e959e18cf" +version = "7.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d7f39ea56df3bfbb3c81c99b1f028d26f205b6004156baffbf1a4f84b46cfa" dependencies = [ "bitflags 2.9.2", "revm-bytecode", diff --git a/Cargo.toml b/Cargo.toml index 9a343d301c7c4..12888adc5ab06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -205,7 +205,7 @@ foundry-linking = { path = "crates/linking" } # solc & compilation utilities foundry-block-explorers = { version = "0.20.0", default-features = false } foundry-compilers = { version = "0.18.2", default-features = false } -foundry-fork-db = "0.16" +foundry-fork-db = "0.17" solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" } solar-ast = { version = "=0.1.5", default-features = false } solar-parse = { version = "=0.1.5", default-features = false } @@ -262,13 +262,13 @@ op-alloy-rpc-types = "0.18.13" op-alloy-flz = "0.13.1" ## revm -revm = { version = "27.1.0", default-features = false } -revm-inspectors = { version = "0.27.1", features = ["serde"] } -op-revm = { version = "8.1.0", default-features = false } +revm = { version = "28.0.0", default-features = false } +revm-inspectors = { version = "0.28.0", features = ["serde"] } +op-revm = { version = "9.0.1", default-features = false } ## alloy-evm -alloy-evm = "0.16.0" -alloy-op-evm = "0.16.0" +alloy-evm = "0.18.3" +alloy-op-evm = "0.18.3" ## cli anstream = "0.6" @@ -401,14 +401,14 @@ idna_adapter = "=1.1.0" # alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "7762adc" } ## revm -revm = { git = "https://github.com/bluealloy/revm.git", rev = "d9cda3a" } -op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "d9cda3a" } +# revm = { git = "https://github.com/bluealloy/revm.git", rev = "d9cda3a" } +# op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "d9cda3a" } # revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors.git", rev = "956bc98" } ## foundry # foundry-block-explorers = { git = "https://github.com/foundry-rs/block-explorers.git", rev = "e09cb89" } # foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "e4a9b04" } -# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "4ed9afb" } +# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "50683eb" } ## solar # solar-ast = { git = "https://github.com/paradigmxyz/solar.git", branch = "main" } diff --git a/crates/anvil/tests/it/state.rs b/crates/anvil/tests/it/state.rs index f64938bf0ae39..336a94118976f 100644 --- a/crates/anvil/tests/it/state.rs +++ b/crates/anvil/tests/it/state.rs @@ -669,11 +669,7 @@ async fn test_backward_compatibility_state_dump_deserialization_v1_2() { "gas_limit": 143385, "status": "Return", "steps": [], - "decoded": { - "label": null, - "return_data": null, - "call_data": null - } + "decoded": null }, "logs": [], "ordering": [] diff --git a/crates/cheatcodes/src/lib.rs b/crates/cheatcodes/src/lib.rs index f793c97bc017c..6676bd2337281 100644 --- a/crates/cheatcodes/src/lib.rs +++ b/crates/cheatcodes/src/lib.rs @@ -171,7 +171,7 @@ impl CheatsCtxt<'_, '_, '_, '_> { #[inline] pub(crate) fn is_precompile(&self, address: &Address) -> bool { - self.ecx.journaled_state.inner.precompiles.contains(address) + self.ecx.journaled_state.warm_addresses.precompiles().contains(address) } } diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index e5a177ee49252..2a41a6e7ce73f 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -1833,7 +1833,9 @@ impl BackendInner { journal_inner.set_spec_id(self.spec_id); journal_inner }; - journal.precompiles.extend(self.precompiles().addresses().copied()); + journal + .warm_addresses + .set_precompile_addresses(self.precompiles().addresses().copied().collect()); journal } } diff --git a/crates/evm/coverage/src/inspector.rs b/crates/evm/coverage/src/inspector.rs index a910a497ad373..a5d142080252c 100644 --- a/crates/evm/coverage/src/inspector.rs +++ b/crates/evm/coverage/src/inspector.rs @@ -89,10 +89,9 @@ impl LineCoverageCollector { /// tx) then the hash is calculated from the bytecode. #[inline] fn get_or_insert_contract_hash(interpreter: &mut Interpreter) -> B256 { - // TODO: use just `get_or_calculate_hash` interpreter .bytecode .hash() .filter(|h| !h.is_zero()) - .unwrap_or_else(|| interpreter.bytecode.regenerate_hash()) + .unwrap_or_else(|| interpreter.bytecode.get_or_calculate_hash()) } diff --git a/crates/evm/evm/src/inspectors/revert_diagnostic.rs b/crates/evm/evm/src/inspectors/revert_diagnostic.rs index 79c9b1754d511..8a5ad2f75c37e 100644 --- a/crates/evm/evm/src/inspectors/revert_diagnostic.rs +++ b/crates/evm/evm/src/inspectors/revert_diagnostic.rs @@ -208,11 +208,6 @@ where /// Handles `REVERT` and `EXTCODESIZE` opcodes for diagnostics. fn step(&mut self, interp: &mut Interpreter, ctx: &mut CTX) { - // Check if an action has already been set (which would null the instruction pointer) - if interp.bytecode.action.is_some() { - return; - } - match interp.bytecode.opcode() { opcode::REVERT => self.handle_revert(interp, ctx), opcode::EXTCODESIZE => self.handle_extcodesize(interp, ctx), diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index 63c70baacbb40..6d0b48d8ba9e1 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -652,7 +652,7 @@ impl InspectorStackRefMut<'_> { for (addr, acc_mut) in &mut state { // mark all accounts cold, besides preloaded addresses - if !journal.warm_preloaded_addresses.contains(addr) { + if journal.warm_addresses.is_cold(addr) { acc_mut.mark_cold(); } @@ -958,7 +958,7 @@ impl Inspector> for InspectorStackRefMut<'_> } // Mark accounts and storage cold before STATICCALLs CallScheme::StaticCall => { - let JournaledState { state, warm_preloaded_addresses, .. } = + let JournaledState { state, warm_addresses, .. } = &mut ecx.journaled_state.inner; for (addr, acc_mut) in state { // Do not mark accounts and storage cold accounts with arbitrary storage. @@ -968,7 +968,7 @@ impl Inspector> for InspectorStackRefMut<'_> continue; } - if !warm_preloaded_addresses.contains(addr) { + if warm_addresses.is_cold(addr) { acc_mut.mark_cold(); } diff --git a/crates/evm/traces/src/debug/mod.rs b/crates/evm/traces/src/debug/mod.rs index dba0dc0d905b4..4dda5ff720444 100644 --- a/crates/evm/traces/src/debug/mod.rs +++ b/crates/evm/traces/src/debug/mod.rs @@ -158,10 +158,10 @@ impl<'a> DebugStepsWalker<'a> { }) .unwrap_or_default(); - self.node.trace.steps[start_idx].decoded = Some(DecodedTraceStep::InternalCall( + self.node.trace.steps[start_idx].decoded = Some(Box::new(DecodedTraceStep::InternalCall( DecodedInternalCall { func_name, args: inputs, return_data: outputs }, self.current_step, - )); + ))); } fn process(&mut self) { diff --git a/crates/evm/traces/src/decoder/mod.rs b/crates/evm/traces/src/decoder/mod.rs index 8257cb86e7900..a5e569c8ff553 100644 --- a/crates/evm/traces/src/decoder/mod.rs +++ b/crates/evm/traces/src/decoder/mod.rs @@ -340,9 +340,9 @@ impl CallTraceDecoder { /// [CallTraceDecoder::decode_event] for more details. pub async fn populate_traces(&self, traces: &mut Vec) { for node in traces { - node.trace.decoded = self.decode_function(&node.trace).await; + node.trace.decoded = Some(Box::new(self.decode_function(&node.trace).await)); for log in &mut node.logs { - log.decoded = self.decode_event(&log.raw_log).await; + log.decoded = Some(Box::new(self.decode_event(&log.raw_log).await)); } if let Some(debug) = self.debug_identifier.as_ref() diff --git a/crates/evm/traces/src/folded_stack_trace.rs b/crates/evm/traces/src/folded_stack_trace.rs index 8b843b56c0efa..80ac8a8dcb620 100644 --- a/crates/evm/traces/src/folded_stack_trace.rs +++ b/crates/evm/traces/src/folded_stack_trace.rs @@ -30,17 +30,27 @@ impl EvmFoldedStackTraceBuilder { let node = &nodes[idx]; let func_name = if node.trace.kind.is_any_create() { - let contract_name = node.trace.decoded.label.as_deref().unwrap_or("Contract"); + let contract_name = node + .trace + .decoded + .as_ref() + .and_then(|dc| dc.label.as_deref()) + .unwrap_or("Contract"); format!("new {contract_name}") } else { let selector = node .selector() .map(|selector| selector.encode_hex_with_prefix()) .unwrap_or_else(|| "fallback".to_string()); - let signature = - node.trace.decoded.call_data.as_ref().map(|dc| &dc.signature).unwrap_or(&selector); + let signature = node + .trace + .decoded + .as_ref() + .and_then(|dc| dc.call_data.as_ref()) + .map(|dc| &dc.signature) + .unwrap_or(&selector); - if let Some(label) = &node.trace.decoded.label { + if let Some(label) = node.trace.decoded.as_ref().and_then(|dc| dc.label.as_ref()) { format!("{label}.{signature}") } else { signature.clone() @@ -87,7 +97,7 @@ impl EvmFoldedStackTraceBuilder { ) { let step = &steps[step_idx]; if let Some(decoded_step) = &step.decoded { - match decoded_step { + match decoded_step.as_ref() { DecodedTraceStep::InternalCall(decoded_internal_call, step_end_idx) => { let gas_used = steps[*step_end_idx].gas_used.saturating_sub(step.gas_used); self.fst.enter(decoded_internal_call.func_name.clone(), gas_used as i64); diff --git a/crates/evm/traces/src/lib.rs b/crates/evm/traces/src/lib.rs index 5417f47e90f0c..3c9de9ff08f64 100644 --- a/crates/evm/traces/src/lib.rs +++ b/crates/evm/traces/src/lib.rs @@ -109,8 +109,8 @@ impl SparsedTraceArena { // we only remove decoded internal calls if they did not start/pause tracing Some(TraceMemberOrder::Step(step_idx)) => { // If this is an internal call beginning, track it in `internal_calls` - if let Some(DecodedTraceStep::InternalCall(_, end_step_idx)) = - &nodes[node_idx].trace.steps[step_idx].decoded + if let Some(decoded) = &nodes[node_idx].trace.steps[step_idx].decoded + && let DecodedTraceStep::InternalCall(_, end_step_idx) = &**decoded { internal_calls.push((item_idx, remove, *end_step_idx)); // we decide if we should remove it later diff --git a/crates/forge/tests/cli/script.rs b/crates/forge/tests/cli/script.rs index 29f274b5190eb..b47ac71d5534c 100644 --- a/crates/forge/tests/cli/script.rs +++ b/crates/forge/tests/cli/script.rs @@ -3149,9 +3149,11 @@ forgetest_async!(call_to_non_contract_address_does_not_panic, |prj, cmd| { r#" contract Counter { uint256 public number; + function setNumber(uint256 newNumber) public { number = newNumber; } + function increment() public { number++; } @@ -3166,6 +3168,7 @@ contract Counter { &r#" import "forge-std/Script.sol"; import {Counter} from "../src/Counter.sol"; + contract CounterScript is Script { Counter public counter; function setUp() public {} @@ -3174,6 +3177,7 @@ contract CounterScript is Script { vm.startBroadcast(); counter = new Counter(); vm.stopBroadcast(); + vm.createSelectFork(""); vm.startBroadcast(); counter.increment(); diff --git a/crates/forge/tests/fixtures/SimpleContractTestVerbose.json b/crates/forge/tests/fixtures/SimpleContractTestVerbose.json index 8659312887de6..8bd3ffabd94b2 100644 --- a/crates/forge/tests/fixtures/SimpleContractTestVerbose.json +++ b/crates/forge/tests/fixtures/SimpleContractTestVerbose.json @@ -49,11 +49,7 @@ "gas_limit": "{...}", "status": "Return", "steps": [], - "decoded": { - "label": null, - "return_data": null, - "call_data": null - } + "decoded": null }, "logs": [], "ordering": [] @@ -90,11 +86,7 @@ "gas_limit": "{...}", "status": "Stop", "steps": [], - "decoded": { - "label": null, - "return_data": null, - "call_data": null - } + "decoded": null }, "logs": [], "ordering": [ @@ -130,11 +122,7 @@ "gas_limit": "{...}", "status": "Return", "steps": [], - "decoded": { - "label": null, - "return_data": null, - "call_data": null - } + "decoded": null }, "logs": [], "ordering": [] @@ -160,11 +148,7 @@ "gas_limit": "{...}", "status": "Stop", "steps": [], - "decoded": { - "label": null, - "return_data": null, - "call_data": null - } + "decoded": null }, "logs": [], "ordering": [] @@ -190,11 +174,7 @@ "gas_limit": "{...}", "status": "Stop", "steps": [], - "decoded": { - "label": null, - "return_data": null, - "call_data": null - } + "decoded": null }, "logs": [], "ordering": []