diff --git a/Cargo.lock b/Cargo.lock index b25c090ef51c7..f5b957331bfa1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -250,9 +250,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.23.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6223235f0b785a83dd10dc1599b7f3763c65e4f98b4e9e4e10e576bbbdf7dfa2" +checksum = "c84786dbd1a354358a01fc682862a22a47ff8c9e9bf4472d8d36bb02e3da5e54" dependencies = [ "alloy-consensus", "alloy-eips", @@ -264,8 +264,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", @@ -365,9 +364,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.23.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad8f3a679eb44ee21481edabd628d191c9a42d182ed29923b4d43a27a0f2cc8" +checksum = "85412ba830f756ada62e6a231db0d213ca7472c7161ed0086ae55ab262e8f9fc" dependencies = [ "alloy-consensus", "alloy-eips", @@ -375,7 +374,7 @@ dependencies = [ "alloy-op-hardforks", "alloy-primitives", "auto_impl", - "op-alloy-consensus", + "op-alloy", "op-revm", "revm", "thiserror 2.0.17", @@ -1826,9 +1825,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 +4273,7 @@ dependencies = [ "foundry-wallets", "futures", "globset", - "indicatif 0.18.2", + "indicatif 0.18.3", "inferno", "itertools 0.14.0", "mockall", @@ -4394,7 +4393,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 +4607,7 @@ dependencies = [ "foundry-evm", "foundry-wallets", "futures", - "indicatif 0.18.2", + "indicatif 0.18.3", "itertools 0.14.0", "mimalloc", "path-slash", @@ -4707,9 +4706,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 +4738,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 +4748,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 +4769,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 +4784,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 +4884,7 @@ dependencies = [ "foundry-evm-fuzz", "foundry-evm-networks", "foundry-evm-traces", - "indicatif 0.18.2", + "indicatif 0.18.3", "parking_lot", "proptest", "revm", @@ -5036,9 +5035,9 @@ dependencies = [ [[package]] name = "foundry-fork-db" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e22c563793782d2b3ca99bac6de70cd2a98be8c9f575590ef3605da47b4deb" +checksum = "8df2fd495cf7337b247d960f90355329cc625fe27fe7da9fe5e598c42df21526" dependencies = [ "alloy-chains", "alloy-consensus", @@ -5692,9 +5691,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 +6006,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 +6363,7 @@ dependencies = [ "regex", "regex-syntax", "sha3", - "string_cache", + "string_cache 0.8.9", "term", "unicode-xid", "walkdir", @@ -7115,11 +7114,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 +7151,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 +7203,29 @@ 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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31622d03b29c826e48800f4c8f389c8a9c440eb796a3e35203561a288f12985" +version = "14.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "revm", @@ -7480,6 +7524,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 +8016,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 +8047,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 +8395,8 @@ dependencies = [ [[package]] name = "revm" -version = "31.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb67a5223602113cae59a305acde2d9936bc18f2478dda879a6124b267cebfb6" +version = "33.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "revm-bytecode", "revm-context", @@ -8352,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", @@ -8363,9 +8424,8 @@ dependencies = [ [[package]] name = "revm-context" -version = "11.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92850e150f4f99d46c05a20ad0cd09286a7ad4ee21866fffb87101de6e602231" +version = "12.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "bitvec", "cfg-if", @@ -8380,9 +8440,8 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "12.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d701e2c2347d65216b066489ab22a0a8e1f7b2568256110d73a7d5eff3385c" +version = "13.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -8397,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", @@ -8411,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", @@ -8423,9 +8480,8 @@ dependencies = [ [[package]] name = "revm-handler" -version = "12.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45418ed95cfdf0cb19effdbb7633cf2144cab7fb0e6ffd6b0eb9117a50adff6" +version = "14.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "derive-where", @@ -8442,9 +8498,8 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "12.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c99801eac7da06cc112df2244bd5a64024f4ef21240e923b26e73c4b4a0e5da6" +version = "14.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "auto_impl", "either", @@ -8460,9 +8515,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21caa99f22184a6818946362778cccd3ff02f743c1e085bee87700671570ecb7" +checksum = "a91cee0a75ef5f96b7e86f6c6a8bd4fda86eb37b57d501df6790418ee2b03c18" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -8480,9 +8535,8 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "29.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22789ce92c5808c70185e3bc49732f987dc6fd907f77828c8d3470b2299c9c65" +version = "31.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -8493,9 +8547,8 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "29.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968b124028960201abf6d6bf8e223f15fadebb4307df6b7dc9244a0aab5d2d05" +version = "31.0.0" +source = "git+https://github.com/bluealloy/revm.git?rev=7e59936#7e59936c87794d0bc1d1d2d18b754f5a76fc37aa" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -8519,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", @@ -8531,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", @@ -9726,17 +9777,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 +10116,7 @@ dependencies = [ "fnv", "nom", "phf 0.11.3", - "phf_codegen", + "phf_codegen 0.11.3", ] [[package]] @@ -11246,13 +11309,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..436ea20795954 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,13 +286,13 @@ 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 = "31.0.0", default-features = false } -revm-inspectors = { version = "0.32.0", features = ["serde"] } -op-revm = { version = "12.0.0", default-features = false } +revm = { version = "33.0.0", default-features = false } +revm-inspectors = { version = "0.33.0", features = ["serde"] } +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 = { 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 # 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/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 6a80384ed83fc..4f2b605944b6f 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 } @@ -723,6 +726,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } }; @@ -741,6 +746,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: true, + precompile_call_logs: vec![], }), Err(err) => Some(CallOutcome { result: InterpreterResult { @@ -749,6 +756,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }), }; } @@ -812,6 +821,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: true, + precompile_call_logs: vec![], }); } } @@ -880,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, @@ -888,6 +900,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } @@ -920,6 +934,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 +977,8 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), + was_precompile_called: false, + precompile_call_logs: vec![], }); } } @@ -973,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; @@ -982,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 @@ -1175,7 +1197,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); } @@ -1373,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; @@ -1656,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, @@ -1813,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; @@ -1836,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, _)) = @@ -2018,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) }) @@ -2069,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; @@ -2098,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; @@ -2134,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; 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..b23069bf62c35 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: true, + 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..ef5718c749efc 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: true, + 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())) diff --git a/crates/forge/tests/cli/test_optimizer.rs b/crates/forge/tests/cli/test_optimizer.rs index 560246ca3fd6b..032f5d0be7d2a 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; } @@ -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: [..])