mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
feat: update el requests for devnet 4 (#11865)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
229
Cargo.lock
generated
229
Cargo.lock
generated
@@ -112,9 +112,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-consensus"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "705687d5bfd019fee57cf9e206b27b30a9a9617535d5590a02b171e813208f8e"
|
||||
checksum = "42642aed67f938363d9c7543e5ca4163cfb4205d9ec15fe933dc4e865d2932dd"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
@@ -161,9 +161,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eip7702"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea59dc42102bc9a1905dc57901edc6dd48b9f38115df86c7d252acba70d71d04"
|
||||
checksum = "eeffd2590ce780ddfaa9d0ae340eb2b4e08627650c4676eef537cef0b4bf535d"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
@@ -176,9 +176,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eips"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ffb906284a1e1f63c4607da2068c8197458a352d0b3e9796e67353d72a9be85"
|
||||
checksum = "9fbc52a30df46f9831ed74557dfad0d94b12420393662a8b9ef90e2d6c8cb4b0"
|
||||
dependencies = [
|
||||
"alloy-eip2930",
|
||||
"alloy-eip7702",
|
||||
@@ -188,6 +188,8 @@ dependencies = [
|
||||
"arbitrary",
|
||||
"c-kzg",
|
||||
"derive_more 1.0.0",
|
||||
"ethereum_ssz",
|
||||
"ethereum_ssz_derive",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"sha2 0.10.8",
|
||||
@@ -195,9 +197,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-genesis"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8429cf4554eed9b40feec7f4451113e76596086447550275e3def933faf47ce3"
|
||||
checksum = "0787d1688b9806290313cc335d416cc7ee39b11e3245f3d218544c62572d92ba"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-serde",
|
||||
@@ -218,9 +220,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-json-rpc"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8fa8a1a3c4cbd221f2b8e3693aeb328fca79a757fe556ed08e47bbbc2a70db7"
|
||||
checksum = "d55a16a5f9ca498a217c060414bcd1c43e934235dc8058b31b87dcd69ff4f105"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-types",
|
||||
@@ -232,9 +234,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-network"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85fa23a6a9d612b52e402c995f2d582c25165ec03ac6edf64c861a76bc5b87cd"
|
||||
checksum = "3d236a8c3e1d5adc09b1b63c81815fc9b757d9a4ba9482cc899f9679b55dd437"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -253,9 +255,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-network-primitives"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "801492711d4392b2ccf5fc0bc69e299fa1aab15167d74dcaa9aab96a54f684bd"
|
||||
checksum = "cd15a0990fa8a56d85a42d6a689719aa4eebf5e2f1a5c5354658c0bfc52cac9a"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -266,9 +268,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-node-bindings"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f1334a738aa1710cb8227441b3fcc319202ce78e967ef37406940242df4a454"
|
||||
checksum = "2249f3c3ce446cf4063fe3d1aa7530823643c2706a1cc63045e0683ebc497a0a"
|
||||
dependencies = [
|
||||
"alloy-genesis",
|
||||
"alloy-primitives",
|
||||
@@ -315,9 +317,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-provider"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcfaa4ffec0af04e3555686b8aacbcdf7d13638133a0672749209069750f78a6"
|
||||
checksum = "316f522bb6f9ac3805132112197957013b570e20cfdad058e8339dae6030c849"
|
||||
dependencies = [
|
||||
"alloy-chains",
|
||||
"alloy-consensus",
|
||||
@@ -341,21 +343,24 @@ dependencies = [
|
||||
"futures",
|
||||
"futures-utils-wasm",
|
||||
"lru",
|
||||
"parking_lot 0.12.3",
|
||||
"pin-project",
|
||||
"reqwest",
|
||||
"schnellru",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
"wasmtimer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-pubsub"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f32cef487122ae75c91eb50154c70801d71fabdb976fec6c49e0af5e6486ab15"
|
||||
checksum = "222cd9b17b1c5ad48de51a88ffbdb17f17145170288f22662f80ac88739125e6"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -394,9 +399,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-client"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "370143ed581aace6e663342d21d209c6b2e34ee6142f7d6675adb518deeaf0dc"
|
||||
checksum = "5b2ab59712c594c9624aaa69e38e4d38f180cb569f1fa46cdaf8c21fd50793e5"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -414,13 +419,14 @@ dependencies = [
|
||||
"tower 0.5.1",
|
||||
"tracing",
|
||||
"url",
|
||||
"wasmtimer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ffc534b7919e18f35e3aa1f507b6f3d9d92ec298463a9f6beaac112809d8d06"
|
||||
checksum = "ba21284319e12d053baa204d438db6c1577aedd94c1298e4becefdac1f9cec87"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-engine",
|
||||
@@ -431,9 +437,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-admin"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb520ed46cc5b7d8c014a73fdd77b6a310383a2a5c0a5ae3c9b8055881f062b7"
|
||||
checksum = "416cc9f391d0b876c4c8da85f7131e771a88a55b917cc9a35e1724d9409e3b1c"
|
||||
dependencies = [
|
||||
"alloy-genesis",
|
||||
"alloy-primitives",
|
||||
@@ -443,9 +449,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-anvil"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d780adaa5d95b07ad92006b2feb68ecfa7e2015f7d5976ceaac4c906c73ebd07"
|
||||
checksum = "ba40bea86c3102b9ed9b3be579e32e0b3e54e766248d873de5fc0437238c8df2"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-serde",
|
||||
@@ -454,9 +460,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-beacon"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a8dc5980fe30203d698627cddb5f0cedc57f900c8b5e1229c8b9448e37acb4a"
|
||||
checksum = "b535781fe224c101c3d957b514cb9f438d165ff0280e5c0b2f87a0d9a2950593"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
@@ -468,9 +474,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-debug"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59d8f8c5bfb160081a772f1f68eb9a37e8929c4ef74e5d01f5b78c2b645a5c5e"
|
||||
checksum = "4303deacf4cbf12ed4431a5a1bbc3284f0defb4b8b72d9aa2b888656cc5ae657"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"serde",
|
||||
@@ -478,9 +484,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-engine"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0285c4c09f838ab830048b780d7f4a4f460f309aa1194bb049843309524c64c"
|
||||
checksum = "44848fced3b42260b9cb61f22102246636dfe5a2d0132f8d10a617df3cb1a74b"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -488,6 +494,8 @@ dependencies = [
|
||||
"alloy-rlp",
|
||||
"alloy-serde",
|
||||
"derive_more 1.0.0",
|
||||
"ethereum_ssz",
|
||||
"ethereum_ssz_derive",
|
||||
"jsonrpsee-types",
|
||||
"jsonwebtoken",
|
||||
"rand 0.8.5",
|
||||
@@ -497,9 +505,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-eth"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413f4aa3ccf2c3e4234a047c5fa4727916d7daf25a89f9b765df0ba09784fd87"
|
||||
checksum = "35894711990019fafff0012b82b9176cbb744516eb2a9bbe6b8e5cae522163ee"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -517,9 +525,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-mev"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cec23ce56c869eec5f6b6fd6a8a92b5aa0cfaf8d7be3a96502e537554dc7430"
|
||||
checksum = "cac6250cad380a005ecb5ffc6d2facf03df0e72628d819a63dd8c3ade7a766ff"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
@@ -530,9 +538,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-trace"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "017cad3e5793c5613588c1f9732bcbad77e820ba7d0feaba3527749f856fdbc5"
|
||||
checksum = "f568c5624881896d8a25e19acbdcbabadd8df339427ea2f10b2ee447d57c4509"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -544,9 +552,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-txpool"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b230e321c416be7f50530159392b4c41a45596d40d97e185575bcd0b545e521"
|
||||
checksum = "d4a37d2e1ed9b7daf20ad0b3e0092613cbae46737e0e988b23caa556c7067ce6"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -556,9 +564,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-serde"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9dff0ab1cdd43ca001e324dc27ee0e8606bd2161d6623c63e0e0b8c4dfc13600"
|
||||
checksum = "2843c195675f06b29c09a4315cccdc233ab5bdc7c0a3775909f9f0cab5e9ae0f"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"arbitrary",
|
||||
@@ -568,9 +576,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-signer"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd4e0ad79c81a27ca659be5d176ca12399141659fef2bcbfdc848da478f4504"
|
||||
checksum = "88b2a00d9803dfef99963303ffe41a7bf2221f3342f0a503d6741a9f4a18e5e5"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"async-trait",
|
||||
@@ -582,9 +590,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-signer-local"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "494e0a256f3e99f2426f994bcd1be312c02cb8f88260088dacb33a8b8936475f"
|
||||
checksum = "5a2505d4f8c98dcae86152d58d549cb4bcf953f8352fca903410e0a0ef535571"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-network",
|
||||
@@ -670,9 +678,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ac3e97dad3d31770db0fc89bd6a63b789fbae78963086733f960cf32c483904"
|
||||
checksum = "9dc2c8f6b8c227ef0398f702d954c4ab572c2ead3c1ed4a5157aa1cbaf959747"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"base64 0.22.1",
|
||||
@@ -685,13 +693,14 @@ dependencies = [
|
||||
"tower 0.5.1",
|
||||
"tracing",
|
||||
"url",
|
||||
"wasmtimer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport-http"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b367dcccada5b28987c2296717ee04b9a5637aacd78eacb1726ef211678b5212"
|
||||
checksum = "dd328e990d57f4c4e63899fb2c26877597d6503f8e0022a3d71b2d753ecbfc0c"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-transport",
|
||||
@@ -704,9 +713,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport-ipc"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b90cf9cde7f2fce617da52768ee28f522264b282d148384a4ca0ea85af04fa3a"
|
||||
checksum = "89aea26aaf1d67904a7ff95ec4a24ddd5e7d419a6945f641b885962d7c2803e2"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-pubsub",
|
||||
@@ -723,9 +732,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport-ws"
|
||||
version = "0.4.2"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7153b88690de6a50bba81c11e1d706bc41dbb90126d607404d60b763f6a3947f"
|
||||
checksum = "e222e950ecc4ea12fbfb524b9a2275cac2cd5f57c8ce25bcaf1bd3ff80dd8fc8"
|
||||
dependencies = [
|
||||
"alloy-pubsub",
|
||||
"alloy-transport",
|
||||
@@ -2665,6 +2674,47 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethereum_serde_utils"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70cbccfccf81d67bff0ab36e591fa536c8a935b078a7b0e58c1d00d418332fc9"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"hex",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethereum_ssz"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfbba28f4f3f32d92c06a64f5bf6c4537b5d4e21f28c689bd2bbaecfea4e0d3e"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"derivative",
|
||||
"ethereum_serde_utils",
|
||||
"itertools 0.13.0",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"smallvec",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ethereum_ssz_derive"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d37845ba7c16bf4be8be4b5786f03a2ba5f2fda0d7f9e7cb2282f69cff420d7"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.79",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "2.5.3"
|
||||
@@ -5157,9 +5207,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-consensus"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ea7162170c6f3cad8f67f4dd7108e3f78349fd553da5b8bebff1e7ef8f38896"
|
||||
checksum = "99d49163f952491820088dd0e66f3a35d63337c3066eceff0a931bf83a8e2101"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -5175,9 +5225,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-genesis"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f3d31dfbbd8dd898c7512f8ce7d30103980485416f668566100b0ed0994b958"
|
||||
checksum = "8e46c2ab105f679f0cbfbc3fb762f3456d4b8556c841e667fc8f3c2226eb6c1e"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -5189,9 +5239,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-network"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d113b325527ba7da271a8793f1c14bdf7f035ce9e0611e668c36fc6812568c7f"
|
||||
checksum = "75ff1ea317441b9eb6317b24d13f9088e3b14ef48b15bfb6a125ca404df036d8"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-network",
|
||||
@@ -5203,9 +5253,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-protocol"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "310873e4fbfc41986716c4fb6000a8b49d025d932d2c261af58271c434b05288"
|
||||
checksum = "6c439457b2a1791325603fc18a94cc175e0b4b1127f11ff8a45071f05d044dcb"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -5220,9 +5270,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-rpc-types"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "323c65880e2561aa87f74f8af260fd15b9cc930c448c88a60ae95af86c88c634"
|
||||
checksum = "9c9556293835232b019ec9c6fd84e4265a3151111af60ea09b5b513e3dbed41c"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -5237,16 +5287,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-alloy-rpc-types-engine"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349e7b420f45d1a00216ec4c65fcf3f0057a841bc39732c405c85ae782b94121"
|
||||
checksum = "8a42a5ac4e07ed226b6a2aeefaad9b2cc7ec160e372ba626a4214d681a355fc2"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-engine",
|
||||
"alloy-serde",
|
||||
"derive_more 1.0.0",
|
||||
"ethereum_ssz",
|
||||
"op-alloy-protocol",
|
||||
"serde",
|
||||
"snap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6310,6 +6362,7 @@ dependencies = [
|
||||
name = "reth-auto-seal-consensus"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-engine",
|
||||
"futures-util",
|
||||
@@ -6700,6 +6753,7 @@ dependencies = [
|
||||
name = "reth-consensus"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"auto_impl",
|
||||
"derive_more 1.0.0",
|
||||
@@ -7275,6 +7329,7 @@ name = "reth-ethereum-consensus"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"reth-chainspec",
|
||||
"reth-consensus",
|
||||
@@ -7327,6 +7382,7 @@ name = "reth-ethereum-payload-builder"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"reth-basic-payload-builder",
|
||||
"reth-chain-state",
|
||||
@@ -8343,6 +8399,8 @@ dependencies = [
|
||||
name = "reth-payload-validator"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types",
|
||||
"reth-chainspec",
|
||||
"reth-primitives",
|
||||
@@ -8524,6 +8582,7 @@ dependencies = [
|
||||
name = "reth-revm"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"reth-chainspec",
|
||||
"reth-consensus-common",
|
||||
@@ -9274,9 +9333,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm"
|
||||
version = "14.0.3"
|
||||
version = "16.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "641702b12847f9ed418d552f4fcabe536d867a2c980e96b6e7e25d7b992f929f"
|
||||
checksum = "34e44692d5736cc44c697a372e507890f8797f06d1541c5f4b9bec594d90fd8a"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"cfg-if",
|
||||
@@ -9289,9 +9348,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-inspectors"
|
||||
version = "0.8.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43c44af0bf801f48d25f7baf25cf72aff4c02d610f83b428175228162fef0246"
|
||||
checksum = "a64e2246ad480167548724eb9c9c66945241b867c7d50894de3ca860c9823a45"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -9308,9 +9367,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-interpreter"
|
||||
version = "10.0.3"
|
||||
version = "12.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e5e14002afae20b5bf1566f22316122f42f57517000e559c55b25bf7a49cba2"
|
||||
checksum = "6f89940d17d5d077570de1977f52f69049595322e237cb6c754c3d47f668f023"
|
||||
dependencies = [
|
||||
"revm-primitives",
|
||||
"serde",
|
||||
@@ -9318,9 +9377,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-precompile"
|
||||
version = "11.0.3"
|
||||
version = "13.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3198c06247e8d4ad0d1312591edf049b0de4ddffa9fecb625c318fd67db8639b"
|
||||
checksum = "d8f816aaea3245cbdbe7fdd84955df33597f9322c7912c3e3ba7bc855e03211f"
|
||||
dependencies = [
|
||||
"aurora-engine-modexp",
|
||||
"blst",
|
||||
@@ -9338,9 +9397,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-primitives"
|
||||
version = "10.0.0"
|
||||
version = "12.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f1525851a03aff9a9d6a1d018b414d76252d6802ab54695b27093ecd7e7a101"
|
||||
checksum = "532411bbde45a46707c1d434dcdc29866cf261c1b748fb01b303ce3b4310b361"
|
||||
dependencies = [
|
||||
"alloy-eip2930",
|
||||
"alloy-eip7702",
|
||||
@@ -11355,6 +11414,20 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmtimer"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7ed9d8b15c7fb594d72bfb4b5a276f3d2029333cd93a932f376f5937f6f80ee"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"js-sys",
|
||||
"parking_lot 0.12.3",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.72"
|
||||
|
||||
127
Cargo.toml
127
Cargo.toml
@@ -410,9 +410,9 @@ reth-trie-db = { path = "crates/trie/db" }
|
||||
reth-trie-parallel = { path = "crates/trie/parallel" }
|
||||
|
||||
# revm
|
||||
revm = { version = "14.0.3", features = ["std"], default-features = false }
|
||||
revm-inspectors = "0.8.1"
|
||||
revm-primitives = { version = "10.0.0", features = [
|
||||
revm = { version = "16.0.0", features = ["std"], default-features = false }
|
||||
revm-inspectors = "0.9.0"
|
||||
revm-primitives = { version = "12.0.0", features = [
|
||||
"std",
|
||||
], default-features = false }
|
||||
|
||||
@@ -424,45 +424,45 @@ alloy-rlp = "0.3.4"
|
||||
alloy-sol-types = "0.8.0"
|
||||
alloy-trie = { version = "0.7", default-features = false }
|
||||
|
||||
alloy-consensus = { version = "0.4.2", default-features = false }
|
||||
alloy-eips = { version = "0.4.2", default-features = false }
|
||||
alloy-genesis = { version = "0.4.2", default-features = false }
|
||||
alloy-json-rpc = { version = "0.4.2", default-features = false }
|
||||
alloy-network = { version = "0.4.2", default-features = false }
|
||||
alloy-network-primitives = { version = "0.4.2", default-features = false }
|
||||
alloy-node-bindings = { version = "0.4.2", default-features = false }
|
||||
alloy-provider = { version = "0.4.2", features = [
|
||||
alloy-consensus = { version = "0.5.2", default-features = false }
|
||||
alloy-eips = { version = "0.5.2", default-features = false }
|
||||
alloy-genesis = { version = "0.5.2", default-features = false }
|
||||
alloy-json-rpc = { version = "0.5.2", default-features = false }
|
||||
alloy-network = { version = "0.5.2", default-features = false }
|
||||
alloy-network-primitives = { version = "0.5.2", default-features = false }
|
||||
alloy-node-bindings = { version = "0.5.2", default-features = false }
|
||||
alloy-provider = { version = "0.5.2", features = [
|
||||
"reqwest",
|
||||
], default-features = false }
|
||||
alloy-pubsub = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-client = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types = { version = "0.4.2", features = [
|
||||
alloy-pubsub = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-client = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types = { version = "0.5.2", features = [
|
||||
"eth",
|
||||
], default-features = false }
|
||||
alloy-rpc-types-admin = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-anvil = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-beacon = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-debug = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-engine = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-mev = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-trace = { version = "0.4.2", default-features = false }
|
||||
alloy-rpc-types-txpool = { version = "0.4.2", default-features = false }
|
||||
alloy-serde = { version = "0.4.2", default-features = false }
|
||||
alloy-signer = { version = "0.4.2", default-features = false }
|
||||
alloy-signer-local = { version = "0.4.2", default-features = false }
|
||||
alloy-transport = { version = "0.4.2" }
|
||||
alloy-transport-http = { version = "0.4.2", features = [
|
||||
alloy-rpc-types-admin = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-anvil = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-beacon = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-debug = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-engine = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-eth = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-mev = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-trace = { version = "0.5.2", default-features = false }
|
||||
alloy-rpc-types-txpool = { version = "0.5.2", default-features = false }
|
||||
alloy-serde = { version = "0.5.2", default-features = false }
|
||||
alloy-signer = { version = "0.5.2", default-features = false }
|
||||
alloy-signer-local = { version = "0.5.2", default-features = false }
|
||||
alloy-transport = { version = "0.5.2" }
|
||||
alloy-transport-http = { version = "0.5.2", features = [
|
||||
"reqwest-rustls-tls",
|
||||
], default-features = false }
|
||||
alloy-transport-ipc = { version = "0.4.2", default-features = false }
|
||||
alloy-transport-ws = { version = "0.4.2", default-features = false }
|
||||
alloy-transport-ipc = { version = "0.5.2", default-features = false }
|
||||
alloy-transport-ws = { version = "0.5.2", default-features = false }
|
||||
|
||||
# op
|
||||
op-alloy-rpc-types = "0.4"
|
||||
op-alloy-rpc-types-engine = "0.4"
|
||||
op-alloy-network = "0.4"
|
||||
op-alloy-consensus = "0.4"
|
||||
op-alloy-rpc-types = "0.5"
|
||||
op-alloy-rpc-types-engine = "0.5"
|
||||
op-alloy-network = "0.5"
|
||||
op-alloy-consensus = "0.5"
|
||||
|
||||
# misc
|
||||
aquamarine = "0.5"
|
||||
@@ -593,30 +593,35 @@ 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 = "8c499409"}
|
||||
#alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
|
||||
#[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" }
|
||||
|
||||
#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-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
|
||||
#op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "6a042e7681b1" }
|
||||
|
||||
@@ -84,7 +84,8 @@ impl InnerTransport {
|
||||
let (auth, claims) =
|
||||
build_auth(jwt).map_err(|e| AuthenticatedTransportError::InvalidJwt(e.to_string()))?;
|
||||
|
||||
let inner = WsConnect { url: url.to_string(), auth: Some(auth) }
|
||||
let inner = WsConnect::new(url.clone())
|
||||
.with_auth(auth)
|
||||
.into_service()
|
||||
.await
|
||||
.map(Self::Ws)
|
||||
|
||||
@@ -215,14 +215,6 @@ pub(crate) async fn call_new_payload<N, T, P: EngineApiValidWaitExt<N, T>>(
|
||||
versioned_hashes: Vec<B256>,
|
||||
) -> TransportResult<EngineApiMessageVersion> {
|
||||
match payload {
|
||||
ExecutionPayload::V4(_payload) => {
|
||||
todo!("V4 payloads not supported yet");
|
||||
// auth_provider
|
||||
// .new_payload_v4_wait(payload, versioned_hashes, parent_beacon_block_root, ...)
|
||||
// .await?;
|
||||
//
|
||||
// Ok(EngineApiMessageVersion::V4)
|
||||
}
|
||||
ExecutionPayload::V3(payload) => {
|
||||
// We expect the caller
|
||||
let parent_beacon_block_root = parent_beacon_block_root
|
||||
|
||||
@@ -171,7 +171,9 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
|
||||
debug!(target: "reth::cli", ?response, "Received for forkchoice updated");
|
||||
}
|
||||
StoredEngineApiMessage::NewPayload { payload, cancun_fields } => {
|
||||
let response = beacon_engine_handle.new_payload(payload, cancun_fields).await?;
|
||||
// todo: prague (last arg)
|
||||
let response =
|
||||
beacon_engine_handle.new_payload(payload, cancun_fields, None).await?;
|
||||
debug!(target: "reth::cli", ?response, "Received for new payload");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1635,7 +1635,6 @@ mod tests {
|
||||
transactions: body.clone().into_iter().map(|tx| tx.into_signed()).collect(),
|
||||
ommers: Vec::new(),
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
body.iter().map(|tx| tx.signer()).collect(),
|
||||
|
||||
@@ -865,10 +865,11 @@ impl NewCanonicalChain {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::test_utils::TestBlockBuilder;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{map::HashSet, BlockNumber, Bytes, StorageKey, StorageValue};
|
||||
use rand::Rng;
|
||||
use reth_errors::ProviderResult;
|
||||
use reth_primitives::{Account, Bytecode, Receipt, Requests};
|
||||
use reth_primitives::{Account, Bytecode, Receipt};
|
||||
use reth_storage_api::{
|
||||
AccountReader, BlockHashReader, StateProofProvider, StateProvider, StateRootProvider,
|
||||
StorageRootProvider,
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::{
|
||||
CanonStateSubscriptions,
|
||||
};
|
||||
use alloy_consensus::{Transaction as _, TxEip1559, EMPTY_ROOT_HASH};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{Address, BlockNumber, Sealable, B256, U256};
|
||||
use alloy_signer::SignerSync;
|
||||
use alloy_signer_local::PrivateKeySigner;
|
||||
@@ -12,8 +13,8 @@ use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_primitives::{
|
||||
constants::EIP1559_INITIAL_BASE_FEE,
|
||||
proofs::{calculate_receipt_root, calculate_transaction_root, calculate_withdrawals_root},
|
||||
BlockBody, Header, Receipt, Receipts, Requests, SealedBlock, SealedBlockWithSenders,
|
||||
SealedHeader, Transaction, TransactionSigned, TransactionSignedEcRecovered,
|
||||
BlockBody, Header, Receipt, Receipts, SealedBlock, SealedBlockWithSenders, SealedHeader,
|
||||
Transaction, TransactionSigned, TransactionSignedEcRecovered,
|
||||
};
|
||||
use reth_trie::{root::state_root_unhashed, updates::TrieUpdates, HashedPostState};
|
||||
use revm::{db::BundleState, primitives::AccountInfo};
|
||||
@@ -169,7 +170,6 @@ impl TestBlockBuilder {
|
||||
transactions: transactions.into_iter().map(|tx| tx.into_signed()).collect(),
|
||||
ommers: Vec::new(),
|
||||
withdrawals: Some(vec![].into()),
|
||||
requests: None,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ alloy-chains = { workspace = true, features = ["serde", "rlp"] }
|
||||
alloy-eips = { workspace = true, features = ["serde"] }
|
||||
alloy-genesis.workspace = true
|
||||
alloy-primitives = { workspace = true, features = ["rand", "rlp"] }
|
||||
alloy-trie.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
# misc
|
||||
|
||||
@@ -3,9 +3,9 @@ pub use alloy_eips::eip1559::BaseFeeParams;
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_chains::{Chain, NamedChain};
|
||||
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
|
||||
use alloy_eips::eip7685::EMPTY_REQUESTS_HASH;
|
||||
use alloy_genesis::Genesis;
|
||||
use alloy_primitives::{address, b256, Address, BlockNumber, B256, U256};
|
||||
use alloy_trie::EMPTY_ROOT_HASH;
|
||||
use derive_more::From;
|
||||
|
||||
use alloy_consensus::constants::{DEV_GENESIS_HASH, MAINNET_GENESIS_HASH};
|
||||
@@ -284,8 +284,9 @@ impl ChainSpec {
|
||||
};
|
||||
|
||||
// If Prague is activated at genesis we set requests root to an empty trie root.
|
||||
let requests_root =
|
||||
self.is_prague_active_at_timestamp(self.genesis.timestamp).then_some(EMPTY_ROOT_HASH);
|
||||
let requests_hash = self
|
||||
.is_prague_active_at_timestamp(self.genesis.timestamp)
|
||||
.then_some(EMPTY_REQUESTS_HASH);
|
||||
|
||||
Header {
|
||||
gas_limit: self.genesis.gas_limit,
|
||||
@@ -301,7 +302,7 @@ impl ChainSpec {
|
||||
parent_beacon_block_root,
|
||||
blob_gas_used: blob_gas_used.map(Into::into),
|
||||
excess_blob_gas: excess_blob_gas.map(Into::into),
|
||||
requests_root,
|
||||
requests_hash,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
@@ -940,6 +941,7 @@ mod tests {
|
||||
use alloy_chains::Chain;
|
||||
use alloy_genesis::{ChainConfig, GenesisAccount};
|
||||
use alloy_primitives::{b256, hex};
|
||||
use alloy_trie::EMPTY_ROOT_HASH;
|
||||
use reth_ethereum_forks::{ForkCondition, ForkHash, ForkId, Head};
|
||||
use reth_trie_common::TrieAccount;
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> Command<C>
|
||||
tx.clear::<tables::TransactionBlocks>()?;
|
||||
tx.clear::<tables::BlockOmmers>()?;
|
||||
tx.clear::<tables::BlockWithdrawals>()?;
|
||||
tx.clear::<tables::BlockRequests>()?;
|
||||
reset_stage_checkpoint(tx, StageId::Bodies)?;
|
||||
|
||||
insert_genesis_header(&provider_rw.0, &static_file_provider, &self.env.chain)?;
|
||||
|
||||
@@ -31,6 +31,7 @@ reth-tokio-util.workspace = true
|
||||
reth-trie.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
alloy-rpc-types-engine.workspace = true
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, Bloom, B256, U256};
|
||||
use reth_beacon_consensus::BeaconEngineMessage;
|
||||
use reth_chainspec::{EthChainSpec, EthereumHardforks};
|
||||
@@ -25,7 +26,7 @@ use reth_execution_errors::{
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{
|
||||
proofs, Block, BlockBody, BlockHashOrNumber, BlockWithSenders, Header, Requests, SealedBlock,
|
||||
proofs, Block, BlockBody, BlockHashOrNumber, BlockWithSenders, Header, SealedBlock,
|
||||
SealedHeader, TransactionSigned, Withdrawals,
|
||||
};
|
||||
use reth_provider::{BlockReaderIdExt, StateProviderFactory, StateRootProvider};
|
||||
@@ -301,7 +302,7 @@ impl StorageInner {
|
||||
timestamp,
|
||||
base_fee_per_gas,
|
||||
blob_gas_used,
|
||||
requests_root: requests.map(|r| proofs::calculate_requests_root(&r.0)),
|
||||
requests_hash: requests.map(|r| r.requests_hash()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -366,7 +367,6 @@ impl StorageInner {
|
||||
transactions,
|
||||
ommers: ommers.clone(),
|
||||
withdrawals: withdrawals.clone(),
|
||||
requests: requests.clone(),
|
||||
},
|
||||
}
|
||||
.with_recovered_senders()
|
||||
@@ -390,7 +390,7 @@ impl StorageInner {
|
||||
// root here
|
||||
|
||||
let Block { mut header, body, .. } = block.block;
|
||||
let body = BlockBody { transactions: body.transactions, ommers, withdrawals, requests };
|
||||
let body = BlockBody { transactions: body.transactions, ommers, withdrawals };
|
||||
|
||||
trace!(target: "consensus::auto", ?execution_outcome, ?header, ?body, "executed block, calculating state root and completing header");
|
||||
|
||||
@@ -682,7 +682,7 @@ mod tests {
|
||||
timestamp,
|
||||
base_fee_per_gas: None,
|
||||
blob_gas_used: Some(0),
|
||||
requests_root: None,
|
||||
requests_hash: None,
|
||||
excess_blob_gas: Some(0),
|
||||
..Default::default()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use crate::{
|
||||
engine::message::OnForkChoiceUpdated, BeaconConsensusEngineEvent, BeaconEngineMessage,
|
||||
BeaconForkChoiceUpdateError, BeaconOnNewPayloadError,
|
||||
};
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, ForkchoiceUpdated, PayloadStatus,
|
||||
};
|
||||
@@ -47,9 +48,17 @@ where
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
) -> Result<PayloadStatus, BeaconOnNewPayloadError> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let _ = self.to_engine.send(BeaconEngineMessage::NewPayload { payload, cancun_fields, tx });
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
let _ = self.to_engine.send(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
});
|
||||
rx.await.map_err(|_| BeaconOnNewPayloadError::EngineUnavailable)?
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::engine::{error::BeaconOnNewPayloadError, forkchoice::ForkchoiceStatus};
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkChoiceUpdateResult, ForkchoiceState,
|
||||
ForkchoiceUpdateError, ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum,
|
||||
@@ -146,6 +147,10 @@ pub enum BeaconEngineMessage<Engine: EngineTypes> {
|
||||
payload: ExecutionPayload,
|
||||
/// The cancun-related newPayload fields, if any.
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
/// The pectra EIP-7685 execution requests.
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
/// The sender for returning payload status result.
|
||||
tx: oneshot::Sender<Result<PayloadStatus, BeaconOnNewPayloadError>>,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use alloy_primitives::{BlockNumber, Bytes, B256};
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum,
|
||||
PayloadValidationError,
|
||||
@@ -1085,6 +1085,9 @@ where
|
||||
&mut self,
|
||||
payload: ExecutionPayload,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
) -> Result<Either<PayloadStatus, SealedBlock>, BeaconOnNewPayloadError> {
|
||||
self.metrics.new_payload_messages.increment(1);
|
||||
|
||||
@@ -1114,10 +1117,11 @@ where
|
||||
//
|
||||
// This validation **MUST** be instantly run in all cases even during active sync process.
|
||||
let parent_hash = payload.parent_hash();
|
||||
let block = match self
|
||||
.payload_validator
|
||||
.ensure_well_formed_payload(payload, cancun_fields.into())
|
||||
{
|
||||
let block = match self.payload_validator.ensure_well_formed_payload(
|
||||
payload,
|
||||
cancun_fields.into(),
|
||||
execution_requests,
|
||||
) {
|
||||
Ok(block) => block,
|
||||
Err(error) => {
|
||||
error!(target: "consensus::engine", %error, "Invalid payload");
|
||||
@@ -1862,8 +1866,13 @@ where
|
||||
BeaconEngineMessage::ForkchoiceUpdated { state, payload_attrs, tx } => {
|
||||
this.on_forkchoice_updated(state, payload_attrs, tx);
|
||||
}
|
||||
BeaconEngineMessage::NewPayload { payload, cancun_fields, tx } => {
|
||||
match this.on_new_payload(payload, cancun_fields) {
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
} => {
|
||||
match this.on_new_payload(payload, cancun_fields, execution_requests) {
|
||||
Ok(Either::Right(block)) => {
|
||||
this.set_blockchain_tree_action(
|
||||
BlockchainTreeAction::InsertNewPayload { block, tx },
|
||||
|
||||
@@ -70,7 +70,7 @@ impl<DB> TestEnv<DB> {
|
||||
payload: T,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
) -> Result<PayloadStatus, BeaconOnNewPayloadError> {
|
||||
self.engine_handle.new_payload(payload.into(), cancun_fields).await
|
||||
self.engine_handle.new_payload(payload.into(), cancun_fields, None).await
|
||||
}
|
||||
|
||||
/// Sends the `ExecutionPayload` message to the consensus engine and retries if the engine
|
||||
|
||||
@@ -75,24 +75,6 @@ pub fn validate_cancun_gas(block: &SealedBlock) -> Result<(), ConsensusError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validate that requests root is present if Prague is active.
|
||||
///
|
||||
/// See [EIP-7685]: General purpose execution layer requests
|
||||
///
|
||||
/// [EIP-7685]: https://eips.ethereum.org/EIPS/eip-7685
|
||||
#[inline]
|
||||
pub fn validate_prague_request(block: &SealedBlock) -> Result<(), ConsensusError> {
|
||||
let requests_root =
|
||||
block.body.calculate_requests_root().ok_or(ConsensusError::BodyRequestsMissing)?;
|
||||
let header_requests_root = block.requests_root.ok_or(ConsensusError::RequestsRootMissing)?;
|
||||
if requests_root != *header_requests_root {
|
||||
return Err(ConsensusError::BodyRequestsRootDiff(
|
||||
GotExpected { got: requests_root, expected: header_requests_root }.into(),
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validate a block without regard for state:
|
||||
///
|
||||
/// - Compares the ommer hash in the block header to the block body
|
||||
@@ -125,10 +107,6 @@ pub fn validate_block_pre_execution<ChainSpec: EthereumHardforks>(
|
||||
validate_cancun_gas(block)?;
|
||||
}
|
||||
|
||||
if chain_spec.is_prague_active_at_timestamp(block.timestamp) {
|
||||
validate_prague_request(block)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -458,7 +436,7 @@ mod tests {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None
|
||||
requests_hash: None
|
||||
};
|
||||
// size: 0x9b5
|
||||
|
||||
@@ -478,7 +456,7 @@ mod tests {
|
||||
(
|
||||
SealedBlock {
|
||||
header: SealedHeader::new(header, seal),
|
||||
body: BlockBody { transactions, ommers, withdrawals: None, requests: None },
|
||||
body: BlockBody { transactions, ommers, withdrawals: None },
|
||||
},
|
||||
parent,
|
||||
)
|
||||
@@ -550,7 +528,6 @@ mod tests {
|
||||
transactions: vec![transaction],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
requests: None,
|
||||
};
|
||||
|
||||
let block = SealedBlock::new(header, body);
|
||||
|
||||
@@ -15,6 +15,7 @@ workspace = true
|
||||
reth-primitives.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
|
||||
# misc
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::{fmt::Debug, vec::Vec};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, Bloom, B256, U256};
|
||||
use reth_primitives::{
|
||||
constants::MINIMUM_GAS_LIMIT, BlockWithSenders, GotExpected, GotExpectedBoxed, Header,
|
||||
InvalidTransactionError, Receipt, Request, SealedBlock, SealedHeader,
|
||||
InvalidTransactionError, Receipt, SealedBlock, SealedHeader,
|
||||
};
|
||||
|
||||
/// A consensus implementation that does nothing.
|
||||
@@ -31,12 +32,12 @@ pub struct PostExecutionInput<'a> {
|
||||
/// Receipts of the block.
|
||||
pub receipts: &'a [Receipt],
|
||||
/// EIP-7685 requests of the block.
|
||||
pub requests: &'a [Request],
|
||||
pub requests: &'a Requests,
|
||||
}
|
||||
|
||||
impl<'a> PostExecutionInput<'a> {
|
||||
/// Creates a new instance of `PostExecutionInput`.
|
||||
pub const fn new(receipts: &'a [Receipt], requests: &'a [Request]) -> Self {
|
||||
pub const fn new(receipts: &'a [Receipt], requests: &'a Requests) -> Self {
|
||||
Self { receipts, requests }
|
||||
}
|
||||
}
|
||||
@@ -170,10 +171,10 @@ pub enum ConsensusError {
|
||||
#[display("mismatched block withdrawals root: {_0}")]
|
||||
BodyWithdrawalsRootDiff(GotExpectedBoxed<B256>),
|
||||
|
||||
/// Error when the requests root in the block is different from the expected requests
|
||||
/// root.
|
||||
#[display("mismatched block requests root: {_0}")]
|
||||
BodyRequestsRootDiff(GotExpectedBoxed<B256>),
|
||||
/// Error when the requests hash in the block is different from the expected requests
|
||||
/// hash.
|
||||
#[display("mismatched block requests hash: {_0}")]
|
||||
BodyRequestsHashDiff(GotExpectedBoxed<B256>),
|
||||
|
||||
/// Error when a block with a specific hash and number is already known.
|
||||
#[display("block with [hash={hash}, number={number}] is already known")]
|
||||
@@ -248,17 +249,17 @@ pub enum ConsensusError {
|
||||
#[display("missing withdrawals root")]
|
||||
WithdrawalsRootMissing,
|
||||
|
||||
/// Error when the requests root is missing.
|
||||
#[display("missing requests root")]
|
||||
RequestsRootMissing,
|
||||
/// Error when the requests hash is missing.
|
||||
#[display("missing requests hash")]
|
||||
RequestsHashMissing,
|
||||
|
||||
/// Error when an unexpected withdrawals root is encountered.
|
||||
#[display("unexpected withdrawals root")]
|
||||
WithdrawalsRootUnexpected,
|
||||
|
||||
/// Error when an unexpected requests root is encountered.
|
||||
#[display("unexpected requests root")]
|
||||
RequestsRootUnexpected,
|
||||
/// Error when an unexpected requests hash is encountered.
|
||||
#[display("unexpected requests hash")]
|
||||
RequestsHashUnexpected,
|
||||
|
||||
/// Error when withdrawals are missing.
|
||||
#[display("missing withdrawals")]
|
||||
|
||||
@@ -56,8 +56,7 @@ impl TransactionTestContext {
|
||||
delegate_to: Address,
|
||||
wallet: PrivateKeySigner,
|
||||
) -> TxEnvelope {
|
||||
let authorization =
|
||||
Authorization { chain_id: U256::from(chain_id), address: delegate_to, nonce: 0 };
|
||||
let authorization = Authorization { chain_id, address: delegate_to, nonce: 0 };
|
||||
let signature = wallet
|
||||
.sign_hash_sync(&authorization.signature_hash())
|
||||
.expect("could not sign authorization");
|
||||
|
||||
@@ -162,7 +162,7 @@ where
|
||||
let response = ExecutionWitness {
|
||||
state: HashMap::from_iter(state),
|
||||
codes: Default::default(),
|
||||
keys: Some(state_preimages),
|
||||
keys: state_preimages,
|
||||
};
|
||||
let re_executed_witness_path = self.save_file(
|
||||
format!("{}_{}.witness.re_executed.json", block.number, block.hash()),
|
||||
|
||||
@@ -222,6 +222,8 @@ where
|
||||
self.to_engine.send(BeaconEngineMessage::NewPayload {
|
||||
payload: block_to_payload(payload.block().clone()),
|
||||
cancun_fields,
|
||||
// todo: prague
|
||||
execution_requests: None,
|
||||
tx,
|
||||
})?;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{
|
||||
use alloy_eips::BlockNumHash;
|
||||
use alloy_primitives::{
|
||||
map::{HashMap, HashSet},
|
||||
BlockNumber, B256, U256,
|
||||
BlockNumber, Bytes, B256, U256,
|
||||
};
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum,
|
||||
@@ -721,6 +721,7 @@ where
|
||||
&mut self,
|
||||
payload: ExecutionPayload,
|
||||
cancun_fields: Option<CancunPayloadFields>,
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
) -> Result<TreeOutcome<PayloadStatus>, InsertBlockFatalError> {
|
||||
trace!(target: "engine::tree", "invoked new payload");
|
||||
self.metrics.engine.new_payload_messages.increment(1);
|
||||
@@ -751,10 +752,11 @@ where
|
||||
//
|
||||
// This validation **MUST** be instantly run in all cases even during active sync process.
|
||||
let parent_hash = payload.parent_hash();
|
||||
let block = match self
|
||||
.payload_validator
|
||||
.ensure_well_formed_payload(payload, cancun_fields.into())
|
||||
{
|
||||
let block = match self.payload_validator.ensure_well_formed_payload(
|
||||
payload,
|
||||
cancun_fields.into(),
|
||||
execution_requests,
|
||||
) {
|
||||
Ok(block) => block,
|
||||
Err(error) => {
|
||||
error!(target: "engine::tree", %error, "Invalid payload");
|
||||
@@ -1236,8 +1238,14 @@ where
|
||||
error!(target: "engine::tree", "Failed to send event: {err:?}");
|
||||
}
|
||||
}
|
||||
BeaconEngineMessage::NewPayload { payload, cancun_fields, tx } => {
|
||||
let output = self.on_new_payload(payload, cancun_fields);
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
} => {
|
||||
let output =
|
||||
self.on_new_payload(payload, cancun_fields, execution_requests);
|
||||
if let Err(err) = tx.send(output.map(|o| o.outcome).map_err(|e| {
|
||||
reth_beacon_consensus::BeaconOnNewPayloadError::Internal(
|
||||
Box::new(e),
|
||||
@@ -2852,6 +2860,7 @@ mod tests {
|
||||
parent_beacon_block_root: block.parent_beacon_block_root.unwrap(),
|
||||
versioned_hashes: vec![],
|
||||
}),
|
||||
None,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
@@ -3114,7 +3123,7 @@ mod tests {
|
||||
|
||||
let mut test_harness = TestHarness::new(HOLESKY.clone());
|
||||
|
||||
let outcome = test_harness.tree.on_new_payload(payload.into(), None).unwrap();
|
||||
let outcome = test_harness.tree.on_new_payload(payload.into(), None, None).unwrap();
|
||||
assert!(outcome.outcome.is_syncing());
|
||||
|
||||
// ensure block is buffered
|
||||
@@ -3159,6 +3168,7 @@ mod tests {
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload: payload.clone().into(),
|
||||
cancun_fields: None,
|
||||
execution_requests: None,
|
||||
tx,
|
||||
}
|
||||
.into(),
|
||||
|
||||
@@ -73,7 +73,13 @@ impl EngineMessageStore {
|
||||
})?,
|
||||
)?;
|
||||
}
|
||||
BeaconEngineMessage::NewPayload { payload, cancun_fields, tx: _tx } => {
|
||||
// todo(onbjerg): execution requests
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests: _,
|
||||
tx: _tx,
|
||||
} => {
|
||||
let filename = format!("{}-new_payload-{}.json", timestamp, payload.block_hash());
|
||||
fs::write(
|
||||
self.path.join(filename),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Stream wrapper that simulates reorgs.
|
||||
|
||||
use alloy_consensus::Transaction;
|
||||
use alloy_primitives::U256;
|
||||
use alloy_primitives::{Bytes, U256};
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus,
|
||||
};
|
||||
@@ -147,7 +147,12 @@ where
|
||||
let next = ready!(this.stream.poll_next_unpin(cx));
|
||||
let item = match (next, &this.last_forkchoice_state) {
|
||||
(
|
||||
Some(BeaconEngineMessage::NewPayload { payload, cancun_fields, tx }),
|
||||
Some(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
}),
|
||||
Some(last_forkchoice_state),
|
||||
) if this.forkchoice_states_forwarded > this.frequency &&
|
||||
// Only enter reorg state if new payload attaches to current head.
|
||||
@@ -162,26 +167,29 @@ where
|
||||
// forkchoice state. We will rely on CL to reorg us back to canonical chain.
|
||||
// TODO: This is an expensive blocking operation, ideally it's spawned as a task
|
||||
// so that the stream could yield the control back.
|
||||
let (reorg_payload, reorg_cancun_fields) = match create_reorg_head(
|
||||
this.provider,
|
||||
this.evm_config,
|
||||
this.payload_validator,
|
||||
*this.depth,
|
||||
payload.clone(),
|
||||
cancun_fields.clone(),
|
||||
) {
|
||||
Ok(result) => result,
|
||||
Err(error) => {
|
||||
error!(target: "engine::stream::reorg", %error, "Error attempting to create reorg head");
|
||||
// Forward the payload and attempt to create reorg on top of
|
||||
// the next one
|
||||
return Poll::Ready(Some(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
tx,
|
||||
}))
|
||||
}
|
||||
};
|
||||
let (reorg_payload, reorg_cancun_fields, reorg_execution_requests) =
|
||||
match create_reorg_head(
|
||||
this.provider,
|
||||
this.evm_config,
|
||||
this.payload_validator,
|
||||
*this.depth,
|
||||
payload.clone(),
|
||||
cancun_fields.clone(),
|
||||
execution_requests.clone(),
|
||||
) {
|
||||
Ok(result) => result,
|
||||
Err(error) => {
|
||||
error!(target: "engine::stream::reorg", %error, "Error attempting to create reorg head");
|
||||
// Forward the payload and attempt to create reorg on top of
|
||||
// the next one
|
||||
return Poll::Ready(Some(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
}))
|
||||
}
|
||||
};
|
||||
let reorg_forkchoice_state = ForkchoiceState {
|
||||
finalized_block_hash: last_forkchoice_state.finalized_block_hash,
|
||||
safe_block_hash: last_forkchoice_state.safe_block_hash,
|
||||
@@ -197,11 +205,17 @@ where
|
||||
|
||||
let queue = VecDeque::from([
|
||||
// Current payload
|
||||
BeaconEngineMessage::NewPayload { payload, cancun_fields, tx },
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
},
|
||||
// Reorg payload
|
||||
BeaconEngineMessage::NewPayload {
|
||||
payload: reorg_payload,
|
||||
cancun_fields: reorg_cancun_fields,
|
||||
execution_requests: reorg_execution_requests,
|
||||
tx: reorg_payload_tx,
|
||||
},
|
||||
// Reorg forkchoice state
|
||||
@@ -236,7 +250,8 @@ fn create_reorg_head<Provider, Evm, Spec>(
|
||||
mut depth: usize,
|
||||
next_payload: ExecutionPayload,
|
||||
next_cancun_fields: Option<CancunPayloadFields>,
|
||||
) -> RethResult<(ExecutionPayload, Option<CancunPayloadFields>)>
|
||||
next_execution_requests: Option<Vec<Bytes>>,
|
||||
) -> RethResult<(ExecutionPayload, Option<CancunPayloadFields>, Option<Vec<Bytes>>)>
|
||||
where
|
||||
Provider: BlockReader + StateProviderFactory,
|
||||
Evm: ConfigureEvm<Header = Header>,
|
||||
@@ -246,7 +261,11 @@ where
|
||||
|
||||
// Ensure next payload is valid.
|
||||
let next_block = payload_validator
|
||||
.ensure_well_formed_payload(next_payload, next_cancun_fields.into())
|
||||
.ensure_well_formed_payload(
|
||||
next_payload,
|
||||
next_cancun_fields.into(),
|
||||
next_execution_requests,
|
||||
)
|
||||
.map_err(RethError::msg)?;
|
||||
|
||||
// Fetch reorg target block depending on its depth and its parent.
|
||||
@@ -401,7 +420,7 @@ 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_root: None, // TODO(prague)
|
||||
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),
|
||||
@@ -411,7 +430,6 @@ where
|
||||
transactions,
|
||||
ommers: reorg_target.body.ommers,
|
||||
withdrawals: reorg_target.body.withdrawals,
|
||||
requests: None, // TODO(prague)
|
||||
},
|
||||
}
|
||||
.seal_slow();
|
||||
@@ -422,5 +440,7 @@ where
|
||||
.header
|
||||
.parent_beacon_block_root
|
||||
.map(|root| CancunPayloadFields { parent_beacon_block_root: root, versioned_hashes }),
|
||||
// todo(prague)
|
||||
None,
|
||||
))
|
||||
}
|
||||
|
||||
@@ -41,7 +41,12 @@ where
|
||||
loop {
|
||||
let next = ready!(this.stream.poll_next_unpin(cx));
|
||||
let item = match next {
|
||||
Some(BeaconEngineMessage::NewPayload { payload, cancun_fields, tx }) => {
|
||||
Some(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
}) => {
|
||||
if this.skipped < this.threshold {
|
||||
*this.skipped += 1;
|
||||
tracing::warn!(
|
||||
@@ -56,7 +61,12 @@ where
|
||||
continue
|
||||
}
|
||||
*this.skipped = 0;
|
||||
Some(BeaconEngineMessage::NewPayload { payload, cancun_fields, tx })
|
||||
Some(BeaconEngineMessage::NewPayload {
|
||||
payload,
|
||||
cancun_fields,
|
||||
execution_requests,
|
||||
tx,
|
||||
})
|
||||
}
|
||||
next => next,
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ reth-primitives.workspace = true
|
||||
reth-consensus.workspace = true
|
||||
|
||||
# alloy
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
|
||||
@@ -121,11 +121,11 @@ impl<ChainSpec: Send + Sync + EthChainSpec + EthereumHardforks + Debug> Consensu
|
||||
}
|
||||
|
||||
if self.chain_spec.is_prague_active_at_timestamp(header.timestamp) {
|
||||
if header.requests_root.is_none() {
|
||||
return Err(ConsensusError::RequestsRootMissing)
|
||||
if header.requests_hash.is_none() {
|
||||
return Err(ConsensusError::RequestsHashMissing)
|
||||
}
|
||||
} else if header.requests_root.is_some() {
|
||||
return Err(ConsensusError::RequestsRootUnexpected)
|
||||
} else if header.requests_hash.is_some() {
|
||||
return Err(ConsensusError::RequestsHashUnexpected)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{Bloom, B256};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_primitives::{gas_spent_by_transactions, BlockWithSenders, GotExpected, Receipt, Request};
|
||||
use reth_primitives::{gas_spent_by_transactions, BlockWithSenders, GotExpected, Receipt};
|
||||
|
||||
/// Validate a block with regard to execution results:
|
||||
///
|
||||
@@ -11,7 +12,7 @@ pub fn validate_block_post_execution<ChainSpec: EthereumHardforks>(
|
||||
block: &BlockWithSenders,
|
||||
chain_spec: &ChainSpec,
|
||||
receipts: &[Receipt],
|
||||
requests: &[Request],
|
||||
requests: &Requests,
|
||||
) -> Result<(), ConsensusError> {
|
||||
// Check if gas used matches the value set in header.
|
||||
let cumulative_gas_used =
|
||||
@@ -36,15 +37,15 @@ pub fn validate_block_post_execution<ChainSpec: EthereumHardforks>(
|
||||
}
|
||||
}
|
||||
|
||||
// Validate that the header requests root matches the calculated requests root
|
||||
// Validate that the header requests hash matches the calculated requests hash
|
||||
if chain_spec.is_prague_active_at_timestamp(block.timestamp) {
|
||||
let Some(header_requests_root) = block.header.requests_root else {
|
||||
return Err(ConsensusError::RequestsRootMissing)
|
||||
let Some(header_requests_hash) = block.header.requests_hash else {
|
||||
return Err(ConsensusError::RequestsHashMissing)
|
||||
};
|
||||
let requests_root = reth_primitives::proofs::calculate_requests_root(requests);
|
||||
if requests_root != header_requests_root {
|
||||
return Err(ConsensusError::BodyRequestsRootDiff(
|
||||
GotExpected::new(requests_root, header_requests_root).into(),
|
||||
let requests_hash = requests.requests_hash();
|
||||
if requests_hash != header_requests_hash {
|
||||
return Err(ConsensusError::BodyRequestsHashDiff(
|
||||
GotExpected::new(requests_hash, header_requests_hash).into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Contains types required for building a payload.
|
||||
|
||||
use alloy_eips::eip4844::BlobTransactionSidecar;
|
||||
use alloy_eips::{eip4844::BlobTransactionSidecar, eip7685::Requests};
|
||||
use alloy_primitives::{Address, B256, U256};
|
||||
use alloy_rlp::Encodable;
|
||||
use alloy_rpc_types_engine::{
|
||||
@@ -11,8 +11,7 @@ use reth_chain_state::ExecutedBlock;
|
||||
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
|
||||
use reth_primitives::{SealedBlock, Withdrawals};
|
||||
use reth_rpc_types_compat::engine::payload::{
|
||||
block_to_payload_v1, block_to_payload_v3, block_to_payload_v4,
|
||||
convert_block_to_payload_field_v2,
|
||||
block_to_payload_v1, block_to_payload_v3, convert_block_to_payload_field_v2,
|
||||
};
|
||||
use std::convert::Infallible;
|
||||
|
||||
@@ -142,10 +141,17 @@ impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV3 {
|
||||
|
||||
impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV4 {
|
||||
fn from(value: EthBuiltPayload) -> Self {
|
||||
let EthBuiltPayload { block, fees, sidecars, .. } = value;
|
||||
let EthBuiltPayload { block, fees, sidecars, executed_block, .. } = value;
|
||||
|
||||
// if we have an executed block, we pop off the first set of requests from the execution
|
||||
// outcome. the assumption here is that there will always only be one block in the execution
|
||||
// outcome.
|
||||
let execution_requests = executed_block
|
||||
.and_then(|block| block.execution_outcome().requests.first().cloned())
|
||||
.map(Requests::take)
|
||||
.unwrap_or_default();
|
||||
Self {
|
||||
execution_payload: block_to_payload_v4(block),
|
||||
execution_payload: block_to_payload_v3(block),
|
||||
block_value: fees,
|
||||
// From the engine API spec:
|
||||
//
|
||||
@@ -157,6 +163,7 @@ impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV4 {
|
||||
// <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#specification-2>
|
||||
should_override_builder: false,
|
||||
blobs_bundle: sidecars.into_iter().map(Into::into).collect::<Vec<_>>().into(),
|
||||
execution_requests,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! EIP-6110 deposit requests parsing
|
||||
use alloc::{string::ToString, vec::Vec};
|
||||
use alloy_eips::eip6110::{DepositRequest, MAINNET_DEPOSIT_CONTRACT_ADDRESS};
|
||||
use alloy_primitives::Log;
|
||||
use alloy_eips::eip6110::MAINNET_DEPOSIT_CONTRACT_ADDRESS;
|
||||
use alloy_primitives::{Bytes, Log};
|
||||
use alloy_sol_types::{sol, SolEvent};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_evm::execute::BlockValidationError;
|
||||
use reth_primitives::{Receipt, Request};
|
||||
use reth_primitives::Receipt;
|
||||
|
||||
sol! {
|
||||
#[allow(missing_docs)]
|
||||
@@ -20,73 +20,57 @@ sol! {
|
||||
|
||||
/// Parse [deposit contract](https://etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705fa)
|
||||
/// (address is from the passed [`ChainSpec`]) deposits from receipts, and return them as a
|
||||
/// [vector](Vec) of (requests)[Request].
|
||||
/// [vector](Vec) of (requests)[`alloy_eips::eip7685::Requests`].
|
||||
pub fn parse_deposits_from_receipts<'a, I>(
|
||||
chain_spec: &ChainSpec,
|
||||
receipts: I,
|
||||
) -> Result<Vec<Request>, BlockValidationError>
|
||||
) -> Result<Bytes, BlockValidationError>
|
||||
where
|
||||
I: IntoIterator<Item = &'a Receipt>,
|
||||
{
|
||||
let mut requests = Vec::new();
|
||||
let deposit_contract_address = chain_spec
|
||||
.deposit_contract
|
||||
.as_ref()
|
||||
.map_or(MAINNET_DEPOSIT_CONTRACT_ADDRESS, |contract| contract.address);
|
||||
receipts
|
||||
let logs: Vec<_> = receipts
|
||||
.into_iter()
|
||||
.flat_map(|receipt| receipt.logs.iter())
|
||||
// No need to filter for topic because there's only one event and that's the Deposit event
|
||||
// in the deposit contract.
|
||||
.flat_map(|receipt| &receipt.logs)
|
||||
// No need to filter for topic because there's only one event and that's the Deposit
|
||||
// event in the deposit contract.
|
||||
.filter(|log| log.address == deposit_contract_address)
|
||||
.map(|log| {
|
||||
let decoded_log = DepositEvent::decode_log(log, false)?;
|
||||
let deposit = parse_deposit_from_log(&decoded_log);
|
||||
Ok(Request::DepositRequest(deposit))
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(|err: alloy_sol_types::Error| {
|
||||
BlockValidationError::DepositRequestDecode(err.to_string())
|
||||
})
|
||||
.collect();
|
||||
|
||||
for log in &logs {
|
||||
let decoded_log =
|
||||
DepositEvent::decode_log(log, false).map_err(|err: alloy_sol_types::Error| {
|
||||
BlockValidationError::DepositRequestDecode(err.to_string())
|
||||
})?;
|
||||
requests.extend(parse_deposit_from_log(&decoded_log).as_ref())
|
||||
}
|
||||
|
||||
Ok(requests.into())
|
||||
}
|
||||
|
||||
fn parse_deposit_from_log(log: &Log<DepositEvent>) -> DepositRequest {
|
||||
fn parse_deposit_from_log(log: &Log<DepositEvent>) -> Bytes {
|
||||
// SAFETY: These `expect` https://github.com/ethereum/consensus-specs/blob/5f48840f4d768bf0e0a8156a3ed06ec333589007/solidity_deposit_contract/deposit_contract.sol#L107-L110
|
||||
// are safe because the `DepositEvent` is the only event in the deposit contract and the length
|
||||
// checks are done there.
|
||||
DepositRequest {
|
||||
pubkey: log
|
||||
.pubkey
|
||||
.as_ref()
|
||||
.try_into()
|
||||
.expect("pubkey length should be enforced in deposit contract"),
|
||||
withdrawal_credentials: log
|
||||
.withdrawal_credentials
|
||||
.as_ref()
|
||||
.try_into()
|
||||
.expect("withdrawal_credentials length should be enforced in deposit contract"),
|
||||
amount: u64::from_le_bytes(
|
||||
log.amount
|
||||
.as_ref()
|
||||
.try_into()
|
||||
.expect("amount length should be enforced in deposit contract"),
|
||||
),
|
||||
signature: log
|
||||
.signature
|
||||
.as_ref()
|
||||
.try_into()
|
||||
.expect("signature length should be enforced in deposit contract"),
|
||||
index: u64::from_le_bytes(
|
||||
log.index
|
||||
.as_ref()
|
||||
.try_into()
|
||||
.expect("deposit index length should be enforced in deposit contract"),
|
||||
),
|
||||
}
|
||||
[
|
||||
log.pubkey.as_ref(),
|
||||
log.withdrawal_credentials.as_ref(),
|
||||
log.amount.as_ref(),
|
||||
log.signature.as_ref(),
|
||||
log.index.as_ref(),
|
||||
]
|
||||
.concat()
|
||||
.into()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_primitives::bytes;
|
||||
use reth_chainspec::MAINNET;
|
||||
use reth_primitives::TxType;
|
||||
|
||||
@@ -119,9 +103,12 @@ mod tests {
|
||||
},
|
||||
];
|
||||
|
||||
let requests = parse_deposits_from_receipts(&MAINNET, &receipts).unwrap();
|
||||
assert_eq!(requests.len(), 2);
|
||||
assert_eq!(requests[0].as_deposit_request().unwrap().amount, 32e9 as u64);
|
||||
assert_eq!(requests[1].as_deposit_request().unwrap().amount, 32e9 as u64);
|
||||
let request_data = parse_deposits_from_receipts(&MAINNET, &receipts).unwrap();
|
||||
assert_eq!(
|
||||
request_data,
|
||||
bytes!(
|
||||
"998c8086669bf65e24581cda47d8537966e9f5066fc6ffdcba910a1bfb91eae7a4873fcce166a1c4ea217e6b1afd396201000000000000000000000001c340fb72ed14d4eaa71f7633ee9e33b88d4f39004059730700000098ddbffd700c1aac324cfdf0492ff289223661eb26718ce3651ba2469b22f480d56efab432ed91af05a006bde0c1ea68134e0acd8cacca0c13ad1f716db874b44abfcc966368019753174753bca3af2ea84bc569c46f76592a91e97f311eddece474160000000000a1a2ba870a90e889aa594a0cc1c6feffb94c2d8f65646c937f1f456a315ef649533e25a4614d8f4f66ebdb06481b90af0100000000000000000000000a0f04a231efbc29e1db7d086300ff550211c2f60040597307000000ad416d590e1a7f52baff770a12835b68904efad22cc9f8ba531e50cbbd26f32b9c7373cf6538a0577f501e4d3e3e63e208767bcccaae94e1e3720bfb734a286f9c017d17af46536545ccb7ca94d71f295e71f6d25bf978c09ada6f8d3f7ba039e374160000000000"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ 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 alloy_primitives::{BlockNumber, U256};
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::{ChainSpec, EthereumHardforks, MAINNET};
|
||||
@@ -19,7 +20,7 @@ use reth_evm::{
|
||||
ConfigureEvm,
|
||||
};
|
||||
use reth_execution_types::ExecutionOutcome;
|
||||
use reth_primitives::{BlockWithSenders, EthereumHardfork, Header, Receipt, Request};
|
||||
use reth_primitives::{BlockWithSenders, EthereumHardfork, Header, Receipt};
|
||||
use reth_prune_types::PruneModes;
|
||||
use reth_revm::{
|
||||
batch::BlockBatchRecord,
|
||||
@@ -104,7 +105,7 @@ where
|
||||
#[derive(Debug, Clone)]
|
||||
struct EthExecuteOutput {
|
||||
receipts: Vec<Receipt>,
|
||||
requests: Vec<Request>,
|
||||
requests: Requests,
|
||||
gas_used: u64,
|
||||
}
|
||||
|
||||
@@ -122,7 +123,7 @@ where
|
||||
EvmConfig: ConfigureEvm<Header = Header>,
|
||||
{
|
||||
/// Executes the transactions in the block and returns the receipts of the transactions in the
|
||||
/// block, the total gas used and the list of EIP-7685 [requests](Request).
|
||||
/// block, the total gas used and the list of EIP-7685 [requests](Requests).
|
||||
///
|
||||
/// This applies the pre-execution and post-execution changes that require an [EVM](Evm), and
|
||||
/// executes the transactions.
|
||||
@@ -205,11 +206,11 @@ where
|
||||
let deposit_requests =
|
||||
crate::eip6110::parse_deposits_from_receipts(&self.chain_spec, &receipts)?;
|
||||
|
||||
let post_execution_requests = system_caller.apply_post_execution_changes(&mut evm)?;
|
||||
|
||||
[deposit_requests, post_execution_requests].concat()
|
||||
let mut requests = Requests::new(vec![deposit_requests]);
|
||||
requests.extend(system_caller.apply_post_execution_changes(&mut evm)?);
|
||||
requests
|
||||
} else {
|
||||
vec![]
|
||||
Requests::default()
|
||||
};
|
||||
|
||||
Ok(EthExecuteOutput { receipts, requests, gas_used: cumulative_gas_used })
|
||||
@@ -283,7 +284,7 @@ where
|
||||
/// Execute a single block and apply the state changes to the internal state.
|
||||
///
|
||||
/// Returns the receipts of the transactions in the block, the total gas used and the list of
|
||||
/// EIP-7685 [requests](Request).
|
||||
/// EIP-7685 [requests](Requests).
|
||||
///
|
||||
/// Returns an error if execution fails.
|
||||
fn execute_without_verification_with_state_hook<F>(
|
||||
@@ -494,11 +495,12 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_consensus::{TxLegacy, EMPTY_ROOT_HASH};
|
||||
use alloy_consensus::TxLegacy;
|
||||
use alloy_eips::{
|
||||
eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE},
|
||||
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS},
|
||||
eip7002::{WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS, WITHDRAWAL_REQUEST_PREDEPLOY_CODE},
|
||||
eip7685::EMPTY_REQUESTS_HASH,
|
||||
};
|
||||
use alloy_primitives::{b256, fixed_bytes, keccak256, Bytes, TxKind, B256};
|
||||
use reth_chainspec::{ChainSpecBuilder, ForkCondition};
|
||||
@@ -583,7 +585,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -612,12 +613,7 @@ mod tests {
|
||||
&BlockWithSenders {
|
||||
block: Block {
|
||||
header: header.clone(),
|
||||
body: BlockBody {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
body: BlockBody { transactions: vec![], ommers: vec![], withdrawals: None },
|
||||
},
|
||||
senders: vec![],
|
||||
},
|
||||
@@ -684,7 +680,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -739,7 +734,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -1016,7 +1010,7 @@ mod tests {
|
||||
parent_hash: B256::random(),
|
||||
timestamp: 1,
|
||||
number: fork_activation_block,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
let provider = executor_provider(chain_spec);
|
||||
@@ -1075,7 +1069,7 @@ mod tests {
|
||||
parent_hash: B256::random(),
|
||||
timestamp: 1,
|
||||
number: fork_activation_block,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
|
||||
@@ -1121,7 +1115,7 @@ mod tests {
|
||||
);
|
||||
|
||||
let mut header = chain_spec.genesis_header().clone();
|
||||
header.requests_root = Some(EMPTY_ROOT_HASH);
|
||||
header.requests_hash = Some(EMPTY_REQUESTS_HASH);
|
||||
let header_hash = header.hash_slow();
|
||||
|
||||
let provider = executor_provider(chain_spec);
|
||||
@@ -1159,7 +1153,7 @@ mod tests {
|
||||
parent_hash: header_hash,
|
||||
timestamp: 1,
|
||||
number: 1,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
let header_hash = header.hash_slow();
|
||||
@@ -1196,7 +1190,7 @@ mod tests {
|
||||
parent_hash: header_hash,
|
||||
timestamp: 1,
|
||||
number: 2,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
|
||||
@@ -1254,15 +1248,16 @@ mod tests {
|
||||
HashMap::default(),
|
||||
);
|
||||
|
||||
// https://github.com/lightclient/7002asm/blob/e0d68e04d15f25057af7b6d180423d94b6b3bdb3/test/Contract.t.sol.in#L49-L64
|
||||
// https://github.com/lightclient/sys-asm/blob/9282bdb9fd64e024e27f60f507486ffb2183cba2/test/Withdrawal.t.sol.in#L36
|
||||
let validator_public_key = fixed_bytes!("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
let withdrawal_amount = fixed_bytes!("2222222222222222");
|
||||
let withdrawal_amount = fixed_bytes!("0203040506070809");
|
||||
let input: Bytes = [&validator_public_key[..], &withdrawal_amount[..]].concat().into();
|
||||
assert_eq!(input.len(), 56);
|
||||
|
||||
let mut header = chain_spec.genesis_header().clone();
|
||||
header.gas_limit = 1_500_000;
|
||||
header.gas_used = 134_807;
|
||||
// measured
|
||||
header.gas_used = 135_856;
|
||||
header.receipts_root =
|
||||
b256!("b31a3e47b902e9211c4d349af4e4c5604ce388471e79ca008907ae4616bb0ed3");
|
||||
|
||||
@@ -1272,10 +1267,10 @@ mod tests {
|
||||
chain_id: Some(chain_spec.chain.id()),
|
||||
nonce: 1,
|
||||
gas_price: header.base_fee_per_gas.unwrap().into(),
|
||||
gas_limit: 134_807,
|
||||
gas_limit: header.gas_used,
|
||||
to: TxKind::Call(WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS),
|
||||
// `MIN_WITHDRAWAL_REQUEST_FEE`
|
||||
value: U256::from(1),
|
||||
value: U256::from(2),
|
||||
input,
|
||||
}),
|
||||
);
|
||||
@@ -1302,11 +1297,9 @@ mod tests {
|
||||
let receipt = receipts.first().unwrap();
|
||||
assert!(receipt.success);
|
||||
|
||||
let request = requests.first().unwrap();
|
||||
let withdrawal_request = request.as_withdrawal_request().unwrap();
|
||||
assert_eq!(withdrawal_request.source_address, sender_address);
|
||||
assert_eq!(withdrawal_request.validator_pubkey, validator_public_key);
|
||||
assert_eq!(withdrawal_request.amount, u64::from_be_bytes(withdrawal_amount.into()));
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::{
|
||||
};
|
||||
use alloc::sync::Arc;
|
||||
use alloy_consensus::Transaction as _;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks, MAINNET};
|
||||
use reth_consensus::ConsensusError;
|
||||
@@ -18,7 +19,7 @@ use reth_evm::{
|
||||
system_calls::{OnStateHook, SystemCaller},
|
||||
ConfigureEvm, ConfigureEvmEnv,
|
||||
};
|
||||
use reth_primitives::{BlockWithSenders, Header, Receipt, Request};
|
||||
use reth_primitives::{BlockWithSenders, Header, Receipt};
|
||||
use reth_revm::{
|
||||
db::{states::bundle_state::BundleRetention, BundleState},
|
||||
state_change::post_block_balance_increments,
|
||||
@@ -194,7 +195,7 @@ where
|
||||
block: &BlockWithSenders,
|
||||
total_difficulty: U256,
|
||||
receipts: &[Receipt],
|
||||
) -> Result<Vec<Request>, Self::Error> {
|
||||
) -> Result<Requests, Self::Error> {
|
||||
let env = self.evm_env_for_block(&block.header, total_difficulty);
|
||||
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);
|
||||
|
||||
@@ -203,12 +204,11 @@ where
|
||||
let deposit_requests =
|
||||
crate::eip6110::parse_deposits_from_receipts(&self.chain_spec, receipts)?;
|
||||
|
||||
let post_execution_requests =
|
||||
self.system_caller.apply_post_execution_changes(&mut evm)?;
|
||||
|
||||
[deposit_requests, post_execution_requests].concat()
|
||||
let mut requests = Requests::new(vec![deposit_requests]);
|
||||
requests.extend(self.system_caller.apply_post_execution_changes(&mut evm)?);
|
||||
requests
|
||||
} else {
|
||||
vec![]
|
||||
Requests::default()
|
||||
};
|
||||
drop(evm);
|
||||
|
||||
@@ -257,7 +257,7 @@ where
|
||||
&self,
|
||||
block: &BlockWithSenders,
|
||||
receipts: &[Receipt],
|
||||
requests: &[Request],
|
||||
requests: &Requests,
|
||||
) -> Result<(), ConsensusError> {
|
||||
validate_block_post_execution(block, &self.chain_spec.clone(), receipts, requests)
|
||||
}
|
||||
@@ -266,11 +266,12 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_consensus::{TxLegacy, EMPTY_ROOT_HASH};
|
||||
use alloy_consensus::TxLegacy;
|
||||
use alloy_eips::{
|
||||
eip2935::{HISTORY_STORAGE_ADDRESS, HISTORY_STORAGE_CODE},
|
||||
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS},
|
||||
eip7002::{WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS, WITHDRAWAL_REQUEST_PREDEPLOY_CODE},
|
||||
eip7685::EMPTY_REQUESTS_HASH,
|
||||
};
|
||||
use alloy_primitives::{b256, fixed_bytes, keccak256, Bytes, TxKind, B256};
|
||||
use reth_chainspec::{ChainSpecBuilder, ForkCondition};
|
||||
@@ -365,7 +366,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -397,7 +397,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -468,7 +467,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -523,7 +521,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
requests: None,
|
||||
},
|
||||
},
|
||||
senders: vec![],
|
||||
@@ -797,7 +794,7 @@ mod tests {
|
||||
parent_hash: B256::random(),
|
||||
timestamp: 1,
|
||||
number: fork_activation_block,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
let provider = executor_provider(chain_spec);
|
||||
@@ -855,7 +852,7 @@ mod tests {
|
||||
parent_hash: B256::random(),
|
||||
timestamp: 1,
|
||||
number: fork_activation_block,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
|
||||
@@ -901,7 +898,7 @@ mod tests {
|
||||
);
|
||||
|
||||
let mut header = chain_spec.genesis_header().clone();
|
||||
header.requests_root = Some(EMPTY_ROOT_HASH);
|
||||
header.requests_hash = Some(EMPTY_REQUESTS_HASH);
|
||||
let header_hash = header.hash_slow();
|
||||
|
||||
let provider = executor_provider(chain_spec);
|
||||
@@ -938,7 +935,7 @@ mod tests {
|
||||
parent_hash: header_hash,
|
||||
timestamp: 1,
|
||||
number: 1,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
let header_hash = header.hash_slow();
|
||||
@@ -977,7 +974,7 @@ mod tests {
|
||||
parent_hash: header_hash,
|
||||
timestamp: 1,
|
||||
number: 2,
|
||||
requests_root: Some(EMPTY_ROOT_HASH),
|
||||
requests_hash: Some(EMPTY_REQUESTS_HASH),
|
||||
..Header::default()
|
||||
};
|
||||
|
||||
@@ -1039,15 +1036,16 @@ mod tests {
|
||||
HashMap::default(),
|
||||
);
|
||||
|
||||
// https://github.com/lightclient/7002asm/blob/e0d68e04d15f25057af7b6d180423d94b6b3bdb3/test/Contract.t.sol.in#L49-L64
|
||||
// https://github.com/lightclient/sys-asm/blob/9282bdb9fd64e024e27f60f507486ffb2183cba2/test/Withdrawal.t.sol.in#L36
|
||||
let validator_public_key = fixed_bytes!("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
|
||||
let withdrawal_amount = fixed_bytes!("2222222222222222");
|
||||
let withdrawal_amount = fixed_bytes!("0203040506070809");
|
||||
let input: Bytes = [&validator_public_key[..], &withdrawal_amount[..]].concat().into();
|
||||
assert_eq!(input.len(), 56);
|
||||
|
||||
let mut header = chain_spec.genesis_header().clone();
|
||||
header.gas_limit = 1_500_000;
|
||||
header.gas_used = 134_807;
|
||||
// measured
|
||||
header.gas_used = 135_856;
|
||||
header.receipts_root =
|
||||
b256!("b31a3e47b902e9211c4d349af4e4c5604ce388471e79ca008907ae4616bb0ed3");
|
||||
|
||||
@@ -1057,10 +1055,10 @@ mod tests {
|
||||
chain_id: Some(chain_spec.chain.id()),
|
||||
nonce: 1,
|
||||
gas_price: header.base_fee_per_gas.unwrap().into(),
|
||||
gas_limit: 134_807,
|
||||
gas_limit: header.gas_used,
|
||||
to: TxKind::Call(WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS),
|
||||
// `MIN_WITHDRAWAL_REQUEST_FEE`
|
||||
value: U256::from(1),
|
||||
value: U256::from(2),
|
||||
input,
|
||||
}),
|
||||
);
|
||||
@@ -1087,11 +1085,9 @@ mod tests {
|
||||
let receipt = receipts.first().unwrap();
|
||||
assert!(receipt.success);
|
||||
|
||||
let request = requests.first().unwrap();
|
||||
let withdrawal_request = request.as_withdrawal_request().unwrap();
|
||||
assert_eq!(withdrawal_request.source_address, sender_address);
|
||||
assert_eq!(withdrawal_request.validator_pubkey, validator_public_key);
|
||||
assert_eq!(withdrawal_request.amount, u64::from_be_bytes(withdrawal_amount.into()));
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -33,8 +33,9 @@ revm.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
# alloy
|
||||
alloy-primitives.workspace = true
|
||||
alloy-eips.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
|
||||
# misc
|
||||
tracing.workspace = true
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#![allow(clippy::useless_let_if_seq)]
|
||||
|
||||
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::U256;
|
||||
use reth_basic_payload_builder::{
|
||||
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
|
||||
@@ -25,7 +26,7 @@ use reth_payload_builder::{EthBuiltPayload, EthPayloadBuilderAttributes};
|
||||
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
|
||||
use reth_primitives::{
|
||||
constants::{eip4844::MAX_DATA_GAS_PER_BLOCK, BEACON_NONCE},
|
||||
proofs::{self, calculate_requests_root},
|
||||
proofs::{self},
|
||||
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
|
||||
Block, BlockBody, EthereumHardforks, Header, Receipt,
|
||||
};
|
||||
@@ -308,9 +309,7 @@ where
|
||||
}
|
||||
|
||||
// calculate the requests and the requests root
|
||||
let (requests, requests_root) = if chain_spec
|
||||
.is_prague_active_at_timestamp(attributes.timestamp)
|
||||
{
|
||||
let requests = if chain_spec.is_prague_active_at_timestamp(attributes.timestamp) {
|
||||
let deposit_requests = parse_deposits_from_receipts(&chain_spec, receipts.iter().flatten())
|
||||
.map_err(|err| PayloadBuilderError::Internal(RethError::Execution(err.into())))?;
|
||||
let withdrawal_requests = system_caller
|
||||
@@ -328,11 +327,9 @@ where
|
||||
)
|
||||
.map_err(|err| PayloadBuilderError::Internal(err.into()))?;
|
||||
|
||||
let requests = [deposit_requests, withdrawal_requests, consolidation_requests].concat();
|
||||
let requests_root = calculate_requests_root(&requests);
|
||||
(Some(requests.into()), Some(requests_root))
|
||||
Some(Requests::new(vec![deposit_requests, withdrawal_requests, consolidation_requests]))
|
||||
} else {
|
||||
(None, None)
|
||||
None
|
||||
};
|
||||
|
||||
let WithdrawalsOutcome { withdrawals_root, withdrawals } =
|
||||
@@ -414,13 +411,13 @@ where
|
||||
parent_beacon_block_root: attributes.parent_beacon_block_root,
|
||||
blob_gas_used: blob_gas_used.map(Into::into),
|
||||
excess_blob_gas: excess_blob_gas.map(Into::into),
|
||||
requests_root,
|
||||
requests_hash: requests.map(|r| r.requests_hash()),
|
||||
};
|
||||
|
||||
// seal the block
|
||||
let block = Block {
|
||||
header,
|
||||
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals, requests },
|
||||
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals },
|
||||
};
|
||||
|
||||
let sealed_block = block.seal_slow();
|
||||
|
||||
@@ -25,7 +25,6 @@ serde = { workspace = true, optional = true }
|
||||
serde_with = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-eips.workspace = true
|
||||
arbitrary.workspace = true
|
||||
bincode.workspace = true
|
||||
rand.workspace = true
|
||||
@@ -35,5 +34,9 @@ reth-primitives = { workspace = true, features = ["arbitrary", "test-utils"] }
|
||||
default = ["std"]
|
||||
optimism = ["reth-primitives/optimism", "revm/optimism"]
|
||||
serde = ["dep:serde", "reth-trie/serde", "revm/serde"]
|
||||
serde-bincode-compat = ["reth-primitives/serde-bincode-compat", "reth-trie/serde-bincode-compat", "serde_with"]
|
||||
serde-bincode-compat = [
|
||||
"reth-primitives/serde-bincode-compat",
|
||||
"reth-trie/serde-bincode-compat",
|
||||
"serde_with",
|
||||
]
|
||||
std = []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::U256;
|
||||
use reth_primitives::Request;
|
||||
use revm::db::BundleState;
|
||||
|
||||
/// A helper type for ethereum block inputs that consists of a block and the total difficulty.
|
||||
@@ -33,8 +33,8 @@ pub struct BlockExecutionOutput<T> {
|
||||
pub state: BundleState,
|
||||
/// All the receipts of the transactions in the block.
|
||||
pub receipts: Vec<T>,
|
||||
/// All the EIP-7685 requests of the transactions in the block.
|
||||
pub requests: Vec<Request>,
|
||||
/// All the EIP-7685 requests in the block.
|
||||
pub requests: Requests,
|
||||
/// The total gas used by the block.
|
||||
pub gas_used: u64,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::BlockExecutionOutput;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{Address, BlockNumber, Bloom, Log, B256, U256};
|
||||
use reth_primitives::{logs_bloom, Account, Bytecode, Receipt, Receipts, Requests, StorageEntry};
|
||||
use reth_primitives::{logs_bloom, Account, Bytecode, Receipt, Receipts, StorageEntry};
|
||||
use reth_trie::HashedPostState;
|
||||
use revm::{
|
||||
db::{states::BundleState, BundleAccount},
|
||||
@@ -357,7 +358,7 @@ impl From<(BlockExecutionOutput<Receipt>, BlockNumber)> for ExecutionOutcome {
|
||||
bundle: value.0.state,
|
||||
receipts: Receipts::from(value.0.receipts),
|
||||
first_block: value.1,
|
||||
requests: vec![Requests::from(value.0.requests)],
|
||||
requests: vec![value.0.requests],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,9 +366,9 @@ impl From<(BlockExecutionOutput<Receipt>, BlockNumber)> for ExecutionOutcome {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_eips::{eip6110::DepositRequest, eip7002::WithdrawalRequest};
|
||||
use alloy_primitives::{Address, FixedBytes, LogData, B256};
|
||||
use reth_primitives::{Receipts, Request, Requests, TxType};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{bytes, Address, LogData, B256};
|
||||
use reth_primitives::{Receipts, TxType};
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[test]
|
||||
@@ -393,29 +394,8 @@ mod tests {
|
||||
})]],
|
||||
};
|
||||
|
||||
// Create a Requests object with a vector of requests, including DepositRequest and
|
||||
// WithdrawalRequest
|
||||
let requests = vec![Requests(vec![
|
||||
Request::DepositRequest(DepositRequest {
|
||||
pubkey: FixedBytes::<48>::from([1; 48]),
|
||||
withdrawal_credentials: B256::from([0; 32]),
|
||||
amount: 1111,
|
||||
signature: FixedBytes::<96>::from([2; 96]),
|
||||
index: 222,
|
||||
}),
|
||||
Request::DepositRequest(DepositRequest {
|
||||
pubkey: FixedBytes::<48>::from([23; 48]),
|
||||
withdrawal_credentials: B256::from([0; 32]),
|
||||
amount: 34343,
|
||||
signature: FixedBytes::<96>::from([43; 96]),
|
||||
index: 1212,
|
||||
}),
|
||||
Request::WithdrawalRequest(WithdrawalRequest {
|
||||
source_address: Address::from([1; 20]),
|
||||
validator_pubkey: FixedBytes::<48>::from([10; 48]),
|
||||
amount: 72,
|
||||
}),
|
||||
])];
|
||||
// Create a Requests object with a vector of requests
|
||||
let requests = vec![Requests::new(vec![bytes!("dead"), bytes!("beef"), bytes!("beebee")])];
|
||||
|
||||
// Define the first block number
|
||||
let first_block = 123;
|
||||
@@ -657,17 +637,12 @@ mod tests {
|
||||
// Define the first block number
|
||||
let first_block = 123;
|
||||
|
||||
// Create a DepositRequest object with specific attributes.
|
||||
let request = Request::DepositRequest(DepositRequest {
|
||||
pubkey: FixedBytes::<48>::from([1; 48]),
|
||||
withdrawal_credentials: B256::from([0; 32]),
|
||||
amount: 1111,
|
||||
signature: FixedBytes::<96>::from([2; 96]),
|
||||
index: 222,
|
||||
});
|
||||
// Create a request.
|
||||
let request = bytes!("deadbeef");
|
||||
|
||||
// Create a vector of Requests containing the request.
|
||||
let requests = vec![Requests(vec![request]), Requests(vec![request])];
|
||||
let requests =
|
||||
vec![Requests::new(vec![request.clone()]), Requests::new(vec![request.clone()])];
|
||||
|
||||
// Create a ExecutionOutcome object with the created bundle, receipts, requests, and
|
||||
// first_block
|
||||
@@ -681,7 +656,7 @@ mod tests {
|
||||
assert_eq!(exec_res.receipts, Receipts { receipt_vec: vec![vec![Some(receipt)]] });
|
||||
|
||||
// Assert that the requests are properly cut after reverting to the initial block number.
|
||||
assert_eq!(exec_res.requests, vec![Requests(vec![request])]);
|
||||
assert_eq!(exec_res.requests, vec![Requests::new(vec![request])]);
|
||||
|
||||
// Assert that the revert_to method returns false when attempting to revert to a block
|
||||
// number greater than the initial block number.
|
||||
@@ -709,17 +684,11 @@ mod tests {
|
||||
// Create a Receipts object containing the receipt.
|
||||
let receipts = Receipts { receipt_vec: vec![vec![Some(receipt.clone())]] };
|
||||
|
||||
// Create a DepositRequest object with specific attributes.
|
||||
let request = Request::DepositRequest(DepositRequest {
|
||||
pubkey: FixedBytes::<48>::from([1; 48]),
|
||||
withdrawal_credentials: B256::from([0; 32]),
|
||||
amount: 1111,
|
||||
signature: FixedBytes::<96>::from([2; 96]),
|
||||
index: 222,
|
||||
});
|
||||
// Create a request.
|
||||
let request = bytes!("deadbeef");
|
||||
|
||||
// Create a vector of Requests containing the request.
|
||||
let requests = vec![Requests(vec![request])];
|
||||
let requests = vec![Requests::new(vec![request.clone()])];
|
||||
|
||||
// Define the initial block number.
|
||||
let first_block = 123;
|
||||
@@ -739,7 +708,7 @@ mod tests {
|
||||
receipts: Receipts {
|
||||
receipt_vec: vec![vec![Some(receipt.clone())], vec![Some(receipt)]]
|
||||
},
|
||||
requests: vec![Requests(vec![request]), Requests(vec![request])],
|
||||
requests: vec![Requests::new(vec![request.clone()]), Requests::new(vec![request])],
|
||||
first_block: 123,
|
||||
}
|
||||
);
|
||||
@@ -771,18 +740,15 @@ mod tests {
|
||||
// Define the first block number
|
||||
let first_block = 123;
|
||||
|
||||
// Create a DepositRequest object with specific attributes.
|
||||
let request = Request::DepositRequest(DepositRequest {
|
||||
pubkey: FixedBytes::<48>::from([1; 48]),
|
||||
withdrawal_credentials: B256::from([0; 32]),
|
||||
amount: 1111,
|
||||
signature: FixedBytes::<96>::from([2; 96]),
|
||||
index: 222,
|
||||
});
|
||||
// Create a request.
|
||||
let request = bytes!("deadbeef");
|
||||
|
||||
// Create a vector of Requests containing the request.
|
||||
let requests =
|
||||
vec![Requests(vec![request]), Requests(vec![request]), Requests(vec![request])];
|
||||
let requests = vec![
|
||||
Requests::new(vec![request.clone()]),
|
||||
Requests::new(vec![request.clone()]),
|
||||
Requests::new(vec![request.clone()]),
|
||||
];
|
||||
|
||||
// Create a ExecutionOutcome object with the created bundle, receipts, requests, and
|
||||
// first_block
|
||||
@@ -796,7 +762,7 @@ mod tests {
|
||||
let lower_execution_outcome = ExecutionOutcome {
|
||||
bundle: Default::default(),
|
||||
receipts: Receipts { receipt_vec: vec![vec![Some(receipt.clone())]] },
|
||||
requests: vec![Requests(vec![request])],
|
||||
requests: vec![Requests::new(vec![request.clone()])],
|
||||
first_block,
|
||||
};
|
||||
|
||||
@@ -806,7 +772,7 @@ mod tests {
|
||||
receipts: Receipts {
|
||||
receipt_vec: vec![vec![Some(receipt.clone())], vec![Some(receipt)]],
|
||||
},
|
||||
requests: vec![Requests(vec![request]), Requests(vec![request])],
|
||||
requests: vec![Requests::new(vec![request.clone()]), Requests::new(vec![request])],
|
||||
first_block: 124,
|
||||
};
|
||||
|
||||
|
||||
@@ -9,10 +9,11 @@ pub use reth_storage_errors::provider::ProviderError;
|
||||
|
||||
use crate::system_calls::OnStateHook;
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use core::{fmt::Display, marker::PhantomData};
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_primitives::{BlockWithSenders, Receipt, Request};
|
||||
use reth_primitives::{BlockWithSenders, Receipt};
|
||||
use reth_prune_types::PruneModes;
|
||||
use reth_revm::batch::BlockBatchRecord;
|
||||
use revm::{db::BundleState, State};
|
||||
@@ -190,7 +191,7 @@ pub trait BlockExecutionStrategy<DB> {
|
||||
block: &BlockWithSenders,
|
||||
total_difficulty: U256,
|
||||
receipts: &[Receipt],
|
||||
) -> Result<Vec<Request>, Self::Error>;
|
||||
) -> Result<Requests, Self::Error>;
|
||||
|
||||
/// Returns a reference to the current state.
|
||||
fn state_ref(&self) -> &State<DB>;
|
||||
@@ -209,7 +210,7 @@ pub trait BlockExecutionStrategy<DB> {
|
||||
&self,
|
||||
block: &BlockWithSenders,
|
||||
receipts: &[Receipt],
|
||||
requests: &[Request],
|
||||
requests: &Requests,
|
||||
) -> Result<(), ConsensusError>;
|
||||
}
|
||||
|
||||
@@ -450,10 +451,10 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use alloy_eips::eip6110::DepositRequest;
|
||||
use alloy_primitives::U256;
|
||||
use reth_chainspec::{ChainSpec, MAINNET};
|
||||
use revm::db::{CacheDB, EmptyDBTyped};
|
||||
use revm_primitives::bytes;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
@@ -545,14 +546,14 @@ mod tests {
|
||||
_evm_config: EvmConfig,
|
||||
state: State<DB>,
|
||||
execute_transactions_result: (Vec<Receipt>, u64),
|
||||
apply_post_execution_changes_result: Vec<Request>,
|
||||
apply_post_execution_changes_result: Requests,
|
||||
finish_result: BundleState,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TestExecutorStrategyFactory {
|
||||
execute_transactions_result: (Vec<Receipt>, u64),
|
||||
apply_post_execution_changes_result: Vec<Request>,
|
||||
apply_post_execution_changes_result: Requests,
|
||||
finish_result: BundleState,
|
||||
}
|
||||
|
||||
@@ -607,7 +608,7 @@ mod tests {
|
||||
_block: &BlockWithSenders,
|
||||
_total_difficulty: U256,
|
||||
_receipts: &[Receipt],
|
||||
) -> Result<Vec<Request>, Self::Error> {
|
||||
) -> Result<Requests, Self::Error> {
|
||||
Ok(self.apply_post_execution_changes_result.clone())
|
||||
}
|
||||
|
||||
@@ -629,7 +630,7 @@ mod tests {
|
||||
&self,
|
||||
_block: &BlockWithSenders,
|
||||
_receipts: &[Receipt],
|
||||
_requests: &[Request],
|
||||
_requests: &Requests,
|
||||
) -> Result<(), ConsensusError> {
|
||||
Ok(())
|
||||
}
|
||||
@@ -651,8 +652,7 @@ mod tests {
|
||||
let expected_gas_used = 10;
|
||||
let expected_receipts = vec![Receipt::default()];
|
||||
let expected_execute_transactions_result = (expected_receipts.clone(), expected_gas_used);
|
||||
let expected_apply_post_execution_changes_result =
|
||||
vec![Request::DepositRequest(DepositRequest::default())];
|
||||
let expected_apply_post_execution_changes_result = Requests::new(vec![bytes!("deadbeef")]);
|
||||
let expected_finish_result = BundleState::default();
|
||||
|
||||
let strategy_factory = TestExecutorStrategyFactory {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) system call implementation.
|
||||
use crate::ConfigureEvm;
|
||||
use alloc::{boxed::Box, format, string::ToString, vec::Vec};
|
||||
use alloy_eips::eip7002::{WithdrawalRequest, WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS};
|
||||
use alloy_primitives::{bytes::Buf, Address, Bytes, FixedBytes};
|
||||
use alloc::{boxed::Box, format};
|
||||
use alloy_eips::eip7002::WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS;
|
||||
use alloy_primitives::Bytes;
|
||||
use reth_execution_errors::{BlockExecutionError, BlockValidationError};
|
||||
use reth_primitives::{Header, Request};
|
||||
use reth_primitives::Header;
|
||||
use revm::{interpreter::Host, Database, Evm};
|
||||
use revm_primitives::{ExecutionResult, ResultAndState};
|
||||
|
||||
@@ -62,52 +62,23 @@ where
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// Parses the withdrawal requests from the execution output.
|
||||
/// Calls the withdrawals requests system contract, and returns the requests from the execution
|
||||
/// output.
|
||||
#[inline]
|
||||
pub(crate) fn post_commit(result: ExecutionResult) -> Result<Vec<Request>, BlockExecutionError> {
|
||||
let mut data = match result {
|
||||
pub(crate) fn post_commit(result: ExecutionResult) -> Result<Bytes, BlockExecutionError> {
|
||||
match result {
|
||||
ExecutionResult::Success { output, .. } => Ok(output.into_data()),
|
||||
ExecutionResult::Revert { output, .. } => {
|
||||
Err(BlockValidationError::WithdrawalRequestsContractCall {
|
||||
message: format!("execution reverted: {output}"),
|
||||
})
|
||||
}
|
||||
.into())
|
||||
}
|
||||
ExecutionResult::Halt { reason, .. } => {
|
||||
Err(BlockValidationError::WithdrawalRequestsContractCall {
|
||||
message: format!("execution halted: {reason:?}"),
|
||||
})
|
||||
}
|
||||
}?;
|
||||
|
||||
// Withdrawals are encoded as a series of withdrawal requests, each with the following
|
||||
// format:
|
||||
//
|
||||
// +------+--------+--------+
|
||||
// | addr | pubkey | amount |
|
||||
// +------+--------+--------+
|
||||
// 20 48 8
|
||||
|
||||
const WITHDRAWAL_REQUEST_SIZE: usize = 20 + 48 + 8;
|
||||
let mut withdrawal_requests = Vec::with_capacity(data.len() / WITHDRAWAL_REQUEST_SIZE);
|
||||
while data.has_remaining() {
|
||||
if data.remaining() < WITHDRAWAL_REQUEST_SIZE {
|
||||
return Err(BlockValidationError::WithdrawalRequestsContractCall {
|
||||
message: "invalid withdrawal request length".to_string(),
|
||||
}
|
||||
.into())
|
||||
}
|
||||
|
||||
let mut source_address = Address::ZERO;
|
||||
data.copy_to_slice(source_address.as_mut_slice());
|
||||
|
||||
let mut validator_pubkey = FixedBytes::<48>::ZERO;
|
||||
data.copy_to_slice(validator_pubkey.as_mut_slice());
|
||||
|
||||
let amount = data.get_u64();
|
||||
|
||||
withdrawal_requests
|
||||
.push(WithdrawalRequest { source_address, validator_pubkey, amount }.into());
|
||||
}
|
||||
|
||||
Ok(withdrawal_requests)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) system call implementation.
|
||||
use crate::ConfigureEvm;
|
||||
use alloc::{boxed::Box, format, string::ToString, vec::Vec};
|
||||
use alloy_eips::eip7251::{ConsolidationRequest, CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS};
|
||||
use alloy_primitives::{bytes::Buf, Address, Bytes, FixedBytes};
|
||||
use alloc::{boxed::Box, format};
|
||||
use alloy_eips::eip7251::CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS;
|
||||
use alloy_primitives::Bytes;
|
||||
use reth_execution_errors::{BlockExecutionError, BlockValidationError};
|
||||
use reth_primitives::{Header, Request};
|
||||
use reth_primitives::Header;
|
||||
use revm::{interpreter::Host, Database, Evm};
|
||||
use revm_primitives::{ExecutionResult, ResultAndState};
|
||||
|
||||
@@ -64,56 +64,23 @@ where
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
/// Parses the consolidation requests from the execution output.
|
||||
/// Calls the consolidation requests system contract, and returns the requests from the execution
|
||||
/// output.
|
||||
#[inline]
|
||||
pub(crate) fn post_commit(result: ExecutionResult) -> Result<Vec<Request>, BlockExecutionError> {
|
||||
let mut data = match result {
|
||||
pub(crate) fn post_commit(result: ExecutionResult) -> Result<Bytes, BlockExecutionError> {
|
||||
match result {
|
||||
ExecutionResult::Success { output, .. } => Ok(output.into_data()),
|
||||
ExecutionResult::Revert { output, .. } => {
|
||||
Err(BlockValidationError::ConsolidationRequestsContractCall {
|
||||
message: format!("execution reverted: {output}"),
|
||||
})
|
||||
}
|
||||
.into())
|
||||
}
|
||||
ExecutionResult::Halt { reason, .. } => {
|
||||
Err(BlockValidationError::ConsolidationRequestsContractCall {
|
||||
message: format!("execution halted: {reason:?}"),
|
||||
})
|
||||
}
|
||||
}?;
|
||||
|
||||
// Consolidations are encoded as a series of consolidation requests, each with the following
|
||||
// format:
|
||||
//
|
||||
// +------+--------+---------------+
|
||||
// | addr | pubkey | target pubkey |
|
||||
// +------+--------+---------------+
|
||||
// 20 48 48
|
||||
|
||||
const CONSOLIDATION_REQUEST_SIZE: usize = 20 + 48 + 48;
|
||||
let mut consolidation_requests = Vec::with_capacity(data.len() / CONSOLIDATION_REQUEST_SIZE);
|
||||
while data.has_remaining() {
|
||||
if data.remaining() < CONSOLIDATION_REQUEST_SIZE {
|
||||
return Err(BlockValidationError::ConsolidationRequestsContractCall {
|
||||
message: "invalid consolidation request length".to_string(),
|
||||
}
|
||||
.into())
|
||||
}
|
||||
|
||||
let mut source_address = Address::ZERO;
|
||||
data.copy_to_slice(source_address.as_mut_slice());
|
||||
|
||||
let mut source_pubkey = FixedBytes::<48>::ZERO;
|
||||
data.copy_to_slice(source_pubkey.as_mut_slice());
|
||||
|
||||
let mut target_pubkey = FixedBytes::<48>::ZERO;
|
||||
data.copy_to_slice(target_pubkey.as_mut_slice());
|
||||
|
||||
consolidation_requests.push(Request::ConsolidationRequest(ConsolidationRequest {
|
||||
source_address,
|
||||
source_pubkey,
|
||||
target_pubkey,
|
||||
}));
|
||||
}
|
||||
|
||||
Ok(consolidation_requests)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
//! System contract call functions.
|
||||
|
||||
use crate::ConfigureEvm;
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use alloc::{boxed::Box, vec};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::Bytes;
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_execution_errors::BlockExecutionError;
|
||||
use reth_primitives::{Block, Header, Request};
|
||||
use reth_primitives::{Block, Header};
|
||||
use revm::{Database, DatabaseCommit, Evm};
|
||||
use revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, B256};
|
||||
|
||||
@@ -119,17 +121,18 @@ where
|
||||
pub fn apply_post_execution_changes<DB, Ext>(
|
||||
&mut self,
|
||||
evm: &mut Evm<'_, Ext, DB>,
|
||||
) -> Result<Vec<Request>, BlockExecutionError>
|
||||
) -> Result<Requests, BlockExecutionError>
|
||||
where
|
||||
DB: Database + DatabaseCommit,
|
||||
DB::Error: Display,
|
||||
{
|
||||
// todo
|
||||
// Collect all EIP-7685 requests
|
||||
let withdrawal_requests = self.apply_withdrawal_requests_contract_call(evm)?;
|
||||
|
||||
// Collect all EIP-7251 requests
|
||||
let consolidation_requests = self.apply_consolidation_requests_contract_call(evm)?;
|
||||
Ok([withdrawal_requests, consolidation_requests].concat())
|
||||
Ok(Requests::new(vec![withdrawal_requests, consolidation_requests]))
|
||||
}
|
||||
|
||||
/// Applies the pre-block call to the EIP-2935 blockhashes contract.
|
||||
@@ -247,7 +250,7 @@ where
|
||||
db: &mut DB,
|
||||
initialized_cfg: &CfgEnvWithHandlerCfg,
|
||||
initialized_block_env: &BlockEnv,
|
||||
) -> Result<Vec<Request>, BlockExecutionError>
|
||||
) -> Result<Bytes, BlockExecutionError>
|
||||
where
|
||||
DB: Database + DatabaseCommit,
|
||||
DB::Error: Display,
|
||||
@@ -263,7 +266,7 @@ where
|
||||
pub fn apply_withdrawal_requests_contract_call<DB, Ext>(
|
||||
&mut self,
|
||||
evm: &mut Evm<'_, Ext, DB>,
|
||||
) -> Result<Vec<Request>, BlockExecutionError>
|
||||
) -> Result<Bytes, BlockExecutionError>
|
||||
where
|
||||
DB: Database + DatabaseCommit,
|
||||
DB::Error: Display,
|
||||
@@ -285,7 +288,7 @@ where
|
||||
db: &mut DB,
|
||||
initialized_cfg: &CfgEnvWithHandlerCfg,
|
||||
initialized_block_env: &BlockEnv,
|
||||
) -> Result<Vec<Request>, BlockExecutionError>
|
||||
) -> Result<Bytes, BlockExecutionError>
|
||||
where
|
||||
DB: Database + DatabaseCommit,
|
||||
DB::Error: Display,
|
||||
@@ -301,7 +304,7 @@ where
|
||||
pub fn apply_consolidation_requests_contract_call<DB, Ext>(
|
||||
&mut self,
|
||||
evm: &mut Evm<'_, Ext, DB>,
|
||||
) -> Result<Vec<Request>, BlockExecutionError>
|
||||
) -> Result<Bytes, BlockExecutionError>
|
||||
where
|
||||
DB: Database + DatabaseCommit,
|
||||
DB::Error: Display,
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::{
|
||||
},
|
||||
system_calls::OnStateHook,
|
||||
};
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::BlockNumber;
|
||||
use parking_lot::Mutex;
|
||||
use reth_execution_errors::BlockExecutionError;
|
||||
@@ -62,7 +63,10 @@ impl<DB> Executor<DB> for MockExecutorProvider {
|
||||
Ok(BlockExecutionOutput {
|
||||
state: bundle,
|
||||
receipts: receipts.into_iter().flatten().flatten().collect(),
|
||||
requests: requests.into_iter().flatten().collect(),
|
||||
requests: requests.into_iter().fold(Requests::default(), |mut reqs, req| {
|
||||
reqs.extend(req);
|
||||
reqs
|
||||
}),
|
||||
gas_used: 0,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use reth_evm::execute::{
|
||||
};
|
||||
use reth_evm_ethereum::execute::EthExecutorProvider;
|
||||
use reth_primitives::{
|
||||
constants::ETH_TO_WEI, Block, BlockBody, BlockWithSenders, Header, Receipt, Requests,
|
||||
constants::ETH_TO_WEI, Block, BlockBody, BlockWithSenders, Header, Receipt,
|
||||
SealedBlockWithSenders, Transaction,
|
||||
};
|
||||
use reth_provider::{
|
||||
@@ -29,7 +29,7 @@ pub(crate) fn to_execution_outcome(
|
||||
bundle: block_execution_output.state.clone(),
|
||||
receipts: block_execution_output.receipts.clone().into(),
|
||||
first_block: block_number,
|
||||
requests: vec![Requests(block_execution_output.requests.clone())],
|
||||
requests: vec![block_execution_output.requests.clone()],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ mod tests {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None
|
||||
requests_hash: None
|
||||
},
|
||||
]),
|
||||
}.encode(&mut data);
|
||||
@@ -312,7 +312,7 @@ mod tests {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None
|
||||
requests_hash: None
|
||||
},
|
||||
]),
|
||||
};
|
||||
@@ -412,11 +412,10 @@ mod tests {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None
|
||||
requests_hash: None
|
||||
},
|
||||
],
|
||||
withdrawals: None,
|
||||
requests: None
|
||||
}
|
||||
]),
|
||||
};
|
||||
@@ -488,11 +487,10 @@ mod tests {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None
|
||||
requests_hash: None
|
||||
},
|
||||
],
|
||||
withdrawals: None,
|
||||
requests: None
|
||||
}
|
||||
]),
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@ mod tests {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None
|
||||
requests_hash: None
|
||||
};
|
||||
assert_eq!(header.hash_slow(), expected_hash);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ mod tests {
|
||||
blob_gas_used: Some(0x020000),
|
||||
excess_blob_gas: Some(0),
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None,
|
||||
requests_hash: None,
|
||||
};
|
||||
|
||||
let header = Header::decode(&mut data.as_slice()).unwrap();
|
||||
@@ -296,7 +296,7 @@ mod tests {
|
||||
parent_beacon_block_root: None,
|
||||
blob_gas_used: Some(0),
|
||||
excess_blob_gas: Some(0x1600000),
|
||||
requests_root: None,
|
||||
requests_hash: None,
|
||||
};
|
||||
|
||||
let header = Header::decode(&mut data.as_slice()).unwrap();
|
||||
|
||||
@@ -347,22 +347,6 @@ fn ensure_valid_body_response(
|
||||
_ => return Err(ConsensusError::WithdrawalsRootUnexpected),
|
||||
}
|
||||
|
||||
match (header.requests_root, &block.requests) {
|
||||
(Some(header_requests_root), Some(requests)) => {
|
||||
let requests = requests.0.as_slice();
|
||||
let requests_root = reth_primitives::proofs::calculate_requests_root(requests);
|
||||
if requests_root != header_requests_root {
|
||||
return Err(ConsensusError::BodyRequestsRootDiff(
|
||||
GotExpected { got: requests_root, expected: header_requests_root }.into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
(None, None) => {
|
||||
// this is ok because we assume the fork is not active in this case
|
||||
}
|
||||
_ => return Err(ConsensusError::RequestsRootUnexpected),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ reth-prune-types.workspace = true
|
||||
reth-consensus.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
op-alloy-consensus.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
@@ -41,8 +42,6 @@ derive_more.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-eips.workspace = true
|
||||
|
||||
reth-evm = { workspace = true, features = ["test-utils"] }
|
||||
reth-revm = { workspace = true, features = ["test-utils"] }
|
||||
reth-primitives = { workspace = true, features = ["test-utils"] }
|
||||
|
||||
@@ -5,6 +5,7 @@ use crate::{
|
||||
};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::Transaction as _;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{BlockNumber, U256};
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
||||
@@ -380,7 +381,7 @@ where
|
||||
Ok(BlockExecutionOutput {
|
||||
state: self.state.take_bundle(),
|
||||
receipts,
|
||||
requests: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used,
|
||||
})
|
||||
}
|
||||
@@ -403,7 +404,7 @@ where
|
||||
Ok(BlockExecutionOutput {
|
||||
state: self.state.take_bundle(),
|
||||
receipts,
|
||||
requests: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used,
|
||||
})
|
||||
}
|
||||
@@ -429,7 +430,7 @@ where
|
||||
Ok(BlockExecutionOutput {
|
||||
state: self.state.take_bundle(),
|
||||
receipts,
|
||||
requests: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
// The `optimism` feature must be enabled to use this crate.
|
||||
#![cfg(feature = "optimism")]
|
||||
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::{sync::Arc, vec::Vec};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use crate::{l1::ensure_create2_deployer, OptimismBlockExecutionError, OptimismEvmConfig};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::Transaction as _;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_consensus::ConsensusError;
|
||||
@@ -17,7 +18,7 @@ use reth_evm::{
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_consensus::validate_block_post_execution;
|
||||
use reth_optimism_forks::OptimismHardfork;
|
||||
use reth_primitives::{BlockWithSenders, Header, Receipt, Request, TxType};
|
||||
use reth_primitives::{BlockWithSenders, Header, Receipt, TxType};
|
||||
use reth_revm::{
|
||||
db::{states::bundle_state::BundleRetention, BundleState},
|
||||
state_change::post_block_balance_increments,
|
||||
@@ -235,7 +236,7 @@ where
|
||||
block: &BlockWithSenders,
|
||||
total_difficulty: U256,
|
||||
_receipts: &[Receipt],
|
||||
) -> Result<Vec<Request>, Self::Error> {
|
||||
) -> Result<Requests, Self::Error> {
|
||||
let balance_increments =
|
||||
post_block_balance_increments(&self.chain_spec.clone(), block, total_difficulty);
|
||||
// increment balances
|
||||
@@ -243,7 +244,7 @@ where
|
||||
.increment_balances(balance_increments)
|
||||
.map_err(|_| BlockValidationError::IncrementBalanceFailed)?;
|
||||
|
||||
Ok(vec![])
|
||||
Ok(Requests::default())
|
||||
}
|
||||
|
||||
fn state_ref(&self) -> &State<DB> {
|
||||
@@ -267,7 +268,7 @@ where
|
||||
&self,
|
||||
block: &BlockWithSenders,
|
||||
receipts: &[Receipt],
|
||||
_requests: &[Request],
|
||||
_requests: &Requests,
|
||||
) -> Result<(), ConsensusError> {
|
||||
validate_block_post_execution(block, &self.chain_spec.clone(), receipts)
|
||||
}
|
||||
|
||||
@@ -507,13 +507,13 @@ where
|
||||
parent_beacon_block_root: attributes.payload_attributes.parent_beacon_block_root,
|
||||
blob_gas_used,
|
||||
excess_blob_gas: excess_blob_gas.map(Into::into),
|
||||
requests_root: None,
|
||||
requests_hash: None,
|
||||
};
|
||||
|
||||
// seal the block
|
||||
let block = Block {
|
||||
header,
|
||||
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals, requests: None },
|
||||
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals },
|
||||
};
|
||||
|
||||
let sealed_block = block.seal_slow();
|
||||
|
||||
@@ -18,8 +18,7 @@ use reth_primitives::{
|
||||
transaction::WithEncoded, BlobTransactionSidecar, SealedBlock, TransactionSigned, Withdrawals,
|
||||
};
|
||||
use reth_rpc_types_compat::engine::payload::{
|
||||
block_to_payload_v1, block_to_payload_v3, block_to_payload_v4,
|
||||
convert_block_to_payload_field_v2,
|
||||
block_to_payload_v1, block_to_payload_v3, convert_block_to_payload_field_v2,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -249,7 +248,7 @@ impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV4 {
|
||||
B256::ZERO
|
||||
};
|
||||
Self {
|
||||
execution_payload: block_to_payload_v4(block),
|
||||
execution_payload: block_to_payload_v3(block),
|
||||
block_value: fees,
|
||||
// From the engine API spec:
|
||||
//
|
||||
@@ -262,6 +261,7 @@ impl From<OptimismBuiltPayload> for OpExecutionPayloadEnvelopeV4 {
|
||||
should_override_builder: false,
|
||||
blobs_bundle: sidecars.into_iter().map(Into::into).collect::<Vec<_>>().into(),
|
||||
parent_beacon_block_root,
|
||||
execution_requests: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ pub const BEDROCK_HEADER: Header = Header {
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None,
|
||||
requests_hash: None,
|
||||
};
|
||||
|
||||
/// Bedrock total difficulty on Optimism Mainnet.
|
||||
|
||||
@@ -227,7 +227,6 @@ impl OpReceiptBuilder {
|
||||
from,
|
||||
to,
|
||||
contract_address,
|
||||
state_root,
|
||||
authorization_list,
|
||||
} = core_receipt;
|
||||
|
||||
@@ -265,7 +264,6 @@ impl OpReceiptBuilder {
|
||||
from,
|
||||
to,
|
||||
contract_address,
|
||||
state_root,
|
||||
authorization_list,
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ mod tests {
|
||||
CompactClientVersion, CompactU256, CompactU64, StoredBlockBodyIndices, StoredBlockOmmers,
|
||||
StoredBlockWithdrawals,
|
||||
};
|
||||
use reth_primitives::{Account, Receipt, ReceiptWithBloom, Requests, Withdrawals};
|
||||
use reth_primitives::{Account, Receipt, ReceiptWithBloom, Withdrawals};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneMode, PruneSegment};
|
||||
use reth_stages_types::{
|
||||
AccountHashingCheckpoint, CheckpointBlockRange, EntitiesCheckpoint, ExecutionCheckpoint,
|
||||
@@ -74,6 +74,5 @@ mod tests {
|
||||
validate_bitflag_backwards_compat!(StoredBlockWithdrawals, UnusedBits::Zero);
|
||||
validate_bitflag_backwards_compat!(StorageHashingCheckpoint, UnusedBits::NotZero);
|
||||
validate_bitflag_backwards_compat!(Withdrawals, UnusedBits::Zero);
|
||||
validate_bitflag_backwards_compat!(Requests, UnusedBits::Zero);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,6 @@ reth-primitives.workspace = true
|
||||
reth-rpc-types-compat.workspace = true
|
||||
|
||||
# alloy
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-rpc-types = { workspace = true, features = ["engine"] }
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rpc_types::engine::{ExecutionPayload, MaybeCancunPayloadFields, PayloadError};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_primitives::SealedBlock;
|
||||
@@ -112,12 +114,17 @@ impl<ChainSpec: EthereumHardforks> ExecutionPayloadValidator<ChainSpec> {
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
cancun_fields: MaybeCancunPayloadFields,
|
||||
execution_requests: Option<Vec<Bytes>>,
|
||||
) -> Result<SealedBlock, PayloadError> {
|
||||
let expected_hash = payload.block_hash();
|
||||
|
||||
// First parse the block
|
||||
let sealed_block =
|
||||
try_into_block(payload, cancun_fields.parent_beacon_block_root())?.seal_slow();
|
||||
let sealed_block = try_into_block(
|
||||
payload,
|
||||
cancun_fields.parent_beacon_block_root(),
|
||||
execution_requests.map(Requests::new),
|
||||
)?
|
||||
.seal_slow();
|
||||
|
||||
// Ensure the hash included in the payload matches the block hash
|
||||
if expected_hash != sealed_block.hash() {
|
||||
@@ -162,7 +169,7 @@ impl<ChainSpec: EthereumHardforks> ExecutionPayloadValidator<ChainSpec> {
|
||||
let shanghai_active = self.is_shanghai_active_at_timestamp(sealed_block.timestamp);
|
||||
if !shanghai_active && sealed_block.body.withdrawals.is_some() {
|
||||
// shanghai not active but withdrawals present
|
||||
return Err(PayloadError::PreShanghaiBlockWithWitdrawals)
|
||||
return Err(PayloadError::PreShanghaiBlockWithWithdrawals)
|
||||
}
|
||||
|
||||
if !self.is_prague_active_at_timestamp(sealed_block.timestamp) &&
|
||||
|
||||
@@ -64,4 +64,4 @@ arbitrary = [
|
||||
"dep:proptest",
|
||||
"dep:proptest-arbitrary-interop",
|
||||
]
|
||||
serde-bincode-compat = ["serde_with", "alloy-consensus/serde-bincode-compat"]
|
||||
serde-bincode-compat = ["serde_with", "alloy-consensus/serde-bincode-compat"]
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use alloc::{fmt, vec::Vec};
|
||||
|
||||
use alloy_consensus::{BlockHeader, Request, Transaction, TxType};
|
||||
use alloy_eips::eip4895::Withdrawal;
|
||||
use alloy_consensus::{BlockHeader, Transaction, TxType};
|
||||
use alloy_eips::{eip4895::Withdrawal, eip7685::Requests};
|
||||
use alloy_primitives::{Address, B256};
|
||||
|
||||
use crate::Block;
|
||||
@@ -30,9 +30,6 @@ pub trait BlockBody:
|
||||
/// Withdrawals in block.
|
||||
type Withdrawals: Iterator<Item = Withdrawal>;
|
||||
|
||||
/// Requests in block.
|
||||
type Requests: Iterator<Item = Request>;
|
||||
|
||||
/// Returns reference to transactions in block.
|
||||
fn transactions(&self) -> &[Self::SignedTransaction];
|
||||
|
||||
@@ -43,8 +40,8 @@ pub trait BlockBody:
|
||||
/// Returns reference to uncle block headers.
|
||||
fn ommers(&self) -> &[Self::Header];
|
||||
|
||||
/// Returns [`Request`] in block, if any.
|
||||
fn requests(&self) -> Option<&Self::Requests>;
|
||||
/// Returns [`Requests`] in block, if any.
|
||||
fn requests(&self) -> Option<&Requests>;
|
||||
|
||||
/// Create a [`Block`] from the body and its header.
|
||||
fn into_block<T: Block<Header = Self::Header, Body = Self>>(self, header: Self::Header) -> T {
|
||||
@@ -63,12 +60,6 @@ pub trait BlockBody:
|
||||
// `Withdrawals` and `Withdrawals` moved to alloy
|
||||
fn calculate_withdrawals_root(&self) -> Option<B256>;
|
||||
|
||||
/// Calculate the requests root for the block body, if requests exist. If there are no
|
||||
/// requests, this will return `None`.
|
||||
// todo: can be default impl if `calculate_requests_root` made into a method on
|
||||
// `Requests` and `Requests` moved to alloy
|
||||
fn calculate_requests_root(&self) -> Option<B256>;
|
||||
|
||||
/// Recover signer addresses for all transactions in the block body.
|
||||
fn recover_signers(&self) -> Option<Vec<Address>>;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ pub const fn generate_valid_header(
|
||||
}
|
||||
|
||||
// Placeholder for future EIP adjustments
|
||||
header.requests_root = None;
|
||||
header.requests_hash = None;
|
||||
|
||||
header
|
||||
}
|
||||
|
||||
@@ -29,9 +29,6 @@ pub use transaction::{signed::SignedTransaction, Transaction};
|
||||
mod integer_list;
|
||||
pub use integer_list::{IntegerList, IntegerListError};
|
||||
|
||||
pub mod request;
|
||||
pub use request::{Request, Requests};
|
||||
|
||||
pub mod block;
|
||||
pub use block::{body::BlockBody, Block};
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
//! EIP-7685 requests.
|
||||
|
||||
use alloc::vec::Vec;
|
||||
pub use alloy_consensus::Request;
|
||||
use alloy_eips::eip7685::{Decodable7685, Encodable7685};
|
||||
use alloy_rlp::{Decodable, Encodable};
|
||||
use derive_more::{Deref, DerefMut, From, IntoIterator};
|
||||
use reth_codecs::{add_arbitrary_tests, Compact};
|
||||
use revm_primitives::Bytes;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A list of EIP-7685 requests.
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Default,
|
||||
Hash,
|
||||
Deref,
|
||||
DerefMut,
|
||||
From,
|
||||
IntoIterator,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Compact,
|
||||
)]
|
||||
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
|
||||
#[add_arbitrary_tests(compact)]
|
||||
pub struct Requests(pub Vec<Request>);
|
||||
|
||||
impl Encodable for Requests {
|
||||
fn encode(&self, out: &mut dyn bytes::BufMut) {
|
||||
let mut h = alloy_rlp::Header { list: true, payload_length: 0 };
|
||||
|
||||
let mut encoded = Vec::new();
|
||||
for req in &self.0 {
|
||||
let encoded_req = req.encoded_7685();
|
||||
h.payload_length += encoded_req.len();
|
||||
encoded.push(Bytes::from(encoded_req));
|
||||
}
|
||||
|
||||
h.encode(out);
|
||||
for req in encoded {
|
||||
req.encode(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Decodable for Requests {
|
||||
fn decode(buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
|
||||
Ok(<Vec<Bytes> as Decodable>::decode(buf)?
|
||||
.into_iter()
|
||||
.map(|bytes| Request::decode_7685(&mut bytes.as_ref()))
|
||||
.collect::<Result<Vec<_>, alloy_eips::eip7685::Eip7685Error>>()
|
||||
.map(Self)?)
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@ zstd = { workspace = true, features = ["experimental"], optional = true }
|
||||
|
||||
# arbitrary utils
|
||||
arbitrary = { workspace = true, features = ["derive"], optional = true }
|
||||
proptest = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
# eth
|
||||
@@ -97,7 +96,6 @@ reth-codec = ["dep:reth-codecs", "dep:zstd", "dep:modular-bitfield", "std"]
|
||||
asm-keccak = ["alloy-primitives/asm-keccak"]
|
||||
arbitrary = [
|
||||
"dep:arbitrary",
|
||||
"dep:proptest",
|
||||
"alloy-eips/arbitrary",
|
||||
"rand",
|
||||
"reth-codec",
|
||||
|
||||
@@ -48,9 +48,6 @@ impl TryFrom<alloy_rpc_types::Block<WithOtherFields<alloy_rpc_types::Transaction
|
||||
transactions,
|
||||
ommers: Default::default(),
|
||||
withdrawals: block.withdrawals.map(Into::into),
|
||||
// todo(onbjerg): we don't know if this is added to rpc yet, so for now we leave it
|
||||
// as empty.
|
||||
requests: None,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,19 +11,8 @@ use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable};
|
||||
use derive_more::{Deref, DerefMut};
|
||||
#[cfg(any(test, feature = "arbitrary"))]
|
||||
pub use reth_primitives_traits::test_utils::{generate_valid_header, valid_header_strategy};
|
||||
use reth_primitives_traits::Requests;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// HACK(onbjerg): we need this to always set `requests` to `None` since we might otherwise generate
|
||||
// a block with `None` withdrawals and `Some` requests, in which case we end up trying to decode the
|
||||
// requests as withdrawals
|
||||
#[cfg(any(feature = "arbitrary", test))]
|
||||
proptest::prelude::prop_compose! {
|
||||
pub fn empty_requests_strategy()(_ in 0..1) -> Option<Requests> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Ethereum full block.
|
||||
///
|
||||
/// Withdrawals can be optionally included at the end of the RLP encoded message.
|
||||
@@ -120,7 +109,6 @@ mod block_rlp {
|
||||
transactions: Vec<TransactionSigned>,
|
||||
ommers: Vec<Header>,
|
||||
withdrawals: Option<Withdrawals>,
|
||||
requests: Option<Requests>,
|
||||
}
|
||||
|
||||
#[derive(RlpEncodable)]
|
||||
@@ -130,50 +118,34 @@ mod block_rlp {
|
||||
transactions: &'a Vec<TransactionSigned>,
|
||||
ommers: &'a Vec<Header>,
|
||||
withdrawals: Option<&'a Withdrawals>,
|
||||
requests: Option<&'a Requests>,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Block> for HelperRef<'a, Header> {
|
||||
fn from(block: &'a Block) -> Self {
|
||||
let Block { header, body: BlockBody { transactions, ommers, withdrawals, requests } } =
|
||||
block;
|
||||
Self {
|
||||
header,
|
||||
transactions,
|
||||
ommers,
|
||||
withdrawals: withdrawals.as_ref(),
|
||||
requests: requests.as_ref(),
|
||||
}
|
||||
let Block { header, body: BlockBody { transactions, ommers, withdrawals } } = block;
|
||||
Self { header, transactions, ommers, withdrawals: withdrawals.as_ref() }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a SealedBlock> for HelperRef<'a, SealedHeader> {
|
||||
fn from(block: &'a SealedBlock) -> Self {
|
||||
let SealedBlock {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
} = block;
|
||||
Self {
|
||||
header,
|
||||
transactions,
|
||||
ommers,
|
||||
withdrawals: withdrawals.as_ref(),
|
||||
requests: requests.as_ref(),
|
||||
}
|
||||
let SealedBlock { header, body: BlockBody { transactions, ommers, withdrawals } } =
|
||||
block;
|
||||
Self { header, transactions, ommers, withdrawals: withdrawals.as_ref() }
|
||||
}
|
||||
}
|
||||
|
||||
impl Decodable for Block {
|
||||
fn decode(b: &mut &[u8]) -> alloy_rlp::Result<Self> {
|
||||
let Helper { header, transactions, ommers, withdrawals, requests } = Helper::decode(b)?;
|
||||
Ok(Self { header, body: BlockBody { transactions, ommers, withdrawals, requests } })
|
||||
let Helper { header, transactions, ommers, withdrawals } = Helper::decode(b)?;
|
||||
Ok(Self { header, body: BlockBody { transactions, ommers, withdrawals } })
|
||||
}
|
||||
}
|
||||
|
||||
impl Decodable for SealedBlock {
|
||||
fn decode(b: &mut &[u8]) -> alloy_rlp::Result<Self> {
|
||||
let Helper { header, transactions, ommers, withdrawals, requests } = Helper::decode(b)?;
|
||||
Ok(Self { header, body: BlockBody { transactions, ommers, withdrawals, requests } })
|
||||
let Helper { header, transactions, ommers, withdrawals } = Helper::decode(b)?;
|
||||
Ok(Self { header, body: BlockBody { transactions, ommers, withdrawals } })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,13 +187,7 @@ impl<'a> arbitrary::Arbitrary<'a> for Block {
|
||||
|
||||
Ok(Self {
|
||||
header: u.arbitrary()?,
|
||||
body: BlockBody {
|
||||
transactions,
|
||||
ommers,
|
||||
// for now just generate empty requests, see HACK above
|
||||
requests: u.arbitrary()?,
|
||||
withdrawals: u.arbitrary()?,
|
||||
},
|
||||
body: BlockBody { transactions, ommers, withdrawals: u.arbitrary()? },
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -570,8 +536,6 @@ pub struct BlockBody {
|
||||
pub ommers: Vec<Header>,
|
||||
/// Withdrawals in the block.
|
||||
pub withdrawals: Option<Withdrawals>,
|
||||
/// Requests in the block.
|
||||
pub requests: Option<Requests>,
|
||||
}
|
||||
|
||||
impl BlockBody {
|
||||
@@ -596,12 +560,6 @@ impl BlockBody {
|
||||
self.withdrawals.as_ref().map(|w| crate::proofs::calculate_withdrawals_root(w))
|
||||
}
|
||||
|
||||
/// Calculate the requests root for the block body, if requests exist. If there are no
|
||||
/// requests, this will return `None`.
|
||||
pub fn calculate_requests_root(&self) -> Option<B256> {
|
||||
self.requests.as_ref().map(|r| crate::proofs::calculate_requests_root(&r.0))
|
||||
}
|
||||
|
||||
/// Recover signer addresses for all transactions in the block body.
|
||||
pub fn recover_signers(&self) -> Option<Vec<Address>> {
|
||||
TransactionSigned::recover_signers(&self.transactions, self.transactions.len())
|
||||
@@ -670,7 +628,6 @@ impl From<Block> for BlockBody {
|
||||
transactions: block.body.transactions,
|
||||
ommers: block.body.ommers,
|
||||
withdrawals: block.body.withdrawals,
|
||||
requests: block.body.requests,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -692,8 +649,7 @@ impl<'a> arbitrary::Arbitrary<'a> for BlockBody {
|
||||
})
|
||||
.collect::<arbitrary::Result<Vec<_>>>()?;
|
||||
|
||||
// for now just generate empty requests, see HACK above
|
||||
Ok(Self { transactions, ommers, requests: None, withdrawals: u.arbitrary()? })
|
||||
Ok(Self { transactions, ommers, withdrawals: u.arbitrary()? })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,7 +659,7 @@ pub(super) mod serde_bincode_compat {
|
||||
use alloc::{borrow::Cow, vec::Vec};
|
||||
use alloy_consensus::serde_bincode_compat::Header;
|
||||
use alloy_primitives::Address;
|
||||
use reth_primitives_traits::{serde_bincode_compat::SealedHeader, Requests, Withdrawals};
|
||||
use reth_primitives_traits::{serde_bincode_compat::SealedHeader, Withdrawals};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde_with::{DeserializeAs, SerializeAs};
|
||||
|
||||
@@ -729,7 +685,6 @@ pub(super) mod serde_bincode_compat {
|
||||
transactions: Vec<TransactionSigned<'a>>,
|
||||
ommers: Vec<Header<'a>>,
|
||||
withdrawals: Cow<'a, Option<Withdrawals>>,
|
||||
requests: Cow<'a, Option<Requests>>,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a super::BlockBody> for BlockBody<'a> {
|
||||
@@ -738,7 +693,6 @@ pub(super) mod serde_bincode_compat {
|
||||
transactions: value.transactions.iter().map(Into::into).collect(),
|
||||
ommers: value.ommers.iter().map(Into::into).collect(),
|
||||
withdrawals: Cow::Borrowed(&value.withdrawals),
|
||||
requests: Cow::Borrowed(&value.requests),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -749,7 +703,6 @@ pub(super) mod serde_bincode_compat {
|
||||
transactions: value.transactions.into_iter().map(Into::into).collect(),
|
||||
ommers: value.ommers.into_iter().map(Into::into).collect(),
|
||||
withdrawals: value.withdrawals.into_owned(),
|
||||
requests: value.requests.into_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ pub use receipt::{
|
||||
};
|
||||
pub use reth_primitives_traits::{
|
||||
logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log,
|
||||
LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals,
|
||||
LogData, SealedHeader, StorageEntry, Withdrawal, Withdrawals,
|
||||
};
|
||||
pub use static_file::StaticFileSegment;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! Helper function for calculating Merkle proofs and hashes.
|
||||
|
||||
use crate::{
|
||||
Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Request, TransactionSigned, Withdrawal,
|
||||
Header, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, TransactionSigned, Withdrawal,
|
||||
};
|
||||
use alloc::vec::Vec;
|
||||
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
|
||||
use alloy_eips::{eip2718::Encodable2718, eip7685::Encodable7685};
|
||||
use alloy_eips::eip2718::Encodable2718;
|
||||
use alloy_primitives::{keccak256, B256};
|
||||
use reth_trie_common::root::{ordered_trie_root, ordered_trie_root_with_encoder};
|
||||
|
||||
@@ -29,13 +29,6 @@ pub fn calculate_receipt_root(receipts: &[ReceiptWithBloom]) -> B256 {
|
||||
ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_inner(buf, false))
|
||||
}
|
||||
|
||||
/// Calculate [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) requests root.
|
||||
///
|
||||
/// NOTE: The requests are encoded as `id + request`
|
||||
pub fn calculate_requests_root(requests: &[Request]) -> B256 {
|
||||
ordered_trie_root_with_encoder(requests, |item, buf| item.encode_7685(buf))
|
||||
}
|
||||
|
||||
/// Calculates the receipt root for a header.
|
||||
pub fn calculate_receipt_root_ref(receipts: &[ReceiptWithBloomRef<'_>]) -> B256 {
|
||||
ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_inner(buf, false))
|
||||
|
||||
@@ -802,18 +802,6 @@ impl alloy_consensus::Transaction for Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
fn to(&self) -> TxKind {
|
||||
match self {
|
||||
Self::Legacy(tx) => tx.to(),
|
||||
Self::Eip2930(tx) => tx.to(),
|
||||
Self::Eip1559(tx) => tx.to(),
|
||||
Self::Eip4844(tx) => tx.to(),
|
||||
Self::Eip7702(tx) => tx.to(),
|
||||
#[cfg(feature = "optimism")]
|
||||
Self::Deposit(tx) => tx.to(),
|
||||
}
|
||||
}
|
||||
|
||||
fn value(&self) -> U256 {
|
||||
match self {
|
||||
Self::Legacy(tx) => tx.value(),
|
||||
@@ -826,7 +814,7 @@ impl alloy_consensus::Transaction for Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
fn input(&self) -> &[u8] {
|
||||
fn input(&self) -> &Bytes {
|
||||
match self {
|
||||
Self::Legacy(tx) => tx.input(),
|
||||
Self::Eip2930(tx) => tx.input(),
|
||||
@@ -885,6 +873,18 @@ impl alloy_consensus::Transaction for Transaction {
|
||||
Self::Deposit(tx) => tx.authorization_list(),
|
||||
}
|
||||
}
|
||||
|
||||
fn kind(&self) -> TxKind {
|
||||
match self {
|
||||
Self::Legacy(tx) => tx.kind(),
|
||||
Self::Eip2930(tx) => tx.kind(),
|
||||
Self::Eip1559(tx) => tx.kind(),
|
||||
Self::Eip4844(tx) => tx.kind(),
|
||||
Self::Eip7702(tx) => tx.kind(),
|
||||
#[cfg(feature = "optimism")]
|
||||
Self::Deposit(tx) => tx.kind(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Signed transaction without its Hash. Used type for inserting into the DB.
|
||||
@@ -1383,15 +1383,11 @@ impl alloy_consensus::Transaction for TransactionSigned {
|
||||
self.deref().priority_fee_or_price()
|
||||
}
|
||||
|
||||
fn to(&self) -> TxKind {
|
||||
alloy_consensus::Transaction::to(self.deref())
|
||||
}
|
||||
|
||||
fn value(&self) -> U256 {
|
||||
self.deref().value()
|
||||
}
|
||||
|
||||
fn input(&self) -> &[u8] {
|
||||
fn input(&self) -> &Bytes {
|
||||
self.deref().input()
|
||||
}
|
||||
|
||||
@@ -1410,6 +1406,10 @@ impl alloy_consensus::Transaction for TransactionSigned {
|
||||
fn authorization_list(&self) -> Option<&[SignedAuthorization]> {
|
||||
self.deref().authorization_list()
|
||||
}
|
||||
|
||||
fn kind(&self) -> TxKind {
|
||||
self.deref().kind()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<TransactionSignedEcRecovered> for TransactionSigned {
|
||||
@@ -2242,8 +2242,8 @@ mod tests {
|
||||
let tx = TransactionSigned::decode_2718(&mut data.as_slice()).unwrap();
|
||||
let sender = tx.recover_signer().unwrap();
|
||||
assert_eq!(sender, address!("001e2b7dE757bA469a57bF6b23d982458a07eFcE"));
|
||||
assert_eq!(tx.to(), Some(address!("D9e1459A7A482635700cBc20BBAF52D495Ab9C96")).into());
|
||||
assert_eq!(tx.input(), hex!("1b55ba3a"));
|
||||
assert_eq!(tx.to(), Some(address!("D9e1459A7A482635700cBc20BBAF52D495Ab9C96")));
|
||||
assert_eq!(tx.input().as_ref(), hex!("1b55ba3a"));
|
||||
let encoded = tx.encoded_2718();
|
||||
assert_eq!(encoded.as_ref(), data.to_vec());
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ reth-consensus-common.workspace = true
|
||||
reth-prune-types.workspace = true
|
||||
reth-storage-api.workspace = true
|
||||
reth-trie = { workspace = true, optional = true }
|
||||
|
||||
# alloy
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
|
||||
# revm
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//! Helper for handling execution of multiple blocks.
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_primitives::{map::HashSet, Address, BlockNumber};
|
||||
use reth_execution_errors::{BlockExecutionError, InternalBlockExecutionError};
|
||||
use reth_primitives::{Receipt, Receipts, Request, Requests};
|
||||
use reth_primitives::{Receipt, Receipts};
|
||||
use reth_prune_types::{PruneMode, PruneModes, PruneSegmentError, MINIMUM_PRUNING_DISTANCE};
|
||||
use revm::db::states::bundle_state::BundleRetention;
|
||||
|
||||
@@ -170,8 +171,8 @@ impl BlockBatchRecord {
|
||||
}
|
||||
|
||||
/// Save EIP-7685 requests to the executor.
|
||||
pub fn save_requests(&mut self, requests: Vec<Request>) {
|
||||
self.requests.push(requests.into());
|
||||
pub fn save_requests(&mut self, requests: Requests) {
|
||||
self.requests.push(requests);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ use alloy_rpc_types::{
|
||||
};
|
||||
use alloy_rpc_types_engine::{
|
||||
ClientVersionV1, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2, ExecutionPayloadV1,
|
||||
ExecutionPayloadV3, ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, PayloadId,
|
||||
PayloadStatus, TransitionConfiguration,
|
||||
ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
|
||||
TransitionConfiguration,
|
||||
};
|
||||
use alloy_rpc_types_eth::transaction::TransactionRequest;
|
||||
use alloy_serde::JsonStorageKey;
|
||||
@@ -54,9 +54,10 @@ pub trait EngineApi<Engine: EngineTypes> {
|
||||
#[method(name = "newPayloadV4")]
|
||||
async fn new_payload_v4(
|
||||
&self,
|
||||
payload: ExecutionPayloadV4,
|
||||
payload: ExecutionPayloadV3,
|
||||
versioned_hashes: Vec<B256>,
|
||||
parent_beacon_block_root: B256,
|
||||
execution_requests: Vec<Bytes>,
|
||||
) -> RpcResult<PayloadStatus>;
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/6709c2a795b707202e93c4f2867fa0bf2640a84f/src/engine/paris.md#engine_forkchoiceupdatedv1>
|
||||
|
||||
@@ -2,11 +2,11 @@ use crate::{
|
||||
capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult,
|
||||
};
|
||||
use alloy_eips::eip4844::BlobAndProofV1;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, B256, U64};
|
||||
use alloy_primitives::{BlockHash, BlockNumber, Bytes, B256, U64};
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
|
||||
ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, ExecutionPayloadV4,
|
||||
ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration,
|
||||
ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceState,
|
||||
ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use jsonrpsee_core::RpcResult;
|
||||
@@ -140,7 +140,7 @@ where
|
||||
self.inner
|
||||
.validator
|
||||
.validate_version_specific_fields(EngineApiMessageVersion::V1, payload_or_attrs)?;
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, None).await?)
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, None, None).await?)
|
||||
}
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/584905270d8ad665718058060267061ecfd79ca5/src/engine/shanghai.md#engine_newpayloadv2>
|
||||
@@ -156,7 +156,7 @@ where
|
||||
self.inner
|
||||
.validator
|
||||
.validate_version_specific_fields(EngineApiMessageVersion::V2, payload_or_attrs)?;
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, None).await?)
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, None, None).await?)
|
||||
}
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#engine_newpayloadv3>
|
||||
@@ -178,15 +178,18 @@ where
|
||||
|
||||
let cancun_fields = CancunPayloadFields { versioned_hashes, parent_beacon_block_root };
|
||||
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, Some(cancun_fields)).await?)
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, Some(cancun_fields), None).await?)
|
||||
}
|
||||
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/7907424db935b93c2fe6a3c0faab943adebe8557/src/engine/prague.md#engine_newpayloadv4>
|
||||
pub async fn new_payload_v4(
|
||||
&self,
|
||||
payload: ExecutionPayloadV4,
|
||||
payload: ExecutionPayloadV3,
|
||||
versioned_hashes: Vec<B256>,
|
||||
parent_beacon_block_root: B256,
|
||||
// TODO(onbjerg): Figure out why we even get these here, since we'll check the requests
|
||||
// from execution against the requests root in the header.
|
||||
execution_requests: Vec<Bytes>,
|
||||
) -> EngineApiResult<PayloadStatus> {
|
||||
let payload = ExecutionPayload::from(payload);
|
||||
let payload_or_attrs =
|
||||
@@ -200,7 +203,13 @@ where
|
||||
|
||||
let cancun_fields = CancunPayloadFields { versioned_hashes, parent_beacon_block_root };
|
||||
|
||||
Ok(self.inner.beacon_consensus.new_payload(payload, Some(cancun_fields)).await?)
|
||||
// HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary
|
||||
// workaround.
|
||||
Ok(self
|
||||
.inner
|
||||
.beacon_consensus
|
||||
.new_payload(payload, Some(cancun_fields), Some(execution_requests))
|
||||
.await?)
|
||||
}
|
||||
|
||||
/// Sends a message to the beacon consensus engine to update the fork choice _without_
|
||||
@@ -370,7 +379,7 @@ where
|
||||
.map_err(|_| EngineApiError::UnknownPayload)?
|
||||
.try_into()
|
||||
.map_err(|_| {
|
||||
warn!("could not transform built payload into ExecutionPayloadV4");
|
||||
warn!("could not transform built payload into ExecutionPayloadV3");
|
||||
EngineApiError::UnknownPayload
|
||||
})
|
||||
}
|
||||
@@ -665,15 +674,22 @@ where
|
||||
/// See also <https://github.com/ethereum/execution-apis/blob/03911ffc053b8b806123f1fc237184b0092a485a/src/engine/prague.md#engine_newpayloadv4>
|
||||
async fn new_payload_v4(
|
||||
&self,
|
||||
payload: ExecutionPayloadV4,
|
||||
payload: ExecutionPayloadV3,
|
||||
versioned_hashes: Vec<B256>,
|
||||
parent_beacon_block_root: B256,
|
||||
execution_requests: Vec<Bytes>,
|
||||
) -> RpcResult<PayloadStatus> {
|
||||
trace!(target: "rpc::engine", "Serving engine_newPayloadV4");
|
||||
let start = Instant::now();
|
||||
let gas_used = payload.payload_inner.payload_inner.payload_inner.gas_used;
|
||||
let res =
|
||||
Self::new_payload_v4(self, payload, versioned_hashes, parent_beacon_block_root).await;
|
||||
let gas_used = payload.payload_inner.payload_inner.gas_used;
|
||||
let res = Self::new_payload_v4(
|
||||
self,
|
||||
payload,
|
||||
versioned_hashes,
|
||||
parent_beacon_block_root,
|
||||
execution_requests,
|
||||
)
|
||||
.await;
|
||||
let elapsed = start.elapsed();
|
||||
self.inner.metrics.latency.new_payload_v4.record(elapsed);
|
||||
self.inner.metrics.new_payload_response.update_response_metrics(&res, gas_used, elapsed);
|
||||
|
||||
@@ -75,7 +75,7 @@ fn payload_validation() {
|
||||
b
|
||||
});
|
||||
|
||||
assert_matches!(try_into_sealed_block(block_with_valid_extra_data, None), Ok(_));
|
||||
assert_matches!(try_into_sealed_block(block_with_valid_extra_data, None, None), Ok(_));
|
||||
|
||||
// Invalid extra data
|
||||
let block_with_invalid_extra_data = Bytes::from_static(&[0; 33]);
|
||||
@@ -84,7 +84,7 @@ fn payload_validation() {
|
||||
b
|
||||
});
|
||||
assert_matches!(
|
||||
try_into_sealed_block(invalid_extra_data_block,None),
|
||||
try_into_sealed_block(invalid_extra_data_block, None, None),
|
||||
Err(PayloadError::ExtraData(data)) if data == block_with_invalid_extra_data
|
||||
);
|
||||
|
||||
@@ -94,8 +94,7 @@ fn payload_validation() {
|
||||
b
|
||||
});
|
||||
assert_matches!(
|
||||
|
||||
try_into_sealed_block(block_with_zero_base_fee,None),
|
||||
try_into_sealed_block(block_with_zero_base_fee, None, None),
|
||||
Err(PayloadError::BaseFee(val)) if val.is_zero()
|
||||
);
|
||||
|
||||
@@ -114,8 +113,7 @@ fn payload_validation() {
|
||||
b
|
||||
});
|
||||
assert_matches!(
|
||||
try_into_sealed_block(block_with_ommers.clone(),None),
|
||||
|
||||
try_into_sealed_block(block_with_ommers.clone(), None, None),
|
||||
Err(PayloadError::BlockHash { consensus, .. })
|
||||
if consensus == block_with_ommers.block_hash()
|
||||
);
|
||||
@@ -126,9 +124,8 @@ fn payload_validation() {
|
||||
b
|
||||
});
|
||||
assert_matches!(
|
||||
try_into_sealed_block(block_with_difficulty.clone(),None),
|
||||
try_into_sealed_block(block_with_difficulty.clone(), None, None),
|
||||
Err(PayloadError::BlockHash { consensus, .. }) if consensus == block_with_difficulty.block_hash()
|
||||
|
||||
);
|
||||
|
||||
// None zero nonce
|
||||
@@ -137,7 +134,7 @@ fn payload_validation() {
|
||||
b
|
||||
});
|
||||
assert_matches!(
|
||||
try_into_sealed_block(block_with_nonce.clone(),None),
|
||||
try_into_sealed_block(block_with_nonce.clone(), None, None),
|
||||
Err(PayloadError::BlockHash { consensus, .. }) if consensus == block_with_nonce.block_hash()
|
||||
|
||||
);
|
||||
|
||||
@@ -5,7 +5,8 @@ use std::time::{Duration, Instant};
|
||||
|
||||
use crate::{EthApiTypes, FromEthApiError, FromEvmError};
|
||||
|
||||
use alloy_consensus::{EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
|
||||
use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
|
||||
use alloy_eips::eip7685::EMPTY_REQUESTS_HASH;
|
||||
use alloy_primitives::{BlockNumber, B256, U256};
|
||||
use alloy_rpc_types::BlockNumberOrTag;
|
||||
use futures::Future;
|
||||
@@ -19,7 +20,7 @@ use reth_primitives::{
|
||||
BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, EVMError, Env, ExecutionResult, InvalidTransaction,
|
||||
ResultAndState, SpecId,
|
||||
},
|
||||
Block, BlockBody, Header, Receipt, Requests, SealedBlockWithSenders, SealedHeader,
|
||||
Block, BlockBody, Header, Receipt, SealedBlockWithSenders, SealedHeader,
|
||||
TransactionSignedEcRecovered,
|
||||
};
|
||||
use reth_provider::{
|
||||
@@ -417,14 +418,9 @@ pub trait LoadPendingBlock: EthApiTypes {
|
||||
let blob_gas_used =
|
||||
(cfg.handler_cfg.spec_id >= SpecId::CANCUN).then_some(sum_blob_gas_used);
|
||||
|
||||
// note(onbjerg): the rpc spec has not been changed to include requests, so for now we just
|
||||
// set these to empty
|
||||
let (requests, requests_root) =
|
||||
if chain_spec.is_prague_active_at_timestamp(block_env.timestamp.to::<u64>()) {
|
||||
(Some(Requests::default()), Some(EMPTY_ROOT_HASH))
|
||||
} else {
|
||||
(None, None)
|
||||
};
|
||||
let requests_hash = chain_spec
|
||||
.is_prague_active_at_timestamp(block_env.timestamp.to::<u64>())
|
||||
.then_some(EMPTY_REQUESTS_HASH);
|
||||
|
||||
let header = Header {
|
||||
parent_hash,
|
||||
@@ -447,7 +443,7 @@ pub trait LoadPendingBlock: EthApiTypes {
|
||||
excess_blob_gas: block_env.get_blob_excess_gas().map(Into::into),
|
||||
extra_data: Default::default(),
|
||||
parent_beacon_block_root,
|
||||
requests_root,
|
||||
requests_hash,
|
||||
};
|
||||
|
||||
// Convert Vec<Option<Receipt>> to Vec<Receipt>
|
||||
@@ -456,7 +452,7 @@ pub trait LoadPendingBlock: EthApiTypes {
|
||||
// seal the block
|
||||
let block = Block {
|
||||
header,
|
||||
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals, requests },
|
||||
body: BlockBody { transactions: executed_txs, ommers: vec![], withdrawals },
|
||||
};
|
||||
Ok((SealedBlockWithSenders { block: block.seal_slow(), senders }, receipts))
|
||||
}
|
||||
|
||||
@@ -102,8 +102,6 @@ impl ReceiptBuilder {
|
||||
gas_used: gas_used as u128,
|
||||
contract_address,
|
||||
effective_gas_price: transaction.effective_gas_price(meta.base_fee),
|
||||
// TODO pre-byzantium receipts have a post-transaction state root
|
||||
state_root: None,
|
||||
// EIP-4844 fields
|
||||
blob_gas_price,
|
||||
blob_gas_used: blob_gas_used.map(u128::from),
|
||||
|
||||
@@ -124,7 +124,7 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader)
|
||||
blob_gas_used,
|
||||
excess_blob_gas,
|
||||
parent_beacon_block_root,
|
||||
requests_root,
|
||||
requests_hash,
|
||||
} = header;
|
||||
|
||||
Header {
|
||||
@@ -150,7 +150,7 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader)
|
||||
excess_blob_gas,
|
||||
parent_beacon_block_root,
|
||||
total_difficulty: None,
|
||||
requests_root,
|
||||
requests_hash,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
//! Ethereum's Engine
|
||||
|
||||
use alloy_consensus::{constants::MAXIMUM_EXTRA_DATA_SIZE, EMPTY_OMMER_ROOT_HASH};
|
||||
use alloy_eips::eip2718::{Decodable2718, Encodable2718};
|
||||
use alloy_eips::{
|
||||
eip2718::{Decodable2718, Encodable2718},
|
||||
eip7685::Requests,
|
||||
};
|
||||
use alloy_primitives::{B256, U256};
|
||||
use alloy_rpc_types_engine::{
|
||||
payload::{ExecutionPayloadBodyV1, ExecutionPayloadFieldV2, ExecutionPayloadInputV2},
|
||||
ExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3,
|
||||
ExecutionPayloadV4, PayloadError,
|
||||
ExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, PayloadError,
|
||||
};
|
||||
use reth_primitives::{
|
||||
proofs::{self},
|
||||
Block, BlockBody, Header, Request, SealedBlock, TransactionSigned, Withdrawals,
|
||||
Block, BlockBody, Header, SealedBlock, TransactionSigned, Withdrawals,
|
||||
};
|
||||
|
||||
/// Converts [`ExecutionPayloadV1`] to [`Block`]
|
||||
@@ -67,7 +69,7 @@ pub fn try_payload_v1_to_block(payload: ExecutionPayloadV1) -> Result<Block, Pay
|
||||
blob_gas_used: None,
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_root: None,
|
||||
requests_hash: None,
|
||||
extra_data: payload.extra_data,
|
||||
// Defaults
|
||||
ommers_hash: EMPTY_OMMER_ROOT_HASH,
|
||||
@@ -101,36 +103,11 @@ pub fn try_payload_v3_to_block(payload: ExecutionPayloadV3) -> Result<Block, Pay
|
||||
Ok(base_block)
|
||||
}
|
||||
|
||||
/// Converts [`ExecutionPayloadV4`] to [`Block`]
|
||||
pub fn try_payload_v4_to_block(payload: ExecutionPayloadV4) -> Result<Block, PayloadError> {
|
||||
let ExecutionPayloadV4 {
|
||||
payload_inner,
|
||||
deposit_requests,
|
||||
withdrawal_requests,
|
||||
consolidation_requests,
|
||||
} = payload;
|
||||
let mut block = try_payload_v3_to_block(payload_inner)?;
|
||||
|
||||
// attach requests with asc type identifiers
|
||||
let requests = deposit_requests
|
||||
.into_iter()
|
||||
.map(Request::DepositRequest)
|
||||
.chain(withdrawal_requests.into_iter().map(Request::WithdrawalRequest))
|
||||
.chain(consolidation_requests.into_iter().map(Request::ConsolidationRequest))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let requests_root = proofs::calculate_requests_root(&requests);
|
||||
block.header.requests_root = Some(requests_root);
|
||||
block.body.requests = Some(requests.into());
|
||||
|
||||
Ok(block)
|
||||
}
|
||||
|
||||
/// Converts [`SealedBlock`] to [`ExecutionPayload`]
|
||||
pub fn block_to_payload(value: SealedBlock) -> ExecutionPayload {
|
||||
if value.header.requests_root.is_some() {
|
||||
if value.header.requests_hash.is_some() {
|
||||
// block with requests root: V3
|
||||
ExecutionPayload::V4(block_to_payload_v4(value))
|
||||
ExecutionPayload::V3(block_to_payload_v3(value))
|
||||
} else if value.header.parent_beacon_block_root.is_some() {
|
||||
// block with parent beacon block root: V3
|
||||
ExecutionPayload::V3(block_to_payload_v3(value))
|
||||
@@ -217,37 +194,6 @@ pub fn block_to_payload_v3(value: SealedBlock) -> ExecutionPayloadV3 {
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts [`SealedBlock`] to [`ExecutionPayloadV4`]
|
||||
pub fn block_to_payload_v4(mut value: SealedBlock) -> ExecutionPayloadV4 {
|
||||
let (deposit_requests, withdrawal_requests, consolidation_requests) =
|
||||
value.body.requests.take().unwrap_or_default().into_iter().fold(
|
||||
(Vec::new(), Vec::new(), Vec::new()),
|
||||
|(mut deposits, mut withdrawals, mut consolidation_requests), request| {
|
||||
match request {
|
||||
Request::DepositRequest(r) => {
|
||||
deposits.push(r);
|
||||
}
|
||||
Request::WithdrawalRequest(r) => {
|
||||
withdrawals.push(r);
|
||||
}
|
||||
Request::ConsolidationRequest(r) => {
|
||||
consolidation_requests.push(r);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
(deposits, withdrawals, consolidation_requests)
|
||||
},
|
||||
);
|
||||
|
||||
ExecutionPayloadV4 {
|
||||
deposit_requests,
|
||||
withdrawal_requests,
|
||||
consolidation_requests,
|
||||
payload_inner: block_to_payload_v3(value),
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts [`SealedBlock`] to [`ExecutionPayloadFieldV2`]
|
||||
pub fn convert_block_to_payload_field_v2(value: SealedBlock) -> ExecutionPayloadFieldV2 {
|
||||
// if there are withdrawals, return V2
|
||||
@@ -312,15 +258,16 @@ pub fn convert_block_to_payload_input_v2(value: SealedBlock) -> ExecutionPayload
|
||||
pub fn try_into_block(
|
||||
value: ExecutionPayload,
|
||||
parent_beacon_block_root: Option<B256>,
|
||||
execution_requests: Option<Requests>,
|
||||
) -> Result<Block, PayloadError> {
|
||||
let mut base_payload = match value {
|
||||
ExecutionPayload::V1(payload) => try_payload_v1_to_block(payload)?,
|
||||
ExecutionPayload::V2(payload) => try_payload_v2_to_block(payload)?,
|
||||
ExecutionPayload::V3(payload) => try_payload_v3_to_block(payload)?,
|
||||
ExecutionPayload::V4(payload) => try_payload_v4_to_block(payload)?,
|
||||
};
|
||||
|
||||
base_payload.header.parent_beacon_block_root = parent_beacon_block_root;
|
||||
base_payload.header.requests_hash = execution_requests.map(|reqs| reqs.requests_hash());
|
||||
|
||||
Ok(base_payload)
|
||||
}
|
||||
@@ -338,9 +285,10 @@ pub fn try_into_block(
|
||||
pub fn try_into_sealed_block(
|
||||
payload: ExecutionPayload,
|
||||
parent_beacon_block_root: Option<B256>,
|
||||
execution_requests: Option<Requests>,
|
||||
) -> Result<SealedBlock, PayloadError> {
|
||||
let block_hash = payload.block_hash();
|
||||
let base_payload = try_into_block(payload, parent_beacon_block_root)?;
|
||||
let base_payload = try_into_block(payload, parent_beacon_block_root, execution_requests)?;
|
||||
|
||||
// validate block hash and return
|
||||
validate_block_hash(block_hash, base_payload)
|
||||
@@ -404,13 +352,12 @@ pub fn execution_payload_from_sealed_block(value: SealedBlock) -> ExecutionPaylo
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
block_to_payload_v3, try_into_block, try_payload_v3_to_block, try_payload_v4_to_block,
|
||||
validate_block_hash,
|
||||
block_to_payload_v3, try_into_block, try_payload_v3_to_block, validate_block_hash,
|
||||
};
|
||||
use alloy_primitives::{b256, hex, Bytes, U256};
|
||||
use alloy_rpc_types_engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2,
|
||||
ExecutionPayloadV3, ExecutionPayloadV4,
|
||||
ExecutionPayloadV3,
|
||||
};
|
||||
|
||||
#[test]
|
||||
@@ -628,60 +575,10 @@ mod tests {
|
||||
let cancun_fields = CancunPayloadFields { parent_beacon_block_root, versioned_hashes };
|
||||
|
||||
// convert into block
|
||||
let block = try_into_block(payload, Some(cancun_fields.parent_beacon_block_root)).unwrap();
|
||||
let block =
|
||||
try_into_block(payload, Some(cancun_fields.parent_beacon_block_root), None).unwrap();
|
||||
|
||||
// Ensure the actual hash is calculated if we set the fields to what they should be
|
||||
validate_block_hash(block_hash_with_blob_fee_fields, block).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_payload_v4() {
|
||||
let s = r#"{
|
||||
"baseFeePerGas": "0x2ada43",
|
||||
"blobGasUsed": "0x0",
|
||||
"blockHash": "0x86eeb2a4b656499f313b601e1dcaedfeacccab27131b6d4ea99bc69a57607f7d",
|
||||
"blockNumber": "0x2c",
|
||||
"depositRequests": [
|
||||
{
|
||||
"amount": "0xe8d4a51000",
|
||||
"index": "0x0",
|
||||
"pubkey": "0xaab5f2b3aad5c2075faf0c1d8937c7de51a53b765a21b4173eb2975878cea05d9ed3428b77f16a981716aa32af74c464",
|
||||
"signature": "0xa889cd238be2dae44f2a3c24c04d686c548f6f82eb44d4604e1bc455b6960efb72b117e878068a8f2cfb91ad84b7ebce05b9254207aa51a1e8a3383d75b5a5bd2439f707636ea5b17b2b594b989c93b000b33e5dff6e4bed9d53a6d2d6889b0c",
|
||||
"withdrawalCredentials": "0x00ab9364f8bf7561862ea0fc3b69c424c94ace406c4dc36ddfbf8a9d72051c80"
|
||||
},
|
||||
{
|
||||
"amount": "0xe8d4a51000",
|
||||
"index": "0x1",
|
||||
"pubkey": "0xb0b1b3b51cf688ead965a954c5cc206ba4e76f3f8efac60656ae708a9aad63487a2ca1fb30ccaf2ebe1028a2b2886b1b",
|
||||
"signature": "0xb9759766e9bb191b1c457ae1da6cdf71a23fb9d8bc9f845eaa49ee4af280b3b9720ac4d81e64b1b50a65db7b8b4e76f1176a12e19d293d75574600e99fbdfecc1ab48edaeeffb3226cd47691d24473821dad0c6ff3973f03e4aa89f418933a56",
|
||||
"withdrawalCredentials": "0x002d2b75f4a27f78e585a4735a40ab2437eceb12ec39938a94dc785a54d62513"
|
||||
}
|
||||
],
|
||||
"excessBlobGas": "0x0",
|
||||
"extraData": "0x726574682f76302e322e302d626574612e372f6c696e7578",
|
||||
"feeRecipient": "0x8943545177806ed17b9f23f0a21ee5948ecaa776",
|
||||
"gasLimit": "0x1855e85",
|
||||
"gasUsed": "0x25f98",
|
||||
"logsBloom": "0x10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000",
|
||||
"parentHash": "0xd753194ef19b5c566b7eca6e9ebcca03895b548e1e93a20a23d922ba0bc210d4",
|
||||
"prevRandao": "0x8c52256fd491776dc32f531ad4c0dc1444684741bca15f54c9cd40c60142df90",
|
||||
"receiptsRoot": "0x510e7fb94279897e5dcd6c1795f6137d8fe02e49e871bfea7999fd21a89f66aa",
|
||||
"stateRoot": "0x59ae0706a2b47162666fc7af3e30ff7aa34154954b68cc6aed58c3af3d58c9c2",
|
||||
"timestamp": "0x6643c5a9",
|
||||
"transactions": [
|
||||
"0x02f9021e8330182480843b9aca0085174876e80083030d40944242424242424242424242424242424242424242893635c9adc5dea00000b901a422895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012049f42823819771c6bbbd9cb6649850083fd3b6e5d0beb1069342c32d65a3b0990000000000000000000000000000000000000000000000000000000000000030aab5f2b3aad5c2075faf0c1d8937c7de51a53b765a21b4173eb2975878cea05d9ed3428b77f16a981716aa32af74c46400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000ab9364f8bf7561862ea0fc3b69c424c94ace406c4dc36ddfbf8a9d72051c800000000000000000000000000000000000000000000000000000000000000060a889cd238be2dae44f2a3c24c04d686c548f6f82eb44d4604e1bc455b6960efb72b117e878068a8f2cfb91ad84b7ebce05b9254207aa51a1e8a3383d75b5a5bd2439f707636ea5b17b2b594b989c93b000b33e5dff6e4bed9d53a6d2d6889b0cc080a0db786f0d89923949e533680524f003cebd66f32fbd30429a6b6bfbd3258dcf60a05241c54e05574765f7ddc1a742ae06b044edfe02bffb202bf172be97397eeca9",
|
||||
"0x02f9021e8330182401843b9aca0085174876e80083030d40944242424242424242424242424242424242424242893635c9adc5dea00000b901a422895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120d694d6a0b0103651aafd87db6c88297175d7317c6e6da53ccf706c3c991c91fd0000000000000000000000000000000000000000000000000000000000000030b0b1b3b51cf688ead965a954c5cc206ba4e76f3f8efac60656ae708a9aad63487a2ca1fb30ccaf2ebe1028a2b2886b1b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020002d2b75f4a27f78e585a4735a40ab2437eceb12ec39938a94dc785a54d625130000000000000000000000000000000000000000000000000000000000000060b9759766e9bb191b1c457ae1da6cdf71a23fb9d8bc9f845eaa49ee4af280b3b9720ac4d81e64b1b50a65db7b8b4e76f1176a12e19d293d75574600e99fbdfecc1ab48edaeeffb3226cd47691d24473821dad0c6ff3973f03e4aa89f418933a56c080a099dc5b94a51e9b91a6425b1fed9792863006496ab71a4178524819d7db0c5e88a0119748e62700234079d91ae80f4676f9e0f71b260e9b46ef9b4aff331d3c2318"
|
||||
],
|
||||
"withdrawalRequests": [],
|
||||
"withdrawals": [],
|
||||
"consolidationRequests": []
|
||||
}"#;
|
||||
|
||||
let payload = serde_json::from_str::<ExecutionPayloadV4>(s).unwrap();
|
||||
let mut block = try_payload_v4_to_block(payload).unwrap();
|
||||
block.header.parent_beacon_block_root =
|
||||
Some(b256!("d9851db05fa63593f75e2b12c4bba9f47740613ca57da3b523a381b8c27f3297"));
|
||||
let hash = block.seal_slow().hash();
|
||||
assert_eq!(hash, b256!("86eeb2a4b656499f313b601e1dcaedfeacccab27131b6d4ea99bc69a57607f7d"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ where
|
||||
|
||||
let state =
|
||||
state_provider.witness(Default::default(), hashed_state).map_err(Into::into)?;
|
||||
Ok(ExecutionWitness { state: state.into_iter().collect(), codes, keys: Some(keys) })
|
||||
Ok(ExecutionWitness { state: state.into_iter().collect(), codes, keys })
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -261,7 +261,6 @@ where
|
||||
from: receipt.from(),
|
||||
to: receipt.to(),
|
||||
contract_address: receipt.contract_address(),
|
||||
state_root: receipt.state_root(),
|
||||
authorization_list: receipt
|
||||
.authorization_list()
|
||||
.map(<[SignedAuthorization]>::to_vec),
|
||||
|
||||
@@ -101,7 +101,7 @@ where
|
||||
entry.insert(
|
||||
tx.nonce().to_string(),
|
||||
TxpoolInspectSummary {
|
||||
to: tx.to().into(),
|
||||
to: tx.to(),
|
||||
value: tx.value(),
|
||||
gas: tx.gas_limit() as u128,
|
||||
gas_price: tx.transaction.max_fee_per_gas(),
|
||||
|
||||
@@ -121,7 +121,6 @@ where
|
||||
let mut tx_block_cursor = tx.cursor_write::<tables::TransactionBlocks>()?;
|
||||
let mut ommers_cursor = tx.cursor_write::<tables::BlockOmmers>()?;
|
||||
let mut withdrawals_cursor = tx.cursor_write::<tables::BlockWithdrawals>()?;
|
||||
let mut requests_cursor = tx.cursor_write::<tables::BlockRequests>()?;
|
||||
|
||||
// Get id for the next tx_num of zero if there are no transactions.
|
||||
let mut next_tx_num = tx_block_cursor.last()?.map(|(id, _)| id + 1).unwrap_or_default();
|
||||
@@ -234,13 +233,6 @@ where
|
||||
.append(block_number, StoredBlockWithdrawals { withdrawals })?;
|
||||
}
|
||||
}
|
||||
|
||||
// Write requests if any
|
||||
if let Some(requests) = block.body.requests {
|
||||
if !requests.0.is_empty() {
|
||||
requests_cursor.append(block_number, requests)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
BlockResponse::Empty(_) => {}
|
||||
};
|
||||
@@ -276,7 +268,6 @@ where
|
||||
let mut body_cursor = tx.cursor_write::<tables::BlockBodyIndices>()?;
|
||||
let mut ommers_cursor = tx.cursor_write::<tables::BlockOmmers>()?;
|
||||
let mut withdrawals_cursor = tx.cursor_write::<tables::BlockWithdrawals>()?;
|
||||
let mut requests_cursor = tx.cursor_write::<tables::BlockRequests>()?;
|
||||
// Cursors to unwind transitions
|
||||
let mut tx_block_cursor = tx.cursor_write::<tables::TransactionBlocks>()?;
|
||||
|
||||
@@ -296,11 +287,6 @@ where
|
||||
withdrawals_cursor.delete_current()?;
|
||||
}
|
||||
|
||||
// Delete the requests entry if any
|
||||
if requests_cursor.seek_exact(number)?.is_some() {
|
||||
requests_cursor.delete_current()?;
|
||||
}
|
||||
|
||||
// Delete all transaction to block values.
|
||||
if !block_meta.is_empty() &&
|
||||
tx_block_cursor.seek_exact(block_meta.last_tx_num())?.is_some()
|
||||
|
||||
@@ -13,7 +13,7 @@ use reth_codecs_derive::add_arbitrary_tests;
|
||||
#[cfg_attr(test, derive(arbitrary::Arbitrary, serde::Serialize, serde::Deserialize))]
|
||||
#[add_arbitrary_tests(compact)]
|
||||
pub(crate) struct Authorization {
|
||||
chain_id: U256,
|
||||
chain_id: u64,
|
||||
address: Address,
|
||||
nonce: u64,
|
||||
}
|
||||
@@ -78,7 +78,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_roundtrip_compact_authorization_list_item() {
|
||||
let authorization = AlloyAuthorization {
|
||||
chain_id: U256::from(1),
|
||||
chain_id: 1u64,
|
||||
address: address!("dac17f958d2ee523a2206206994597c13d831ec7"),
|
||||
nonce: 1,
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ pub(crate) struct Header {
|
||||
#[cfg_attr(test, derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default, Compact)]
|
||||
pub(crate) struct HeaderExt {
|
||||
requests_root: Option<B256>,
|
||||
requests_hash: Option<B256>,
|
||||
}
|
||||
|
||||
impl HeaderExt {
|
||||
@@ -53,7 +53,7 @@ impl HeaderExt {
|
||||
///
|
||||
/// Required since [`Header`] uses `Option<HeaderExt>` as a field.
|
||||
const fn into_option(self) -> Option<Self> {
|
||||
if self.requests_root.is_some() {
|
||||
if self.requests_hash.is_some() {
|
||||
Some(self)
|
||||
} else {
|
||||
None
|
||||
@@ -66,7 +66,7 @@ impl Compact for AlloyHeader {
|
||||
where
|
||||
B: bytes::BufMut + AsMut<[u8]>,
|
||||
{
|
||||
let extra_fields = HeaderExt { requests_root: self.requests_root };
|
||||
let extra_fields = HeaderExt { requests_hash: self.requests_hash };
|
||||
|
||||
let header = Header {
|
||||
parent_hash: self.parent_hash,
|
||||
@@ -116,7 +116,7 @@ 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_root: header.extra_fields.and_then(|h| h.requests_root),
|
||||
requests_hash: header.extra_fields.and_then(|h| h.requests_hash),
|
||||
extra_data: header.extra_data,
|
||||
};
|
||||
(alloy_header, buf)
|
||||
@@ -176,7 +176,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_extra_fields() {
|
||||
let mut header = HOLESKY_BLOCK;
|
||||
header.extra_fields = Some(HeaderExt { requests_root: Some(B256::random()) });
|
||||
header.extra_fields = Some(HeaderExt { requests_hash: Some(B256::random()) });
|
||||
|
||||
let mut encoded_header = vec![];
|
||||
let len = header.to_compact(&mut encoded_header);
|
||||
|
||||
@@ -3,7 +3,6 @@ mod authorization_list;
|
||||
mod genesis_account;
|
||||
mod header;
|
||||
mod log;
|
||||
mod request;
|
||||
mod signature;
|
||||
mod transaction;
|
||||
mod trie;
|
||||
@@ -14,7 +13,6 @@ mod withdrawal;
|
||||
mod tests {
|
||||
use crate::{
|
||||
alloy::{
|
||||
authorization_list::Authorization,
|
||||
genesis_account::{GenesisAccount, GenesisAccountRef, StorageEntries, StorageEntry},
|
||||
header::{Header, HeaderExt},
|
||||
transaction::{
|
||||
@@ -38,7 +36,6 @@ mod tests {
|
||||
validate_bitflag_backwards_compat!(StorageEntries, UnusedBits::Zero);
|
||||
validate_bitflag_backwards_compat!(StorageEntry, UnusedBits::Zero);
|
||||
|
||||
validate_bitflag_backwards_compat!(Authorization, UnusedBits::NotZero);
|
||||
validate_bitflag_backwards_compat!(GenesisAccountRef<'_>, UnusedBits::NotZero);
|
||||
validate_bitflag_backwards_compat!(GenesisAccount, UnusedBits::NotZero);
|
||||
validate_bitflag_backwards_compat!(TxEip1559, UnusedBits::NotZero);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
//! Native Compact codec impl for EIP-7685 requests.
|
||||
|
||||
use crate::Compact;
|
||||
use alloy_consensus::Request;
|
||||
use alloy_eips::eip7685::{Decodable7685, Encodable7685};
|
||||
use alloy_primitives::Bytes;
|
||||
use bytes::BufMut;
|
||||
|
||||
impl Compact for Request {
|
||||
fn to_compact<B>(&self, buf: &mut B) -> usize
|
||||
where
|
||||
B: BufMut + AsMut<[u8]>,
|
||||
{
|
||||
let encoded: Bytes = self.encoded_7685().into();
|
||||
encoded.to_compact(buf)
|
||||
}
|
||||
|
||||
fn from_compact(buf: &[u8], _: usize) -> (Self, &[u8]) {
|
||||
let (raw, buf) = Bytes::from_compact(buf, buf.len());
|
||||
|
||||
(Self::decode_7685(&mut raw.as_ref()).expect("invalid eip-7685 request in db"), buf)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use proptest::proptest;
|
||||
use proptest_arbitrary_interop::arb;
|
||||
|
||||
proptest! {
|
||||
#[test]
|
||||
fn roundtrip(request in arb::<Request>()) {
|
||||
let mut buf = Vec::<u8>::new();
|
||||
request.to_compact(&mut buf);
|
||||
let (decoded, _) = Request::from_compact(&buf, buf.len());
|
||||
assert_eq!(request, decoded);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use alloy_genesis::GenesisAccount;
|
||||
use alloy_primitives::{Address, Bytes, Log, B256, U256};
|
||||
use reth_codecs::{add_arbitrary_tests, Compact};
|
||||
use reth_primitives::{
|
||||
Account, Bytecode, Header, Receipt, Requests, StorageEntry, TransactionSignedNoHash, TxType,
|
||||
Account, Bytecode, Header, Receipt, StorageEntry, TransactionSignedNoHash, TxType,
|
||||
};
|
||||
use reth_prune_types::{PruneCheckpoint, PruneSegment};
|
||||
use reth_stages_types::StageCheckpoint;
|
||||
@@ -230,7 +230,6 @@ impl_compression_for_compact!(
|
||||
StageCheckpoint,
|
||||
PruneCheckpoint,
|
||||
ClientVersion,
|
||||
Requests,
|
||||
// Non-DB
|
||||
GenesisAccount
|
||||
);
|
||||
@@ -366,6 +365,5 @@ mod tests {
|
||||
validate_bitflag_backwards_compat!(StoredBlockWithdrawals, UnusedBits::Zero);
|
||||
validate_bitflag_backwards_compat!(StorageHashingCheckpoint, UnusedBits::NotZero);
|
||||
validate_bitflag_backwards_compat!(Withdrawals, UnusedBits::Zero);
|
||||
validate_bitflag_backwards_compat!(Requests, UnusedBits::Zero);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,7 @@ use reth_db_api::{
|
||||
},
|
||||
table::{Decode, DupSort, Encode, Table},
|
||||
};
|
||||
use reth_primitives::{
|
||||
Account, Bytecode, Header, Receipt, Requests, StorageEntry, TransactionSignedNoHash,
|
||||
};
|
||||
use reth_primitives::{Account, Bytecode, Header, Receipt, StorageEntry, TransactionSignedNoHash};
|
||||
use reth_primitives_traits::IntegerList;
|
||||
use reth_prune_types::{PruneCheckpoint, PruneSegment};
|
||||
use reth_stages_types::StageCheckpoint;
|
||||
@@ -404,9 +402,6 @@ tables! {
|
||||
/// Stores the history of client versions that have accessed the database with write privileges by unix timestamp in seconds.
|
||||
table VersionHistory<Key = u64, Value = ClientVersion>;
|
||||
|
||||
/// Stores EIP-7685 EL -> CL requests, indexed by block number.
|
||||
table BlockRequests<Key = BlockNumber, Value = Requests>;
|
||||
|
||||
/// Stores generic chain state info, like the last finalized block.
|
||||
table ChainState<Key = ChainStateKey, Value = BlockNumber>;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
CanonStateSubscriptions, ChainSpecProvider, ChainStateBlockReader, ChangeSetReader,
|
||||
DatabaseProviderFactory, DatabaseProviderRO, EvmEnvProvider, HeaderProvider, ProviderError,
|
||||
ProviderFactory, PruneCheckpointReader, ReceiptProvider, ReceiptProviderIdExt,
|
||||
RequestsProvider, StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
|
||||
StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
|
||||
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
|
||||
};
|
||||
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, HashOrNumber};
|
||||
@@ -1200,24 +1200,6 @@ impl<N: ProviderNodeTypes> WithdrawalsProvider for BlockchainProvider2<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ProviderNodeTypes> RequestsProvider for BlockchainProvider2<N> {
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
id: BlockHashOrNumber,
|
||||
timestamp: u64,
|
||||
) -> ProviderResult<Option<reth_primitives::Requests>> {
|
||||
if !self.chain_spec().is_prague_active_at_timestamp(timestamp) {
|
||||
return Ok(None)
|
||||
}
|
||||
|
||||
self.get_in_memory_or_storage_by_block(
|
||||
id,
|
||||
|db_provider| db_provider.requests_by_block(id, timestamp),
|
||||
|block_state| Ok(block_state.block_ref().block().body.requests.clone()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ProviderNodeTypes> StageCheckpointReader for BlockchainProvider2<N> {
|
||||
fn get_stage_checkpoint(&self, id: StageId) -> ProviderResult<Option<StageCheckpoint>> {
|
||||
self.database.provider()?.get_stage_checkpoint(id)
|
||||
@@ -1747,8 +1729,8 @@ mod tests {
|
||||
use reth_storage_api::{
|
||||
BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt, BlockSource,
|
||||
ChangeSetReader, DatabaseProviderFactory, HeaderProvider, ReceiptProvider,
|
||||
ReceiptProviderIdExt, RequestsProvider, StateProviderFactory, TransactionVariant,
|
||||
TransactionsProvider, WithdrawalsProvider,
|
||||
ReceiptProviderIdExt, StateProviderFactory, TransactionVariant, TransactionsProvider,
|
||||
WithdrawalsProvider,
|
||||
};
|
||||
use reth_testing_utils::generators::{
|
||||
self, random_block, random_block_range, random_changeset_range, random_eoa_accounts,
|
||||
@@ -2849,37 +2831,6 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_requests_provider() -> eyre::Result<()> {
|
||||
let mut rng = generators::rng();
|
||||
let chain_spec = Arc::new(ChainSpecBuilder::mainnet().prague_activated().build());
|
||||
let (provider, database_blocks, in_memory_blocks, _) =
|
||||
provider_with_chain_spec_and_random_blocks(
|
||||
&mut rng,
|
||||
chain_spec.clone(),
|
||||
TEST_BLOCKS_COUNT,
|
||||
TEST_BLOCKS_COUNT,
|
||||
BlockRangeParams { requests_count: Some(1..2), ..Default::default() },
|
||||
)?;
|
||||
|
||||
let database_block = database_blocks.first().unwrap().clone();
|
||||
let in_memory_block = in_memory_blocks.last().unwrap().clone();
|
||||
|
||||
let prague_timestamp =
|
||||
chain_spec.hardforks.fork(EthereumHardfork::Prague).as_timestamp().unwrap();
|
||||
|
||||
assert_eq!(
|
||||
provider.requests_by_block(database_block.number.into(), prague_timestamp,)?,
|
||||
database_block.body.requests.clone()
|
||||
);
|
||||
assert_eq!(
|
||||
provider.requests_by_block(in_memory_block.number.into(), prague_timestamp,)?,
|
||||
in_memory_block.body.requests.clone()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_state_provider_factory() -> eyre::Result<()> {
|
||||
let mut rng = generators::rng();
|
||||
|
||||
@@ -61,7 +61,6 @@ pub(crate) enum Action {
|
||||
InsertTransactions,
|
||||
InsertTransactionHashNumbers,
|
||||
InsertBlockWithdrawals,
|
||||
InsertBlockRequests,
|
||||
InsertBlockBodyIndices,
|
||||
InsertTransactionBlocks,
|
||||
GetNextTxNum,
|
||||
@@ -106,8 +105,6 @@ struct DatabaseProviderMetrics {
|
||||
insert_tx_hash_numbers: Histogram,
|
||||
/// Duration of insert block withdrawals
|
||||
insert_block_withdrawals: Histogram,
|
||||
/// Duration of insert block requests
|
||||
insert_block_requests: Histogram,
|
||||
/// Duration of insert block body indices
|
||||
insert_block_body_indices: Histogram,
|
||||
/// Duration of insert transaction blocks
|
||||
@@ -139,7 +136,6 @@ impl DatabaseProviderMetrics {
|
||||
Action::InsertTransactions => self.insert_transactions.record(duration),
|
||||
Action::InsertTransactionHashNumbers => self.insert_tx_hash_numbers.record(duration),
|
||||
Action::InsertBlockWithdrawals => self.insert_block_withdrawals.record(duration),
|
||||
Action::InsertBlockRequests => self.insert_block_requests.record(duration),
|
||||
Action::InsertBlockBodyIndices => self.insert_block_body_indices.record(duration),
|
||||
Action::InsertTransactionBlocks => self.insert_tx_blocks.record(duration),
|
||||
Action::GetNextTxNum => self.get_next_tx_num.record(duration),
|
||||
|
||||
@@ -4,8 +4,8 @@ use crate::{
|
||||
traits::{BlockSource, ReceiptProvider},
|
||||
BlockHashReader, BlockNumReader, BlockReader, ChainSpecProvider, DatabaseProviderFactory,
|
||||
EvmEnvProvider, HeaderProvider, HeaderSyncGap, HeaderSyncGapProvider, ProviderError,
|
||||
PruneCheckpointReader, RequestsProvider, StageCheckpointReader, StateProviderBox,
|
||||
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
|
||||
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, StaticFileProviderFactory,
|
||||
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
|
||||
};
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
@@ -519,16 +519,6 @@ impl<N: ProviderNodeTypes> WithdrawalsProvider for ProviderFactory<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ProviderNodeTypes> RequestsProvider for ProviderFactory<N> {
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
id: BlockHashOrNumber,
|
||||
timestamp: u64,
|
||||
) -> ProviderResult<Option<reth_primitives::Requests>> {
|
||||
self.provider()?.requests_by_block(id, timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ProviderNodeTypes> StageCheckpointReader for ProviderFactory<N> {
|
||||
fn get_stage_checkpoint(&self, id: StageId) -> ProviderResult<Option<StageCheckpoint>> {
|
||||
self.provider()?.get_stage_checkpoint(id)
|
||||
|
||||
@@ -11,10 +11,10 @@ use crate::{
|
||||
DBProvider, EvmEnvProvider, HashingWriter, HeaderProvider, HeaderSyncGap,
|
||||
HeaderSyncGapProvider, HistoricalStateProvider, HistoricalStateProviderRef, HistoryWriter,
|
||||
LatestStateProvider, LatestStateProviderRef, OriginalValuesKnown, ProviderError,
|
||||
PruneCheckpointReader, PruneCheckpointWriter, RequestsProvider, RevertsInit,
|
||||
StageCheckpointReader, StateChangeWriter, StateProviderBox, StateReader, StateWriter,
|
||||
StaticFileProviderFactory, StatsReader, StorageReader, StorageTrieWriter, TransactionVariant,
|
||||
TransactionsProvider, TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
|
||||
PruneCheckpointReader, PruneCheckpointWriter, RevertsInit, StageCheckpointReader,
|
||||
StateChangeWriter, StateProviderBox, StateReader, StateWriter, StaticFileProviderFactory,
|
||||
StatsReader, StorageReader, StorageTrieWriter, TransactionVariant, TransactionsProvider,
|
||||
TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
|
||||
};
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
@@ -40,7 +40,7 @@ use reth_evm::ConfigureEvmEnv;
|
||||
use reth_execution_types::{Chain, ExecutionOutcome};
|
||||
use reth_network_p2p::headers::downloader::SyncTarget;
|
||||
use reth_primitives::{
|
||||
Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, Requests,
|
||||
Account, Block, BlockBody, BlockWithSenders, Bytecode, GotExpected, Header, Receipt,
|
||||
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
|
||||
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
|
||||
Withdrawal, Withdrawals,
|
||||
@@ -500,7 +500,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
Vec<Address>,
|
||||
Vec<Header>,
|
||||
Option<Withdrawals>,
|
||||
Option<Requests>,
|
||||
) -> ProviderResult<Option<B>>,
|
||||
{
|
||||
let Some(block_number) = self.convert_hash_or_number(id)? else { return Ok(None) };
|
||||
@@ -509,7 +508,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
let ommers = self.ommers(block_number.into())?.unwrap_or_default();
|
||||
let withdrawals =
|
||||
self.withdrawals_by_block(block_number.into(), header.as_ref().timestamp)?;
|
||||
let requests = self.requests_by_block(block_number.into(), header.as_ref().timestamp)?;
|
||||
|
||||
// Get the block body
|
||||
//
|
||||
@@ -540,7 +538,7 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
})
|
||||
.collect();
|
||||
|
||||
construct_block(header, body, senders, ommers, withdrawals, requests)
|
||||
construct_block(header, body, senders, ommers, withdrawals)
|
||||
}
|
||||
|
||||
/// Returns a range of blocks from the database.
|
||||
@@ -551,7 +549,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
/// - Range of transaction numbers
|
||||
/// – Ommers
|
||||
/// – Withdrawals
|
||||
/// – Requests
|
||||
/// – Senders
|
||||
fn block_range<F, H, HF, R>(
|
||||
&self,
|
||||
@@ -563,13 +560,7 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
Spec: EthereumHardforks,
|
||||
H: AsRef<Header>,
|
||||
HF: FnOnce(RangeInclusive<BlockNumber>) -> ProviderResult<Vec<H>>,
|
||||
F: FnMut(
|
||||
H,
|
||||
Range<TxNumber>,
|
||||
Vec<Header>,
|
||||
Option<Withdrawals>,
|
||||
Option<Requests>,
|
||||
) -> ProviderResult<R>,
|
||||
F: FnMut(H, Range<TxNumber>, Vec<Header>, Option<Withdrawals>) -> ProviderResult<R>,
|
||||
{
|
||||
if range.is_empty() {
|
||||
return Ok(Vec::new())
|
||||
@@ -581,7 +572,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
let headers = headers_range(range)?;
|
||||
let mut ommers_cursor = self.tx.cursor_read::<tables::BlockOmmers>()?;
|
||||
let mut withdrawals_cursor = self.tx.cursor_read::<tables::BlockWithdrawals>()?;
|
||||
let mut requests_cursor = self.tx.cursor_read::<tables::BlockRequests>()?;
|
||||
let mut block_body_cursor = self.tx.cursor_read::<tables::BlockBodyIndices>()?;
|
||||
|
||||
for header in headers {
|
||||
@@ -608,13 +598,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let requests =
|
||||
if self.chain_spec.is_prague_active_at_timestamp(header_ref.timestamp) {
|
||||
(requests_cursor.seek_exact(header_ref.number)?.unwrap_or_default().1)
|
||||
.into()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let ommers =
|
||||
if self.chain_spec.final_paris_total_difficulty(header_ref.number).is_some() {
|
||||
Vec::new()
|
||||
@@ -625,7 +608,7 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
.unwrap_or_default()
|
||||
};
|
||||
|
||||
if let Ok(b) = assemble_block(header, tx_range, ommers, withdrawals, requests) {
|
||||
if let Ok(b) = assemble_block(header, tx_range, ommers, withdrawals) {
|
||||
blocks.push(b);
|
||||
}
|
||||
}
|
||||
@@ -643,7 +626,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
/// - Transactions
|
||||
/// – Ommers
|
||||
/// – Withdrawals
|
||||
/// – Requests
|
||||
/// – Senders
|
||||
fn block_with_senders_range<H, HF, B, BF>(
|
||||
&self,
|
||||
@@ -660,14 +642,13 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
Vec<TransactionSigned>,
|
||||
Vec<Header>,
|
||||
Option<Withdrawals>,
|
||||
Option<Requests>,
|
||||
Vec<Address>,
|
||||
) -> ProviderResult<B>,
|
||||
{
|
||||
let mut tx_cursor = self.tx.cursor_read::<tables::Transactions>()?;
|
||||
let mut senders_cursor = self.tx.cursor_read::<tables::TransactionSenders>()?;
|
||||
|
||||
self.block_range(range, headers_range, |header, tx_range, ommers, withdrawals, requests| {
|
||||
self.block_range(range, headers_range, |header, tx_range, ommers, withdrawals| {
|
||||
let (body, senders) = if tx_range.is_empty() {
|
||||
(Vec::new(), Vec::new())
|
||||
} else {
|
||||
@@ -699,7 +680,7 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
(body, senders)
|
||||
};
|
||||
|
||||
assemble_block(header, body, ommers, withdrawals, requests, senders)
|
||||
assemble_block(header, body, ommers, withdrawals, senders)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -781,7 +762,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
// - Bodies (transactions)
|
||||
// - Uncles/ommers
|
||||
// - Withdrawals
|
||||
// - Requests
|
||||
// - Signers
|
||||
|
||||
let block_headers = self.get::<tables::Headers>(range.clone())?;
|
||||
@@ -792,7 +772,6 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
let block_header_hashes = self.get::<tables::CanonicalHeaders>(range.clone())?;
|
||||
let block_ommers = self.get::<tables::BlockOmmers>(range.clone())?;
|
||||
let block_withdrawals = self.get::<tables::BlockWithdrawals>(range.clone())?;
|
||||
let block_requests = self.get::<tables::BlockRequests>(range.clone())?;
|
||||
|
||||
let block_tx = self.get_block_transaction_range(range)?;
|
||||
let mut blocks = Vec::with_capacity(block_headers.len());
|
||||
@@ -805,10 +784,8 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
// Ommers can be empty for some blocks
|
||||
let mut block_ommers_iter = block_ommers.into_iter();
|
||||
let mut block_withdrawals_iter = block_withdrawals.into_iter();
|
||||
let mut block_requests_iter = block_requests.into_iter();
|
||||
let mut block_ommers = block_ommers_iter.next();
|
||||
let mut block_withdrawals = block_withdrawals_iter.next();
|
||||
let mut block_requests = block_requests_iter.next();
|
||||
|
||||
for ((main_block_number, header), (_, header_hash), (_, tx)) in
|
||||
izip!(block_header_iter, block_header_hashes_iter, block_tx_iter)
|
||||
@@ -841,24 +818,10 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
withdrawals = None
|
||||
}
|
||||
|
||||
// requests can be missing
|
||||
let prague_is_active = self.chain_spec.is_prague_active_at_timestamp(header.timestamp);
|
||||
let mut requests = Some(Requests::default());
|
||||
if prague_is_active {
|
||||
if let Some((block_number, _)) = block_requests.as_ref() {
|
||||
if *block_number == main_block_number {
|
||||
requests = Some(block_requests.take().unwrap().1);
|
||||
block_requests = block_requests_iter.next();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
requests = None;
|
||||
}
|
||||
|
||||
blocks.push(SealedBlockWithSenders {
|
||||
block: SealedBlock {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
body: BlockBody { transactions, ommers, withdrawals },
|
||||
},
|
||||
senders,
|
||||
})
|
||||
@@ -1222,7 +1185,6 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
/// * [`CanonicalHeaders`](tables::CanonicalHeaders)
|
||||
/// * [`BlockOmmers`](tables::BlockOmmers)
|
||||
/// * [`BlockWithdrawals`](tables::BlockWithdrawals)
|
||||
/// * [`BlockRequests`](tables::BlockRequests)
|
||||
/// * [`HeaderTerminalDifficulties`](tables::HeaderTerminalDifficulties)
|
||||
///
|
||||
/// This will also remove transaction data according to
|
||||
@@ -1242,7 +1204,6 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
self.remove::<tables::CanonicalHeaders>(range.clone())?;
|
||||
self.remove::<tables::BlockOmmers>(range.clone())?;
|
||||
self.remove::<tables::BlockWithdrawals>(range.clone())?;
|
||||
self.remove::<tables::BlockRequests>(range.clone())?;
|
||||
self.remove_block_transaction_range(range.clone())?;
|
||||
self.remove::<tables::HeaderTerminalDifficulties>(range)?;
|
||||
|
||||
@@ -1256,7 +1217,6 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
/// * [`CanonicalHeaders`](tables::CanonicalHeaders)
|
||||
/// * [`BlockOmmers`](tables::BlockOmmers)
|
||||
/// * [`BlockWithdrawals`](tables::BlockWithdrawals)
|
||||
/// * [`BlockRequests`](tables::BlockRequests)
|
||||
/// * [`HeaderTerminalDifficulties`](tables::HeaderTerminalDifficulties)
|
||||
///
|
||||
/// This will also remove transaction data according to
|
||||
@@ -1274,7 +1234,6 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
// - Bodies (transactions)
|
||||
// - Uncles/ommers
|
||||
// - Withdrawals
|
||||
// - Requests
|
||||
// - Signers
|
||||
|
||||
let block_headers = self.take::<tables::Headers>(range.clone())?;
|
||||
@@ -1288,7 +1247,6 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
let block_header_hashes = self.take::<tables::CanonicalHeaders>(range.clone())?;
|
||||
let block_ommers = self.take::<tables::BlockOmmers>(range.clone())?;
|
||||
let block_withdrawals = self.take::<tables::BlockWithdrawals>(range.clone())?;
|
||||
let block_requests = self.take::<tables::BlockRequests>(range.clone())?;
|
||||
let block_tx = self.take_block_transaction_range(range.clone())?;
|
||||
|
||||
let mut blocks = Vec::with_capacity(block_headers.len());
|
||||
@@ -1304,10 +1262,8 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
// Ommers can be empty for some blocks
|
||||
let mut block_ommers_iter = block_ommers.into_iter();
|
||||
let mut block_withdrawals_iter = block_withdrawals.into_iter();
|
||||
let mut block_requests_iter = block_requests.into_iter();
|
||||
let mut block_ommers = block_ommers_iter.next();
|
||||
let mut block_withdrawals = block_withdrawals_iter.next();
|
||||
let mut block_requests = block_requests_iter.next();
|
||||
|
||||
for ((main_block_number, header), (_, header_hash), (_, tx)) in
|
||||
izip!(block_header_iter, block_header_hashes_iter, block_tx_iter)
|
||||
@@ -1340,24 +1296,10 @@ impl<TX: DbTxMut + DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
withdrawals = None
|
||||
}
|
||||
|
||||
// requests can be missing
|
||||
let prague_is_active = self.chain_spec.is_prague_active_at_timestamp(header.timestamp);
|
||||
let mut requests = Some(Requests::default());
|
||||
if prague_is_active {
|
||||
if let Some((block_number, _)) = block_requests.as_ref() {
|
||||
if *block_number == main_block_number {
|
||||
requests = Some(block_requests.take().unwrap().1);
|
||||
block_requests = block_requests_iter.next();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
requests = None;
|
||||
}
|
||||
|
||||
blocks.push(SealedBlockWithSenders {
|
||||
block: SealedBlock {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
body: BlockBody { transactions, ommers, withdrawals },
|
||||
},
|
||||
senders,
|
||||
})
|
||||
@@ -1726,7 +1668,6 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
if let Some(header) = self.header_by_number(number)? {
|
||||
let withdrawals = self.withdrawals_by_block(number.into(), header.timestamp)?;
|
||||
let ommers = self.ommers(number.into())?.unwrap_or_default();
|
||||
let requests = self.requests_by_block(number.into(), header.timestamp)?;
|
||||
// If the body indices are not found, this means that the transactions either do not
|
||||
// exist in the database yet, or they do exit but are not indexed.
|
||||
// If they exist but are not indexed, we don't have enough
|
||||
@@ -1738,7 +1679,7 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
|
||||
return Ok(Some(Block {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
body: BlockBody { transactions, ommers, withdrawals },
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -1798,8 +1739,8 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
id,
|
||||
transaction_kind,
|
||||
|block_number| self.header_by_number(block_number),
|
||||
|header, transactions, senders, ommers, withdrawals, requests| {
|
||||
Block { header, body: BlockBody { transactions, ommers, withdrawals, requests } }
|
||||
|header, transactions, senders, ommers, withdrawals| {
|
||||
Block { header, body: BlockBody { transactions, ommers, withdrawals } }
|
||||
// Note: we're using unchecked here because we know the block contains valid txs
|
||||
// wrt to its height and can ignore the s value check so pre
|
||||
// EIP-2 txs are allowed
|
||||
@@ -1819,17 +1760,14 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
id,
|
||||
transaction_kind,
|
||||
|block_number| self.sealed_header(block_number),
|
||||
|header, transactions, senders, ommers, withdrawals, requests| {
|
||||
SealedBlock {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
}
|
||||
// Note: we're using unchecked here because we know the block contains valid txs
|
||||
// wrt to its height and can ignore the s value check so pre
|
||||
// EIP-2 txs are allowed
|
||||
.try_with_senders_unchecked(senders)
|
||||
.map(Some)
|
||||
.map_err(|_| ProviderError::SenderRecoveryError)
|
||||
|header, transactions, senders, ommers, withdrawals| {
|
||||
SealedBlock { header, body: BlockBody { transactions, ommers, withdrawals } }
|
||||
// Note: we're using unchecked here because we know the block contains valid txs
|
||||
// wrt to its height and can ignore the s value check so pre
|
||||
// EIP-2 txs are allowed
|
||||
.try_with_senders_unchecked(senders)
|
||||
.map(Some)
|
||||
.map_err(|_| ProviderError::SenderRecoveryError)
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -1839,7 +1777,7 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
self.block_range(
|
||||
range,
|
||||
|range| self.headers_range(range),
|
||||
|header, tx_range, ommers, withdrawals, requests| {
|
||||
|header, tx_range, ommers, withdrawals| {
|
||||
let transactions = if tx_range.is_empty() {
|
||||
Vec::new()
|
||||
} else {
|
||||
@@ -1848,10 +1786,7 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
.map(Into::into)
|
||||
.collect()
|
||||
};
|
||||
Ok(Block {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
})
|
||||
Ok(Block { header, body: BlockBody { transactions, ommers, withdrawals } })
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -1863,8 +1798,8 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
self.block_with_senders_range(
|
||||
range,
|
||||
|range| self.headers_range(range),
|
||||
|header, transactions, ommers, withdrawals, requests, senders| {
|
||||
Block { header, body: BlockBody { transactions, ommers, withdrawals, requests } }
|
||||
|header, transactions, ommers, withdrawals, senders| {
|
||||
Block { header, body: BlockBody { transactions, ommers, withdrawals } }
|
||||
.try_with_senders_unchecked(senders)
|
||||
.map_err(|_| ProviderError::SenderRecoveryError)
|
||||
},
|
||||
@@ -1878,12 +1813,9 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> BlockReader for DatabasePr
|
||||
self.block_with_senders_range(
|
||||
range,
|
||||
|range| self.sealed_headers_range(range),
|
||||
|header, transactions, ommers, withdrawals, requests, senders| {
|
||||
|header, transactions, ommers, withdrawals, senders| {
|
||||
SealedBlockWithSenders::new(
|
||||
SealedBlock {
|
||||
header,
|
||||
body: BlockBody { transactions, ommers, withdrawals, requests },
|
||||
},
|
||||
SealedBlock { header, body: BlockBody { transactions, ommers, withdrawals } },
|
||||
senders,
|
||||
)
|
||||
.ok_or(ProviderError::SenderRecoveryError)
|
||||
@@ -2200,24 +2132,6 @@ impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> WithdrawalsProvider
|
||||
}
|
||||
}
|
||||
|
||||
impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> RequestsProvider
|
||||
for DatabaseProvider<TX, Spec>
|
||||
{
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
id: BlockHashOrNumber,
|
||||
timestamp: u64,
|
||||
) -> ProviderResult<Option<Requests>> {
|
||||
if self.chain_spec.is_prague_active_at_timestamp(timestamp) {
|
||||
if let Some(number) = self.convert_hash_or_number(id)? {
|
||||
let requests = self.tx.get::<tables::BlockRequests>(number)?;
|
||||
return Ok(requests)
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
impl<TX: DbTx, Spec: Send + Sync + EthereumHardforks> EvmEnvProvider
|
||||
for DatabaseProvider<TX, Spec>
|
||||
{
|
||||
@@ -3413,7 +3327,6 @@ impl<TX: DbTxMut + DbTx + 'static, Spec: Send + Sync + EthereumHardforks + 'stat
|
||||
/// If ommers are not empty, this will modify [`BlockOmmers`](tables::BlockOmmers).
|
||||
/// If withdrawals are not empty, this will modify
|
||||
/// [`BlockWithdrawals`](tables::BlockWithdrawals).
|
||||
/// If requests are not empty, this will modify [`BlockRequests`](tables::BlockRequests).
|
||||
///
|
||||
/// If the provider has __not__ configured full sender pruning, this will modify
|
||||
/// [`TransactionSenders`](tables::TransactionSenders).
|
||||
@@ -3539,11 +3452,6 @@ impl<TX: DbTxMut + DbTx + 'static, Spec: Send + Sync + EthereumHardforks + 'stat
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(requests) = block.block.body.requests {
|
||||
self.tx.put::<tables::BlockRequests>(block_number, requests)?;
|
||||
durations_recorder.record_relative(metrics::Action::InsertBlockRequests);
|
||||
}
|
||||
|
||||
let block_indices = StoredBlockBodyIndices { first_tx_num, tx_count };
|
||||
self.tx.put::<tables::BlockBodyIndices>(block_number, block_indices.clone())?;
|
||||
durations_recorder.record_relative(metrics::Action::InsertBlockBodyIndices);
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{
|
||||
BlockSource, BlockchainTreePendingStateProvider, CanonChainTracker, CanonStateNotifications,
|
||||
CanonStateSubscriptions, ChainSpecProvider, ChainStateBlockReader, ChangeSetReader,
|
||||
DatabaseProviderFactory, EvmEnvProvider, FullExecutionDataProvider, HeaderProvider,
|
||||
ProviderError, PruneCheckpointReader, ReceiptProvider, ReceiptProviderIdExt, RequestsProvider,
|
||||
ProviderError, PruneCheckpointReader, ReceiptProvider, ReceiptProviderIdExt,
|
||||
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
|
||||
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
|
||||
};
|
||||
@@ -504,16 +504,6 @@ impl<N: ProviderNodeTypes> WithdrawalsProvider for BlockchainProvider<N> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ProviderNodeTypes> RequestsProvider for BlockchainProvider<N> {
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
id: BlockHashOrNumber,
|
||||
timestamp: u64,
|
||||
) -> ProviderResult<Option<reth_primitives::Requests>> {
|
||||
self.database.requests_by_block(id, timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: ProviderNodeTypes> StageCheckpointReader for BlockchainProvider<N> {
|
||||
fn get_stage_checkpoint(&self, id: StageId) -> ProviderResult<Option<StageCheckpoint>> {
|
||||
self.database.provider()?.get_stage_checkpoint(id)
|
||||
|
||||
@@ -4,8 +4,8 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
to_range, BlockHashReader, BlockNumReader, BlockReader, BlockSource, HeaderProvider,
|
||||
ReceiptProvider, RequestsProvider, StageCheckpointReader, StatsReader, TransactionVariant,
|
||||
TransactionsProvider, TransactionsProviderExt, WithdrawalsProvider,
|
||||
ReceiptProvider, StageCheckpointReader, StatsReader, TransactionVariant, TransactionsProvider,
|
||||
TransactionsProviderExt, WithdrawalsProvider,
|
||||
};
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
|
||||
@@ -1642,17 +1642,6 @@ impl WithdrawalsProvider for StaticFileProvider {
|
||||
}
|
||||
}
|
||||
|
||||
impl RequestsProvider for StaticFileProvider {
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
_id: BlockHashOrNumber,
|
||||
_timestamp: u64,
|
||||
) -> ProviderResult<Option<reth_primitives::Requests>> {
|
||||
// Required data not present in static_files
|
||||
Err(ProviderError::UnsupportedProvider)
|
||||
}
|
||||
}
|
||||
|
||||
impl StatsReader for StaticFileProvider {
|
||||
fn count_entries<T: Table>(&self) -> ProviderResult<usize> {
|
||||
match T::NAME {
|
||||
|
||||
@@ -40,7 +40,6 @@ pub fn assert_genesis_block<DB: Database, Spec: Send + Sync>(
|
||||
);
|
||||
assert_eq!(tx.table::<tables::BlockOmmers>().unwrap(), vec![]);
|
||||
assert_eq!(tx.table::<tables::BlockWithdrawals>().unwrap(), vec![]);
|
||||
assert_eq!(tx.table::<tables::BlockRequests>().unwrap(), vec![]);
|
||||
assert_eq!(tx.table::<tables::Transactions>().unwrap(), vec![]);
|
||||
assert_eq!(tx.table::<tables::TransactionBlocks>().unwrap(), vec![]);
|
||||
assert_eq!(tx.table::<tables::TransactionHashNumbers>().unwrap(), vec![]);
|
||||
|
||||
@@ -2,9 +2,9 @@ use crate::{
|
||||
traits::{BlockSource, ReceiptProvider},
|
||||
AccountReader, BlockExecutionReader, BlockHashReader, BlockIdReader, BlockNumReader,
|
||||
BlockReader, BlockReaderIdExt, ChainSpecProvider, ChangeSetReader, DatabaseProvider,
|
||||
EvmEnvProvider, HeaderProvider, ReceiptProviderIdExt, RequestsProvider, StateProvider,
|
||||
StateProviderBox, StateProviderFactory, StateReader, StateRootProvider, TransactionVariant,
|
||||
TransactionsProvider, WithdrawalsProvider,
|
||||
EvmEnvProvider, HeaderProvider, ReceiptProviderIdExt, StateProvider, StateProviderBox,
|
||||
StateProviderFactory, StateReader, StateRootProvider, TransactionVariant, TransactionsProvider,
|
||||
WithdrawalsProvider,
|
||||
};
|
||||
use alloy_consensus::constants::EMPTY_ROOT_HASH;
|
||||
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
|
||||
@@ -809,16 +809,6 @@ impl WithdrawalsProvider for MockEthProvider {
|
||||
}
|
||||
}
|
||||
|
||||
impl RequestsProvider for MockEthProvider {
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
_id: BlockHashOrNumber,
|
||||
_timestamp: u64,
|
||||
) -> ProviderResult<Option<reth_primitives::Requests>> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
impl ChangeSetReader for MockEthProvider {
|
||||
fn account_block_changeset(
|
||||
&self,
|
||||
|
||||
@@ -37,7 +37,7 @@ use crate::{
|
||||
traits::{BlockSource, ReceiptProvider},
|
||||
AccountReader, BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt,
|
||||
ChainSpecProvider, ChangeSetReader, EvmEnvProvider, HeaderProvider, PruneCheckpointReader,
|
||||
ReceiptProviderIdExt, RequestsProvider, StageCheckpointReader, StateProvider, StateProviderBox,
|
||||
ReceiptProviderIdExt, StageCheckpointReader, StateProvider, StateProviderBox,
|
||||
StateProviderFactory, StateRootProvider, StaticFileProviderFactory, TransactionVariant,
|
||||
TransactionsProvider, WithdrawalsProvider,
|
||||
};
|
||||
@@ -539,16 +539,6 @@ impl WithdrawalsProvider for NoopProvider {
|
||||
}
|
||||
}
|
||||
|
||||
impl RequestsProvider for NoopProvider {
|
||||
fn requests_by_block(
|
||||
&self,
|
||||
_id: BlockHashOrNumber,
|
||||
_timestamp: u64,
|
||||
) -> ProviderResult<Option<reth_primitives::Requests>> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
impl PruneCheckpointReader for NoopProvider {
|
||||
fn get_prune_checkpoint(
|
||||
&self,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, RequestsProvider,
|
||||
TransactionVariant, TransactionsProvider, WithdrawalsProvider,
|
||||
BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt, TransactionVariant,
|
||||
TransactionsProvider, WithdrawalsProvider,
|
||||
};
|
||||
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
|
||||
use alloy_primitives::{BlockNumber, Sealable, B256};
|
||||
@@ -52,7 +52,6 @@ pub trait BlockReader:
|
||||
+ HeaderProvider
|
||||
+ TransactionsProvider
|
||||
+ ReceiptProvider
|
||||
+ RequestsProvider
|
||||
+ WithdrawalsProvider
|
||||
+ Send
|
||||
+ Sync
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user