diff --git a/Cargo.lock b/Cargo.lock index 68308a1ee3..0b59ce1402 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3a590d13de3944675987394715f37537b50b856e3b23a0e66e97d963edbf38" +checksum = "ed1958f0294ecc05ebe7b3c9a8662a3e221c2523b7f2bcd94c7a651efbd510bf" dependencies = [ "alloy-eips", "alloy-primitives", @@ -149,9 +149,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f28f769d5ea999f0d8a105e434f483456a15b4e1fcb08edbbbe1650a497ff6d" +checksum = "f752e99497ddc39e22d547d7dfe516af10c979405a034ed90e69b914b7dddeae" dependencies = [ "alloy-consensus", "alloy-eips", @@ -164,9 +164,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990fa65cd132a99d3c3795a82b9f93ec82b81c7de3bab0bf26ca5c73286f7186" +checksum = "f2140796bc79150b1b7375daeab99750f0ff5e27b1f8b0aa81ccde229c7f02a2" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -255,19 +255,21 @@ checksum = "6adac476434bf024279164dcdca299309f0c7d1e3557024eb7a83f8d9d01c6b5" dependencies = [ "alloy-primitives", "alloy-rlp", + "arbitrary", "borsh", "serde", ] [[package]] name = "alloy-eips" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09535cbc646b0e0c6fcc12b7597eaed12cf86dff4c4fba9507a61e71b94f30eb" +checksum = "813a67f87e56b38554d18b182616ee5006e8e2bf9df96a0df8bf29dff1d52e3f" dependencies = [ "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", + "alloy-eip7928", "alloy-primitives", "alloy-rlp", "alloy-serde", @@ -287,9 +289,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.26.3" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a96827207397445a919a8adc49289b53cc74e48e460411740bba31cec2fc307d" +checksum = "1582933a9fc27c0953220eb4f18f6492ff577822e9a8d848890ff59f6b4f5beb" dependencies = [ "alloy-consensus", "alloy-eips", @@ -309,9 +311,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1005520ccf89fa3d755e46c1d992a9e795466c2e7921be2145ef1f749c5727de" +checksum = "05864eef929c4d28895ae4b4d8ac9c6753c4df66e873b9c8fafc8089b59c1502" dependencies = [ "alloy-eips", "alloy-primitives", @@ -350,9 +352,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b626409c98ba43aaaa558361bca21440c88fd30df7542c7484b9c7a1489cdb" +checksum = "d2dd146b3de349a6ffaa4e4e319ab3a90371fb159fb0bddeb1c7bbe8b1792eff" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -365,9 +367,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89924fdcfeee0e0fa42b1f10af42f92802b5d16be614a70897382565663bf7cf" +checksum = "8c12278ffbb8872dfba3b2f17d8ea5e8503c2df5155d9bc5ee342794bde505c3" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -391,9 +393,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0dbe56ff50065713ff8635d8712a0895db3ad7f209db9793ad8fcb6b1734aa" +checksum = "833037c04917bc2031541a60e8249e4ab5500e24c637c1c62e95e963a655d66f" dependencies = [ "alloy-consensus", "alloy-eips", @@ -404,9 +406,9 @@ dependencies = [ [[package]] name = "alloy-op-evm" -version = "0.26.3" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54dc5c46a92fc7267055a174d30efb34e2599a0047102a4d38a025ae521435ba" +checksum = "6f19214adae08ea95600c3ede76bcbf0c40b36a263534a8f441a4c732f60e868" dependencies = [ "alloy-consensus", "alloy-eips", @@ -467,9 +469,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b56f7a77513308a21a2ba0e9d57785a9d9d2d609e77f4e71a78a1192b83ff2d" +checksum = "eafa840b0afe01c889a3012bb2fde770a544f74eab2e2870303eb0a5fb869c48" dependencies = [ "alloy-chains", "alloy-consensus", @@ -512,9 +514,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94813abbd7baa30c700ea02e7f92319dbcb03bff77aeea92a3a9af7ba19c5c70" +checksum = "57b3a3b3e4efc9f4d30e3326b6bd6811231d16ef94837e18a802b44ca55119e6" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -556,9 +558,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff01723afc25ec4c5b04de399155bef7b6a96dfde2475492b1b7b4e7a4f46445" +checksum = "12768ae6303ec764905a8a7cd472aea9072f9f9c980d18151e26913da8ae0123" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -582,9 +584,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91bf006bb06b7d812591b6ac33395cb92f46c6a65cda11ee30b348338214f0f" +checksum = "0622d8bcac2f16727590aa33f4c3f05ea98130e7e4b4924bce8be85da5ad0dae" dependencies = [ "alloy-primitives", "alloy-rpc-types-engine", @@ -595,9 +597,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-admin" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b934c3bcdc6617563b45deb36a40881c8230b94d0546ea739dff7edb3aa2f6fd" +checksum = "c38c5ac70457ecc74e87fe1a5a19f936419224ded0eb0636241452412ca92733" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -607,9 +609,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e82145856df8abb1fefabef58cdec0f7d9abf337d4abd50c1ed7e581634acdd" +checksum = "ae8eb0e5d6c48941b61ab76fabab4af66f7d88309a98aa14ad3dec7911c1eba3" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -619,9 +621,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ca1c1dab27f531d3858f8b1a2d6bfb2da664be0c1083971078eb7b71abe4b" +checksum = "a1cf5a093e437dfd62df48e480f24e1a3807632358aad6816d7a52875f1c04aa" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -630,9 +632,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-beacon" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d92a9b4b268fac505ef7fb1dac9bb129d4fd7de7753f22a5b6e9f666f7f7de6" +checksum = "e07949e912479ef3b848e1cf8db54b534bdd7bc58e6c23f28ea9488960990c8c" dependencies = [ "alloy-eips", "alloy-primitives", @@ -650,9 +652,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab1ebed118b701c497e6541d2d11dfa6f3c6ae31a3c52999daa802fcdcc16b7" +checksum = "925ff0f48c2169c050f0ae7a82769bdf3f45723d6742ebb6a5efb4ed2f491b26" dependencies = [ "alloy-primitives", "derive_more", @@ -662,9 +664,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232f00fcbcd3ee3b9399b96223a8fc884d17742a70a44f9d7cef275f93e6e872" +checksum = "336ef381c7409f23c69f6e79bddc1917b6e832cff23e7a5cf84b9381d53582e6" dependencies = [ "alloy-consensus", "alloy-eips", @@ -683,9 +685,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5715d0bf7efbd360873518bd9f6595762136b5327a9b759a8c42ccd9b5e44945" +checksum = "28e97603095020543a019ab133e0e3dc38cd0819f19f19bdd70c642404a54751" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -705,9 +707,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-mev" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7b61941d2add2ee64646612d3eda92cbbde8e6c933489760b6222c8898c79be" +checksum = "2805153975e25d38e37ee100880e642d5b24e421ed3014a7d2dae1d9be77562e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -720,9 +722,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9763cc931a28682bd4b9a68af90057b0fbe80e2538a82251afd69d7ae00bbebf" +checksum = "f1aec4e1c66505d067933ea1a949a4fb60a19c4cfc2f109aa65873ea99e62ea8" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -734,9 +736,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "359a8caaa98cb49eed62d03f5bc511dd6dd5dee292238e8627a6e5690156df0f" +checksum = "25b73c1d6e4f1737a20d246dad5a0abd6c1b76ec4c3d153684ef8c6f1b6bb4f4" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -746,9 +748,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed8531cae8d21ee1c6571d0995f8c9f0652a6ef6452fde369283edea6ab7138" +checksum = "946a0d413dbb5cd9adba0de5f8a1a34d5b77deda9b69c1d7feed8fc875a1aa26" dependencies = [ "alloy-primitives", "arbitrary", @@ -758,9 +760,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb10ccd49d0248df51063fce6b716f68a315dd912d55b32178c883fd48b4021d" +checksum = "2f7481dc8316768f042495eaf305d450c32defbc9bce09d8bf28afcd956895bb" dependencies = [ "alloy-primitives", "async-trait", @@ -773,9 +775,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4d992d44e6c414ece580294abbadb50e74cfd4eaa69787350a4dfd4b20eaa1b" +checksum = "1259dac1f534a4c66c1d65237c89915d0010a2a91d6c3b0bada24dc5ee0fb917" dependencies = [ "alloy-consensus", "alloy-network", @@ -862,9 +864,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f50a9516736d22dd834cc2240e5bf264f338667cc1d9e514b55ec5a78b987ca" +checksum = "78f169b85eb9334871db986e7eaf59c58a03d86a30cc68b846573d47ed0656bb" dependencies = [ "alloy-json-rpc", "auto_impl", @@ -885,9 +887,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a18b541a6197cf9a084481498a766fdf32fefda0c35ea6096df7d511025e9f1" +checksum = "019821102e70603e2c141954418255bec539ef64ac4117f8e84fb493769acf73" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -900,9 +902,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8075911680ebc537578cacf9453464fd394822a0f68614884a9c63f9fbaf5e89" +checksum = "e574ca2f490fb5961d2cdd78188897392c46615cd88b35c202d34bbc31571a81" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -920,9 +922,9 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921d37a57e2975e5215f7dd0f28873ed5407c7af630d4831a4b5c737de4b0b8b" +checksum = "b92dea6996269769f74ae56475570e3586910661e037b7b52d50c9641f76c68f" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -957,9 +959,9 @@ dependencies = [ [[package]] name = "alloy-tx-macros" -version = "1.4.3" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2289a842d02fe63f8c466db964168bb2c7a9fdfb7b24816dbb17d45520575fb" +checksum = "45ceac797eb8a56bdf5ab1fab353072c17d472eab87645ca847afe720db3246d" dependencies = [ "darling 0.21.3", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index e2d2bd3b84..bc5df15fb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -485,10 +485,10 @@ revm-inspectors = "0.34.0" # eth alloy-chains = { version = "0.2.5", default-features = false } -alloy-dyn-abi = "1.4.3" +alloy-dyn-abi = "1.5.2" alloy-eip2124 = { version = "0.2.0", default-features = false } alloy-eip7928 = { version = "0.3.0", default-features = false } -alloy-evm = { version = "0.26.3", default-features = false } +alloy-evm = { version = "0.27.0", default-features = false } alloy-primitives = { version = "1.5.0", default-features = false, features = ["map-foldhash"] } alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] } alloy-sol-macro = "1.5.0" @@ -497,36 +497,36 @@ alloy-trie = { version = "0.9.1", default-features = false } alloy-hardforks = "0.4.5" -alloy-consensus = { version = "1.4.3", default-features = false } -alloy-contract = { version = "1.4.3", default-features = false } -alloy-eips = { version = "1.4.3", default-features = false } -alloy-genesis = { version = "1.4.3", default-features = false } -alloy-json-rpc = { version = "1.4.3", default-features = false } -alloy-network = { version = "1.4.3", default-features = false } -alloy-network-primitives = { version = "1.4.3", default-features = false } -alloy-provider = { version = "1.4.3", features = ["reqwest", "debug-api"], default-features = false } -alloy-pubsub = { version = "1.4.3", default-features = false } -alloy-rpc-client = { version = "1.4.3", default-features = false } -alloy-rpc-types = { version = "1.4.3", features = ["eth"], default-features = false } -alloy-rpc-types-admin = { version = "1.4.3", default-features = false } -alloy-rpc-types-anvil = { version = "1.4.3", default-features = false } -alloy-rpc-types-beacon = { version = "1.4.3", default-features = false } -alloy-rpc-types-debug = { version = "1.4.3", default-features = false } -alloy-rpc-types-engine = { version = "1.4.3", default-features = false } -alloy-rpc-types-eth = { version = "1.4.3", default-features = false } -alloy-rpc-types-mev = { version = "1.4.3", default-features = false } -alloy-rpc-types-trace = { version = "1.4.3", default-features = false } -alloy-rpc-types-txpool = { version = "1.4.3", default-features = false } -alloy-serde = { version = "1.4.3", default-features = false } -alloy-signer = { version = "1.4.3", default-features = false } -alloy-signer-local = { version = "1.4.3", default-features = false } -alloy-transport = { version = "1.4.3" } -alloy-transport-http = { version = "1.4.3", features = ["reqwest-rustls-tls"], default-features = false } -alloy-transport-ipc = { version = "1.4.3", default-features = false } -alloy-transport-ws = { version = "1.4.3", default-features = false } +alloy-consensus = { version = "1.5.2", default-features = false } +alloy-contract = { version = "1.5.2", default-features = false } +alloy-eips = { version = "1.5.2", default-features = false } +alloy-genesis = { version = "1.5.2", default-features = false } +alloy-json-rpc = { version = "1.5.2", default-features = false } +alloy-network = { version = "1.5.2", default-features = false } +alloy-network-primitives = { version = "1.5.2", default-features = false } +alloy-provider = { version = "1.5.2", features = ["reqwest", "debug-api"], default-features = false } +alloy-pubsub = { version = "1.5.2", default-features = false } +alloy-rpc-client = { version = "1.5.2", default-features = false } +alloy-rpc-types = { version = "1.5.2", features = ["eth"], default-features = false } +alloy-rpc-types-admin = { version = "1.5.2", default-features = false } +alloy-rpc-types-anvil = { version = "1.5.2", default-features = false } +alloy-rpc-types-beacon = { version = "1.5.2", default-features = false } +alloy-rpc-types-debug = { version = "1.5.2", default-features = false } +alloy-rpc-types-engine = { version = "1.5.2", default-features = false } +alloy-rpc-types-eth = { version = "1.5.2", default-features = false } +alloy-rpc-types-mev = { version = "1.5.2", default-features = false } +alloy-rpc-types-trace = { version = "1.5.2", default-features = false } +alloy-rpc-types-txpool = { version = "1.5.2", default-features = false } +alloy-serde = { version = "1.5.2", default-features = false } +alloy-signer = { version = "1.5.2", default-features = false } +alloy-signer-local = { version = "1.5.2", default-features = false } +alloy-transport = { version = "1.5.2" } +alloy-transport-http = { version = "1.5.2", features = ["reqwest-rustls-tls"], default-features = false } +alloy-transport-ipc = { version = "1.5.2", default-features = false } +alloy-transport-ws = { version = "1.5.2", default-features = false } # op -alloy-op-evm = { version = "0.26.3", default-features = false } +alloy-op-evm = { version = "0.27.0", default-features = false } alloy-op-hardforks = "0.4.4" op-alloy-rpc-types = { version = "0.23.1", default-features = false } op-alloy-rpc-types-engine = { version = "0.23.1", default-features = false } @@ -790,8 +790,8 @@ ipnet = "2.11" # jsonrpsee-http-client = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" } # jsonrpsee-types = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" } -# alloy-evm = { git = "https://github.com/alloy-rs/evm", rev = "a69f0b45a6b0286e16072cb8399e02ce6ceca353" } -# alloy-op-evm = { git = "https://github.com/alloy-rs/evm", rev = "a69f0b45a6b0286e16072cb8399e02ce6ceca353" } +# alloy-evm = { git = "https://github.com/alloy-rs/evm", rev = "df124c0" } +# alloy-op-evm = { git = "https://github.com/alloy-rs/evm", rev = "df124c0" } # revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "3020ea8" } diff --git a/crates/engine/tree/src/tree/payload_processor/mod.rs b/crates/engine/tree/src/tree/payload_processor/mod.rs index 6d61578f63..23da7c23cc 100644 --- a/crates/engine/tree/src/tree/payload_processor/mod.rs +++ b/crates/engine/tree/src/tree/payload_processor/mod.rs @@ -15,7 +15,7 @@ use crate::tree::{ }; use alloy_eip7928::BlockAccessList; use alloy_eips::eip1898::BlockWithParent; -use alloy_evm::{block::StateChangeSource, ToTxEnv}; +use alloy_evm::block::StateChangeSource; use alloy_primitives::B256; use crossbeam_channel::Sender as CrossbeamSender; use executor::WorkloadExecutor; @@ -25,6 +25,7 @@ use parking_lot::RwLock; use prewarm::PrewarmMetrics; use rayon::prelude::*; use reth_evm::{ + block::ExecutableTxParts, execute::{ExecutableTxFor, WithTxEnv}, ConfigureEvm, EvmEnvFor, ExecutableTxIterator, ExecutableTxTuple, OnStateHook, SpecFor, TxEnvFor, @@ -101,7 +102,7 @@ pub const SPARSE_TRIE_MAX_VALUES_SHRINK_CAPACITY: usize = 1_000_000; /// Type alias for [`PayloadHandle`] returned by payload processor spawn methods. type IteratorPayloadHandle = PayloadHandle< - WithTxEnv, ::Tx>, + WithTxEnv, >::Recovered>, ::Error, ::Receipt, >; @@ -369,8 +370,8 @@ where &self, transactions: I, ) -> ( - mpsc::Receiver, I::Tx>>, - mpsc::Receiver, I::Tx>, I::Error>>, + mpsc::Receiver, I::Recovered>>, + mpsc::Receiver, I::Recovered>, I::Error>>, usize, ) { let (transactions, convert) = transactions.into(); @@ -385,7 +386,10 @@ where self.executor.spawn_blocking(move || { transactions.enumerate().for_each_with(ooo_tx, |ooo_tx, (idx, tx)| { let tx = convert(tx); - let tx = tx.map(|tx| WithTxEnv { tx_env: tx.to_tx_env(), tx: Arc::new(tx) }); + let tx = tx.map(|tx| { + let (tx_env, tx) = tx.into_parts(); + WithTxEnv { tx_env, tx: Arc::new(tx) } + }); // Only send Ok(_) variants to prewarming task. if let Ok(tx) = &tx { let _ = prewarm_tx.send(tx.clone()); diff --git a/crates/engine/tree/src/tree/payload_processor/prewarm.rs b/crates/engine/tree/src/tree/payload_processor/prewarm.rs index 4f044e98fa..5c782ed1f5 100644 --- a/crates/engine/tree/src/tree/payload_processor/prewarm.rs +++ b/crates/engine/tree/src/tree/payload_processor/prewarm.rs @@ -29,7 +29,7 @@ use alloy_evm::Database; use alloy_primitives::{keccak256, map::B256Set, B256}; use crossbeam_channel::Sender as CrossbeamSender; use metrics::{Counter, Gauge, Histogram}; -use reth_evm::{execute::ExecutableTxFor, ConfigureEvm, Evm, EvmFor, SpecFor}; +use reth_evm::{execute::ExecutableTxFor, ConfigureEvm, Evm, EvmFor, RecoveredTx, SpecFor}; use reth_metrics::Metrics; use reth_primitives_traits::NodePrimitives; use reth_provider::{ @@ -609,7 +609,8 @@ where break } - let res = match evm.transact(&tx) { + let (tx_env, tx) = tx.into_parts(); + let res = match evm.transact(tx_env) { Ok(res) => res, Err(err) => { trace!( diff --git a/crates/ethereum/evm/src/receipt.rs b/crates/ethereum/evm/src/receipt.rs index ac8f5358c0..932c6ca0db 100644 --- a/crates/ethereum/evm/src/receipt.rs +++ b/crates/ethereum/evm/src/receipt.rs @@ -1,3 +1,4 @@ +use alloy_consensus::TxType; use alloy_evm::eth::receipt_builder::{ReceiptBuilder, ReceiptBuilderCtx}; use reth_ethereum_primitives::{Receipt, TransactionSigned}; use reth_evm::Evm; @@ -12,13 +13,10 @@ impl ReceiptBuilder for RethReceiptBuilder { type Transaction = TransactionSigned; type Receipt = Receipt; - fn build_receipt( - &self, - ctx: ReceiptBuilderCtx<'_, Self::Transaction, E>, - ) -> Self::Receipt { - let ReceiptBuilderCtx { tx, result, cumulative_gas_used, .. } = ctx; + fn build_receipt(&self, ctx: ReceiptBuilderCtx<'_, TxType, E>) -> Self::Receipt { + let ReceiptBuilderCtx { tx_type, result, cumulative_gas_used, .. } = ctx; Receipt { - tx_type: tx.tx_type(), + tx_type, // Success flag was added in `EIP-658: Embedding transaction status code in // receipts`. success: result.is_success(), diff --git a/crates/ethereum/evm/src/test_utils.rs b/crates/ethereum/evm/src/test_utils.rs index cf32d9e6bd..ed472c28a4 100644 --- a/crates/ethereum/evm/src/test_utils.rs +++ b/crates/ethereum/evm/src/test_utils.rs @@ -1,6 +1,6 @@ use crate::EthEvmConfig; use alloc::{boxed::Box, sync::Arc, vec, vec::Vec}; -use alloy_consensus::Header; +use alloy_consensus::{Header, TxType}; use alloy_eips::eip7685::Requests; use alloy_evm::precompiles::PrecompilesMap; use alloy_primitives::Bytes; @@ -11,14 +11,14 @@ use reth_evm::{ block::{ BlockExecutionError, BlockExecutor, BlockExecutorFactory, BlockExecutorFor, ExecutableTx, }, - eth::{EthBlockExecutionCtx, EthEvmContext}, + eth::{EthBlockExecutionCtx, EthEvmContext, EthTxResult}, ConfigureEngineEvm, ConfigureEvm, Database, EthEvm, EthEvmFactory, Evm, EvmEnvFor, EvmFactory, - ExecutableTxIterator, ExecutionCtxFor, + ExecutableTxIterator, ExecutionCtxFor, RecoveredTx, }; use reth_execution_types::{BlockExecutionResult, ExecutionOutcome}; use reth_primitives_traits::{BlockTy, SealedBlock, SealedHeader}; use revm::{ - context::result::{ExecutionResult, Output, ResultAndState, SuccessReason}, + context::result::{ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason}, database::State, Inspector, }; @@ -90,6 +90,7 @@ impl<'a, DB: Database, I: Inspector>>> BlockExec type Evm = EthEvm<&'a mut State, I, PrecompilesMap>; type Transaction = TransactionSigned; type Receipt = Receipt; + type Result = EthTxResult; fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError> { Ok(()) @@ -101,25 +102,25 @@ impl<'a, DB: Database, I: Inspector>>> BlockExec fn execute_transaction_without_commit( &mut self, - _tx: impl ExecutableTx, - ) -> Result::HaltReason>, BlockExecutionError> { - Ok(ResultAndState::new( - ExecutionResult::Success { - reason: SuccessReason::Return, - gas_used: 0, - gas_refunded: 0, - logs: vec![], - output: Output::Call(Bytes::from(vec![])), - }, - Default::default(), - )) + tx: impl ExecutableTx, + ) -> Result { + Ok(EthTxResult { + result: ResultAndState::new( + ExecutionResult::Success { + reason: SuccessReason::Return, + gas_used: 0, + gas_refunded: 0, + logs: vec![], + output: Output::Call(Bytes::from(vec![])), + }, + Default::default(), + ), + tx_type: tx.into_parts().1.tx().tx_type(), + blob_gas_used: 0, + }) } - fn commit_transaction( - &mut self, - _output: ResultAndState<::HaltReason>, - _tx: impl ExecutableTx, - ) -> Result { + fn commit_transaction(&mut self, _output: Self::Result) -> Result { Ok(0) } diff --git a/crates/evm/evm/src/engine.rs b/crates/evm/evm/src/engine.rs index 5663745f45..13f802c27a 100644 --- a/crates/evm/evm/src/engine.rs +++ b/crates/evm/evm/src/engine.rs @@ -1,5 +1,7 @@ -use crate::{execute::ExecutableTxFor, ConfigureEvm, EvmEnvFor, ExecutionCtxFor}; +use crate::{execute::ExecutableTxFor, ConfigureEvm, EvmEnvFor, ExecutionCtxFor, TxEnvFor}; +use alloy_evm::{block::ExecutableTxParts, RecoveredTx}; use rayon::prelude::*; +use reth_primitives_traits::TxTy; /// [`ConfigureEvm`] extension providing methods for executing payloads. pub trait ConfigureEngineEvm: ConfigureEvm { @@ -61,11 +63,16 @@ where /// Iterator over executable transactions. pub trait ExecutableTxIterator: - ExecutableTxTuple> + ExecutableTxTuple> { + /// HACK: for some reason, this duplicated AT is the only way to enforce the inner Recovered: + /// Send + Sync bound. Effectively alias for `Self::Tx::Recovered`. + type Recovered: RecoveredTx> + Send + Sync; } -impl ExecutableTxIterator for T where - T: ExecutableTxTuple> +impl ExecutableTxIterator for T +where + T: ExecutableTxTuple>, { + type Recovered = , TxTy>>::Recovered; } diff --git a/crates/evm/evm/src/execute.rs b/crates/evm/evm/src/execute.rs index 866099a996..540f86692d 100644 --- a/crates/evm/evm/src/execute.rs +++ b/crates/evm/evm/src/execute.rs @@ -6,7 +6,7 @@ use alloy_consensus::{BlockHeader, Header}; use alloy_eips::eip2718::WithEncoded; pub use alloy_evm::block::{BlockExecutor, BlockExecutorFactory}; use alloy_evm::{ - block::{CommitChanges, ExecutableTx}, + block::{CommitChanges, ExecutableTxParts}, Evm, EvmEnv, EvmFactory, RecoveredTx, ToTxEnv, }; use alloy_primitives::{Address, B256}; @@ -401,49 +401,31 @@ where /// Conversions for executable transactions. pub trait ExecutorTx { - /// Converts the transaction into [`ExecutableTx`]. - fn as_executable(&self) -> impl ExecutableTx; - - /// Converts the transaction into [`Recovered`]. - fn into_recovered(self) -> Recovered; + /// Converts the transaction into a tuple of [`TxEnvFor`] and [`Recovered`]. + fn into_parts(self) -> (::Tx, Recovered); } impl ExecutorTx for WithEncoded> { - fn as_executable(&self) -> impl ExecutableTx { - self - } - - fn into_recovered(self) -> Recovered { - self.1 + fn into_parts(self) -> (::Tx, Recovered) { + (self.to_tx_env(), self.1) } } impl ExecutorTx for Recovered { - fn as_executable(&self) -> impl ExecutableTx { - self - } - - fn into_recovered(self) -> Self { - self + fn into_parts(self) -> (::Tx, Self) { + (self.to_tx_env(), self) } } -impl ExecutorTx - for WithTxEnv<<::Evm as Evm>::Tx, T> +impl ExecutorTx + for WithTxEnv<::Tx, Recovered> where - T: ExecutorTx + Clone, - Executor: BlockExecutor, - <::Evm as Evm>::Tx: Clone, - Self: RecoveredTx, + Executor: BlockExecutor, { - fn as_executable(&self) -> impl ExecutableTx { - self - } - - fn into_recovered(self) -> Recovered { - Arc::unwrap_or_clone(self.tx).into_recovered() + fn into_parts(self) -> (::Tx, Recovered) { + (self.tx_env, Arc::unwrap_or_clone(self.tx)) } } @@ -479,10 +461,11 @@ where &ExecutionResult<<::Evm as Evm>::HaltReason>, ) -> CommitChanges, ) -> Result, BlockExecutionError> { + let (tx_env, tx) = tx.into_parts(); if let Some(gas_used) = - self.executor.execute_transaction_with_commit_condition(tx.as_executable(), f)? + self.executor.execute_transaction_with_commit_condition((tx_env, &tx), f)? { - self.transactions.push(tx.into_recovered()); + self.transactions.push(tx); Ok(Some(gas_used)) } else { Ok(None) @@ -609,20 +592,20 @@ where } } -/// A helper trait marking a 'static type that can be converted into an [`ExecutableTx`] for block -/// executor. +/// A helper trait marking a 'static type that can be converted into an [`ExecutableTxParts`] for +/// block executor. pub trait ExecutableTxFor: - ToTxEnv> + RecoveredTx> + ExecutableTxParts, TxTy> + RecoveredTx> { } impl ExecutableTxFor for T where - T: ToTxEnv> + RecoveredTx> + T: ExecutableTxParts, TxTy> + RecoveredTx> { } /// A container for a transaction and a transaction environment. -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct WithTxEnv { /// The transaction environment for EVM. pub tx_env: TxEnv, @@ -630,6 +613,12 @@ pub struct WithTxEnv { pub tx: Arc, } +impl Clone for WithTxEnv { + fn clone(&self) -> Self { + Self { tx_env: self.tx_env.clone(), tx: self.tx.clone() } + } +} + impl> RecoveredTx for WithTxEnv { fn tx(&self) -> &Tx { self.tx.tx() @@ -640,9 +629,11 @@ impl> RecoveredTx for WithTxEnv { } } -impl ToTxEnv for WithTxEnv { - fn to_tx_env(&self) -> TxEnv { - self.tx_env.clone() +impl, Tx> ExecutableTxParts for WithTxEnv { + type Recovered = Arc; + + fn into_parts(self) -> (TxEnv, Self::Recovered) { + (self.tx_env, self.tx) } } diff --git a/crates/optimism/evm/src/receipts.rs b/crates/optimism/evm/src/receipts.rs index 50ca3679cc..9b95cf3a48 100644 --- a/crates/optimism/evm/src/receipts.rs +++ b/crates/optimism/evm/src/receipts.rs @@ -17,9 +17,9 @@ impl OpReceiptBuilder for OpRethReceiptBuilder { fn build_receipt<'a, E: Evm>( &self, - ctx: ReceiptBuilderCtx<'a, OpTransactionSigned, E>, - ) -> Result> { - match ctx.tx.tx_type() { + ctx: ReceiptBuilderCtx<'a, OpTxType, E>, + ) -> Result> { + match ctx.tx_type { OpTxType::Deposit => Err(ctx), ty => { let receipt = Receipt { diff --git a/examples/custom-beacon-withdrawals/src/main.rs b/examples/custom-beacon-withdrawals/src/main.rs index d1e59384c5..4ba63885fa 100644 --- a/examples/custom-beacon-withdrawals/src/main.rs +++ b/examples/custom-beacon-withdrawals/src/main.rs @@ -6,9 +6,9 @@ use alloy_eips::eip4895::Withdrawal; use alloy_evm::{ block::{BlockExecutorFactory, BlockExecutorFor, ExecutableTx}, - eth::{EthBlockExecutionCtx, EthBlockExecutor}, + eth::{EthBlockExecutionCtx, EthBlockExecutor, EthTxResult}, precompiles::PrecompilesMap, - revm::context::{result::ResultAndState, Block as _}, + revm::context::Block as _, EthEvm, EthEvmFactory, }; use alloy_sol_macro::sol; @@ -39,7 +39,7 @@ use reth_ethereum::{ primitives::{Header, SealedBlock, SealedHeader}, provider::BlockExecutionResult, rpc::types::engine::ExecutionData, - Block, EthPrimitives, Receipt, TransactionSigned, + Block, EthPrimitives, Receipt, TransactionSigned, TxType, }; use std::{fmt::Display, sync::Arc}; @@ -196,6 +196,7 @@ where type Transaction = TransactionSigned; type Receipt = Receipt; type Evm = E; + type Result = EthTxResult; fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError> { self.inner.apply_pre_execution_changes() @@ -208,16 +209,12 @@ where fn execute_transaction_without_commit( &mut self, tx: impl ExecutableTx, - ) -> Result::HaltReason>, BlockExecutionError> { + ) -> Result { self.inner.execute_transaction_without_commit(tx) } - fn commit_transaction( - &mut self, - output: ResultAndState<::HaltReason>, - tx: impl ExecutableTx, - ) -> Result { - self.inner.commit_transaction(output, tx) + fn commit_transaction(&mut self, output: Self::Result) -> Result { + self.inner.commit_transaction(output) } fn finish(mut self) -> Result<(Self::Evm, BlockExecutionResult), BlockExecutionError> { diff --git a/examples/custom-node/src/evm/executor.rs b/examples/custom-node/src/evm/executor.rs index 575b4949c0..3b935b4c64 100644 --- a/examples/custom-node/src/evm/executor.rs +++ b/examples/custom-node/src/evm/executor.rs @@ -12,12 +12,12 @@ use alloy_evm::{ BlockExecutorFor, ExecutableTx, OnStateHook, }, precompiles::PrecompilesMap, - Database, Evm, + Database, Evm, RecoveredTx, }; -use alloy_op_evm::{OpBlockExecutionCtx, OpBlockExecutor}; +use alloy_op_evm::{block::OpTxResult, OpBlockExecutionCtx, OpBlockExecutor}; use reth_ethereum::evm::primitives::InspectorFor; -use reth_op::{chainspec::OpChainSpec, node::OpRethReceiptBuilder, OpReceipt}; -use revm::{context::result::ResultAndState, database::State}; +use reth_op::{chainspec::OpChainSpec, node::OpRethReceiptBuilder, OpReceipt, OpTxType}; +use revm::database::State; use std::sync::Arc; pub struct CustomBlockExecutor { @@ -32,6 +32,7 @@ where type Transaction = CustomTransaction; type Receipt = OpReceipt; type Evm = E; + type Result = OpTxResult; fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError> { self.inner.apply_pre_execution_changes() @@ -44,7 +45,8 @@ where fn execute_transaction_without_commit( &mut self, tx: impl ExecutableTx, - ) -> Result::HaltReason>, BlockExecutionError> { + ) -> Result { + let tx = tx.into_parts().1; match tx.tx() { CustomTransaction::Op(op_tx) => self .inner @@ -53,17 +55,8 @@ where } } - fn commit_transaction( - &mut self, - output: ResultAndState<::HaltReason>, - tx: impl ExecutableTx, - ) -> Result { - match tx.tx() { - CustomTransaction::Op(op_tx) => { - self.inner.commit_transaction(output, Recovered::new_unchecked(op_tx, *tx.signer())) - } - CustomTransaction::Payment(..) => todo!(), - } + fn commit_transaction(&mut self, output: Self::Result) -> Result { + self.inner.commit_transaction(output) } fn finish(self) -> Result<(Self::Evm, BlockExecutionResult), BlockExecutionError> {