From 7f88e62781e1d33a04db90d4831b82f50487eed6 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Mon, 2 Dec 2024 04:55:17 +0400 Subject: [PATCH] feat: bump alloy (#12930) Co-authored-by: Ryan Schneider --- Cargo.lock | 178 +++++++++++------- Cargo.toml | 129 ++++++------- .../src/commands/debug_cmd/build_block.rs | 2 + crates/chain-state/src/in_memory.rs | 4 +- crates/consensus/common/src/validation.rs | 3 +- crates/engine/local/src/payload.rs | 2 + crates/engine/util/Cargo.toml | 1 + crates/engine/util/src/reorg.rs | 3 +- .../ethereum/engine-primitives/src/payload.rs | 6 + crates/ethereum/evm/src/execute.rs | 15 +- crates/ethereum/node/tests/e2e/rpc.rs | 3 +- crates/ethereum/node/tests/e2e/utils.rs | 2 + crates/ethereum/payload/src/lib.rs | 28 ++- .../execution-types/src/execution_outcome.rs | 2 +- crates/evm/src/system_calls/mod.rs | 24 ++- crates/net/eth-wire-types/src/blocks.rs | 12 +- crates/net/eth-wire-types/src/header.rs | 5 +- crates/optimism/evm/Cargo.toml | 1 + crates/optimism/node/src/engine.rs | 2 + crates/optimism/node/src/utils.rs | 2 + crates/optimism/payload/src/builder.rs | 1 + crates/optimism/payload/src/payload.rs | 4 +- crates/optimism/primitives/src/bedrock.rs | 1 + .../primitives/src/transaction/mod.rs | 4 + crates/primitives-traits/src/receipt.rs | 2 +- crates/primitives/src/alloy_compat.rs | 2 + crates/primitives/src/receipt.rs | 2 + crates/primitives/src/traits.rs | 18 +- crates/primitives/src/transaction/mod.rs | 18 +- crates/primitives/src/transaction/pooled.rs | 10 + crates/revm/src/batch.rs | 6 +- crates/rpc/rpc-engine-api/src/engine_api.rs | 15 +- .../rpc-eth-api/src/helpers/pending_block.rs | 1 + .../rpc-eth-api/src/helpers/transaction.rs | 2 +- crates/rpc/rpc-eth-types/src/receipt.rs | 2 +- .../rpc-types-compat/src/engine/payload.rs | 4 +- crates/rpc/rpc/src/debug.rs | 35 +++- crates/rpc/rpc/src/eth/bundle.rs | 16 +- crates/rpc/rpc/src/validation.rs | 10 +- crates/storage/codecs/src/alloy/header.rs | 10 +- testing/ef-tests/src/models.rs | 3 + 41 files changed, 386 insertions(+), 204 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4da864b1b..8f68f71bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,14 +112,15 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae09ffd7c29062431dd86061deefe4e3c6f07fa0d674930095f8dcedb0baf02c" +checksum = "3a1ff8439834ab71a4b0ecd1a8ff80b3921c87615f158940c3364f399c732786" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", "alloy-serde", + "alloy-trie", "arbitrary", "auto_impl", "c-kzg", @@ -130,10 +131,24 @@ dependencies = [ ] [[package]] -name = "alloy-contract" -version = "0.6.4" +name = "alloy-consensus-any" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66430a72d5bf5edead101c8c2f0a24bada5ec9f3cf9909b3e08b6d6899b4803e" +checksum = "519a86faaa6729464365a90c04eba68539b6d3a30f426edb4b3dafd78920d42f" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-contract" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cca2b353d8b7f160dc930dfa174557acefece6deab5ecd7e6230d38858579eea" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -198,9 +213,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6aa3961694b30ba53d41006131a2fca3bdab22e4c344e46db2c639e7c2dfdd" +checksum = "8dedb328c2114284f767e075589ca9de8d5e9c8a91333402f4804a584ed71a38" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -219,9 +234,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53f7877ded3921d18a0a9556d55bedf84535567198c9edab2aa23106da91855" +checksum = "4841e8dd4e0f53d76b501fd4c6bc21d95d688bc8ebf0ea359fc6c7ab65b48742" dependencies = [ "alloy-primitives", "alloy-serde", @@ -242,9 +257,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3694b7e480728c0b3e228384f223937f14c10caef5a4c766021190fc8f283d35" +checksum = "254f770918f96dc4ec88a15e6e2e243358e1719d66b40ef814428e7697079d25" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -256,15 +271,17 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea94b8ceb5c75d7df0a93ba0acc53b55a22b47b532b600a800a87ef04eb5b0b4" +checksum = "931dd176c6e33355f3dc0170ec69cf5b951f4d73870b276e2c837ab35f9c5136" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", "alloy-primitives", + "alloy-rpc-types-any", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", @@ -279,9 +296,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9f3e281005943944d15ee8491534a1c7b3cbf7a7de26f8c433b842b93eb5f9" +checksum = "fa6ec0f23be233e851e31c5e4badfedfa9c7bc177bc37f4e03616072cd40a806" dependencies = [ "alloy-consensus", "alloy-eips", @@ -292,9 +309,9 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9805d126f24be459b958973c0569c73e1aadd27d4535eee82b2b6764aa03616" +checksum = "e3bce85f0f67b2248c2eb42941bb75079ac53648569a668e8bfd7de5a831ec64" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -341,9 +358,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c1f9eede27bf4c13c099e8e64d54efd7ce80ef6ea47478aa75d5d74e2dba3b" +checksum = "5545e2cbf2f8f24c68bb887ba0294fa12a2f816b9e72c4f226cd137b77d0e294" dependencies = [ "alloy-chains", "alloy-consensus", @@ -382,9 +399,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f1f34232f77341076541c405482e4ae12f0ee7153d8f9969fc1691201b2247" +checksum = "b633f7731a3df2f4f334001bf80436565113816c5aa5c136c1ded563051e049b" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -423,9 +440,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374dbe0dc3abdc2c964f36b3d3edf9cdb3db29d16bda34aa123f03d810bec1dd" +checksum = "aed9e40c2a73265ebf70f1e48303ee55920282e1ea5971e832873fb2d32cea74" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -448,9 +465,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74832aa474b670309c20fffc2a869fa141edab7c79ff7963fad0a08de60bae1" +checksum = "42dea20fa715a6f39ec7adc735cfd9567342870737270ac67795d55896527772" dependencies = [ "alloy-primitives", "alloy-rpc-types-engine", @@ -461,9 +478,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-admin" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bfd9b2cc3a1985f1f6da5afc41120256f9f9316fcd89e054cea99dbb10172f6" +checksum = "c9eab93eabf53697b4b9095c0f9203fca3702e78d083c77a5c677bdc02bebab8" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -473,9 +490,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca97963132f78ddfc60e43a017348e6d52eea983925c23652f5b330e8e02291" +checksum = "2750f4f694b27461915b9794df60177198bf733da38dde71aadfbe2946a3c0be" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -484,14 +501,27 @@ dependencies = [ ] [[package]] -name = "alloy-rpc-types-beacon" -version = "0.6.4" +name = "alloy-rpc-types-any" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922fa76678d2f9f07ea1b19309b5cfbf244c6029dcba3515227b515fdd6ed4a7" +checksum = "79d7620e22d6ed7c58451dd303d0501ade5a8bec9dc8daef0fbc48ceffabbae1" +dependencies = [ + "alloy-consensus", + "alloy-consensus-any", + "alloy-rpc-types-eth", + "alloy-serde", +] + +[[package]] +name = "alloy-rpc-types-beacon" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdbfc1b5ee81b1ef6d5e770f3bd6018eab66c7ac2ee1e897f88973b327e2fc20" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rpc-types-engine", + "alloy-serde", "serde", "serde_with", "thiserror 1.0.69", @@ -499,9 +529,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba2253bee958658ebd614c07a61c40580e09dd1fad3f017684314442332ab753" +checksum = "51d2d4a265fb1198272cc43d8d418c0423cdfc1aebcd283be9105464874a1dda" dependencies = [ "alloy-primitives", "serde", @@ -509,9 +539,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56294dce86af23ad6ee8df46cf8b0d292eb5d1ff67dc88a0886051e32b1faf" +checksum = "9fb843daa6feb011475f0db8c499fff5ac62e1e6012fc01d97477ddb3217a83f" dependencies = [ "alloy-consensus", "alloy-eips", @@ -530,11 +560,12 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a477281940d82d29315846c7216db45b15e90bcd52309da9f54bcf7ad94a11" +checksum = "df34b88df4deeac9ecfc80ad7cbb26a33e57437b9db8be5b952792feef6134bc" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-network-primitives", "alloy-primitives", @@ -551,9 +582,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-mev" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8647f8135ee3d5de1cf196706c905c05728a4e38bb4a5b61a7214bd1ba8f60a6" +checksum = "be601847f0b13112249ed577eaa7501755e7dd3df7b037088f8b8236a4602d59" dependencies = [ "alloy-eips", "alloy-primitives", @@ -564,9 +595,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd8b4877ef520c138af702097477cdd19504a8e1e4675ba37e92ba40f2d3c6f" +checksum = "db32f30a55ea4fa9d893127a84eef52fc54d23acb34c1a5a39bfe9bd95fbc149" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -578,9 +609,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4ab49acf90a71f7fb894dc5fd485f1f07a1e348966c714c4d1e0b7478850a8" +checksum = "af1588d8d799095a9bd55d9045b76add042ab725c37316a77da933683754aa4b" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -590,9 +621,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dfa4a7ccf15b2492bb68088692481fd6b2604ccbee1d0d6c44c21427ae4df83" +checksum = "43a89fd4cc3f96b3c5c0dd1cebeb63323e4659bbdc837117fa3fd5ac168df7d9" dependencies = [ "alloy-primitives", "arbitrary", @@ -602,9 +633,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e10aec39d60dc27edcac447302c7803d2371946fb737245320a05b78eb2fafd" +checksum = "532010243a96d1f8593c2246ec3971bc52303884fa1e43ca0a776798ba178910" dependencies = [ "alloy-primitives", "async-trait", @@ -616,9 +647,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8396f6dff60700bc1d215ee03d86ff56de268af96e2bf833a14d0bafcab9882" +checksum = "e8080c0ab2dc729b0cbb183843d08e78d2a1629140c9fc16234d2272abb483bd" dependencies = [ "alloy-consensus", "alloy-network", @@ -704,9 +735,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99acddb34000d104961897dbb0240298e8b775a7efffb9fda2a1a3efedd65b3" +checksum = "b6f295f4b745fb9e4e663d70bc57aed991288912c7aaaf25767def921050ee43" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -724,9 +755,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc013132e34eeadaa0add7e74164c1503988bfba8bae885b32e0918ba85a8a6" +checksum = "39139015a5ec127d9c895b49b484608e27fe4538544f84cdf5eae0bd36339bc6" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -739,9 +770,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063edc0660e81260653cc6a95777c29d54c2543a668aa5da2359fb450d25a1ba" +checksum = "d9b4f865b13bb8648e93f812b19b74838b9165212a2beb95fc386188c443a5e3" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -758,9 +789,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abd170e600801116d5efe64f74a4fc073dbbb35c807013a7d0a388742aeebba0" +checksum = "6af91e3521b8b3eac26809b1c6f9b86e3ed455dfab812f036836aabdf709b921" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -5297,9 +5328,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "op-alloy-consensus" -version = "0.6.8" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce158d886815d419222daa67fcdf949a34f7950653a4498ebeb4963331f70ed" +checksum = "75353c94e7515fac7d3c280bae56bff3375784a05cb44b317260606292ff6ba9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5315,9 +5346,9 @@ dependencies = [ [[package]] name = "op-alloy-genesis" -version = "0.6.8" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2734e9a65efb90fe4520303f984c124766b7d2f2e5dd51cbe54d6269c85a3c91" +checksum = "f24feef0404861c836b8fc0a3eb0cf6f20507e63ab59a61eeb1491c0f57bc352" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5330,9 +5361,9 @@ dependencies = [ [[package]] name = "op-alloy-network" -version = "0.6.8" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e4aef8ed017004a176ab1de49df419f59c0fb4a6ce3b693a10fe099fe1afe7" +checksum = "3dda5a5c4bc786f35f6c53ba611863a889790cc40a07c8160465072026795cba" dependencies = [ "alloy-consensus", "alloy-network", @@ -5345,9 +5376,9 @@ dependencies = [ [[package]] name = "op-alloy-protocol" -version = "0.6.8" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c68a3e2770890da3ad2fd20d7fe0c8e15672707577b4168a60e388c8eceaca0" +checksum = "ef2ab185601941f4ed04418d71e42b220a9c59353c8fb98ba8993c42590c6742" dependencies = [ "alloc-no-stdlib", "alloy-consensus", @@ -5357,6 +5388,7 @@ dependencies = [ "alloy-serde", "async-trait", "brotli", + "cfg-if", "miniz_oxide", "op-alloy-consensus", "op-alloy-genesis", @@ -5368,9 +5400,9 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types" -version = "0.6.8" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060ebeaea8c772e396215f69bb86d231ec8b7f36aca0dd6ce367ceaa9a8c33e6" +checksum = "680a86b63fe4c45fbd5dbf1ac6779409565211c4b234d20af94cf1f79d11f23a" dependencies = [ "alloy-consensus", "alloy-eips", @@ -5387,9 +5419,9 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" -version = "0.6.8" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864dbd5511ef4ef00b6c2c980739259b25b24048007b7751ca0069b30b1e3fee" +checksum = "eeff9cf6fcdf8ef7183f254f9ad59b6e87af5084f21dfa17ba00c4448a84ddf1" dependencies = [ "alloy-eips", "alloy-primitives", @@ -7312,6 +7344,7 @@ dependencies = [ "futures", "itertools 0.13.0", "pin-project", + "reth-consensus-common", "reth-engine-primitives", "reth-errors", "reth-ethereum-forks", @@ -8301,6 +8334,7 @@ dependencies = [ "op-alloy-consensus", "reth-chainspec", "reth-consensus", + "reth-consensus-common", "reth-ethereum-forks", "reth-evm", "reth-execution-errors", @@ -9519,9 +9553,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747291a18ad6726a08dd73f8b6a6b3a844db582ecae2063ccf0a04880c44f482" +checksum = "41bbeb6004cc4ed48d27756f0479011df91a6f5642a3abab9309eda5ce67c4ad" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", diff --git a/Cargo.toml b/Cargo.toml index 0f6193812..d0f321149 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -423,7 +423,7 @@ reth-trie-sparse = { path = "crates/trie/sparse" } # revm revm = { version = "18.0.0", features = ["std"], default-features = false } -revm-inspectors = "0.11.0" +revm-inspectors = "0.12.0" revm-primitives = { version = "14.0.0", features = [ "std", ], default-features = false } @@ -436,46 +436,46 @@ alloy-rlp = { version = "0.3.4", default-features = false } alloy-sol-types = "0.8.11" alloy-trie = { version = "0.7", default-features = false } -alloy-consensus = { version = "0.6.4", default-features = false } -alloy-contract = { version = "0.6.4", default-features = false } -alloy-eips = { version = "0.6.4", default-features = false } -alloy-genesis = { version = "0.6.4", default-features = false } -alloy-json-rpc = { version = "0.6.4", default-features = false } -alloy-network = { version = "0.6.4", default-features = false } -alloy-network-primitives = { version = "0.6.4", default-features = false } -alloy-node-bindings = { version = "0.6.4", default-features = false } -alloy-provider = { version = "0.6.4", features = [ +alloy-consensus = { version = "0.7.0", default-features = false } +alloy-contract = { version = "0.7.0", default-features = false } +alloy-eips = { version = "0.7.0", default-features = false } +alloy-genesis = { version = "0.7.0", default-features = false } +alloy-json-rpc = { version = "0.7.0", default-features = false } +alloy-network = { version = "0.7.0", default-features = false } +alloy-network-primitives = { version = "0.7.0", default-features = false } +alloy-node-bindings = { version = "0.7.0", default-features = false } +alloy-provider = { version = "0.7.0", features = [ "reqwest", ], default-features = false } -alloy-pubsub = { version = "0.6.4", default-features = false } -alloy-rpc-client = { version = "0.6.4", default-features = false } -alloy-rpc-types = { version = "0.6.4", features = [ +alloy-pubsub = { version = "0.7.0", default-features = false } +alloy-rpc-client = { version = "0.7.0", default-features = false } +alloy-rpc-types = { version = "0.7.0", features = [ "eth", ], default-features = false } -alloy-rpc-types-admin = { version = "0.6.4", default-features = false } -alloy-rpc-types-anvil = { version = "0.6.4", default-features = false } -alloy-rpc-types-beacon = { version = "0.6.4", default-features = false } -alloy-rpc-types-debug = { version = "0.6.4", default-features = false } -alloy-rpc-types-engine = { version = "0.6.4", default-features = false } -alloy-rpc-types-eth = { version = "0.6.4", default-features = false } -alloy-rpc-types-mev = { version = "0.6.4", default-features = false } -alloy-rpc-types-trace = { version = "0.6.4", default-features = false } -alloy-rpc-types-txpool = { version = "0.6.4", default-features = false } -alloy-serde = { version = "0.6.4", default-features = false } -alloy-signer = { version = "0.6.4", default-features = false } -alloy-signer-local = { version = "0.6.4", default-features = false } -alloy-transport = { version = "0.6.4" } -alloy-transport-http = { version = "0.6.4", features = [ +alloy-rpc-types-admin = { version = "0.7.0", default-features = false } +alloy-rpc-types-anvil = { version = "0.7.0", default-features = false } +alloy-rpc-types-beacon = { version = "0.7.0", default-features = false } +alloy-rpc-types-debug = { version = "0.7.0", default-features = false } +alloy-rpc-types-engine = { version = "0.7.0", default-features = false } +alloy-rpc-types-eth = { version = "0.7.0", default-features = false } +alloy-rpc-types-mev = { version = "0.7.0", default-features = false } +alloy-rpc-types-trace = { version = "0.7.0", default-features = false } +alloy-rpc-types-txpool = { version = "0.7.0", default-features = false } +alloy-serde = { version = "0.7.0", default-features = false } +alloy-signer = { version = "0.7.0", default-features = false } +alloy-signer-local = { version = "0.7.0", default-features = false } +alloy-transport = { version = "0.7.0" } +alloy-transport-http = { version = "0.7.0", features = [ "reqwest-rustls-tls", ], default-features = false } -alloy-transport-ipc = { version = "0.6.4", default-features = false } -alloy-transport-ws = { version = "0.6.4", default-features = false } +alloy-transport-ipc = { version = "0.7.0", default-features = false } +alloy-transport-ws = { version = "0.7.0", default-features = false } # op -op-alloy-rpc-types = "0.6.7" -op-alloy-rpc-types-engine = "0.6.7" -op-alloy-network = "0.6.7" -op-alloy-consensus = "0.6.7" +op-alloy-rpc-types = "0.7.1" +op-alloy-rpc-types-engine = "0.7.1" +op-alloy-network = "0.7.1" +op-alloy-consensus = "0.7.1" # misc aquamarine = "0.6" @@ -611,35 +611,36 @@ tikv-jemalloc-ctl = "0.6" tikv-jemallocator = "0.6" tracy-client = "0.17.3" -#[patch.crates-io] -#alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } -#alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "a971b3a" } +# [patch.crates-io] +# alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-network-primitives = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } +# alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "5492e40" } -#op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } -#op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } -#op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } -#op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" } +# op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" } +# op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" } +# op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" } +# op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "debfc29" } diff --git a/bin/reth/src/commands/debug_cmd/build_block.rs b/bin/reth/src/commands/debug_cmd/build_block.rs index e08c32b93..c7e1be893 100644 --- a/bin/reth/src/commands/debug_cmd/build_block.rs +++ b/bin/reth/src/commands/debug_cmd/build_block.rs @@ -224,6 +224,8 @@ impl> Command { suggested_fee_recipient: self.suggested_fee_recipient, // TODO: add support for withdrawals withdrawals: None, + target_blobs_per_block: None, + max_blobs_per_block: None, }; let payload_config = PayloadConfig::new( Arc::new(SealedHeader::new(best_block.header().clone(), best_block.hash())), diff --git a/crates/chain-state/src/in_memory.rs b/crates/chain-state/src/in_memory.rs index 349758725..3cd6f4645 100644 --- a/crates/chain-state/src/in_memory.rs +++ b/crates/chain-state/src/in_memory.rs @@ -12,8 +12,8 @@ use reth_chainspec::ChainInfo; use reth_execution_types::{Chain, ExecutionOutcome}; use reth_metrics::{metrics::Gauge, Metrics}; use reth_primitives::{ - BlockWithSenders, EthPrimitives, HeaderExt, NodePrimitives, Receipts, SealedBlock, - SealedBlockFor, SealedBlockWithSenders, SealedHeader, TransactionMeta, + BlockWithSenders, EthPrimitives, NodePrimitives, Receipts, SealedBlock, SealedBlockFor, + SealedBlockWithSenders, SealedHeader, TransactionMeta, }; use reth_primitives_traits::{Block, BlockBody as _, SignedTransaction}; use reth_storage_api::StateProviderBox; diff --git a/crates/consensus/common/src/validation.rs b/crates/consensus/common/src/validation.rs index 8035f8bf6..dce7d2579 100644 --- a/crates/consensus/common/src/validation.rs +++ b/crates/consensus/common/src/validation.rs @@ -495,7 +495,8 @@ mod tests { blob_gas_used: None, excess_blob_gas: None, parent_beacon_block_root: None, - requests_hash: None + requests_hash: None, + target_blobs_per_block: None, }; // size: 0x9b5 diff --git a/crates/engine/local/src/payload.rs b/crates/engine/local/src/payload.rs index 5111360d5..6355a2a00 100644 --- a/crates/engine/local/src/payload.rs +++ b/crates/engine/local/src/payload.rs @@ -39,6 +39,8 @@ where .chain_spec .is_cancun_active_at_timestamp(timestamp) .then(B256::random), + target_blobs_per_block: None, + max_blobs_per_block: None, } } } diff --git a/crates/engine/util/Cargo.toml b/crates/engine/util/Cargo.toml index 6eb22340e..54f9321f2 100644 --- a/crates/engine/util/Cargo.toml +++ b/crates/engine/util/Cargo.toml @@ -14,6 +14,7 @@ workspace = true # reth reth-primitives.workspace = true reth-errors.workspace = true +reth-consensus-common.workspace = true reth-fs-util.workspace = true reth-rpc-types-compat.workspace = true reth-engine-primitives.workspace = true diff --git a/crates/engine/util/src/reorg.rs b/crates/engine/util/src/reorg.rs index 20e2b2144..8e9a195a1 100644 --- a/crates/engine/util/src/reorg.rs +++ b/crates/engine/util/src/reorg.rs @@ -415,11 +415,12 @@ where transactions_root: proofs::calculate_transaction_root(&transactions), receipts_root: outcome.receipts_root_slow(reorg_target.header.number).unwrap(), logs_bloom: outcome.block_logs_bloom(reorg_target.header.number).unwrap(), - requests_hash: None, // TODO(prague) gas_used: cumulative_gas_used, blob_gas_used: blob_gas_used.map(Into::into), excess_blob_gas: excess_blob_gas.map(Into::into), state_root: state_provider.state_root(hashed_state)?, + requests_hash: None, // TODO(prague) + target_blobs_per_block: None, // TODO(prague) }, body: BlockBody { transactions, diff --git a/crates/ethereum/engine-primitives/src/payload.rs b/crates/ethereum/engine-primitives/src/payload.rs index 094a1df26..ff07856f1 100644 --- a/crates/ethereum/engine-primitives/src/payload.rs +++ b/crates/ethereum/engine-primitives/src/payload.rs @@ -332,6 +332,8 @@ mod tests { .unwrap(), withdrawals: None, parent_beacon_block_root: None, + target_blobs_per_block: None, + max_blobs_per_block: None, }; // Verify that the generated payload ID matches the expected value @@ -369,6 +371,8 @@ mod tests { }, ]), parent_beacon_block_root: None, + target_blobs_per_block: None, + max_blobs_per_block: None, }; // Verify that the generated payload ID matches the expected value @@ -401,6 +405,8 @@ mod tests { ) .unwrap(), ), + target_blobs_per_block: None, + max_blobs_per_block: None, }; // Verify that the generated payload ID matches the expected value diff --git a/crates/ethereum/evm/src/execute.rs b/crates/ethereum/evm/src/execute.rs index fdbc9eefd..3bfc3cb2e 100644 --- a/crates/ethereum/evm/src/execute.rs +++ b/crates/ethereum/evm/src/execute.rs @@ -4,7 +4,7 @@ use crate::{ dao_fork::{DAO_HARDFORK_BENEFICIARY, DAO_HARDKFORK_ACCOUNTS}, EthEvmConfig, }; -use alloc::{boxed::Box, sync::Arc, vec, vec::Vec}; +use alloc::{boxed::Box, sync::Arc, vec::Vec}; use alloy_consensus::Transaction as _; use alloy_eips::eip7685::Requests; use core::fmt::Display; @@ -232,7 +232,12 @@ where let deposit_requests = crate::eip6110::parse_deposits_from_receipts(&self.chain_spec, receipts)?; - let mut requests = Requests::new(vec![deposit_requests]); + let mut requests = Requests::default(); + + if !deposit_requests.is_empty() { + requests.push_request(core::iter::once(0).chain(deposit_requests).collect()); + } + requests.extend(self.system_caller.apply_post_execution_changes(&mut evm)?); requests } else { @@ -1127,9 +1132,9 @@ mod tests { let receipt = receipts.first().unwrap(); assert!(receipt.success); - assert!(requests[0].is_empty(), "there should be no deposits"); - assert!(!requests[1].is_empty(), "there should be a withdrawal"); - assert!(requests[2].is_empty(), "there should be no consolidations"); + // There should be exactly one entry with withdrawal requests + assert_eq!(requests.len(), 1); + assert_eq!(requests[0][0], 1); } #[test] diff --git a/crates/ethereum/node/tests/e2e/rpc.rs b/crates/ethereum/node/tests/e2e/rpc.rs index 54bfbc820..664f447cf 100644 --- a/crates/ethereum/node/tests/e2e/rpc.rs +++ b/crates/ethereum/node/tests/e2e/rpc.rs @@ -1,5 +1,5 @@ use crate::utils::eth_payload_attributes; -use alloy_eips::{calc_next_block_base_fee, eip2718::Encodable2718}; +use alloy_eips::{calc_next_block_base_fee, eip2718::Encodable2718, eip4844}; use alloy_primitives::{Address, B256, U256}; use alloy_provider::{network::EthereumWallet, Provider, ProviderBuilder, SendableTx}; use alloy_rpc_types_beacon::relay::{ @@ -240,6 +240,7 @@ async fn test_flashbots_validate_v4() -> eyre::Result<()> { execution_payload: block_to_payload_v3(payload.block().clone()), blobs_bundle: BlobsBundleV1::new([]), execution_requests: payload.requests().unwrap_or_default().to_vec(), + target_blobs_per_block: eip4844::TARGET_BLOBS_PER_BLOCK, signature: Default::default(), }, parent_beacon_block_root: attrs.parent_beacon_block_root.unwrap(), diff --git a/crates/ethereum/node/tests/e2e/utils.rs b/crates/ethereum/node/tests/e2e/utils.rs index ee451b8f3..84741a46a 100644 --- a/crates/ethereum/node/tests/e2e/utils.rs +++ b/crates/ethereum/node/tests/e2e/utils.rs @@ -26,6 +26,8 @@ pub(crate) fn eth_payload_attributes(timestamp: u64) -> EthPayloadBuilderAttribu suggested_fee_recipient: Address::ZERO, withdrawals: Some(vec![]), parent_beacon_block_root: Some(B256::ZERO), + target_blobs_per_block: None, + max_blobs_per_block: None, }; EthPayloadBuilderAttributes::new(B256::ZERO, attributes) } diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index 43bb04504..a5c643431 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -10,7 +10,10 @@ #![allow(clippy::useless_let_if_seq)] use alloy_consensus::{Header, EMPTY_OMMER_ROOT_HASH}; -use alloy_eips::{eip4844::MAX_DATA_GAS_PER_BLOCK, eip7685::Requests, merge::BEACON_NONCE}; +use alloy_eips::{ + eip4844::MAX_DATA_GAS_PER_BLOCK, eip7002::WITHDRAWAL_REQUEST_TYPE, + eip7251::CONSOLIDATION_REQUEST_TYPE, eip7685::Requests, merge::BEACON_NONCE, +}; use alloy_primitives::U256; use reth_basic_payload_builder::{ commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder, @@ -365,7 +368,27 @@ where ) .map_err(|err| PayloadBuilderError::Internal(err.into()))?; - Some(Requests::new(vec![deposit_requests, withdrawal_requests, consolidation_requests])) + let mut requests = Requests::default(); + + if !deposit_requests.is_empty() { + requests.push_request(core::iter::once(0).chain(deposit_requests).collect()); + } + + if !withdrawal_requests.is_empty() { + requests.push_request( + core::iter::once(WITHDRAWAL_REQUEST_TYPE).chain(withdrawal_requests).collect(), + ); + } + + if !consolidation_requests.is_empty() { + requests.push_request( + core::iter::once(CONSOLIDATION_REQUEST_TYPE) + .chain(consolidation_requests) + .collect(), + ); + } + + Some(requests) } else { None }; @@ -452,6 +475,7 @@ where blob_gas_used: blob_gas_used.map(Into::into), excess_blob_gas: excess_blob_gas.map(Into::into), requests_hash, + target_blobs_per_block: None, }; let withdrawals = chain_spec diff --git a/crates/evm/execution-types/src/execution_outcome.rs b/crates/evm/execution-types/src/execution_outcome.rs index 412269ace..7acbfea33 100644 --- a/crates/evm/execution-types/src/execution_outcome.rs +++ b/crates/evm/execution-types/src/execution_outcome.rs @@ -334,7 +334,7 @@ impl ExecutionOutcome { } } -impl ExecutionOutcome { +impl> ExecutionOutcome { /// Returns an iterator over all block logs. pub fn logs(&self, block_number: BlockNumber) -> Option> { let index = self.block_number_to_index(block_number)?; diff --git a/crates/evm/src/system_calls/mod.rs b/crates/evm/src/system_calls/mod.rs index fd9a1bf5f..2a5b80ad6 100644 --- a/crates/evm/src/system_calls/mod.rs +++ b/crates/evm/src/system_calls/mod.rs @@ -1,9 +1,11 @@ //! System contract call functions. use crate::ConfigureEvm; -use alloc::{boxed::Box, sync::Arc, vec}; +use alloc::{boxed::Box, sync::Arc}; use alloy_consensus::Header; -use alloy_eips::eip7685::Requests; +use alloy_eips::{ + eip7002::WITHDRAWAL_REQUEST_TYPE, eip7251::CONSOLIDATION_REQUEST_TYPE, eip7685::Requests, +}; use alloy_primitives::Bytes; use core::fmt::Display; use reth_chainspec::EthereumHardforks; @@ -127,13 +129,27 @@ where DB: Database + DatabaseCommit, DB::Error: Display, { - // todo + let mut requests = Requests::default(); + // Collect all EIP-7685 requests let withdrawal_requests = self.apply_withdrawal_requests_contract_call(evm)?; + if !withdrawal_requests.is_empty() { + requests.push_request( + core::iter::once(WITHDRAWAL_REQUEST_TYPE).chain(withdrawal_requests).collect(), + ); + } // Collect all EIP-7251 requests let consolidation_requests = self.apply_consolidation_requests_contract_call(evm)?; - Ok(Requests::new(vec![withdrawal_requests, consolidation_requests])) + if !consolidation_requests.is_empty() { + requests.push_request( + core::iter::once(CONSOLIDATION_REQUEST_TYPE) + .chain(consolidation_requests) + .collect(), + ); + } + + Ok(requests) } /// Applies the pre-block call to the EIP-2935 blockhashes contract. diff --git a/crates/net/eth-wire-types/src/blocks.rs b/crates/net/eth-wire-types/src/blocks.rs index 97bbe36b3..e6506e86a 100644 --- a/crates/net/eth-wire-types/src/blocks.rs +++ b/crates/net/eth-wire-types/src/blocks.rs @@ -258,7 +258,8 @@ mod tests { blob_gas_used: None, excess_blob_gas: None, parent_beacon_block_root: None, - requests_hash: None + requests_hash: None, + target_blobs_per_block: None, }, ]), }.encode(&mut data); @@ -293,7 +294,8 @@ mod tests { blob_gas_used: None, excess_blob_gas: None, parent_beacon_block_root: None, - requests_hash: None + requests_hash: None, + target_blobs_per_block: None, }, ]), }; @@ -393,7 +395,8 @@ mod tests { blob_gas_used: None, excess_blob_gas: None, parent_beacon_block_root: None, - requests_hash: None + requests_hash: None, + target_blobs_per_block: None, }, ], withdrawals: None, @@ -468,7 +471,8 @@ mod tests { blob_gas_used: None, excess_blob_gas: None, parent_beacon_block_root: None, - requests_hash: None + requests_hash: None, + target_blobs_per_block: None, }, ], withdrawals: None, diff --git a/crates/net/eth-wire-types/src/header.rs b/crates/net/eth-wire-types/src/header.rs index 9fa3b150d..883db625c 100644 --- a/crates/net/eth-wire-types/src/header.rs +++ b/crates/net/eth-wire-types/src/header.rs @@ -142,7 +142,8 @@ mod tests { blob_gas_used: None, excess_blob_gas: None, parent_beacon_block_root: None, - requests_hash: None + requests_hash: None, + target_blobs_per_block: None, }; assert_eq!(header.hash_slow(), expected_hash); } @@ -256,6 +257,7 @@ mod tests { excess_blob_gas: Some(0), parent_beacon_block_root: None, requests_hash: None, + target_blobs_per_block: None, }; let header = Header::decode(&mut data.as_slice()).unwrap(); @@ -296,6 +298,7 @@ mod tests { blob_gas_used: Some(0), excess_blob_gas: Some(0x1600000), requests_hash: None, + target_blobs_per_block: None, }; let header = Header::decode(&mut data.as_slice()).unwrap(); diff --git a/crates/optimism/evm/Cargo.toml b/crates/optimism/evm/Cargo.toml index b5d6fac50..d03a1c649 100644 --- a/crates/optimism/evm/Cargo.toml +++ b/crates/optimism/evm/Cargo.toml @@ -21,6 +21,7 @@ reth-execution-errors.workspace = true reth-execution-types.workspace = true reth-prune-types.workspace = true reth-consensus.workspace = true +reth-consensus-common.workspace = true # ethereum alloy-eips.workspace = true diff --git a/crates/optimism/node/src/engine.rs b/crates/optimism/node/src/engine.rs index 57b76b904..063ac3617 100644 --- a/crates/optimism/node/src/engine.rs +++ b/crates/optimism/node/src/engine.rs @@ -229,6 +229,8 @@ mod test { suggested_fee_recipient: Address::ZERO, withdrawals: Some(vec![]), parent_beacon_block_root: Some(B256::ZERO), + target_blobs_per_block: None, + max_blobs_per_block: None, }, } } diff --git a/crates/optimism/node/src/utils.rs b/crates/optimism/node/src/utils.rs index 9cadcdcf7..147aaac59 100644 --- a/crates/optimism/node/src/utils.rs +++ b/crates/optimism/node/src/utils.rs @@ -55,6 +55,8 @@ pub fn optimism_payload_attributes(timestamp: u64) -> OpPayloadBuilderAttributes suggested_fee_recipient: Address::ZERO, withdrawals: Some(vec![]), parent_beacon_block_root: Some(B256::ZERO), + target_blobs_per_block: None, + max_blobs_per_block: None, }; OpPayloadBuilderAttributes { diff --git a/crates/optimism/payload/src/builder.rs b/crates/optimism/payload/src/builder.rs index fbf99c78d..aeaa8ef40 100644 --- a/crates/optimism/payload/src/builder.rs +++ b/crates/optimism/payload/src/builder.rs @@ -410,6 +410,7 @@ where blob_gas_used, excess_blob_gas, requests_hash: None, + target_blobs_per_block: None, }; // seal the block diff --git a/crates/optimism/payload/src/payload.rs b/crates/optimism/payload/src/payload.rs index 1a951abad..e243745ce 100644 --- a/crates/optimism/payload/src/payload.rs +++ b/crates/optimism/payload/src/payload.rs @@ -370,7 +370,9 @@ mod tests { prev_randao: b256!("9158595abbdab2c90635087619aa7042bbebe47642dfab3c9bfb934f6b082765"), suggested_fee_recipient: address!("4200000000000000000000000000000000000011"), withdrawals: Some([].into()), - parent_beacon_block_root: b256!("8fe0193b9bf83cb7e5a08538e494fecc23046aab9a497af3704f4afdae3250ff").into() + parent_beacon_block_root: b256!("8fe0193b9bf83cb7e5a08538e494fecc23046aab9a497af3704f4afdae3250ff").into(), + target_blobs_per_block: None, + max_blobs_per_block: None, }, transactions: Some([bytes!("7ef8f8a0dc19cfa777d90980e4875d0a548a881baaa3f83f14d1bc0d3038bc329350e54194deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e20000f424000000000000000000000000300000000670d6d890000000000000125000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000014bf9181db6e381d4384bbf69c48b0ee0eed23c6ca26143c6d2544f9d39997a590000000000000000000000007f83d659683caf2767fd3c720981d51f5bc365bc")].into()), no_tx_pool: None, diff --git a/crates/optimism/primitives/src/bedrock.rs b/crates/optimism/primitives/src/bedrock.rs index 204b34d33..3a345abe2 100644 --- a/crates/optimism/primitives/src/bedrock.rs +++ b/crates/optimism/primitives/src/bedrock.rs @@ -85,6 +85,7 @@ pub const BEDROCK_HEADER: Header = Header { excess_blob_gas: None, parent_beacon_block_root: None, requests_hash: None, + target_blobs_per_block: None, }; /// Bedrock total difficulty on Optimism Mainnet. diff --git a/crates/optimism/primitives/src/transaction/mod.rs b/crates/optimism/primitives/src/transaction/mod.rs index 070b3d984..5861a3229 100644 --- a/crates/optimism/primitives/src/transaction/mod.rs +++ b/crates/optimism/primitives/src/transaction/mod.rs @@ -123,6 +123,10 @@ impl alloy_consensus::Transaction for OpTransaction { self.0.kind() } + fn is_create(&self) -> bool { + self.0.is_create() + } + fn value(&self) -> Uint<256, 4> { self.0.value() } diff --git a/crates/primitives-traits/src/receipt.rs b/crates/primitives-traits/src/receipt.rs index e2af40c44..435748c4e 100644 --- a/crates/primitives-traits/src/receipt.rs +++ b/crates/primitives-traits/src/receipt.rs @@ -22,7 +22,7 @@ pub trait Receipt: + Clone + Default + fmt::Debug - + TxReceipt + + TxReceipt + alloy_rlp::Encodable + alloy_rlp::Decodable + MaybeSerde diff --git a/crates/primitives/src/alloy_compat.rs b/crates/primitives/src/alloy_compat.rs index a72c83996..06451c30b 100644 --- a/crates/primitives/src/alloy_compat.rs +++ b/crates/primitives/src/alloy_compat.rs @@ -58,6 +58,7 @@ impl TryFrom for Block { excess_blob_gas, parent_beacon_block_root, requests_hash, + target_blobs_per_block, } = block.header.inner; Ok(Self { @@ -84,6 +85,7 @@ impl TryFrom for Block { excess_blob_gas, parent_beacon_block_root, requests_hash, + target_blobs_per_block, }, body: BlockBody { transactions, diff --git a/crates/primitives/src/receipt.rs b/crates/primitives/src/receipt.rs index 95d707d1b..79e15b89d 100644 --- a/crates/primitives/src/receipt.rs +++ b/crates/primitives/src/receipt.rs @@ -73,6 +73,8 @@ impl Receipt { } impl TxReceipt for Receipt { + type Log = Log; + fn status_or_post_state(&self) -> Eip658Value { self.success.into() } diff --git a/crates/primitives/src/traits.rs b/crates/primitives/src/traits.rs index ec4e75c8c..73eabd8ec 100644 --- a/crates/primitives/src/traits.rs +++ b/crates/primitives/src/traits.rs @@ -3,8 +3,8 @@ use crate::{ BlockWithSenders, SealedBlock, }; use alloc::vec::Vec; -use alloy_eips::{eip2718::Encodable2718, BlockNumHash}; -use reth_primitives_traits::{Block, BlockBody, BlockHeader, SealedHeader, SignedTransaction}; +use alloy_eips::eip2718::Encodable2718; +use reth_primitives_traits::{Block, BlockBody, SealedHeader, SignedTransaction}; use revm_primitives::{Address, B256}; /// Extension trait for [`reth_primitives_traits::Block`] implementations @@ -121,17 +121,3 @@ pub trait BlockBodyTxExt: BlockBody { } impl BlockBodyTxExt for T {} - -/// Extension trait for [`BlockHeader`] adding useful helper methods. -pub trait HeaderExt: BlockHeader { - /// TODO: remove once is released - /// - /// Returns the parent block's number and hash - /// - /// Note: for the genesis block the parent number is 0 and the parent hash is the zero hash. - fn parent_num_hash(&self) -> BlockNumHash { - BlockNumHash::new(self.number().saturating_sub(1), self.parent_hash()) - } -} - -impl HeaderExt for T {} diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index e1524aa1d..f4c4a0f29 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -308,7 +308,7 @@ impl Transaction { set_code_tx.eip2718_encode(signature, out); } #[cfg(feature = "optimism")] - Self::Deposit(deposit_tx) => deposit_tx.eip2718_encode(out), + Self::Deposit(deposit_tx) => deposit_tx.encode_2718(out), } } @@ -675,6 +675,18 @@ impl alloy_consensus::Transaction for Transaction { } } + fn is_create(&self) -> bool { + match self { + Self::Legacy(tx) => tx.is_create(), + Self::Eip2930(tx) => tx.is_create(), + Self::Eip1559(tx) => tx.is_create(), + Self::Eip4844(tx) => tx.is_create(), + Self::Eip7702(tx) => tx.is_create(), + #[cfg(feature = "optimism")] + Self::Deposit(tx) => tx.is_create(), + } + } + fn value(&self) -> U256 { match self { Self::Legacy(tx) => tx.value(), @@ -1392,6 +1404,10 @@ impl alloy_consensus::Transaction for TransactionSigned { self.deref().kind() } + fn is_create(&self) -> bool { + self.deref().is_create() + } + fn value(&self) -> U256 { self.deref().value() } diff --git a/crates/primitives/src/transaction/pooled.rs b/crates/primitives/src/transaction/pooled.rs index 979a55f27..5015f5b8e 100644 --- a/crates/primitives/src/transaction/pooled.rs +++ b/crates/primitives/src/transaction/pooled.rs @@ -525,6 +525,16 @@ impl alloy_consensus::Transaction for PooledTransactionsElement { } } + fn is_create(&self) -> bool { + match self { + Self::Legacy(tx) => tx.tx().is_create(), + Self::Eip2930(tx) => tx.tx().is_create(), + Self::Eip1559(tx) => tx.tx().is_create(), + Self::Eip7702(tx) => tx.tx().is_create(), + Self::BlobTransaction(tx) => tx.tx().is_create(), + } + } + fn value(&self) -> U256 { match self { Self::Legacy(tx) => tx.tx().value(), diff --git a/crates/revm/src/batch.rs b/crates/revm/src/batch.rs index 36708b5ff..c980bdc98 100644 --- a/crates/revm/src/batch.rs +++ b/crates/revm/src/batch.rs @@ -3,7 +3,7 @@ use alloc::vec::Vec; use alloy_eips::eip7685::Requests; -use alloy_primitives::{map::HashSet, Address, BlockNumber}; +use alloy_primitives::{map::HashSet, Address, BlockNumber, Log}; use reth_execution_errors::{BlockExecutionError, InternalBlockExecutionError}; use reth_primitives::Receipts; use reth_primitives_traits::Receipt; @@ -131,7 +131,7 @@ impl BlockBatchRecord { /// Save receipts to the executor. pub fn save_receipts(&mut self, receipts: Vec) -> Result<(), BlockExecutionError> where - T: Receipt, + T: Receipt, { let mut receipts = receipts.into_iter().map(Some).collect(); // Prune receipts if necessary. @@ -144,7 +144,7 @@ impl BlockBatchRecord { /// Prune receipts according to the pruning configuration. fn prune_receipts(&mut self, receipts: &mut Vec>) -> Result<(), PruneSegmentError> where - T: Receipt, + T: Receipt, { let (Some(first_block), Some(tip)) = (self.first_block, self.tip) else { return Ok(()) }; diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index 1062363ea..8b57cb1f1 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -1,12 +1,17 @@ use crate::{ capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult, }; -use alloy_eips::{eip1898::BlockHashOrNumber, eip4844::BlobAndProofV1, eip7685::Requests}; +use alloy_eips::{ + eip1898::BlockHashOrNumber, + eip4844::BlobAndProofV1, + eip7685::{Requests, RequestsOrHash}, +}; use alloy_primitives::{BlockHash, BlockNumber, B256, U64}; use alloy_rpc_types_engine::{ CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2, ExecutionPayloadSidecar, ExecutionPayloadV1, ExecutionPayloadV3, - ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration, + ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, PraguePayloadFields, + TransitionConfiguration, }; use async_trait::async_trait; use jsonrpsee_core::RpcResult; @@ -279,7 +284,11 @@ where payload, ExecutionPayloadSidecar::v4( CancunPayloadFields { versioned_hashes, parent_beacon_block_root }, - execution_requests, + PraguePayloadFields { + requests: RequestsOrHash::Requests(execution_requests), + // TODO: add as an argument and handle in `try_into_block` + target_blobs_per_block: 0, + }, ), ) .await diff --git a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs index e1cd8f5c3..e3ef6621b 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs @@ -467,6 +467,7 @@ pub trait LoadPendingBlock: extra_data: Default::default(), parent_beacon_block_root, requests_hash, + target_blobs_per_block: None, }; // Convert Vec> to Vec diff --git a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs index 5bf6b0c02..43ac03ada 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/transaction.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/transaction.rs @@ -282,7 +282,7 @@ pub trait EthTransactions: LoadTransaction { block .transactions_with_sender() .enumerate() - .find(|(_, (signer, tx))| **signer == sender && tx.nonce() == nonce) + .find(|(_, (signer, tx))| **signer == sender && (*tx).nonce() == nonce) .map(|(index, (signer, tx))| { let tx_info = TransactionInfo { hash: Some(tx.hash()), diff --git a/crates/rpc/rpc-eth-types/src/receipt.rs b/crates/rpc/rpc-eth-types/src/receipt.rs index 3136d42e9..b7f82782b 100644 --- a/crates/rpc/rpc-eth-types/src/receipt.rs +++ b/crates/rpc/rpc-eth-types/src/receipt.rs @@ -14,7 +14,7 @@ pub fn build_receipt( meta: TransactionMeta, receipt: &Receipt, all_receipts: &[Receipt], - build_envelope: impl FnOnce(ReceiptWithBloom) -> T, + build_envelope: impl FnOnce(ReceiptWithBloom>) -> T, ) -> EthResult> { // Note: we assume this transaction is valid, because it's mined (or part of pending block) // and we don't need to check for pre EIP-2 diff --git a/crates/rpc/rpc-types-compat/src/engine/payload.rs b/crates/rpc/rpc-types-compat/src/engine/payload.rs index afe50d3af..f504d57ad 100644 --- a/crates/rpc/rpc-types-compat/src/engine/payload.rs +++ b/crates/rpc/rpc-types-compat/src/engine/payload.rs @@ -5,7 +5,6 @@ use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, Header, EMPTY_OMMER_RO use alloy_eips::{ eip2718::{Decodable2718, Encodable2718}, eip4895::Withdrawals, - eip7685::Requests, }; use alloy_primitives::{B256, U256}; use alloy_rpc_types_engine::{ @@ -77,6 +76,7 @@ pub fn try_payload_v1_to_block(payload: ExecutionPayloadV1) -> Result let db = db.0; + let tx_info = TransactionInfo { + block_number: Some( + env.block.number.try_into().unwrap_or_default(), + ), + base_fee: Some( + env.block.basefee.try_into().unwrap_or_default(), + ), + hash: None, + block_hash: None, + index: None, + }; + let (res, _) = this.eth_api().inspect(&mut *db, env, &mut inspector)?; let frame = inspector - .try_into_mux_frame(&res, db) + .try_into_mux_frame(&res, db, tx_info) .map_err(Eth::Error::from_eth_err)?; Ok(frame.into()) }) @@ -658,6 +670,17 @@ where ) -> Result<(GethTrace, revm_primitives::EvmState), Eth::Error> { let GethDebugTracingOptions { config, tracer, tracer_config, .. } = opts; + let tx_info = TransactionInfo { + hash: transaction_context.as_ref().map(|c| c.tx_hash).unwrap_or_default(), + index: transaction_context + .as_ref() + .map(|c| c.tx_index.map(|i| i as u64)) + .unwrap_or_default(), + block_hash: transaction_context.as_ref().map(|c| c.block_hash).unwrap_or_default(), + block_number: Some(env.block.number.try_into().unwrap_or_default()), + base_fee: Some(env.block.basefee.try_into().unwrap_or_default()), + }; + if let Some(tracer) = tracer { return match tracer { GethDebugTracerType::BuiltInTracer(tracer) => match tracer { @@ -723,7 +746,7 @@ where let (res, _) = self.eth_api().inspect(&mut *db, env, &mut inspector)?; let frame = inspector - .try_into_mux_frame(&res, db) + .try_into_mux_frame(&res, db, tx_info) .map_err(Eth::Error::from_eth_err)?; return Ok((frame.into(), res.state)) } @@ -738,14 +761,6 @@ where ); let (res, env) = self.eth_api().inspect(db, env, &mut inspector)?; - - let tx_info = TransactionInfo { - hash: transaction_context.unwrap().tx_hash, - index: transaction_context.unwrap().tx_index.map(|index| index as u64), - block_hash: transaction_context.unwrap().block_hash, - block_number: Some(env.block.number.try_into().unwrap_or_default()), - base_fee: Some(env.block.basefee.try_into().unwrap_or_default()), - }; let frame: FlatCallFrame = inspector .with_transaction_gas_limit(env.tx.gas_limit) .into_parity_builder() diff --git a/crates/rpc/rpc/src/eth/bundle.rs b/crates/rpc/rpc/src/eth/bundle.rs index 10eec4dbf..a80060b33 100644 --- a/crates/rpc/rpc/src/eth/bundle.rs +++ b/crates/rpc/rpc/src/eth/bundle.rs @@ -55,7 +55,9 @@ where let EthCallBundle { txs, block_number, + coinbase, state_block_number, + timeout: _, timestamp, gas_limit, difficulty, @@ -106,6 +108,10 @@ where // Note: the block number is considered the `parent` block: let (cfg, mut block_env, at) = self.eth_api().evm_env_at(block_id).await?; + if let Some(coinbase) = coinbase { + block_env.coinbase = coinbase; + } + // need to adjust the timestamp for the next block if let Some(timestamp) = timestamp { block_env.timestamp = U256::from(timestamp); @@ -117,8 +123,16 @@ where block_env.difficulty = U256::from(difficulty); } + // default to call gas limit unless user requests a smaller limit + block_env.gas_limit = U256::from(self.inner.eth_api.call_gas_limit()); if let Some(gas_limit) = gas_limit { - block_env.gas_limit = U256::from(gas_limit); + let gas_limit = U256::from(gas_limit); + if gas_limit > block_env.gas_limit { + return Err( + EthApiError::InvalidTransaction(RpcInvalidTransactionError::GasTooHigh).into() + ) + } + block_env.gas_limit = gas_limit; } if let Some(base_fee) = base_fee { diff --git a/crates/rpc/rpc/src/validation.rs b/crates/rpc/rpc/src/validation.rs index 1aa502c1f..91a3dae2c 100644 --- a/crates/rpc/rpc/src/validation.rs +++ b/crates/rpc/rpc/src/validation.rs @@ -1,11 +1,12 @@ use alloy_consensus::{BlobTransactionValidationError, EnvKzgSettings, Transaction, TxReceipt}; -use alloy_eips::eip4844::kzg_to_versioned_hash; +use alloy_eips::{eip4844::kzg_to_versioned_hash, eip7685::RequestsOrHash}; use alloy_rpc_types_beacon::relay::{ BidTrace, BuilderBlockValidationRequest, BuilderBlockValidationRequestV2, BuilderBlockValidationRequestV3, BuilderBlockValidationRequestV4, }; use alloy_rpc_types_engine::{ BlobsBundleV1, CancunPayloadFields, ExecutionPayload, ExecutionPayloadSidecar, PayloadError, + PraguePayloadFields, }; use async_trait::async_trait; use jsonrpsee::core::RpcResult; @@ -386,7 +387,12 @@ where versioned_hashes: self .validate_blobs_bundle(request.request.blobs_bundle)?, }, - request.request.execution_requests.into(), + PraguePayloadFields { + requests: RequestsOrHash::Requests( + request.request.execution_requests.into(), + ), + target_blobs_per_block: request.request.target_blobs_per_block, + }, ), )? .try_seal_with_senders() diff --git a/crates/storage/codecs/src/alloy/header.rs b/crates/storage/codecs/src/alloy/header.rs index 04b7d6ab7..418b8b903 100644 --- a/crates/storage/codecs/src/alloy/header.rs +++ b/crates/storage/codecs/src/alloy/header.rs @@ -58,6 +58,7 @@ pub(crate) struct Header { #[reth_codecs(crate = "crate")] pub(crate) struct HeaderExt { requests_hash: Option, + target_blobs_per_block: Option, } impl HeaderExt { @@ -65,7 +66,7 @@ impl HeaderExt { /// /// Required since [`Header`] uses `Option` as a field. const fn into_option(self) -> Option { - if self.requests_hash.is_some() { + if self.requests_hash.is_some() || self.target_blobs_per_block.is_some() { Some(self) } else { None @@ -78,7 +79,7 @@ impl Compact for AlloyHeader { where B: bytes::BufMut + AsMut<[u8]>, { - let extra_fields = HeaderExt { requests_hash: self.requests_hash }; + let extra_fields = HeaderExt { requests_hash: self.requests_hash, target_blobs_per_block: self.target_blobs_per_block }; let header = Header { parent_hash: self.parent_hash, @@ -128,8 +129,9 @@ impl Compact for AlloyHeader { blob_gas_used: header.blob_gas_used, excess_blob_gas: header.excess_blob_gas, parent_beacon_block_root: header.parent_beacon_block_root, - requests_hash: header.extra_fields.and_then(|h| h.requests_hash), + requests_hash: header.extra_fields.as_ref().and_then(|h| h.requests_hash), extra_data: header.extra_data, + target_blobs_per_block: header.extra_fields.as_ref().and_then(|h| h.target_blobs_per_block), }; (alloy_header, buf) } @@ -188,7 +190,7 @@ mod tests { #[test] fn test_extra_fields() { let mut header = HOLESKY_BLOCK; - header.extra_fields = Some(HeaderExt { requests_hash: Some(B256::random()) }); + header.extra_fields = Some(HeaderExt { requests_hash: Some(B256::random()), target_blobs_per_block: Some(3) }); let mut encoded_header = vec![]; let len = header.to_compact(&mut encoded_header); diff --git a/testing/ef-tests/src/models.rs b/testing/ef-tests/src/models.rs index 292b32e8c..742498e81 100644 --- a/testing/ef-tests/src/models.rs +++ b/testing/ef-tests/src/models.rs @@ -88,6 +88,8 @@ pub struct Header { pub parent_beacon_block_root: Option, /// Requests root. pub requests_hash: Option, + /// Target blobs per block. + pub target_blobs_per_block: Option, } impl From
for SealedHeader { @@ -114,6 +116,7 @@ impl From
for SealedHeader { excess_blob_gas: value.excess_blob_gas.map(|v| v.to::()), parent_beacon_block_root: value.parent_beacon_block_root, requests_hash: value.requests_hash, + target_blobs_per_block: value.target_blobs_per_block.map(|v| v.to::()), }; Self::new(header, value.hash) }