diff --git a/Cargo.lock b/Cargo.lock index 9869a2658dd67..0e15282e1c3e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da374e868f54c7f4ad2ad56829827badca388efd645f8cf5fccc61c2b5343504" +checksum = "f58047cc851e58c26224521d1ecda466e3d746ebca0274cd5427aa660a88c353" dependencies = [ "alloy-eips", "alloy-primitives", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc6957ff706f9e5f6fd42f52a93e4bce476b726c92d077b348de28c4a76730c" +checksum = "fa5d42d9f87896536234b0fac1a84ad9d9dc7a4b27839cac35d0899e64ddf083" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -134,15 +134,17 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76ecab54890cdea1e4808fc0891c7e6cfcf71fe1a9fe26810c7280ef768f4ed" +checksum = "d32a3e14fa0d152d00bd8daf605eb74ad397efb0f54bd7155585823dddb4401e" dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-serde", + "arbitrary", "c-kzg", "derive_more", + "k256", "once_cell", "serde", "sha2", @@ -150,9 +152,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca15afde1b6d15e3fc1c97421262b1bbb37aee45752e3c8b6d6f13f776554ff" +checksum = "20cb76c8a3913f2466c5488f3a915e3a15d15596bdc935558c1a9be75e9ec508" dependencies = [ "alloy-primitives", "alloy-serde", @@ -173,9 +175,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d6f34930b7e3e2744bcc79056c217f00cb2abb33bc5d4ff88da7623c5bb078b" +checksum = "0e76a9feec2352c78545d1a37415699817bae8dc41654bd1bfe57d6cdd5433bd" dependencies = [ "alloy-primitives", "serde", @@ -186,9 +188,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f6895fc31b48fa12306ef9b4f78b7764f8bd6d7d91cdb0a40e233704a0f23f" +checksum = "3223d71dc78f464b2743418d0be8b5c894313e272105a6206ad5e867d67b3ce2" dependencies = [ "alloy-consensus", "alloy-eips", @@ -233,9 +235,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c538bfa893d07e27cb4f3c1ab5f451592b7c526d511d62b576a2ce59e146e4a" +checksum = "f29da7457d853cb8199ec04b227d5d2ef598be3e59fc2bbad70c8be213292f32" dependencies = [ "alloy-chains", "alloy-consensus", @@ -270,9 +272,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a7341322d9bc0e49f6e9fd9f2eb8e30f73806f2dd12cbb3d6bab2694c921f87" +checksum = "f64acfec654ade392cecfa9bba0408eb2a337d55f1b857925da79970cb70f3d6" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -311,9 +313,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba31bae67773fd5a60020bea900231f8396202b7feca4d0c70c6b59308ab4a8" +checksum = "f8a9e609524fa31c2c70eb24c0da60796809193ad4787a6dfe6d0db0d3ac112d" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -336,9 +338,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184a7a42c7ba9141cc9e76368356168c282c3bc3d9e5d78f3556bdfe39343447" +checksum = "7e5d76f1e8b22f48b7b8f985782b68e7eb3938780e50e8b646a53e41a598cdf5" dependencies = [ "alloy-rpc-types-anvil", "alloy-rpc-types-engine", @@ -346,13 +348,14 @@ dependencies = [ "alloy-rpc-types-trace", "alloy-rpc-types-txpool", "alloy-serde", + "serde", ] [[package]] name = "alloy-rpc-types-anvil" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7cf4356a9d00df76d6e90d002e2a7b5edc1c8476e90e6f17ab868d99db6435" +checksum = "4282c002a4ae9f57887dae57083fcca6dca09cb6685bf98b8582ea93cb3df97d" dependencies = [ "alloy-primitives", "alloy-serde", @@ -361,9 +364,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e765962e3b82fd6f276a0873b5bd897e5d75a25f78fa9a6a21bd350d8e98a4e" +checksum = "73445fbc5c02258e3d0d977835c92366a4d91545fd456c3fc8601c61810bc9f6" dependencies = [ "alloy-consensus", "alloy-eips", @@ -379,9 +382,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4123ee21f99ba4bd31bfa36ba89112a18a500f8b452f02b35708b1b951e2b9" +checksum = "605fa8462732bb8fd0645a9941e12961e079d45ae6a44634c826f8229c187bdf" dependencies = [ "alloy-consensus", "alloy-eips", @@ -397,9 +400,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567933b1d95fd42cb70b75126e32afec2e5e2c3c16e7100a3f83dc1c80f4dc0e" +checksum = "5f561a8cdd377b6ac3beab805b9df5ec2c7d99bb6139aab23c317f26df6fb346" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -411,9 +414,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3115f4eb1bb9ae9aaa0b24ce875a1d86d6689b16438a12377832def2b09e373c" +checksum = "c06a4bd39910631c11148c5b2c55e2c61f8626affd2a612e382c668d5e5971ce" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -423,20 +426,21 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9416c52959e66ead795a11f4a86c248410e9e368a0765710e57055b8a1774dd6" +checksum = "15c5b9057acc02aee1b8aac2b5a0729cb0f73d080082c111313e5d1f92a96630" dependencies = [ "alloy-primitives", + "arbitrary", "serde", "serde_json", ] [[package]] name = "alloy-signer" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b33753c09fa1ad85e5b092b8dc2372f1e337a42e84b9b4cff9fede75ba4adb32" +checksum = "37f10592696f4ab8b687d5a8ab55e998a14ea0ca5f8eb20ad74a96ad671bb54a" dependencies = [ "alloy-dyn-abi", "alloy-primitives", @@ -450,9 +454,9 @@ dependencies = [ [[package]] name = "alloy-signer-aws" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63ce17bfd5aa38e14b9c83b553d93c76e1bd5641a2db45f381f81619fd3e54ca" +checksum = "49300a7aecbd28c364fbad6a9f886264f79ff4fed9a67c8caa27c39f99d52b2d" dependencies = [ "alloy-consensus", "alloy-network", @@ -468,9 +472,9 @@ dependencies = [ [[package]] name = "alloy-signer-gcp" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2804c1d4fae0341195def6c5eb6efc65756cdf8cd3c0087ad2afff7972f8a115" +checksum = "5ce638c267429ea7513be9fffc47d949d1f425a33c8813fc6a145e03b999e79f" dependencies = [ "alloy-consensus", "alloy-network", @@ -486,9 +490,9 @@ dependencies = [ [[package]] name = "alloy-signer-ledger" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575e4c924b23132234c75bd1f8f3871c1bc12ba462f76af9b59249515a38253e" +checksum = "5a9450ae05631ac2a5eb180d91d7162bf71ea7a2bb6833cc7c25997e5a11dc38" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -506,9 +510,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dfc9c26fe6c6f1bad818c9a976de9044dd12e1f75f1f156a801ee3e8148c1b6" +checksum = "0b537f3e55f30753578f4623d5f66ddad8fa582af3fa6b15bad23dd1b9775228" dependencies = [ "alloy-consensus", "alloy-network", @@ -526,9 +530,9 @@ dependencies = [ [[package]] name = "alloy-signer-trezor" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd82e86e4a6604fd11f84b170638d16dcdac9db6c2b5f5b91a3941b7e7af7f94" +checksum = "c6efa624373339e7cbdd597a785a69c5fcbc10d5368797a18b7cb3476eadf8c9" dependencies = [ "alloy-consensus", "alloy-network", @@ -616,9 +620,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b51a291f949f755e6165c3ed562883175c97423703703355f4faa4b7d0a57c" +checksum = "5b44b0f6f4a2593b258fa7b6cae8968e6a4c404d9ef4f5bc74401f2d04fa23fa" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -635,9 +639,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d65871f9f1cafe1ed25cde2f1303be83e6473e995a2d56c275ae4fcce6119c" +checksum = "6d8f1eefa8cb9e7550740ee330feba4fed303a77ad3085707546f9152a88c380" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -650,9 +654,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7fbc8b6282ce41b01cbddef7bffb133fe6e1bf65dcd39770d45a905c051179" +checksum = "31007c56dc65bd81392112dda4a14c20ac7e30bb4cb2e9176192e8d9fab1983f" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -671,9 +675,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec83fd052684556c78c54df111433493267234d82321c2236560c752f595f20" +checksum = "15ccc1c8f8ae415e93ec0e7851bd4cdf4afdd48793d13a91b860317da1f36104" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -1723,6 +1727,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "group", + "pairing", + "rand_core", + "subtle", +] + [[package]] name = "blst" version = "0.3.12" @@ -3210,6 +3227,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "bitvec", "rand_core", "subtle", ] @@ -3561,7 +3579,6 @@ dependencies = [ "foundry-common", "foundry-compilers", "foundry-config", - "foundry-evm-abi", "foundry-evm-core", "foundry-wallets", "itertools 0.13.0", @@ -4000,9 +4017,9 @@ dependencies = [ [[package]] name = "foundry-fork-db" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3f9c9e02b19933218eb39c7234dcb0cc20e461258ced030f6fd6ac254a8637" +checksum = "734f01574b6804ed6985d042684235c6c1007228eff8b2b488c260e3caf742d5" dependencies = [ "alloy-primitives", "alloy-provider", @@ -5297,6 +5314,21 @@ dependencies = [ "libc", ] +[[package]] +name = "kzg-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9920cd4460ce3cbca19c62f3bb9a9611562478a4dc9d2c556f4a7d049c5b6b" +dependencies = [ + "bls12_381", + "glob", + "hex", + "once_cell", + "serde", + "serde_derive", + "serde_yaml", +] + [[package]] name = "lalrpop" version = "0.20.2" @@ -6030,6 +6062,15 @@ dependencies = [ "sha2", ] +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -7060,9 +7101,9 @@ dependencies = [ [[package]] name = "revm" -version = "10.0.0" +version = "12.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355bde4e21578c241f9379fbb344a73d254969b5007239115e094dda1511cd34" +checksum = "c6cfb48bce8ca2113e157bdbddbd5eeb09daac1c903d79ec17085897c38c7c91" dependencies = [ "auto_impl", "cfg-if", @@ -7075,9 +7116,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aede4aaaa0c5b446ce1a951629d7929ea48473a0f307bd8d999ecdeb55c420b" +checksum = "d485a7ccfbbcaf2d0c08c3d866dae279c6f71d7357862cbea637f23f27b7b695" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -7092,9 +7133,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "6.0.0" +version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dfd24faa3cbbd96e0976103d1e174d6559b8036730f70415488ee21870d578" +checksum = "e6b0daddea06fc6da5346acc39b32a357bbe3579e9e3d94117d9ae125cd596fc" dependencies = [ "revm-primitives", "serde", @@ -7102,13 +7143,14 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "8.0.0" +version = "9.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c669c9b105dbb41133c17bf7f34d29368e358a7fee8fcc289e90dbfb024dfc4" +checksum = "ef55228211251d7b6c7707c3ee13bb70dea4d2fd81ec4034521e4fe31010b2ea" dependencies = [ "aurora-engine-modexp", "blst", "c-kzg", + "cfg-if", "k256", "once_cell", "p256", @@ -7121,10 +7163,11 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "5.0.0" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "902184a7a781550858d4b96707098da357429f1e4545806fd5b589f455555cf2" +checksum = "2fc4311037ee093ec50ec734e1424fcb3e12d535c6cef683b75d1c064639630c" dependencies = [ + "alloy-eips", "alloy-primitives", "auto_impl", "bitflags 2.6.0", @@ -7136,6 +7179,7 @@ dependencies = [ "enumn", "hashbrown 0.14.5", "hex", + "kzg-rs", "once_cell", "serde", ] @@ -7792,6 +7836,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.2.6", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "serial_test" version = "3.1.1" @@ -8892,9 +8949,9 @@ dependencies = [ [[package]] name = "trezor-client" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f62c95b37f6c769bd65a0d0beb8b2b003e72998003b896a616a6777c645c05ed" +checksum = "10636211ab89c96ed2824adc5ec0d081e1080aeacc24c37abb318dcb31dcc779" dependencies = [ "byteorder", "hex", @@ -9054,6 +9111,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index a64a6688cbfab..c4783973811f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,41 +159,41 @@ foundry-linking = { path = "crates/linking" } # solc & compilation utilities foundry-block-explorers = { version = "0.5.0", default-features = false } foundry-compilers = { version = "0.9.0", default-features = false } -foundry-fork-db = "0.1" +foundry-fork-db = "0.2" solang-parser = "=0.3.3" ## revm # no default features to avoid c-kzg -revm = { version = "10.0.0", default-features = false } -revm-primitives = { version = "5.0.0", default-features = false } -revm-inspectors = { version = "0.3", features = ["serde"] } +revm = { version = "12.1.0", default-features = false } +revm-primitives = { version = "7.1.0", default-features = false } +revm-inspectors = { version = "0.5", features = ["serde"] } ## ethers ethers-contract-abigen = { version = "2.0.14", default-features = false } ## alloy -alloy-consensus = { version = "0.1.4", default-features = false } -alloy-contract = { version = "0.1.4", default-features = false } -alloy-eips = { version = "0.1.4", default-features = false } -alloy-genesis = { version = "0.1.4", default-features = false } -alloy-json-rpc = { version = "0.1.4", default-features = false } -alloy-network = { version = "0.1.4", default-features = false } -alloy-node-bindings = { version = "0.1.4", default-features = false } -alloy-provider = { version = "0.1.4", default-features = false } -alloy-pubsub = { version = "0.1.4", default-features = false } -alloy-rpc-client = { version = "0.1.4", default-features = false } -alloy-rpc-types = { version = "0.1.4", default-features = false } -alloy-serde = { version = "0.1.4", default-features = false } -alloy-signer = { version = "0.1.4", default-features = false } -alloy-signer-aws = { version = "0.1.4", default-features = false } -alloy-signer-gcp = { version = "0.1.4", default-features = false } -alloy-signer-ledger = { version = "0.1.4", default-features = false } -alloy-signer-local = { version = "0.1.4", default-features = false } -alloy-signer-trezor = { version = "0.1.4", default-features = false } -alloy-transport = { version = "0.1.4", default-features = false } -alloy-transport-http = { version = "0.1.4", default-features = false } -alloy-transport-ipc = { version = "0.1.4", default-features = false } -alloy-transport-ws = { version = "0.1.4", default-features = false } +alloy-consensus = { version = "0.2.0", default-features = false } +alloy-contract = { version = "0.2.0", default-features = false } +alloy-eips = { version = "0.2.0", default-features = false } +alloy-genesis = { version = "0.2.0", default-features = false } +alloy-json-rpc = { version = "0.2.0", default-features = false } +alloy-network = { version = "0.2.0", default-features = false } +alloy-node-bindings = { version = "0.2.0", default-features = false } +alloy-provider = { version = "0.2.0", default-features = false } +alloy-pubsub = { version = "0.2.0", default-features = false } +alloy-rpc-client = { version = "0.2.0", default-features = false } +alloy-rpc-types = { version = "0.2.0", default-features = false } +alloy-serde = { version = "0.2.0", default-features = false } +alloy-signer = { version = "0.2.0", default-features = false } +alloy-signer-aws = { version = "0.2.0", default-features = false } +alloy-signer-gcp = { version = "0.2.0", default-features = false } +alloy-signer-ledger = { version = "0.2.0", default-features = false } +alloy-signer-local = { version = "0.2.0", default-features = false } +alloy-signer-trezor = { version = "0.2.0", default-features = false } +alloy-transport = { version = "0.2.0", default-features = false } +alloy-transport-http = { version = "0.2.0", default-features = false } +alloy-transport-ipc = { version = "0.2.0", default-features = false } +alloy-transport-ws = { version = "0.2.0", default-features = false } alloy-dyn-abi = "0.7.7" alloy-json-abi = "0.7.7" diff --git a/crates/anvil/core/src/eth/transaction/mod.rs b/crates/anvil/core/src/eth/transaction/mod.rs index dc758a52aad75..1db93c6a0cdaa 100644 --- a/crates/anvil/core/src/eth/transaction/mod.rs +++ b/crates/anvil/core/src/eth/transaction/mod.rs @@ -296,6 +296,7 @@ pub fn to_alloy_transaction_with_hash_and_sender( max_fee_per_blob_gas: None, blob_versioned_hashes: None, other: Default::default(), + authorization_list: None, }, TypedTransaction::EIP2930(t) => RpcTransaction { hash, @@ -323,6 +324,7 @@ pub fn to_alloy_transaction_with_hash_and_sender( max_fee_per_blob_gas: None, blob_versioned_hashes: None, other: Default::default(), + authorization_list: None, }, TypedTransaction::EIP1559(t) => RpcTransaction { hash, @@ -350,6 +352,7 @@ pub fn to_alloy_transaction_with_hash_and_sender( max_fee_per_blob_gas: None, blob_versioned_hashes: None, other: Default::default(), + authorization_list: None, }, TypedTransaction::EIP4844(t) => RpcTransaction { hash, @@ -377,6 +380,7 @@ pub fn to_alloy_transaction_with_hash_and_sender( max_fee_per_blob_gas: Some(t.tx().tx().max_fee_per_blob_gas), blob_versioned_hashes: Some(t.tx().tx().blob_versioned_hashes.clone()), other: Default::default(), + authorization_list: None, }, TypedTransaction::Deposit(t) => RpcTransaction { hash, @@ -399,6 +403,7 @@ pub fn to_alloy_transaction_with_hash_and_sender( max_fee_per_blob_gas: None, blob_versioned_hashes: None, other: Default::default(), + authorization_list: None, }, } } @@ -494,7 +499,7 @@ impl PendingTransaction { gas_price: U256::from(*gas_price), gas_priority_fee: None, gas_limit: *gas_limit as u64, - access_list: access_list.flattened(), + access_list: access_list.clone().into(), ..Default::default() } } @@ -521,7 +526,7 @@ impl PendingTransaction { gas_price: U256::from(*max_fee_per_gas), gas_priority_fee: Some(U256::from(*max_priority_fee_per_gas)), gas_limit: *gas_limit as u64, - access_list: access_list.flattened(), + access_list: access_list.clone().into(), ..Default::default() } } @@ -552,7 +557,7 @@ impl PendingTransaction { max_fee_per_blob_gas: Some(U256::from(*max_fee_per_blob_gas)), blob_hashes: blob_versioned_hashes.clone(), gas_limit: *gas_limit as u64, - access_list: access_list.flattened(), + access_list: access_list.clone().into(), ..Default::default() } } @@ -1463,6 +1468,7 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option Option TypedReceipt::Legacy(receipt_with_bloom), 0x01 => TypedReceipt::EIP2930(receipt_with_bloom), diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs index 346fb27bd1dd4..f50e2ea65f0d7 100644 --- a/crates/anvil/src/eth/api.rs +++ b/crates/anvil/src/eth/api.rs @@ -2743,7 +2743,9 @@ impl TryFrom, u128, State)>> for GasEs InstructionResult::OpcodeNotFound | InstructionResult::CallNotAllowedInsideStatic | InstructionResult::StateChangeDuringStaticCall | - InstructionResult::InvalidEFOpcode | + InstructionResult::InvalidExtDelegateCallTarget | + InstructionResult::InvalidEXTCALLTarget | + InstructionResult::InvalidFEOpcode | InstructionResult::InvalidJump | InstructionResult::NotActivated | InstructionResult::StackUnderflow | diff --git a/crates/anvil/src/eth/backend/db.rs b/crates/anvil/src/eth/backend/db.rs index 48b0eaaf5b139..fb9b6078204b8 100644 --- a/crates/anvil/src/eth/backend/db.rs +++ b/crates/anvil/src/eth/backend/db.rs @@ -291,7 +291,7 @@ impl DatabaseRef for StateDb { self.0.storage_ref(address, index) } - fn block_hash_ref(&self, number: U256) -> DatabaseResult { + fn block_hash_ref(&self, number: u64) -> DatabaseResult { self.0.block_hash_ref(number) } } diff --git a/crates/anvil/src/eth/backend/mem/inspector.rs b/crates/anvil/src/eth/backend/mem/inspector.rs index 43ba00810b944..68336935f4bb7 100644 --- a/crates/anvil/src/eth/backend/mem/inspector.rs +++ b/crates/anvil/src/eth/backend/mem/inspector.rs @@ -78,9 +78,9 @@ impl revm::Inspector for Inspector { }); } - fn log(&mut self, ecx: &mut EvmContext, log: &Log) { + fn log(&mut self, interp: &mut Interpreter, ecx: &mut EvmContext, log: &Log) { call_inspectors!([&mut self.tracer, &mut self.log_collector], |inspector| { - inspector.log(ecx, log); + inspector.log(interp, ecx, log); }); } diff --git a/crates/anvil/src/eth/backend/mem/mod.rs b/crates/anvil/src/eth/backend/mem/mod.rs index cf7cf6f9fe373..f89ba6a50568d 100644 --- a/crates/anvil/src/eth/backend/mem/mod.rs +++ b/crates/anvil/src/eth/backend/mem/mod.rs @@ -1156,9 +1156,10 @@ impl Backend { data: input.into_input().unwrap_or_default(), chain_id: None, nonce, - access_list: access_list.unwrap_or_default().flattened(), + access_list: access_list.unwrap_or_default().into(), blob_hashes: blob_versioned_hashes.unwrap_or_default(), optimism: OptimismFields { enveloped_tx: Some(Bytes::new()), ..Default::default() }, + authorization_list: None, }; if env.block.basefee.is_zero() { @@ -2110,6 +2111,7 @@ impl Backend { state_root: Some(block.header.state_root), blob_gas_price: Some(blob_gas_price), blob_gas_used, + authorization_list: None, }; Some(MinedTransactionReceipt { inner, out: info.out.map(|o| o.0.into()) }) @@ -2261,7 +2263,7 @@ impl Backend { let account_proof = AccountProof { address, balance: account.info.balance, - nonce: U64::from(account.info.nonce), + nonce: account.info.nonce, code_hash: account.info.code_hash, storage_hash: storage_root(&account.storage), account_proof: proof, diff --git a/crates/anvil/src/eth/backend/mem/state.rs b/crates/anvil/src/eth/backend/mem/state.rs index dd52eedfa0e44..9d66fac289dec 100644 --- a/crates/anvil/src/eth/backend/mem/state.rs +++ b/crates/anvil/src/eth/backend/mem/state.rs @@ -83,7 +83,7 @@ where let mut account_info = cache_db.basic_ref(*account)?.unwrap_or_default(); if let Some(nonce) = account_overrides.nonce { - account_info.nonce = nonce.to::(); + account_info.nonce = nonce; } if let Some(code) = &account_overrides.code { account_info.code = Some(Bytecode::new_raw(code.to_vec().into())); diff --git a/crates/anvil/tests/it/optimism.rs b/crates/anvil/tests/it/optimism.rs index 3406e686526ca..c355d11e889dc 100644 --- a/crates/anvil/tests/it/optimism.rs +++ b/crates/anvil/tests/it/optimism.rs @@ -3,7 +3,7 @@ use crate::utils::http_provider_with_signer; use alloy_eips::eip2718::Encodable2718; use alloy_network::{EthereumWallet, TransactionBuilder}; -use alloy_primitives::{b256, U128, U256}; +use alloy_primitives::{b256, U256}; use alloy_provider::Provider; use alloy_rpc_types::{optimism::OptimismTransactionFields, TransactionRequest}; use alloy_serde::WithOtherFields; @@ -29,7 +29,7 @@ async fn test_deposits_not_supported_if_optimism_disabled() { source_hash: Some(b256!( "0000000000000000000000000000000000000000000000000000000000000000" )), - mint: Some(U128::from(0)), + mint: Some(0), is_system_tx: Some(true), } .into(), @@ -67,7 +67,7 @@ async fn test_send_value_deposit_transaction() { source_hash: Some(b256!( "0000000000000000000000000000000000000000000000000000000000000000" )), - mint: Some(U128::from(0)), + mint: Some(0), is_system_tx: Some(true), } .into(), @@ -119,7 +119,7 @@ async fn test_send_value_raw_deposit_transaction() { source_hash: Some(b256!( "0000000000000000000000000000000000000000000000000000000000000000" )), - mint: Some(U128::from(0)), + mint: Some(0), is_system_tx: Some(true), } .into(), diff --git a/crates/anvil/tests/it/otterscan.rs b/crates/anvil/tests/it/otterscan.rs index 37da4f00006e5..d0536a0326d7e 100644 --- a/crates/anvil/tests/it/otterscan.rs +++ b/crates/anvil/tests/it/otterscan.rs @@ -5,7 +5,7 @@ use alloy_primitives::{address, Address, Bytes, U256}; use alloy_provider::Provider; use alloy_rpc_types::{ trace::otterscan::{InternalOperation, OperationType, TraceEntry}, - BlockNumberOrTag, BlockTransactions, TransactionRequest, + BlockNumberOrTag, TransactionRequest, }; use alloy_serde::WithOtherFields; use alloy_sol_types::{sol, SolCall, SolError, SolValue}; @@ -331,13 +331,11 @@ async fn ots_get_block_details() { let tx = TransactionRequest::default().to(Address::random()).value(U256::from(100)); let tx = WithOtherFields::new(tx); - let receipt = provider.send_transaction(tx).await.unwrap().get_receipt().await.unwrap(); + provider.send_transaction(tx).await.unwrap().get_receipt().await.unwrap(); let result = api.ots_get_block_details(1.into()).await.unwrap(); assert_eq!(result.block.transaction_count, 1); - let hash = result.block.block.transactions.hashes().next().unwrap(); - assert_eq!(*hash, receipt.transaction_hash); } #[tokio::test(flavor = "multi_thread")] @@ -353,12 +351,6 @@ async fn ots_get_block_details_by_hash() { let result = api.ots_get_block_details_by_hash(block_hash).await.unwrap(); assert_eq!(result.block.transaction_count, 1); - let hash = match result.block.block.transactions { - BlockTransactions::Full(txs) => txs[0].hash, - BlockTransactions::Hashes(hashes) => hashes[0], - BlockTransactions::Uncle => unreachable!(), - }; - assert_eq!(hash, receipt.transaction_hash); } #[tokio::test(flavor = "multi_thread")] diff --git a/crates/cheatcodes/Cargo.toml b/crates/cheatcodes/Cargo.toml index f04254b1812b6..93636c3f2f6d3 100644 --- a/crates/cheatcodes/Cargo.toml +++ b/crates/cheatcodes/Cargo.toml @@ -21,7 +21,6 @@ foundry-compilers.workspace = true foundry-config.workspace = true foundry-evm-core.workspace = true foundry-wallets.workspace = true -foundry-evm-abi.workspace = true alloy-dyn-abi.workspace = true alloy-json-abi.workspace = true diff --git a/crates/cheatcodes/src/inspector.rs b/crates/cheatcodes/src/inspector.rs index 91d6df148cb75..4a95fb75d8386 100644 --- a/crates/cheatcodes/src/inspector.rs +++ b/crates/cheatcodes/src/inspector.rs @@ -21,7 +21,6 @@ use alloy_rpc_types::request::{TransactionInput, TransactionRequest}; use alloy_sol_types::{SolCall, SolInterface, SolValue}; use foundry_common::{evm::Breakpoints, SELECTOR_LEN}; use foundry_config::Config; -use foundry_evm_abi::Console; use foundry_evm_core::{ abi::Vm::stopExpectSafeMemoryCall, backend::{DatabaseExt, RevertDiagnostic}, @@ -92,6 +91,7 @@ pub trait CheatcodesExecutor { db: &mut ccx.ecx.db as &mut dyn DatabaseExt, error, l1_block_info, + valid_authorizations: std::mem::take(&mut ccx.ecx.valid_authorizations), }; let mut evm = new_evm_with_existing_context(inner, &mut inspector as _); @@ -102,6 +102,7 @@ pub trait CheatcodesExecutor { ccx.ecx.env = evm.context.evm.inner.env; ccx.ecx.l1_block_info = evm.context.evm.inner.l1_block_info; ccx.ecx.error = evm.context.evm.inner.error; + ccx.ecx.valid_authorizations = evm.context.evm.inner.valid_authorizations; Ok(res) } @@ -136,19 +137,8 @@ pub trait CheatcodesExecutor { }) } - fn console_log( - &mut self, - ccx: &mut CheatsCtxt, - message: String, - ) -> Result<(), EVMError> { - self.with_evm(ccx, |evm| { - let log = - Log { address: CHEATCODE_ADDRESS, data: (&Console::log { val: message }).into() }; - - evm.context.external.log(&mut evm.context.evm, &log); - - Ok(()) - }) + fn console_log(&mut self, ccx: &mut CheatsCtxt, message: String) { + self.get_inspector::(ccx.state).console_log(message); } } @@ -499,7 +489,7 @@ impl Cheatcodes { gas, }, address: None, - }) + }); } ecx.env.tx.caller = broadcast.new_origin; @@ -730,7 +720,7 @@ impl Cheatcodes { let ecx = &mut ecx.inner; if call.target_address == HARDHAT_CONSOLE_ADDRESS { - return None + return None; } // Handle expected calls @@ -779,7 +769,7 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), - }) + }); } } @@ -837,7 +827,7 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), - }) + }); } let is_fixed_gas_limit = check_if_fixed_gas_limit(ecx, call.gas_limit); @@ -879,7 +869,7 @@ impl Cheatcodes { gas, }, memory_offset: call.return_memory_offset.clone(), - }) + }); } } } @@ -902,6 +892,9 @@ impl Cheatcodes { CallScheme::CallCode => crate::Vm::AccountAccessKind::CallCode, CallScheme::DelegateCall => crate::Vm::AccountAccessKind::DelegateCall, CallScheme::StaticCall => crate::Vm::AccountAccessKind::StaticCall, + CallScheme::ExtCall => crate::Vm::AccountAccessKind::Call, + CallScheme::ExtStaticCall => crate::Vm::AccountAccessKind::StaticCall, + CallScheme::ExtDelegateCall => crate::Vm::AccountAccessKind::DelegateCall, }; // 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 @@ -975,7 +968,7 @@ impl Inspector for Cheatcodes { } } - fn log(&mut self, _context: &mut EvmContext, log: &Log) { + fn log(&mut self, _interpreter: &mut Interpreter, _context: &mut EvmContext, log: &Log) { if !self.expected_emits.is_empty() { expect::handle_expect_emit(self, log); } @@ -1086,7 +1079,7 @@ impl Inspector for Cheatcodes { // Exit early for calls to cheatcodes as other logic is not relevant for cheatcode // invocations if cheatcode_call { - return outcome + return outcome; } // Record the gas usage of the call, this allows the `lastCallGas` cheatcode to @@ -1161,7 +1154,7 @@ impl Inspector for Cheatcodes { if self.expected_emits.iter().any(|expected| !expected.found) { outcome.result.result = InstructionResult::Revert; outcome.result.output = "log != expected log".abi_encode().into(); - return outcome + return outcome; } else { // All emits were found, we're good. // Clear the queue, as we expect the user to declare more events for the next call @@ -1179,7 +1172,7 @@ impl Inspector for Cheatcodes { if outcome.result.is_revert() { if let Some(err) = diag { outcome.result.output = Error::encode(err.to_error_msg(&self.labels)); - return outcome + return outcome; } } diff --git a/crates/cheatcodes/src/test/assert.rs b/crates/cheatcodes/src/test/assert.rs index 3f85b6e5c1c66..4ab97c031e5a8 100644 --- a/crates/cheatcodes/src/test/assert.rs +++ b/crates/cheatcodes/src/test/assert.rs @@ -189,7 +189,7 @@ fn handle_assertion_result( if ccx.state.config.assertions_revert { Err(msg.into()) } else { - executor.console_log(ccx, msg)?; + executor.console_log(ccx, msg); ccx.ecx.sstore(CHEATCODE_ADDRESS, GLOBAL_FAIL_SLOT, U256::from(1))?; Ok(Default::default()) } diff --git a/crates/common/fmt/src/ui.rs b/crates/common/fmt/src/ui.rs index c7fa9c6e726e1..b9deffc7eda2a 100644 --- a/crates/common/fmt/src/ui.rs +++ b/crates/common/fmt/src/ui.rs @@ -181,6 +181,7 @@ impl UIfmt for AnyTransactionReceipt { }, blob_gas_price, blob_gas_used, + authorization_list, }, other, } = self; @@ -202,7 +203,8 @@ transactionHash {} transactionIndex {} type {} blobGasPrice {} -blobGasUsed {}", +blobGasUsed {} +authorizationList {}", block_hash.pretty(), block_number.pretty(), contract_address.pretty(), @@ -219,6 +221,10 @@ blobGasUsed {}", transaction_type, blob_gas_price.pretty(), blob_gas_used.pretty(), + authorization_list + .as_ref() + .map(|l| serde_json::to_string(&l).unwrap()) + .unwrap_or_default(), ); if let Some(to) = to { diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index e59c44a57b95e..f82975c670ee9 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -907,7 +907,7 @@ impl Config { #[inline] pub fn evm_spec_id(&self) -> SpecId { if self.prague { - return SpecId::PRAGUE + return SpecId::PRAGUE_EOF } evm_spec_id(&self.evm_version) } diff --git a/crates/debugger/src/tui/draw.rs b/crates/debugger/src/tui/draw.rs index 6ee71dd6dbedf..d74a085a07490 100644 --- a/crates/debugger/src/tui/draw.rs +++ b/crates/debugger/src/tui/draw.rs @@ -200,6 +200,7 @@ impl DebuggerContext<'_> { CallKind::CallCode => "Contract callcode", CallKind::DelegateCall => "Contract delegatecall", CallKind::AuthCall => "Contract authcall", + CallKind::EOFCreate => "EOF contract creation", }; let title = format!( "{} {} ", diff --git a/crates/evm/core/src/backend/cow.rs b/crates/evm/core/src/backend/cow.rs index b0ca3876667b5..9ca63c5136603 100644 --- a/crates/evm/core/src/backend/cow.rs +++ b/crates/evm/core/src/backend/cow.rs @@ -266,7 +266,7 @@ impl<'a> DatabaseRef for CowBackend<'a> { DatabaseRef::storage_ref(self.backend.as_ref(), address, index) } - fn block_hash_ref(&self, number: U256) -> Result { + fn block_hash_ref(&self, number: u64) -> Result { DatabaseRef::block_hash_ref(self.backend.as_ref(), number) } } @@ -286,7 +286,7 @@ impl<'a> Database for CowBackend<'a> { DatabaseRef::storage_ref(self, address, index) } - fn block_hash(&mut self, number: U256) -> Result { + fn block_hash(&mut self, number: u64) -> Result { DatabaseRef::block_hash_ref(self, number) } } diff --git a/crates/evm/core/src/backend/in_memory_db.rs b/crates/evm/core/src/backend/in_memory_db.rs index be63f230073c0..e819c5313c2a3 100644 --- a/crates/evm/core/src/backend/in_memory_db.rs +++ b/crates/evm/core/src/backend/in_memory_db.rs @@ -44,7 +44,7 @@ impl DatabaseRef for MemDb { DatabaseRef::storage_ref(&self.inner, address, index) } - fn block_hash_ref(&self, number: U256) -> Result { + fn block_hash_ref(&self, number: u64) -> Result { DatabaseRef::block_hash_ref(&self.inner, number) } } @@ -65,7 +65,7 @@ impl Database for MemDb { Database::storage(&mut self.inner, address, index) } - fn block_hash(&mut self, number: U256) -> Result { + fn block_hash(&mut self, number: u64) -> Result { Database::block_hash(&mut self.inner, number) } } @@ -111,7 +111,7 @@ impl DatabaseRef for EmptyDBWrapper { Ok(self.0.storage_ref(address, index)?) } - fn block_hash_ref(&self, number: U256) -> Result { + fn block_hash_ref(&self, number: u64) -> Result { Ok(self.0.block_hash_ref(number)?) } } diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index d55e0d6f940ee..7839bb262e93b 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -1422,7 +1422,7 @@ impl DatabaseRef for Backend { } } - fn block_hash_ref(&self, number: U256) -> Result { + fn block_hash_ref(&self, number: u64) -> Result { if let Some(db) = self.active_fork_db() { db.block_hash_ref(number) } else { @@ -1467,7 +1467,7 @@ impl Database for Backend { } } - fn block_hash(&mut self, number: U256) -> Result { + fn block_hash(&mut self, number: u64) -> Result { if let Some(db) = self.active_fork_db_mut() { Ok(db.block_hash(number)?) } else { diff --git a/crates/evm/core/src/fork/database.rs b/crates/evm/core/src/fork/database.rs index 590f6717e09a3..de6b2a6b9f22e 100644 --- a/crates/evm/core/src/fork/database.rs +++ b/crates/evm/core/src/fork/database.rs @@ -167,7 +167,7 @@ impl Database for ForkedDatabase { Database::storage(&mut self.cache_db, address, index) } - fn block_hash(&mut self, number: U256) -> Result { + fn block_hash(&mut self, number: u64) -> Result { Database::block_hash(&mut self.cache_db, number) } } @@ -187,7 +187,7 @@ impl DatabaseRef for ForkedDatabase { DatabaseRef::storage_ref(&self.cache_db, address, index) } - fn block_hash_ref(&self, number: U256) -> Result { + fn block_hash_ref(&self, number: u64) -> Result { self.cache_db.block_hash_ref(number) } } @@ -253,8 +253,8 @@ impl DatabaseRef for ForkDbSnapshot { } } - fn block_hash_ref(&self, number: U256) -> Result { - match self.snapshot.block_hashes.get(&number).copied() { + fn block_hash_ref(&self, number: u64) -> Result { + match self.snapshot.block_hashes.get(&U256::from(number)).copied() { None => self.local.block_hash_ref(number), Some(block_hash) => Ok(block_hash), } diff --git a/crates/evm/core/src/lib.rs b/crates/evm/core/src/lib.rs index dd05568411be4..ed10c5d751465 100644 --- a/crates/evm/core/src/lib.rs +++ b/crates/evm/core/src/lib.rs @@ -44,6 +44,9 @@ pub trait InspectorExt: Inspector { ) -> bool { false } + + // Simulates `console.log` invocation. + fn console_log(&mut self, _input: String) {} } impl InspectorExt for NoOpInspector {} diff --git a/crates/evm/core/src/utils.rs b/crates/evm/core/src/utils.rs index 2fc202c0dc189..76a738c525405 100644 --- a/crates/evm/core/src/utils.rs +++ b/crates/evm/core/src/utils.rs @@ -77,22 +77,7 @@ pub fn configure_tx_env(env: &mut revm::primitives::Env, tx: &Transaction) { env.tx.gas_price = U256::from(tx.gas_price.unwrap_or_default()); env.tx.gas_priority_fee = tx.max_priority_fee_per_gas.map(U256::from); env.tx.nonce = Some(tx.nonce); - env.tx.access_list = tx - .access_list - .clone() - .unwrap_or_default() - .0 - .into_iter() - .map(|item| { - ( - item.address, - item.storage_keys - .into_iter() - .map(|key| alloy_primitives::U256::from_be_bytes(key.0)) - .collect(), - ) - }) - .collect(); + env.tx.access_list = tx.access_list.clone().unwrap_or_default().0.into_iter().collect(); env.tx.value = tx.value.to(); env.tx.data = alloy_primitives::Bytes(tx.input.0.clone()); env.tx.transact_to = tx.to.map(TxKind::Call).unwrap_or(TxKind::Create) diff --git a/crates/evm/evm/src/executors/mod.rs b/crates/evm/evm/src/executors/mod.rs index 16e760375129e..66010a33cfc75 100644 --- a/crates/evm/evm/src/executors/mod.rs +++ b/crates/evm/evm/src/executors/mod.rs @@ -844,6 +844,7 @@ fn convert_executed_result( &env.tx.data, env.tx.transact_to.is_create(), &env.tx.access_list, + 0, ); let result = match &out { diff --git a/crates/evm/evm/src/inspectors/logs.rs b/crates/evm/evm/src/inspectors/logs.rs index ec95fb41ca5fc..03b677fcdf844 100644 --- a/crates/evm/evm/src/inspectors/logs.rs +++ b/crates/evm/evm/src/inspectors/logs.rs @@ -4,9 +4,12 @@ use foundry_common::{fmt::ConsoleFmt, ErrorExt}; use foundry_evm_core::{ abi::{patch_hh_console_selector, Console, HardhatConsole}, constants::HARDHAT_CONSOLE_ADDRESS, + InspectorExt, }; use revm::{ - interpreter::{CallInputs, CallOutcome, Gas, InstructionResult, InterpreterResult}, + interpreter::{ + CallInputs, CallOutcome, Gas, InstructionResult, Interpreter, InterpreterResult, + }, Database, EvmContext, Inspector, }; @@ -38,7 +41,7 @@ impl LogCollector { } impl Inspector for LogCollector { - fn log(&mut self, _context: &mut EvmContext, log: &Log) { + fn log(&mut self, _interp: &mut Interpreter, _context: &mut EvmContext, log: &Log) { self.logs.push(log.clone()); } @@ -65,6 +68,16 @@ impl Inspector for LogCollector { } } +impl InspectorExt for LogCollector { + fn console_log(&mut self, input: String) { + self.logs.push(Log::new_unchecked( + HARDHAT_CONSOLE_ADDRESS, + vec![Console::log::SIGNATURE_HASH], + input.abi_encode().into(), + )); + } +} + /// Converts a call to Hardhat's `console.log` to a DSTest `log(string)` event. fn convert_hh_log_to_event(call: HardhatConsole::HardhatConsoleCalls) -> Log { // Convert the parameters of the call to their string representation using `ConsoleFmt`. diff --git a/crates/evm/evm/src/inspectors/stack.rs b/crates/evm/evm/src/inspectors/stack.rs index 8a2e7468baf31..c61fab4e85087 100644 --- a/crates/evm/evm/src/inspectors/stack.rs +++ b/crates/evm/evm/src/inspectors/stack.rs @@ -560,7 +560,7 @@ impl<'a> InspectorStackRefMut<'a> { // Should we match, encode and propagate error as a revert reason? let result = InterpreterResult { result: InstructionResult::Revert, output: Bytes::new(), gas }; - return (result, None) + return (result, None); }; // Commit changes after transaction @@ -573,7 +573,7 @@ impl<'a> InspectorStackRefMut<'a> { output: Bytes::from(e.to_string()), gas, }; - return (res, None) + return (res, None); } if let Err(e) = update_state(&mut res.state, &mut ecx.db, None) { let res = InterpreterResult { @@ -581,7 +581,7 @@ impl<'a> InspectorStackRefMut<'a> { output: Bytes::from(e.to_string()), gas, }; - return (res, None) + return (res, None); } // Merge transaction journal into the active journal. @@ -653,10 +653,10 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { ); } - fn log(&mut self, ecx: &mut EvmContext, log: &Log) { + fn log(&mut self, interpreter: &mut Interpreter, ecx: &mut EvmContext, log: &Log) { call_inspectors_adjust_depth!( [&mut self.tracer, &mut self.log_collector, &mut self.cheatcodes, &mut self.printer], - |inspector| inspector.log(ecx, log), + |inspector| inspector.log(interpreter, ecx, log), self, ecx ); @@ -689,7 +689,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { if let Some(output) = cheatcodes.call_with_executor(ecx, call, self.inner) { if output.result.result != InstructionResult::Continue { ecx.journaled_state.depth -= self.in_inner_context as usize; - return Some(output) + return Some(output); } } } @@ -708,7 +708,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { call.gas_limit, call.value.get(), ); - return Some(CallOutcome { result, memory_offset: call.return_memory_offset.clone() }) + return Some(CallOutcome { result, memory_offset: call.return_memory_offset.clone() }); } None @@ -723,7 +723,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { // Inner context calls with depth 0 are being dispatched as top-level calls with depth 1. // Avoid processing twice. if self.in_inner_context && ecx.journaled_state.depth == 0 { - return outcome + return outcome; } let outcome = self.do_call_end(ecx, inputs, outcome); @@ -770,7 +770,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { create.gas_limit, create.value, ); - return Some(CreateOutcome { result, address }) + return Some(CreateOutcome { result, address }); } None @@ -785,7 +785,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { // Inner context calls with depth 0 are being dispatched as top-level calls with depth 1. // Avoid processing twice. if self.in_inner_context && ecx.journaled_state.depth == 0 { - return outcome + return outcome; } let result = outcome.result.result; @@ -828,10 +828,14 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { ecx ); - if self.enable_isolation && !self.in_inner_context && ecx.journaled_state.depth == 1 { - let init_code = match &create.kind { + if matches!(create.kind, EOFCreateKind::Tx { .. }) && + self.enable_isolation && + !self.in_inner_context && + ecx.journaled_state.depth == 1 + { + let init_code = match &mut create.kind { EOFCreateKind::Tx { initdata } => initdata.clone(), - EOFCreateKind::Opcode { initcode, .. } => initcode.raw.clone(), + EOFCreateKind::Opcode { .. } => unreachable!(), }; let (result, address) = self.transact_inner( @@ -842,7 +846,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { create.gas_limit, create.value, ); - return Some(CreateOutcome { result, address }) + return Some(CreateOutcome { result, address }); } None @@ -857,7 +861,7 @@ impl<'a, DB: DatabaseExt> Inspector for InspectorStackRefMut<'a> { // Inner context calls with depth 0 are being dispatched as top-level calls with depth 1. // Avoid processing twice. if self.in_inner_context && ecx.journaled_state.depth == 0 { - return outcome + return outcome; } let result = outcome.result.result; @@ -905,6 +909,12 @@ impl<'a, DB: DatabaseExt> InspectorExt for InspectorStackRefMut<'a> { false } + + fn console_log(&mut self, input: String) { + call_inspectors!([&mut self.log_collector], |inspector| InspectorExt::::console_log( + inspector, input + )); + } } impl Inspector for InspectorStack { @@ -952,12 +962,29 @@ impl Inspector for InspectorStack { self.as_mut().create_end(context, call, outcome) } + fn eofcreate( + &mut self, + context: &mut EvmContext, + create: &mut EOFCreateInputs, + ) -> Option { + self.as_mut().eofcreate(context, create) + } + + fn eofcreate_end( + &mut self, + context: &mut EvmContext, + call: &EOFCreateInputs, + outcome: CreateOutcome, + ) -> CreateOutcome { + self.as_mut().eofcreate_end(context, call, outcome) + } + fn initialize_interp(&mut self, interpreter: &mut Interpreter, ecx: &mut EvmContext) { self.as_mut().initialize_interp(interpreter, ecx) } - fn log(&mut self, ecx: &mut EvmContext, log: &Log) { - self.as_mut().log(ecx, log) + fn log(&mut self, interpreter: &mut Interpreter, ecx: &mut EvmContext, log: &Log) { + self.as_mut().log(interpreter, ecx, log) } fn selfdestruct(&mut self, contract: Address, target: Address, value: U256) { diff --git a/crates/forge/src/gas_report.rs b/crates/forge/src/gas_report.rs index 56f59fffc7771..4fb4388448cb6 100644 --- a/crates/forge/src/gas_report.rs +++ b/crates/forge/src/gas_report.rs @@ -84,7 +84,8 @@ impl GasReport { if trace.depth > 1 && (trace.kind == CallKind::Call || trace.kind == CallKind::Create || - trace.kind == CallKind::Create2) + trace.kind == CallKind::Create2 || + trace.kind == CallKind::EOFCreate) { return; } @@ -143,7 +144,7 @@ impl Display for GasReport { for (name, contract) in &self.contracts { if contract.functions.is_empty() { trace!(name, "gas report contract without functions"); - continue + continue; } let mut table = Table::new(); diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index f966d6024118d..f259579d616f7 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -107,7 +107,7 @@ forgetest!(can_extract_config_values, |prj, cmd| { etherscan_api_key: None, etherscan: Default::default(), verbosity: 4, - remappings: vec![Remapping::from_str("forge-std=lib/forge-std/").unwrap().into()], + remappings: vec![Remapping::from_str("forge-std/=lib/forge-std/").unwrap().into()], libraries: vec![ "src/DssSpell.sol:DssExecLib:0x8De6DDbCd5053d32292AAA0D2105A32d108484a6".to_string() ],