From 8768a79da146c24b282500767d255cc7b631bf78 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 11:57:29 +0100 Subject: [PATCH 1/7] initial changes, some breaking ones to resolve --- Cargo.lock | 206 ++++++++++++------ Cargo.toml | 12 +- crates/anvil/src/eth/backend/mem/inspector.rs | 4 +- crates/anvil/src/evm.rs | 1 + crates/anvil/tests/it/fork.rs | 1 + crates/cheatcodes/src/inspector.rs | 16 +- crates/evm/core/src/evm.rs | 4 + crates/evm/evm/src/inspectors/logs.rs | 4 +- crates/evm/evm/src/inspectors/stack.rs | 10 +- crates/evm/networks/src/celo/transfer.rs | 19 +- 10 files changed, 189 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b25c090ef51c7..6e5256db67eb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,8 +251,7 @@ dependencies = [ [[package]] name = "alloy-evm" version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6223235f0b785a83dd10dc1599b7f3763c65e4f98b4e9e4e10e576bbbdf7dfa2" +source = "git+https://github.com/alloy-rs/evm.git?rev=237d0a0#237d0a06915de43c500094015c23a9e90456ec76" dependencies = [ "alloy-consensus", "alloy-eips", @@ -264,8 +263,7 @@ dependencies = [ "alloy-sol-types", "auto_impl", "derive_more", - "op-alloy-consensus", - "op-alloy-rpc-types-engine", + "op-alloy", "op-revm", "revm", "thiserror 2.0.17", @@ -366,8 +364,7 @@ dependencies = [ [[package]] name = "alloy-op-evm" version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad8f3a679eb44ee21481edabd628d191c9a42d182ed29923b4d43a27a0f2cc8" +source = "git+https://github.com/alloy-rs/evm.git?rev=237d0a0#237d0a06915de43c500094015c23a9e90456ec76" dependencies = [ "alloy-consensus", "alloy-eips", @@ -375,7 +372,7 @@ dependencies = [ "alloy-op-hardforks", "alloy-primitives", "auto_impl", - "op-alloy-consensus", + "op-alloy", "op-revm", "revm", "thiserror 2.0.17", @@ -1826,9 +1823,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.91.0" +version = "1.92.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f8090151d4d1e971269957b10dbf287bba551ab812e591ce0516b1c73b75d27" +checksum = "a0c7808adcff8333eaa76a849e6de926c6ac1a1268b9fd6afe32de9c29ef29d2" dependencies = [ "aws-credential-types", "aws-runtime", @@ -4274,7 +4271,7 @@ dependencies = [ "foundry-wallets", "futures", "globset", - "indicatif 0.18.2", + "indicatif 0.18.3", "inferno", "itertools 0.14.0", "mockall", @@ -4394,7 +4391,7 @@ dependencies = [ "foundry-linking", "foundry-wallets", "futures", - "indicatif 0.18.2", + "indicatif 0.18.3", "itertools 0.14.0", "parking_lot", "revm-inspectors", @@ -4608,7 +4605,7 @@ dependencies = [ "foundry-evm", "foundry-wallets", "futures", - "indicatif 0.18.2", + "indicatif 0.18.3", "itertools 0.14.0", "mimalloc", "path-slash", @@ -4707,9 +4704,9 @@ dependencies = [ [[package]] name = "foundry-compilers" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5767bfd01a240b57e6eb540e233b248d2ecb554d60b7936574cd077c0bd4c15e" +checksum = "ea2b71f446c308daa68016cd51397eeeacec940a88985ac5c97cd848a90a7120" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -4739,9 +4736,9 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b35da40bb333baff6f4533431c050a94857a4d1a379365085da403938fc9edf" +checksum = "c1917c800c1bfa634f4cdb1d9fc5ab2b178e301986d59d42cc0912ff5b8eeaa4" dependencies = [ "foundry-compilers-artifacts-solc", "foundry-compilers-artifacts-vyper", @@ -4749,9 +4746,9 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-solc" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff50fa9f518e96f80c77d1596122bb41c6fb9f1ec8d93e3127e2cf7a4726faa" +checksum = "93771b9ec1b582c66de791a7505062815a921f120918bf34a066a6000c9aee81" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -4770,9 +4767,9 @@ dependencies = [ [[package]] name = "foundry-compilers-artifacts-vyper" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34764d842fcf3aee77dc892beba3f12d7d5cebe196caf2050302caa986de8914" +checksum = "be462f9144604965e42c7afcf2e04d0dc5aca1b51a133fe72cd3feaf3cd81579" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -4785,9 +4782,9 @@ dependencies = [ [[package]] name = "foundry-compilers-core" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48bcd9ff6881e2f5acd8544d490cc91d2c1d47c59c1e9337ea2ade66ce7e1800" +checksum = "8afc3767284e674e270ba31b94befa7faf976c100b3489e5c79f4a32d87a84a4" dependencies = [ "alloy-primitives", "cfg-if", @@ -4885,7 +4882,7 @@ dependencies = [ "foundry-evm-fuzz", "foundry-evm-networks", "foundry-evm-traces", - "indicatif 0.18.2", + "indicatif 0.18.3", "parking_lot", "proptest", "revm", @@ -5037,8 +5034,7 @@ dependencies = [ [[package]] name = "foundry-fork-db" version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e22c563793782d2b3ca99bac6de70cd2a98be8c9f575590ef3605da47b4deb" +source = "git+https://github.com/foundry-rs/foundry-fork-db?rev=b4299fc#b4299fc18155dee70b3a5247840b3cda8d309cae" dependencies = [ "alloy-chains", "alloy-consensus", @@ -5692,9 +5688,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3aa54a13a0dfe7fbe3a59e0c76093041720fdc77b110cc0fc260fafb4dc51e" +checksum = "1744436df46f0bde35af3eda22aeaba453aada65d8f1c171cd8a5f59030bd69f" dependencies = [ "atomic-waker", "bytes", @@ -6007,9 +6003,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade6dfcba0dfb62ad59e59e7241ec8912af34fd29e0e743e3db992bd278e8b65" +checksum = "9375e112e4b463ec1b1c6c011953545c65a30164fbab5b581df32b3abf0dcb88" dependencies = [ "console 0.16.1", "portable-atomic", @@ -6364,7 +6360,7 @@ dependencies = [ "regex", "regex-syntax", "sha3", - "string_cache", + "string_cache 0.8.9", "term", "unicode-xid", "walkdir", @@ -7115,11 +7111,24 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "op-alloy" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5da980f0756a505bf7f2ab9f0be886c8b3213b9c23a19fff6c1c6afa53803c3a" +dependencies = [ + "op-alloy-consensus", + "op-alloy-network", + "op-alloy-provider", + "op-alloy-rpc-types", + "op-alloy-rpc-types-engine", +] + [[package]] name = "op-alloy-consensus" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42e9de945efe3c2fbd207e69720c9c1af2b8caa6872aee0e216450c25a3ca70" +checksum = "a0d7ec388eb83a3e6c71774131dbbb2ba9c199b6acac7dce172ed8de2f819e91" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7139,11 +7148,42 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a79f352fc3893dcd670172e615afef993a41798a1d3fc0db88a3e60ef2e70ecc" +[[package]] +name = "op-alloy-network" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "979fe768bbb571d1d0bd7f84bc35124243b4db17f944b94698872a4701e743a0" +dependencies = [ + "alloy-consensus", + "alloy-network", + "alloy-primitives", + "alloy-provider", + "alloy-rpc-types-eth", + "alloy-signer", + "op-alloy-consensus", + "op-alloy-rpc-types", +] + +[[package]] +name = "op-alloy-provider" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0594687a750dff379f16219c7441bfa8979f11aeda440981e32e65a9e28c3c6" +dependencies = [ + "alloy-network", + "alloy-primitives", + "alloy-provider", + "alloy-rpc-types-engine", + "alloy-transport", + "async-trait", + "op-alloy-rpc-types-engine", +] + [[package]] name = "op-alloy-rpc-types" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd1eb7bddd2232856ba9d259320a094f9edf2b9061acfe5966e7960208393e6" +checksum = "cc252b5fa74dbd33aa2f9a40e5ff9cfe34ed2af9b9b235781bc7cc8ec7d6aca8" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7160,28 +7200,30 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5429622150d18d8e6847a701135082622413e2451b64d03f979415d764566bef" +checksum = "c1abe694cd6718b8932da3f824f46778be0f43289e4103c88abc505c63533a04" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", + "alloy-serde", "derive_more", "ethereum_ssz", "ethereum_ssz_derive", "op-alloy-consensus", + "serde", "snap", "thiserror 2.0.17", ] [[package]] name = "op-revm" -version = "12.0.2" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31622d03b29c826e48800f4c8f389c8a9c440eb796a3e35203561a288f12985" +checksum = "f887a8353e22df6ce5b150e4d3a51838bc6a64d4644c5f7416bef70f442c2857" dependencies = [ "auto_impl", "revm", @@ -7480,6 +7522,16 @@ dependencies = [ "phf_shared 0.11.3", ] +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", +] + [[package]] name = "phf_generator" version = "0.11.3" @@ -7962,14 +8014,14 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-junit" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed1a693391a16317257103ad06a88c6529ac640846021da7c435a06fffdacd7" +checksum = "6ee9342d671fae8d66b3ae9fd7a9714dfd089c04d2a8b1ec0436ef77aee15e5f" dependencies = [ "chrono", "indexmap 2.12.0", "newtype-uuid", - "quick-xml 0.37.5", + "quick-xml 0.38.4", "strip-ansi-escapes", "thiserror 2.0.17", "uuid 1.18.1", @@ -7993,6 +8045,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "quick-xml" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" +dependencies = [ + "memchr", +] + [[package]] name = "quinn" version = "0.11.9" @@ -8332,9 +8393,9 @@ dependencies = [ [[package]] name = "revm" -version = "31.0.2" +version = "33.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb67a5223602113cae59a305acde2d9936bc18f2478dda879a6124b267cebfb6" +checksum = "151be0bca9fd5ebfbbbc02af9f75f1e1610f71c750eea71b4d91fe7b65362c61" dependencies = [ "revm-bytecode", "revm-context", @@ -8363,9 +8424,9 @@ dependencies = [ [[package]] name = "revm-context" -version = "11.0.2" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92850e150f4f99d46c05a20ad0cd09286a7ad4ee21866fffb87101de6e602231" +checksum = "e4e6ab8619ee12fdcd34ee8e932364153340b744c75e2fdaebbc8f76308b0826" dependencies = [ "bitvec", "cfg-if", @@ -8380,9 +8441,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "12.0.1" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d701e2c2347d65216b066489ab22a0a8e1f7b2568256110d73a7d5eff3385c" +checksum = "1d8fb70266f324e266fe5d75cfd9b1c0f5d4556c756a8ee50ddb329347fd695c" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -8423,9 +8484,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "12.0.2" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45418ed95cfdf0cb19effdbb7633cf2144cab7fb0e6ffd6b0eb9117a50adff6" +checksum = "fa52757cd0287eac51864aa9a6a583a327d29a0d08b3c91b7f91157f229cd28a" dependencies = [ "auto_impl", "derive-where", @@ -8442,9 +8503,9 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "12.0.2" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c99801eac7da06cc112df2244bd5a64024f4ef21240e923b26e73c4b4a0e5da6" +checksum = "6421be68d5f649faf26b9684d7e0339568695096ae2faaf789a56b12cfea3fcf" dependencies = [ "auto_impl", "either", @@ -8461,8 +8522,7 @@ dependencies = [ [[package]] name = "revm-inspectors" version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21caa99f22184a6818946362778cccd3ff02f743c1e085bee87700671570ecb7" +source = "git+https://github.com/zerosnacks/revm-inspectors.git?rev=0aaab71#0aaab71572fa0074e3193464889b5aadbfb4f68b" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -8480,9 +8540,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "29.0.1" +version = "31.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22789ce92c5808c70185e3bc49732f987dc6fd907f77828c8d3470b2299c9c65" +checksum = "8201c0fbd91334a8d4d0aae955f8d4534a118d55855ed9b03aec8f83fb62561e" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -8493,9 +8553,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "29.0.1" +version = "31.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968b124028960201abf6d6bf8e223f15fadebb4307df6b7dc9244a0aab5d2d05" +checksum = "9a62958af953cc4043e93b5be9b8497df84cc3bd612b865c49a7a7dfa26a84e2" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -9726,17 +9786,29 @@ dependencies = [ "parking_lot", "phf_shared 0.11.3", "precomputed-hash", +] + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.13.1", + "precomputed-hash", "serde", ] [[package]] name = "string_cache_codegen" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" dependencies = [ - "phf_generator 0.11.3", - "phf_shared 0.11.3", + "phf_generator 0.13.1", + "phf_shared 0.13.1", "proc-macro2", "quote", ] @@ -10053,7 +10125,7 @@ dependencies = [ "fnv", "nom", "phf 0.11.3", - "phf_codegen", + "phf_codegen 0.11.3", ] [[package]] @@ -11246,13 +11318,13 @@ dependencies = [ [[package]] name = "web_atoms" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ffde1dc01240bdf9992e3205668b235e59421fd085e8a317ed98da0178d414" +checksum = "44b72896d90cfd22c495d0ee4960d3dd20ca64180895cb92cd5342ff7482a579" dependencies = [ - "phf 0.11.3", - "phf_codegen", - "string_cache", + "phf 0.13.1", + "phf_codegen 0.13.1", + "string_cache 0.9.0", "string_cache_codegen", ] diff --git a/Cargo.toml b/Cargo.toml index 16c8d8e4aa8e6..9f637ebad496c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -290,9 +290,9 @@ alloy-evm = "0.23.2" alloy-op-evm = "0.23.2" # revm -revm = { version = "31.0.0", default-features = false } +revm = { version = "33.0.0", default-features = false } revm-inspectors = { version = "0.32.0", features = ["serde"] } -op-revm = { version = "12.0.0", default-features = false } +op-revm = { version = "14.0.0", default-features = false } ## cli anstream = "0.6" @@ -437,18 +437,18 @@ rexpect = { git = "https://github.com/rust-cli/rexpect", rev = "2ed0b1898d7edaf6 # alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "7fab7ee" } ## alloy-evm -# alloy-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "085ad53" } -# alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "085ad53" } +alloy-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } +alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } ## revm # 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/zerosnacks/revm-inspectors.git", rev = "340d37e" } +revm-inspectors = { git = "https://github.com/zerosnacks/revm-inspectors.git", rev = "0aaab71" } ## foundry # foundry-block-explorers = { git = "https://github.com/foundry-rs/block-explorers.git", rev = "f5b46b2" } # foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", branch = "main" } -# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "be95912" } +foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "b4299fc" } # solar solar = { package = "solar-compiler", git = "https://github.com/paradigmxyz/solar.git", rev = "0bea5f0" } diff --git a/crates/anvil/src/eth/backend/mem/inspector.rs b/crates/anvil/src/eth/backend/mem/inspector.rs index ce101add14291..a04849bdad534 100644 --- a/crates/anvil/src/eth/backend/mem/inspector.rs +++ b/crates/anvil/src/eth/backend/mem/inspector.rs @@ -139,9 +139,9 @@ where } #[allow(clippy::redundant_clone)] - fn log(&mut self, interp: &mut Interpreter, ecx: &mut CTX, log: Log) { + fn log_full(&mut self, interp: &mut Interpreter, ecx: &mut CTX, log: Log) { call_inspectors!([&mut self.tracer, &mut self.log_collector], |inspector| { - inspector.log(interp, ecx, log.clone()); + inspector.log_full(interp, ecx, log.clone()); }); } diff --git a/crates/anvil/src/evm.rs b/crates/anvil/src/evm.rs index b665c1b46fac6..295a3ef0d1fe2 100644 --- a/crates/anvil/src/evm.rs +++ b/crates/anvil/src/evm.rs @@ -58,6 +58,7 @@ mod tests { Ok(PrecompileOutput { bytes: Bytes::copy_from_slice(input.data), gas_used: 0, + gas_refunded: 0, reverted: false, }) }), diff --git a/crates/anvil/tests/it/fork.rs b/crates/anvil/tests/it/fork.rs index ab0e791360ad1..d5df1ca93382a 100644 --- a/crates/anvil/tests/it/fork.rs +++ b/crates/anvil/tests/it/fork.rs @@ -1878,6 +1878,7 @@ async fn test_config_with_osaka_hardfork_with_precompile_factory() { Ok(revm::precompile::PrecompileOutput { bytes: Bytes::copy_from_slice(input.data), gas_used: 0, + gas_refunded: 0, reverted: false, }) }, diff --git a/crates/cheatcodes/src/inspector.rs b/crates/cheatcodes/src/inspector.rs index 6a80384ed83fc..98c09fa9a12d0 100644 --- a/crates/cheatcodes/src/inspector.rs +++ b/crates/cheatcodes/src/inspector.rs @@ -723,6 +723,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } }; @@ -741,6 +743,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }), Err(err) => Some(CallOutcome { result: InterpreterResult { @@ -749,6 +753,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }), }; } @@ -812,6 +818,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } } @@ -888,6 +896,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } @@ -920,6 +930,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } tx_req.set_blob_sidecar(blob_sidecar); @@ -961,6 +973,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } } @@ -1175,7 +1189,7 @@ impl Inspector> for Cheatcodes { } } - fn log(&mut self, interpreter: &mut Interpreter, _ecx: Ecx, log: Log) { + fn log_full(&mut self, interpreter: &mut Interpreter, _ecx: Ecx, log: Log) { if !self.expected_emits.is_empty() { expect::handle_expect_emit(self, &log, interpreter); } diff --git a/crates/evm/core/src/evm.rs b/crates/evm/core/src/evm.rs index 081689225fb73..379b1ba1f8414 100644 --- a/crates/evm/core/src/evm.rs +++ b/crates/evm/core/src/evm.rs @@ -315,6 +315,8 @@ impl<'db, I: InspectorExt> FoundryHandler<'db, I> { gas: Gas::new(gas_limit), }, memory_offset: 0..0, + was_precompile_called: false, + precompile_call_logs: vec![], }))); } else if code_hash != DEFAULT_CREATE2_DEPLOYER_CODEHASH { return Ok(Some(FrameResult::Call(CallOutcome { @@ -324,6 +326,8 @@ impl<'db, I: InspectorExt> FoundryHandler<'db, I> { gas: Gas::new(gas_limit), }, memory_offset: 0..0, + was_precompile_called: false, + precompile_call_logs: vec![], }))); } diff --git a/crates/evm/evm/src/inspectors/logs.rs b/crates/evm/evm/src/inspectors/logs.rs index 4b7bee7ce11a7..cd98c8e66017e 100644 --- a/crates/evm/evm/src/inspectors/logs.rs +++ b/crates/evm/evm/src/inspectors/logs.rs @@ -32,6 +32,8 @@ impl LogCollector { return Some(CallOutcome { result: InterpreterResult { result, output, gas: Gas::new(inputs.gas_limit) }, memory_offset: inputs.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } None @@ -48,7 +50,7 @@ impl Inspector for LogCollector where CTX: ContextTr, { - fn log(&mut self, _interp: &mut Interpreter, _context: &mut CTX, log: Log) { + fn log_full(&mut self, _interp: &mut Interpreter, _context: &mut CTX, log: Log) { self.logs.push(log); } diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index 4374ed7ba7702..e98605a42dab6 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -909,7 +909,7 @@ impl Inspector> for InspectorStackRefMut<'_> } #[allow(clippy::redundant_clone)] - fn log( + fn log_full( &mut self, interpreter: &mut Interpreter, ecx: &mut EthEvmContext<&mut dyn DatabaseExt>, @@ -917,7 +917,7 @@ impl Inspector> for InspectorStackRefMut<'_> ) { call_inspectors!( [&mut self.tracer, &mut self.log_collector, &mut self.cheatcodes, &mut self.printer], - |inspector| inspector.log(interpreter, ecx, log.clone()), + |inspector| inspector.log_full(interpreter, ecx, log.clone()), ); } @@ -987,6 +987,8 @@ impl Inspector> for InspectorStackRefMut<'_> return Some(CallOutcome { result, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } // Mark accounts and storage cold before STATICCALLs @@ -1193,13 +1195,13 @@ impl Inspector> for InspectorStack { self.as_mut().initialize_interp(interpreter, ecx) } - fn log( + fn log_full( &mut self, interpreter: &mut Interpreter, ecx: &mut EthEvmContext<&mut dyn DatabaseExt>, log: Log, ) { - self.as_mut().log(interpreter, ecx, log) + self.as_mut().log_full(interpreter, ecx, log) } fn selfdestruct(&mut self, contract: Address, target: Address, value: U256) { diff --git a/crates/evm/networks/src/celo/transfer.rs b/crates/evm/networks/src/celo/transfer.rs index a4c86c2d7ebe7..24b204f2f4c93 100644 --- a/crates/evm/networks/src/celo/transfer.rs +++ b/crates/evm/networks/src/celo/transfer.rs @@ -46,10 +46,13 @@ pub fn celo_transfer_precompile(mut input: PrecompileInput<'_>) -> PrecompileRes // Validate input length (must be exactly 96 bytes: 32 + 32 + 32) if input.data.len() != 96 { - return Err(PrecompileError::Other(format!( - "Invalid input length for Celo transfer precompile: expected 96 bytes, got {}", - input.data.len() - ))); + return Err(PrecompileError::Other( + format!( + "Invalid input length for Celo transfer precompile: expected 96 bytes, got {}", + input.data.len() + ) + .into(), + )); } // Parse input: from (bytes 12-32), to (bytes 44-64), value (bytes 64-96) @@ -69,7 +72,9 @@ pub fn celo_transfer_precompile(mut input: PrecompileInput<'_>) -> PrecompileRes let from_account = match internals.load_account(from_address) { Ok(account) => account, Err(e) => { - return Err(PrecompileError::Other(format!("Failed to load from account: {e:?}"))); + return Err(PrecompileError::Other( + format!("Failed to load from account: {e:?}").into(), + )); } }; @@ -81,7 +86,7 @@ pub fn celo_transfer_precompile(mut input: PrecompileInput<'_>) -> PrecompileRes let to_account = match internals.load_account(to_address) { Ok(account) => account, Err(e) => { - return Err(PrecompileError::Other(format!("Failed to load to account: {e:?}"))); + return Err(PrecompileError::Other(format!("Failed to load to account: {e:?}").into())); } }; @@ -93,7 +98,7 @@ pub fn celo_transfer_precompile(mut input: PrecompileInput<'_>) -> PrecompileRes // Transfer the value between accounts internals .transfer(from_address, to_address, value) - .map_err(|e| PrecompileError::Other(format!("Failed to perform transfer: {e:?}")))?; + .map_err(|e| PrecompileError::Other(format!("Failed to perform transfer: {e:?}").into()))?; // No output data for successful transfer Ok(PrecompileOutput::new(CELO_TRANSFER_GAS_COST, alloy_primitives::Bytes::new())) From 1cf001d58dcf6625cc06ee3e3118f7db3b565b23 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 12:44:06 +0100 Subject: [PATCH 2/7] fix breaking changes --- crates/cheatcodes/src/evm.rs | 32 +++++++++++----- crates/cheatcodes/src/inspector.rs | 59 +++++++++++++++++++----------- 2 files changed, 59 insertions(+), 32 deletions(-) diff --git a/crates/cheatcodes/src/evm.rs b/crates/cheatcodes/src/evm.rs index e930c104809c3..bb7283a6b2861 100644 --- a/crates/cheatcodes/src/evm.rs +++ b/crates/cheatcodes/src/evm.rs @@ -256,8 +256,12 @@ impl Cheatcode for loadCall { fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { let Self { target, slot } = *self; ccx.ensure_not_precompile(&target)?; - ccx.ecx.journaled_state.load_account(target)?; - let mut val = ccx.ecx.journaled_state.sload(target, slot.into())?; + + let (db, journal, _) = ccx.ecx.as_db_env_and_journal(); + journal.load_account(db, target)?; + let mut val = journal + .sload(db, target, slot.into(), false) + .map_err(|e| fmt_err!("failed to load storage slot: {:?}", e))?; if val.is_cold && val.data.is_zero() { if ccx.state.has_arbitrary_storage(&target) { @@ -611,10 +615,11 @@ impl Cheatcode for etchCall { fn apply_stateful(&self, ccx: &mut CheatsCtxt) -> Result { let Self { target, newRuntimeBytecode } = self; ccx.ensure_not_precompile(target)?; - ccx.ecx.journaled_state.load_account(*target)?; + let (db, journal, _) = ccx.ecx.as_db_env_and_journal(); + journal.load_account(db, *target)?; let bytecode = Bytecode::new_raw_checked(newRuntimeBytecode.clone()) .map_err(|e| fmt_err!("failed to create bytecode: {e}"))?; - ccx.ecx.journaled_state.set_code(*target, bytecode); + journal.set_code(*target, bytecode); Ok(Default::default()) } } @@ -664,7 +669,10 @@ impl Cheatcode for storeCall { let Self { target, slot, value } = *self; ccx.ensure_not_precompile(&target)?; ensure_loaded_account(ccx.ecx, target)?; - ccx.ecx.journaled_state.sstore(target, slot.into(), value.into())?; + let (db, journal, _) = ccx.ecx.as_db_env_and_journal(); + journal + .sstore(db, target, slot.into(), value.into(), false) + .map_err(|e| fmt_err!("failed to store storage slot: {:?}", e))?; Ok(Default::default()) } } @@ -970,7 +978,8 @@ impl Cheatcode for getStorageSlotsCall { if storage_type.encoding == ENCODING_BYTES { // Try to check if it's a long bytes/string by reading the current storage // value - if let Ok(value) = ccx.ecx.journaled_state.sload(*target, slot) { + let (db, journal, _) = ccx.ecx.as_db_env_and_journal(); + if let Ok(value) = journal.sload(db, *target, slot, false) { let value_bytes = value.data.to_be_bytes::<32>(); let length_byte = value_bytes[31]; // Check if it's a long bytes/string (LSB is 1) @@ -1124,7 +1133,8 @@ impl Cheatcode for getEvmVersionCall { } pub(super) fn get_nonce(ccx: &mut CheatsCtxt, address: &Address) -> Result { - let account = ccx.ecx.journaled_state.load_account(*address)?; + let (db, journal, _) = ccx.ecx.as_db_env_and_journal(); + let account = journal.load_account(db, *address)?; Ok(account.info.nonce.abi_encode()) } @@ -1345,8 +1355,9 @@ pub(super) fn journaled_account<'a>( } pub(super) fn ensure_loaded_account(ecx: Ecx, addr: Address) -> Result<()> { - ecx.journaled_state.load_account(addr)?; - ecx.journaled_state.touch(addr); + let (db, journal, _) = ecx.as_db_env_and_journal(); + journal.load_account(db, addr)?; + journal.touch(addr); Ok(()) } @@ -1573,7 +1584,8 @@ fn get_contract_data<'a>( let artifacts = ccx.state.config.available_artifacts.as_ref()?; // Try to load the account and get its code - let account = ccx.ecx.journaled_state.load_account(address).ok()?; + let (db, journal, _) = ccx.ecx.as_db_env_and_journal(); + let account = journal.load_account(db, address).ok()?; let code = account.info.code.as_ref()?; // Skip if code is empty diff --git a/crates/cheatcodes/src/inspector.rs b/crates/cheatcodes/src/inspector.rs index 98c09fa9a12d0..0d0db63ebc383 100644 --- a/crates/cheatcodes/src/inspector.rs +++ b/crates/cheatcodes/src/inspector.rs @@ -37,7 +37,7 @@ use foundry_common::{ mapping_slots::{MappingSlots, step as mapping_step}, }; use foundry_evm_core::{ - Breakpoints, InspectorExt, + Breakpoints, ContextExt, InspectorExt, abi::Vm::stopExpectSafeMemoryCall, backend::{DatabaseError, DatabaseExt, RevertDiagnostic}, constants::{CHEATCODE_ADDRESS, HARDHAT_CONSOLE_ADDRESS, MAGIC_ASSUME}, @@ -316,9 +316,10 @@ impl ArbitraryStorage { /// - update account's storage with given value. pub fn save(&mut self, ecx: Ecx, address: Address, slot: U256, data: U256) { self.values.get_mut(&address).expect("missing arbitrary address entry").insert(slot, data); - if ecx.journaled_state.load_account(address).is_ok() { - ecx.journaled_state - .sstore(address, slot, data) + let (db, journal, _) = ecx.as_db_env_and_journal(); + if journal.load_account(db, address).is_ok() { + journal + .sstore(db, address, slot, data, false) .expect("could not set arbitrary storage value"); } } @@ -336,17 +337,19 @@ impl ArbitraryStorage { None => { storage_cache.insert(slot, new_value); // Update source storage with new value. - if ecx.journaled_state.load_account(*source).is_ok() { - ecx.journaled_state - .sstore(*source, slot, new_value) + let (db, journal, _) = ecx.as_db_env_and_journal(); + if journal.load_account(db, *source).is_ok() { + journal + .sstore(db, *source, slot, new_value, false) .expect("could not copy arbitrary storage value"); } new_value } }; // Update target storage with new value. - if ecx.journaled_state.load_account(target).is_ok() { - ecx.journaled_state.sstore(target, slot, value).expect("could not set storage"); + let (db, journal, _) = ecx.as_db_env_and_journal(); + if journal.load_account(db, target).is_ok() { + journal.sstore(db, target, slot, value, false).expect("could not set storage"); } value } @@ -888,7 +891,8 @@ impl Cheatcodes { // into 1559, in the cli package, relatively easily once we // know the target chain supports EIP-1559. if !call.is_static { - if let Err(err) = ecx.journaled_state.load_account(broadcast.new_origin) { + let (db, journal, _) = ecx.as_db_env_and_journal(); + if let Err(err) = journal.load_account(db, broadcast.new_origin) { return Some(CallOutcome { result: InterpreterResult { result: InstructionResult::Revert, @@ -987,7 +991,9 @@ impl Cheatcodes { let initialized; let old_balance; let old_nonce; - if let Ok(acc) = ecx.journaled_state.load_account(call.target_address) { + + let (db, journal, _) = ecx.as_db_env_and_journal(); + if let Ok(acc) = journal.load_account(db, call.target_address) { initialized = acc.info.exists(); old_balance = acc.info.balance; old_nonce = acc.info.nonce; @@ -996,12 +1002,14 @@ impl Cheatcodes { old_balance = U256::ZERO; old_nonce = 0; } + let kind = match call.scheme { CallScheme::Call => crate::Vm::AccountAccessKind::Call, CallScheme::CallCode => crate::Vm::AccountAccessKind::CallCode, CallScheme::DelegateCall => crate::Vm::AccountAccessKind::DelegateCall, CallScheme::StaticCall => crate::Vm::AccountAccessKind::StaticCall, }; + // Record this call by pushing it to a new pending vector; all subsequent calls at // that depth will be pushed to the same vector. When the call ends, the // RecordedAccountAccess (and all subsequent RecordedAccountAccesses) will be @@ -1387,9 +1395,10 @@ impl Inspector> for Cheatcodes { // changes. Depending on the depth the cheat was // called at, there may not be any pending // calls to update if execution has percolated up to a higher depth. - let curr_depth = ecx.journaled_state.depth(); + let (db, journal, _) = ecx.as_db_env_and_journal(); + let curr_depth = journal.depth; if call_access.depth == curr_depth as u64 - && let Ok(acc) = ecx.journaled_state.load_account(call.target_address) + && let Ok(acc) = journal.load_account(db, call.target_address) { debug_assert!(access_is_call(call_access.kind)); call_access.newBalance = acc.info.balance; @@ -1670,7 +1679,8 @@ impl Inspector> for Cheatcodes { && curr_depth >= broadcast.depth && input.caller() == broadcast.original_caller { - if let Err(err) = ecx.journaled_state.load_account(broadcast.new_origin) { + let (db, journal, _) = ecx.as_db_env_and_journal(); + if let Err(err) = journal.load_account(db, broadcast.new_origin) { return Some(CreateOutcome { result: InterpreterResult { result: InstructionResult::Revert, @@ -1827,8 +1837,9 @@ impl Inspector> for Cheatcodes { create_access.kind as u8, crate::Vm::AccountAccessKind::Create as u8 ); + let (db, journal, _) = ecx.as_db_env_and_journal(); if let Some(address) = outcome.address - && let Ok(created_acc) = ecx.journaled_state.load_account(address) + && let Ok(created_acc) = journal.load_account(db, address) { create_access.newBalance = created_acc.info.balance; create_access.newNonce = created_acc.info.nonce; @@ -1850,9 +1861,10 @@ impl Inspector> for Cheatcodes { } // Match the create against expected_creates + let (db, journal, _) = ecx.as_db_env_and_journal(); if !self.expected_creates.is_empty() && let (Some(address), Some(call)) = (outcome.address, call) - && let Ok(created_acc) = ecx.journaled_state.load_account(address) + && let Ok(created_acc) = journal.load_account(db, address) { let bytecode = created_acc.info.code.clone().unwrap_or_default().original_bytes(); if let Some((index, _)) = @@ -2032,9 +2044,9 @@ impl Cheatcodes { // get previous balance, nonce and initialized status of the target account let target = try_or_return!(interpreter.stack.peek(0)); let target = Address::from_word(B256::from(target)); - let (initialized, old_balance, old_nonce) = ecx - .journaled_state - .load_account(target) + let (db, journal, _) = ecx.as_db_env_and_journal(); + let (initialized, old_balance, old_nonce) = journal + .load_account(db, target) .map(|account| { (account.info.exists(), account.info.balance, account.info.nonce) }) @@ -2083,7 +2095,8 @@ impl Cheatcodes { // it's not set (zero value) let mut present_value = U256::ZERO; // Try to load the account and the slot's present value - if ecx.journaled_state.load_account(address).is_ok() + let (db, journal, _) = ecx.as_db_env_and_journal(); + if journal.load_account(db, address).is_ok() && let Some(previous) = ecx.sload(address, key) { present_value = previous.data; @@ -2112,7 +2125,8 @@ impl Cheatcodes { // Try to load the account and the slot's previous value, otherwise, assume it's // not set (zero value) let mut previous_value = U256::ZERO; - if ecx.journaled_state.load_account(address).is_ok() + let (db, journal, _) = ecx.as_db_env_and_journal(); + if journal.load_account(db, address).is_ok() && let Some(previous) = ecx.sload(address, key) { previous_value = previous.data; @@ -2148,7 +2162,8 @@ impl Cheatcodes { let initialized; let balance; let nonce; - if let Ok(acc) = ecx.journaled_state.load_account(address) { + let (db, journal, _) = ecx.as_db_env_and_journal(); + if let Ok(acc) = journal.load_account(db, address) { initialized = acc.info.exists(); balance = acc.info.balance; nonce = acc.info.nonce; From d26cc64e44039c9092f5607a7fdddc4cc26bc5d6 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 12:51:29 +0100 Subject: [PATCH 3/7] unpin patches, bump versions --- Cargo.lock | 20 ++++++++++++-------- Cargo.toml | 16 ++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e5256db67eb4..33a5400099679 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -250,8 +250,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.23.2" -source = "git+https://github.com/alloy-rs/evm.git?rev=237d0a0#237d0a06915de43c500094015c23a9e90456ec76" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c84786dbd1a354358a01fc682862a22a47ff8c9e9bf4472d8d36bb02e3da5e54" dependencies = [ "alloy-consensus", "alloy-eips", @@ -363,8 +364,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.23.2" -source = "git+https://github.com/alloy-rs/evm.git?rev=237d0a0#237d0a06915de43c500094015c23a9e90456ec76" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85412ba830f756ada62e6a231db0d213ca7472c7161ed0086ae55ab262e8f9fc" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5033,8 +5035,9 @@ dependencies = [ [[package]] name = "foundry-fork-db" -version = "0.20.0" -source = "git+https://github.com/foundry-rs/foundry-fork-db?rev=b4299fc#b4299fc18155dee70b3a5247840b3cda8d309cae" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df2fd495cf7337b247d960f90355329cc625fe27fe7da9fe5e598c42df21526" dependencies = [ "alloy-chains", "alloy-consensus", @@ -8521,8 +8524,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.32.0" -source = "git+https://github.com/zerosnacks/revm-inspectors.git?rev=0aaab71#0aaab71572fa0074e3193464889b5aadbfb4f68b" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91cee0a75ef5f96b7e86f6c6a8bd4fda86eb37b57d501df6790418ee2b03c18" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", diff --git a/Cargo.toml b/Cargo.toml index 9f637ebad496c..aa89fdee49ea7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -227,7 +227,7 @@ foundry-compilers = { version = "0.19.5", default-features = false, features = [ "rustls", "svm-solc", ] } -foundry-fork-db = "0.20" +foundry-fork-db = "0.21" solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" } solar = { package = "solar-compiler", version = "=0.1.8", default-features = false } svm = { package = "svm-rs", version = "0.5", default-features = false, features = [ @@ -286,12 +286,12 @@ op-alloy-rpc-types = "0.22.0" op-alloy-flz = "0.13.1" ## alloy-evm -alloy-evm = "0.23.2" -alloy-op-evm = "0.23.2" +alloy-evm = "0.24.1" +alloy-op-evm = "0.24.1" # revm revm = { version = "33.0.0", default-features = false } -revm-inspectors = { version = "0.32.0", features = ["serde"] } +revm-inspectors = { version = "0.33.0", features = ["serde"] } op-revm = { version = "14.0.0", default-features = false } ## cli @@ -437,18 +437,18 @@ rexpect = { git = "https://github.com/rust-cli/rexpect", rev = "2ed0b1898d7edaf6 # alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "7fab7ee" } ## alloy-evm -alloy-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } -alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } +# alloy-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } +# alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } ## revm # 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/zerosnacks/revm-inspectors.git", rev = "0aaab71" } +# revm-inspectors = { git = "https://github.com/zerosnacks/revm-inspectors.git", rev = "0aaab71" } ## foundry # foundry-block-explorers = { git = "https://github.com/foundry-rs/block-explorers.git", rev = "f5b46b2" } # foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", branch = "main" } -foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "b4299fc" } +# foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "b4299fc" } # solar solar = { package = "solar-compiler", git = "https://github.com/paradigmxyz/solar.git", rev = "0bea5f0" } From 39330715e2b2865b5887cb15605d72c60a4b573d Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 13:10:45 +0100 Subject: [PATCH 4/7] flag any returning outcomes as having a precompile called --- crates/cheatcodes/src/inspector.rs | 4 ++-- crates/evm/evm/src/inspectors/logs.rs | 2 +- crates/evm/evm/src/inspectors/stack.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/cheatcodes/src/inspector.rs b/crates/cheatcodes/src/inspector.rs index 0d0db63ebc383..4f2b605944b6f 100644 --- a/crates/cheatcodes/src/inspector.rs +++ b/crates/cheatcodes/src/inspector.rs @@ -746,7 +746,7 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), - was_precompile_called: false, + was_precompile_called: true, precompile_call_logs: vec![], }), Err(err) => Some(CallOutcome { @@ -821,7 +821,7 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), - was_precompile_called: false, + was_precompile_called: true, precompile_call_logs: vec![], }); } diff --git a/crates/evm/evm/src/inspectors/logs.rs b/crates/evm/evm/src/inspectors/logs.rs index cd98c8e66017e..b23069bf62c35 100644 --- a/crates/evm/evm/src/inspectors/logs.rs +++ b/crates/evm/evm/src/inspectors/logs.rs @@ -32,7 +32,7 @@ impl LogCollector { return Some(CallOutcome { result: InterpreterResult { result, output, gas: Gas::new(inputs.gas_limit) }, memory_offset: inputs.return_memory_offset.clone(), - was_precompile_called: false, + was_precompile_called: true, precompile_call_logs: vec![], }); } diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index e98605a42dab6..ef5718c749efc 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -987,7 +987,7 @@ impl Inspector> for InspectorStackRefMut<'_> return Some(CallOutcome { result, memory_offset: call.return_memory_offset.clone(), - was_precompile_called: false, + was_precompile_called: true, precompile_call_logs: vec![], }); } From 20011fb0000c660bfd4a49cd61937fab11764447 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 13:23:34 +0100 Subject: [PATCH 5/7] apply revm patch --- Cargo.lock | 39 ++++++++++++----------------------- Cargo.toml | 4 ++-- crates/cast/tests/cli/main.rs | 2 +- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33a5400099679..f5b957331bfa1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7225,8 +7225,7 @@ dependencies = [ [[package]] name = "op-revm" version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f887a8353e22df6ce5b150e4d3a51838bc6a64d4644c5f7416bef70f442c2857" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "revm", @@ -8397,8 +8396,7 @@ dependencies = [ [[package]] name = "revm" version = "33.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151be0bca9fd5ebfbbbc02af9f75f1e1610f71c750eea71b4d91fe7b65362c61" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "revm-bytecode", "revm-context", @@ -8416,8 +8414,7 @@ dependencies = [ [[package]] name = "revm-bytecode" version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c6b5e6e8dd1e28a4a60e5f46615d4ef0809111c9e63208e55b5c7058200fb0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "bitvec", "phf 0.13.1", @@ -8428,8 +8425,7 @@ dependencies = [ [[package]] name = "revm-context" version = "12.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e6ab8619ee12fdcd34ee8e932364153340b744c75e2fdaebbc8f76308b0826" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "bitvec", "cfg-if", @@ -8445,8 +8441,7 @@ dependencies = [ [[package]] name = "revm-context-interface" version = "13.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8fb70266f324e266fe5d75cfd9b1c0f5d4556c756a8ee50ddb329347fd695c" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -8461,8 +8456,7 @@ dependencies = [ [[package]] name = "revm-database" version = "9.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b6c15bb255481fcf29f5ef7c97f00ed4c28a6ab6c490d77b990d73603031569" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "alloy-eips", "revm-bytecode", @@ -8475,8 +8469,7 @@ dependencies = [ [[package]] name = "revm-database-interface" version = "8.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cce03e3780287b07abe58faf4a7f5d8be7e81321f93ccf3343c8f7755602bae" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "either", @@ -8488,8 +8481,7 @@ dependencies = [ [[package]] name = "revm-handler" version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52757cd0287eac51864aa9a6a583a327d29a0d08b3c91b7f91157f229cd28a" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "derive-where", @@ -8507,8 +8499,7 @@ dependencies = [ [[package]] name = "revm-inspector" version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6421be68d5f649faf26b9684d7e0339568695096ae2faaf789a56b12cfea3fcf" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "either", @@ -8545,8 +8536,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "31.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8201c0fbd91334a8d4d0aae955f8d4534a118d55855ed9b03aec8f83fb62561e" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -8558,8 +8548,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "31.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a62958af953cc4043e93b5be9b8497df84cc3bd612b865c49a7a7dfa26a84e2" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -8583,8 +8572,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "21.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e161db429d465c09ba9cbff0df49e31049fe6b549e28eb0b7bd642fcbd4412" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "alloy-primitives", "num_enum", @@ -8595,8 +8583,7 @@ dependencies = [ [[package]] name = "revm-state" version = "8.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8be953b7e374dbdea0773cf360debed8df394ea8d82a8b240a6b5da37592fc" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "bitflags 2.10.0", "revm-bytecode", diff --git a/Cargo.toml b/Cargo.toml index aa89fdee49ea7..436ea20795954 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -441,8 +441,8 @@ rexpect = { git = "https://github.com/rust-cli/rexpect", rev = "2ed0b1898d7edaf6 # alloy-op-evm = { git = "https://github.com/alloy-rs/evm.git", rev = "237d0a0" } ## 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 = "7e59936" } +op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "7e59936" } # revm-inspectors = { git = "https://github.com/zerosnacks/revm-inspectors.git", rev = "0aaab71" } ## foundry diff --git a/crates/cast/tests/cli/main.rs b/crates/cast/tests/cli/main.rs index 5d768911b27a8..9c694b5363eae 100644 --- a/crates/cast/tests/cli/main.rs +++ b/crates/cast/tests/cli/main.rs @@ -3416,7 +3416,7 @@ Traces: │ │ ├─ [15711] 0x0B55b053230E4EFFb6609de652fCa73Fd1C29804::pay(1551, 0x1bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b, 0x290a4c4039f102eceba2147e1fcc46f994a46d1229faf43ffff26a058e7378ff, 0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a12384c5e52fd646e7bc7f6b3b33a605651f566e000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f0000000000000000000000000000000000000000000000000000000000036cd000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000327a25ad5cfe5c4d4339c1a4267d4a83e8c93312000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000b55b053230e4effb6609de652fca73fd1c2980400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000221000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006cdd519280ec730727f07aa36550bde31a1d5f3097818f3425c2f083ed33a91f080fa2afac0071f6e1af9a0e9c09b851bf01e68bc8a1c1f89f686c48205762f92500000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b51704d51446e7841757a726f68522d483878472d5a536b625249702d76515f5f5f4a714259357a655038222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) [delegatecall] │ │ │ ├─ [12963] 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913::transfer(0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, 1551) │ │ │ │ ├─ [12263] 0x2Ce6311ddAE708829bc0784C967b7d77D19FD779::transfer(0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, 1551) [delegatecall] - │ │ │ │ │ ├─ emit Transfer(param0: 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E, param1: 0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, param2: 1551) + │ │ │ │ │ ├─ emit Transfer(from: 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E, to: 0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, amount: 1551) │ │ │ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ │ └─ ← [Stop] From 98ea10f8c2e1a5a20f71b7ea510883d9a964bdcf Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 13:37:28 +0100 Subject: [PATCH 6/7] fix tests --- crates/cast/tests/cli/main.rs | 2 +- crates/forge/tests/cli/test_optimizer.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cast/tests/cli/main.rs b/crates/cast/tests/cli/main.rs index 9c694b5363eae..5d768911b27a8 100644 --- a/crates/cast/tests/cli/main.rs +++ b/crates/cast/tests/cli/main.rs @@ -3416,7 +3416,7 @@ Traces: │ │ ├─ [15711] 0x0B55b053230E4EFFb6609de652fCa73Fd1C29804::pay(1551, 0x1bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b, 0x290a4c4039f102eceba2147e1fcc46f994a46d1229faf43ffff26a058e7378ff, 0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a12384c5e52fd646e7bc7f6b3b33a605651f566e000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f0000000000000000000000000000000000000000000000000000000000036cd000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000327a25ad5cfe5c4d4339c1a4267d4a83e8c93312000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000b55b053230e4effb6609de652fca73fd1c2980400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000221000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006cdd519280ec730727f07aa36550bde31a1d5f3097818f3425c2f083ed33a91f080fa2afac0071f6e1af9a0e9c09b851bf01e68bc8a1c1f89f686c48205762f92500000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b51704d51446e7841757a726f68522d483878472d5a536b625249702d76515f5f5f4a714259357a655038222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) [delegatecall] │ │ │ ├─ [12963] 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913::transfer(0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, 1551) │ │ │ │ ├─ [12263] 0x2Ce6311ddAE708829bc0784C967b7d77D19FD779::transfer(0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, 1551) [delegatecall] - │ │ │ │ │ ├─ emit Transfer(from: 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E, to: 0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, amount: 1551) + │ │ │ │ │ ├─ emit Transfer(param0: 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E, param1: 0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312, param2: 1551) │ │ │ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001 │ │ │ └─ ← [Stop] diff --git a/crates/forge/tests/cli/test_optimizer.rs b/crates/forge/tests/cli/test_optimizer.rs index 560246ca3fd6b..055faafda92be 100644 --- a/crates/forge/tests/cli/test_optimizer.rs +++ b/crates/forge/tests/cli/test_optimizer.rs @@ -553,7 +553,7 @@ Compiling 22 files with [..] contract Counter { uint256 public number; - function setNumber(uint256 newNumber) public virtual { + function setNumber(uint256) public virtual { number = 12345; } From 625677a4db25d9e6a7ad6c44ee036a28ace327da Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Wed, 12 Nov 2025 13:39:47 +0100 Subject: [PATCH 7/7] fix test --- crates/forge/tests/cli/test_optimizer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/forge/tests/cli/test_optimizer.rs b/crates/forge/tests/cli/test_optimizer.rs index 055faafda92be..032f5d0be7d2a 100644 --- a/crates/forge/tests/cli/test_optimizer.rs +++ b/crates/forge/tests/cli/test_optimizer.rs @@ -568,7 +568,7 @@ contract Counter { // compiled and both tests fail. cmd.with_no_redact().assert_failure().stdout_eq(str![[r#" ... -Compiling 2 files with [..] +Compiling 3 files with [..] ... [FAIL: assertion failed: 12347 != 1] test_Increment() (gas: [..]) [FAIL: assertion failed: 12345 != 1] test_SetNumber() (gas: [..])