diff --git a/rust/Cargo.lock b/rust/Cargo.lock index e930e01f071..ce85ded292f 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -353,9 +353,9 @@ dependencies = [ [[package]] name = "alloy-eip7928" -version = "0.4.5" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3b12337f74cbfa451cb04dac173974814a6ff463079e1793aa09600ba8813ab" +checksum = "1cb19c9d53b507960f649e5689f7098e556696023fe1b57b67f2181ed54bc5b7" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -412,7 +412,7 @@ dependencies = [ "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eip8141", "alloy-primitives", "alloy-rlp", @@ -432,9 +432,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b307a52f91f7f3aad56b5cb4f54e5eb17dd0b3f4b2c82823301499fe1c6fdaf" +checksum = "7b6bd5f7e5ce9858bac99275e3f548c3b63bb3e5806da0142dc0b2f518d3ec4a" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -467,9 +467,9 @@ dependencies = [ [[package]] name = "alloy-hardforks" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ba208044232d14d4adbfa77e57d6329f51bc1acc21f5667bb7db72d88a0831" +checksum = "865371fb677c005f7cb0ea9c2847a1ba4fdb042caf6428b1769fee20368bbfc7" dependencies = [ "alloy-chains", "alloy-eip2124", @@ -3756,6 +3756,19 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "corosensei" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6886a0c0f263965933c438626e7179139a62b978a33aa18281cbf0cd5a975f34" +dependencies = [ + "autocfg", + "cfg-if", + "libc", + "scopeguard", + "windows-sys 0.59.0", +] + [[package]] name = "cow-utils" version = "0.1.3" @@ -4473,7 +4486,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -4918,7 +4931,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -5160,7 +5173,7 @@ checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" dependencies = [ "cfg-if", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -5567,8 +5580,8 @@ dependencies = [ "libc", "log", "rustversion", - "windows-link 0.2.1", - "windows-result 0.4.1", + "windows-link 0.1.3", + "windows-result 0.3.4", ] [[package]] @@ -6301,7 +6314,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.62.2", + "windows-core 0.61.2", ] [[package]] @@ -6737,7 +6750,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -9460,7 +9473,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -9843,7 +9856,7 @@ dependencies = [ [[package]] name = "op-reth" -version = "1.11.3" +version = "2.0.0" dependencies = [ "eyre", "op-version", @@ -11352,7 +11365,7 @@ dependencies = [ "once_cell", "socket2 0.6.5", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.52.0", ] [[package]] @@ -11865,8 +11878,8 @@ checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" [[package]] name = "reth-basic-payload-builder" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -11892,8 +11905,8 @@ dependencies = [ [[package]] name = "reth-chain-state" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -11923,8 +11936,8 @@ dependencies = [ [[package]] name = "reth-chainspec" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -11943,8 +11956,8 @@ dependencies = [ [[package]] name = "reth-cli" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-genesis", "clap", @@ -11956,11 +11969,12 @@ dependencies = [ [[package]] name = "reth-cli-commands" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-primitives", "alloy-rlp", @@ -12045,8 +12059,8 @@ dependencies = [ [[package]] name = "reth-cli-runner" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "reth-tasks", "tokio", @@ -12055,8 +12069,8 @@ dependencies = [ [[package]] name = "reth-cli-util" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -12076,9 +12090,9 @@ dependencies = [ [[package]] name = "reth-codecs" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f0dd7f542fbcae0e490ebe13f3eababcc05547375246ff7f62700b533cf3f01" +checksum = "a6bac09d9d84a412ae151149ec870d6eb7770335c5eb63f209453d81deff8d39" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12097,9 +12111,9 @@ dependencies = [ [[package]] name = "reth-codecs-derive" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e508fcbb8cb775639dbbb56b81b62756d4322f28e76c60a52aa32575f993fe" +checksum = "0101b1f474563c4c48c04fc2477199279a53d9c19b65301c6fd2131cf6e4a330" dependencies = [ "proc-macro2", "quote", @@ -12108,8 +12122,8 @@ dependencies = [ [[package]] name = "reth-config" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "eyre", "humantime-serde", @@ -12125,11 +12139,11 @@ dependencies = [ [[package]] name = "reth-consensus" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-primitives", "auto_impl", "reth-execution-types", @@ -12139,8 +12153,8 @@ dependencies = [ [[package]] name = "reth-consensus-common" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12152,8 +12166,8 @@ dependencies = [ [[package]] name = "reth-consensus-debug-client" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12177,8 +12191,8 @@ dependencies = [ [[package]] name = "reth-db" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "derive_more 2.1.1", @@ -12187,12 +12201,12 @@ dependencies = [ "metrics", "page_size", "parking_lot", - "quanta", "reth-db-api", "reth-fs-util", "reth-libmdbx", "reth-metrics", "reth-nippy-jar", + "reth-primitives-traits", "reth-static-file-types", "reth-storage-errors", "reth-tracing", @@ -12206,10 +12220,11 @@ dependencies = [ [[package]] name = "reth-db-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", + "alloy-eips 2.5.0", "alloy-primitives", "arbitrary", "arrayvec", @@ -12232,8 +12247,8 @@ dependencies = [ [[package]] name = "reth-db-common" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-genesis", @@ -12262,8 +12277,8 @@ dependencies = [ [[package]] name = "reth-db-models" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -12277,8 +12292,8 @@ dependencies = [ [[package]] name = "reth-discv4" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -12302,8 +12317,8 @@ dependencies = [ [[package]] name = "reth-discv5" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -12326,8 +12341,8 @@ dependencies = [ [[package]] name = "reth-dns-discovery" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "dashmap", @@ -12350,8 +12365,8 @@ dependencies = [ [[package]] name = "reth-downloaders" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12366,6 +12381,7 @@ dependencies = [ "rayon", "reth-config", "reth-consensus", + "reth-eth-wire-types", "reth-ethereum-primitives", "reth-metrics", "reth-network-p2p", @@ -12375,6 +12391,7 @@ dependencies = [ "reth-storage-api", "reth-tasks", "reth-testing-utils", + "reth-trie-common", "tempfile", "thiserror 2.0.18", "tokio", @@ -12385,8 +12402,8 @@ dependencies = [ [[package]] name = "reth-e2e-test-utils" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12431,6 +12448,8 @@ dependencies = [ "reth-tasks", "reth-tokio-util", "reth-tracing", + "reth-trie", + "reth-trie-db", "revm", "serde_json", "tempfile", @@ -12442,8 +12461,8 @@ dependencies = [ [[package]] name = "reth-ecies" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "aes 0.8.4", "alloy-primitives", @@ -12469,8 +12488,8 @@ dependencies = [ [[package]] name = "reth-engine-local" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12492,8 +12511,8 @@ dependencies = [ [[package]] name = "reth-engine-primitives" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12519,11 +12538,11 @@ dependencies = [ [[package]] name = "reth-engine-tree" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-evm", "alloy-primitives", @@ -12575,8 +12594,8 @@ dependencies = [ [[package]] name = "reth-engine-util" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12605,8 +12624,8 @@ dependencies = [ [[package]] name = "reth-era" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12623,8 +12642,8 @@ dependencies = [ [[package]] name = "reth-era-downloader" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "bytes", @@ -12639,8 +12658,8 @@ dependencies = [ [[package]] name = "reth-era-utils" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12663,8 +12682,8 @@ dependencies = [ [[package]] name = "reth-errors" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "reth-consensus", "reth-execution-errors", @@ -12674,8 +12693,8 @@ dependencies = [ [[package]] name = "reth-eth-wire" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-chains", "alloy-primitives", @@ -12703,12 +12722,12 @@ dependencies = [ [[package]] name = "reth-eth-wire-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-hardforks", "alloy-primitives", @@ -12729,8 +12748,8 @@ dependencies = [ [[package]] name = "reth-ethereum" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-rpc-types-engine", "alloy-rpc-types-eth 2.4.2", @@ -12770,8 +12789,8 @@ dependencies = [ [[package]] name = "reth-ethereum-cli" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "clap", "eyre", @@ -12793,8 +12812,8 @@ dependencies = [ [[package]] name = "reth-ethereum-consensus" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12809,8 +12828,8 @@ dependencies = [ [[package]] name = "reth-ethereum-engine-primitives" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -12825,8 +12844,8 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eip2124", "alloy-hardforks", @@ -12839,8 +12858,8 @@ dependencies = [ [[package]] name = "reth-ethereum-payload-builder" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12869,12 +12888,11 @@ dependencies = [ [[package]] name = "reth-ethereum-primitives" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", - "alloy-primitives", "alloy-rpc-types-eth 2.4.2", "reth-codecs", "reth-primitives-traits", @@ -12883,8 +12901,8 @@ dependencies = [ [[package]] name = "reth-etl" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "rayon", "reth-db-api", @@ -12893,11 +12911,11 @@ dependencies = [ [[package]] name = "reth-evm" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-evm", "alloy-primitives", @@ -12919,8 +12937,8 @@ dependencies = [ [[package]] name = "reth-evm-ethereum" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12939,8 +12957,8 @@ dependencies = [ [[package]] name = "reth-execution-cache" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "fixed-cache", @@ -12957,8 +12975,8 @@ dependencies = [ [[package]] name = "reth-execution-errors" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-evm", "alloy-primitives", @@ -12970,8 +12988,8 @@ dependencies = [ [[package]] name = "reth-execution-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12989,8 +13007,8 @@ dependencies = [ [[package]] name = "reth-exex" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13027,8 +13045,8 @@ dependencies = [ [[package]] name = "reth-exex-test-utils" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "eyre", @@ -13059,8 +13077,8 @@ dependencies = [ [[package]] name = "reth-exex-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -13073,8 +13091,8 @@ dependencies = [ [[package]] name = "reth-fs-util" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "serde", "serde_json", @@ -13083,8 +13101,8 @@ dependencies = [ [[package]] name = "reth-invalid-block-hooks" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -13109,8 +13127,8 @@ dependencies = [ [[package]] name = "reth-ipc" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "bytes", "futures", @@ -13129,8 +13147,8 @@ dependencies = [ [[package]] name = "reth-libmdbx" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "bitflags 2.11.1", "byteorder", @@ -13146,8 +13164,8 @@ dependencies = [ [[package]] name = "reth-mdbx-sys" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "bindgen", "cc", @@ -13155,8 +13173,8 @@ dependencies = [ [[package]] name = "reth-metrics" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "futures", "libc", @@ -13169,8 +13187,8 @@ dependencies = [ [[package]] name = "reth-net-banlist" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "ipnet", @@ -13178,8 +13196,8 @@ dependencies = [ [[package]] name = "reth-net-nat" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "futures-util", "if-addrs 0.14.0", @@ -13192,8 +13210,8 @@ dependencies = [ [[package]] name = "reth-network" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13251,8 +13269,8 @@ dependencies = [ [[package]] name = "reth-network-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -13276,11 +13294,11 @@ dependencies = [ [[package]] name = "reth-network-p2p" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-primitives", "auto_impl", @@ -13300,8 +13318,8 @@ dependencies = [ [[package]] name = "reth-network-peers" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -13315,8 +13333,8 @@ dependencies = [ [[package]] name = "reth-network-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eip2124", "humantime-serde", @@ -13329,8 +13347,8 @@ dependencies = [ [[package]] name = "reth-nippy-jar" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "anyhow", "bincode 1.3.3", @@ -13339,6 +13357,7 @@ dependencies = [ "memmap2", "reth-fs-util", "serde", + "smallvec", "thiserror 2.0.18", "tracing", "zstd", @@ -13346,8 +13365,8 @@ dependencies = [ [[package]] name = "reth-node-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-rpc-types-engine", "eyre", @@ -13370,8 +13389,8 @@ dependencies = [ [[package]] name = "reth-node-builder" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13438,8 +13457,8 @@ dependencies = [ [[package]] name = "reth-node-core" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13493,18 +13512,20 @@ dependencies = [ [[package]] name = "reth-node-ethereum" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", "alloy-network 2.4.2", "alloy-primitives", + "alloy-rlp", "alloy-rpc-types-engine", "alloy-rpc-types-eth 2.4.2", "ethereum_ssz", "ethereum_ssz_derive", "eyre", + "futures", "http-body-util", "jsonrpsee", "reth-chainspec", @@ -13531,8 +13552,10 @@ dependencies = [ "reth-rpc-eth-api", "reth-rpc-eth-types", "reth-rpc-server-types", + "reth-tasks", "reth-tracing", "reth-transaction-pool", + "reth-trie-common", "revm", "serde", "serde_json", @@ -13542,8 +13565,8 @@ dependencies = [ [[package]] name = "reth-node-ethstats" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -13566,8 +13589,8 @@ dependencies = [ [[package]] name = "reth-node-events" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13590,8 +13613,8 @@ dependencies = [ [[package]] name = "reth-node-metrics" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "bytes", "eyre", @@ -13604,6 +13627,7 @@ dependencies = [ "metrics-exporter-prometheus", "metrics-process", "metrics-util", + "parking_lot", "pprof_util", "procfs", "reqwest 0.13.2", @@ -13619,8 +13643,8 @@ dependencies = [ [[package]] name = "reth-node-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "reth-chainspec", "reth-db-api", @@ -13631,7 +13655,7 @@ dependencies = [ [[package]] name = "reth-op" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-primitives", "reth-chainspec", @@ -13672,7 +13696,7 @@ dependencies = [ [[package]] name = "reth-optimism-chainspec" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -13705,7 +13729,7 @@ dependencies = [ [[package]] name = "reth-optimism-cli" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-genesis", @@ -13748,7 +13772,7 @@ dependencies = [ [[package]] name = "reth-optimism-consensus" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -13758,10 +13782,12 @@ dependencies = [ "metrics-exporter-prometheus", "metrics-util", "op-alloy-consensus", + "reth-chain-state", "reth-chainspec", "reth-consensus", "reth-consensus-common", "reth-db-common", + "reth-ethereum-consensus", "reth-execution-types", "reth-metrics", "reth-optimism-chainspec", @@ -13771,8 +13797,10 @@ dependencies = [ "reth-primitives-traits", "reth-provider", "reth-revm", + "reth-stages-types", "reth-storage-api", "reth-storage-errors", + "reth-storage-overlay", "reth-trie", "reth-trie-common", "revm", @@ -13783,7 +13811,7 @@ dependencies = [ [[package]] name = "reth-optimism-evm" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13820,7 +13848,7 @@ dependencies = [ [[package]] name = "reth-optimism-exex" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13829,6 +13857,7 @@ dependencies = [ "futures-util", "reth-db", "reth-ethereum-primitives", + "reth-evm-ethereum", "reth-execution-types", "reth-exex", "reth-exex-test-utils", @@ -13847,7 +13876,7 @@ dependencies = [ [[package]] name = "reth-optimism-flashblocks" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13894,7 +13923,7 @@ dependencies = [ [[package]] name = "reth-optimism-forks" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-op-hardforks", "alloy-primitives", @@ -13904,7 +13933,7 @@ dependencies = [ [[package]] name = "reth-optimism-node" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-genesis", @@ -13930,7 +13959,6 @@ dependencies = [ "op-alloy-network", "op-alloy-rpc-types-engine", "op-revm", - "reth-basic-payload-builder", "reth-chain-state", "reth-chainspec", "reth-consensus", @@ -13944,7 +13972,6 @@ dependencies = [ "reth-node-api", "reth-node-builder", "reth-node-core", - "reth-node-metrics", "reth-optimism-chainspec", "reth-optimism-consensus", "reth-optimism-evm", @@ -13985,7 +14012,7 @@ dependencies = [ [[package]] name = "reth-optimism-payload-builder" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14030,7 +14057,7 @@ dependencies = [ [[package]] name = "reth-optimism-post-exec-replay" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14049,7 +14076,7 @@ dependencies = [ [[package]] name = "reth-optimism-primitives" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14076,7 +14103,7 @@ dependencies = [ [[package]] name = "reth-optimism-rpc" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14111,6 +14138,7 @@ dependencies = [ "reth-basic-payload-builder", "reth-chain-state", "reth-chainspec", + "reth-errors", "reth-evm", "reth-metrics", "reth-node-api", @@ -14151,7 +14179,7 @@ dependencies = [ [[package]] name = "reth-optimism-storage" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "reth-codecs", @@ -14163,7 +14191,7 @@ dependencies = [ [[package]] name = "reth-optimism-trie" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14177,6 +14205,7 @@ dependencies = [ "metrics", "mockall", "parking_lot", + "reth-chain-state", "reth-chainspec", "reth-codecs", "reth-db", @@ -14192,6 +14221,7 @@ dependencies = [ "reth-primitives-traits", "reth-provider", "reth-revm", + "reth-stages-types", "reth-storage-errors", "reth-tasks", "reth-trie", @@ -14210,7 +14240,7 @@ dependencies = [ [[package]] name = "reth-optimism-txpool" -version = "1.11.3" +version = "2.0.0" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14254,8 +14284,8 @@ dependencies = [ [[package]] name = "reth-payload-builder" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14278,8 +14308,8 @@ dependencies = [ [[package]] name = "reth-payload-builder-primitives" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "pin-project", "reth-payload-primitives", @@ -14290,8 +14320,8 @@ dependencies = [ [[package]] name = "reth-payload-primitives" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14313,8 +14343,8 @@ dependencies = [ [[package]] name = "reth-payload-util" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14323,8 +14353,8 @@ dependencies = [ [[package]] name = "reth-payload-validator" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-rpc-types-engine", @@ -14333,11 +14363,12 @@ dependencies = [ [[package]] name = "reth-primitives-traits" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4666a8d5b246650b23e6767a45e46334d352557f473e91c2ea7211cc29291cca" +checksum = "18341fba74d004c7fad32f784488baaea9adebfde7a4f231a4d8d445aea70347" dependencies = [ "alloy-consensus 2.4.2", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-genesis", "alloy-primitives", @@ -14366,11 +14397,11 @@ dependencies = [ [[package]] name = "reth-provider" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-genesis", "alloy-primitives", @@ -14416,8 +14447,8 @@ dependencies = [ [[package]] name = "reth-prune" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14443,8 +14474,8 @@ dependencies = [ [[package]] name = "reth-prune-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "arbitrary", @@ -14459,8 +14490,8 @@ dependencies = [ [[package]] name = "reth-revm" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -14474,12 +14505,12 @@ dependencies = [ [[package]] name = "reth-rpc" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-dyn-abi", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-evm", "alloy-genesis", @@ -14550,8 +14581,8 @@ dependencies = [ [[package]] name = "reth-rpc-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-genesis", @@ -14580,8 +14611,8 @@ dependencies = [ [[package]] name = "reth-rpc-builder" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-network 2.4.2", "alloy-provider", @@ -14623,8 +14654,8 @@ dependencies = [ [[package]] name = "reth-rpc-convert" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-evm", @@ -14643,8 +14674,8 @@ dependencies = [ [[package]] name = "reth-rpc-engine-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -14674,12 +14705,12 @@ dependencies = [ [[package]] name = "reth-rpc-eth-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-dyn-abi", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-evm", "alloy-json-rpc 2.5.0", @@ -14721,12 +14752,12 @@ dependencies = [ [[package]] name = "reth-rpc-eth-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-evm", "alloy-network 2.4.2", @@ -14758,7 +14789,6 @@ dependencies = [ "reth-storage-api", "reth-tasks", "reth-transaction-pool", - "reth-trie", "revm", "revm-inspectors", "schnellru", @@ -14772,13 +14802,15 @@ dependencies = [ [[package]] name = "reth-rpc-layer" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-rpc-types-engine", "http 1.4.0", + "http-body-util", "jsonrpsee-http-client", "pin-project", + "tokio", "tower 0.5.3", "tower-http", "tracing", @@ -14786,10 +14818,9 @@ dependencies = [ [[package]] name = "reth-rpc-server-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ - "alloy-eips 2.5.0", "alloy-primitives", "alloy-rpc-types-engine", "jsonrpsee-core", @@ -14802,9 +14833,9 @@ dependencies = [ [[package]] name = "reth-rpc-traits" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b417a50d3fa9b58bb1a22e46fb47e0866006f24abffa1fbe75ae60116b5b2efa" +checksum = "f410d6bff1fd059ebaec2edeff1326f103f61162158411325d78158f94b2b4a9" dependencies = [ "alloy-consensus 2.4.2", "alloy-network 2.4.2", @@ -14817,10 +14848,11 @@ dependencies = [ [[package]] name = "reth-stages" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", + "alloy-eip7928 0.4.10", "alloy-primitives", "alloy-rlp", "eyre", @@ -14868,8 +14900,8 @@ dependencies = [ [[package]] name = "reth-stages-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -14896,8 +14928,8 @@ dependencies = [ [[package]] name = "reth-stages-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "arbitrary", @@ -14910,8 +14942,8 @@ dependencies = [ [[package]] name = "reth-static-file" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "parking_lot", @@ -14930,8 +14962,8 @@ dependencies = [ [[package]] name = "reth-static-file-types" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "clap", @@ -14945,11 +14977,11 @@ dependencies = [ [[package]] name = "reth-storage-api" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "alloy-eips 2.5.0", "alloy-primitives", "alloy-rpc-types-engine", @@ -14971,8 +15003,8 @@ dependencies = [ [[package]] name = "reth-storage-errors" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -14988,8 +15020,8 @@ dependencies = [ [[package]] name = "reth-storage-overlay" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -15010,13 +15042,14 @@ dependencies = [ "reth-trie", "reth-trie-common", "reth-trie-db", + "revm", "tracing", ] [[package]] name = "reth-tasks" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "crossbeam-utils", "dashmap", @@ -15036,8 +15069,8 @@ dependencies = [ [[package]] name = "reth-testing-utils" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -15052,8 +15085,8 @@ dependencies = [ [[package]] name = "reth-tokio-util" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "tokio", "tokio-stream", @@ -15062,8 +15095,8 @@ dependencies = [ [[package]] name = "reth-tracing" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "clap", "eyre", @@ -15082,8 +15115,8 @@ dependencies = [ [[package]] name = "reth-tracing-otlp" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "base64 0.22.1", "clap", @@ -15101,8 +15134,8 @@ dependencies = [ [[package]] name = "reth-transaction-pool" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -15146,8 +15179,8 @@ dependencies = [ [[package]] name = "reth-trie" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -15172,8 +15205,8 @@ dependencies = [ [[package]] name = "reth-trie-common" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -15195,12 +15228,13 @@ dependencies = [ "revm", "serde", "serde_with", + "thiserror 2.0.18", ] [[package]] name = "reth-trie-db" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "reth-db-api", @@ -15215,8 +15249,8 @@ dependencies = [ [[package]] name = "reth-trie-parallel" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-evm", "alloy-primitives", @@ -15231,7 +15265,6 @@ dependencies = [ "reth-storage-errors", "reth-tasks", "reth-trie", - "reth-trie-sparse", "revm", "thiserror 2.0.18", "tracing", @@ -15239,8 +15272,8 @@ dependencies = [ [[package]] name = "reth-trie-sparse" -version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +version = "2.6.0" +source = "git+https://github.com/ethereum-optimism/reth?rev=8d359d0142719d4042eaf09fcbb7e4a1f89c37ac#8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" dependencies = [ "alloy-primitives", "alloy-trie", @@ -15251,8 +15284,6 @@ dependencies = [ "reth-metrics", "reth-primitives-traits", "reth-trie-common", - "serde", - "serde_json", "slotmap", "smallvec", "strum", @@ -15261,18 +15292,18 @@ dependencies = [ [[package]] name = "reth-zstd-compressors" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80addacffc5df9398c55919f8993922d2b688f2aa5753708fdd658ca3cc63e39" +checksum = "dbdee2f0ad09dc32b43ab52641f8239766a66de4345834bad27d5cfa2f62864d" dependencies = [ "zstd", ] [[package]] name = "revm" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c7fcd426beab3b91300a6d0d5eb8d583c0fad0fba451126e19fd51443eca62" +checksum = "55f2322f5ea197fac72c2cdc88cb501b2a7db0b0009911133fd3dda45bfceedd" dependencies = [ "revm-bytecode", "revm-context", @@ -15289,9 +15320,9 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537356bdec80dbc04e4e6bb688b3441ff7cf18eecdcf3cac23150633c46467f1" +checksum = "c8d38e16b72ec1c836ec8490562bfb21003165ea8bc496086bf345680a6e6c41" dependencies = [ "bitvec", "phf 0.14.0", @@ -15301,9 +15332,9 @@ dependencies = [ [[package]] name = "revm-context" -version = "42.0.0" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6512f05f83378e29b2b016fa5bd7f5a533e3625548be4113732e1a536c2564" +checksum = "c16835bc2ead203219a18fcc84c2c71879ad6b890e8a71150cf7f10e4e355dc4" dependencies = [ "bitvec", "cfg-if", @@ -15318,9 +15349,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "42.0.0" +version = "43.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "103fff818b10311034c0c11ff8760294ee0e3c320daab3c5717990fe8ee2617b" +checksum = "e3b4109bdceaca5ee6e27bf41f6b156f2b15892dc5bb47d3530bc4d3b3060077" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -15334,9 +15365,9 @@ dependencies = [ [[package]] name = "revm-database" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df72760eab0852100e748c7cb03ce0221626d60ac14534118c84c5cc894fb4c9" +checksum = "31d764afa9a1c9278c05d40461b07319d21ccb39c1bdf0e9dde7e5ea7d9be53d" dependencies = [ "alloy-eips 2.5.0", "derive_more 2.1.1", @@ -15350,16 +15381,18 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9286c059a11be1dee814cafdc3a3ade57521c8caa050785a52c19a9d894f400" +checksum = "d2a27e4440c2ef4932afdaa28a1d1ac8601504c7030c1a387b5e307d07d864d1" dependencies = [ "auto_impl", + "corosensei", "either", "revm-primitives", "revm-state", "serde", "thiserror 2.0.18", + "tokio", ] [[package]] @@ -15374,9 +15407,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09126175c3fa482e71e80cc28c6bb17e681911e472b94d4f7f73dd6780411798" +checksum = "73a7409031d87ec281b74efff65d7a4dbea9d80727a55dbc7e4b3fd77b5e03fb" dependencies = [ "auto_impl", "derive-where", @@ -15393,9 +15426,9 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa55b208b52f0c083ea68147c78866eeecadd7c0071a614f477de316b60648e" +checksum = "7a56f37224afd628f7244aa6965609ada04b440ed8ab7a19f55e4291df5a0112" dependencies = [ "auto_impl", "either", @@ -15411,9 +15444,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.42.2" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90c136a072540987ee442e9824631835520b13e5756f20780a637ba2e11f9c28" +checksum = "79b609cb78fcb3a8c10f3190847c9bb0223423cf46e2de30a61ea9e37a3e6736" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth 2.4.2", @@ -15431,9 +15464,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "42.0.0" +version = "43.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd310927437752ce4bac6997b385772823b84843f04c82e151993bec1265a5ed" +checksum = "932f7fe05a2cdeb08195dd7e88a09a4da7c3660cdc6e62720839c77ba77f65aa" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -15444,9 +15477,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2431091420999795df6a200b9f7933defe3d654710560a895e6bcabbd9954a5" +checksum = "ac4dc0279f2a44770faa8c93d008df684440cf573c91b8e0e39d0d581abf7b3d" dependencies = [ "ark-bls12-381 0.6.0", "ark-bn254", @@ -15472,9 +15505,9 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef5564c1bce219fd08beca43d4f39fdcbc19193fa4f604c0c6b58950a13194a" +checksum = "f1f4ba1a5757fe4398262290422c371556fcebf236f762f7ed7ff2c56768a63c" dependencies = [ "alloy-primitives", "once_cell", @@ -15483,11 +15516,11 @@ dependencies = [ [[package]] name = "revm-state" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4ae66db3abfcb565854dbfc95513bfa440b3dc390ddf8e50b0363d12a6fa79" +checksum = "7cd02082cf1baca01e8bc17456c45136bdc66632395a98db1c1a2afe4c6ea87f" dependencies = [ - "alloy-eip7928 0.4.5", + "alloy-eip7928 0.4.10", "bitflags 2.11.1", "nonmax", "revm-bytecode", @@ -15818,7 +15851,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -15886,7 +15919,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -15907,7 +15940,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs 1.0.7", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -18085,7 +18118,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -18899,7 +18932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf" dependencies = [ "cc", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 2f049524491..c6a21dae98d 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -349,104 +349,104 @@ alloy-op-evm = { version = "0.32.0", path = "alloy-op-evm/", default-features = alloy-op-hardforks = { version = "0.5.0", path = "alloy-op-hardforks/", default-features = false } # ==================== RETH CRATES (crates.io) ==================== -reth-codecs = { version = "0.6.0", default-features = false, features = [ +reth-codecs = { version = "0.7.0", default-features = false, features = [ "alloy", ] } -reth-codecs-derive = "0.6.0" -reth-primitives-traits = { version = "0.6.0", default-features = false } -reth-rpc-traits = { version = "0.6.0", default-features = false } -reth-zstd-compressors = { version = "0.6.0", default-features = false } +reth-codecs-derive = "0.7.0" +reth-primitives-traits = { version = "0.7.1", default-features = false } +reth-rpc-traits = { version = "0.7.0", default-features = false } +reth-zstd-compressors = { version = "0.7.0", default-features = false } # ==================== RETH CRATES (git) ==================== -reth = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-basic-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-chain-state = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-chainspec = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-cli-commands = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-cli-runner = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-cli-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-consensus-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-db = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-db-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-db-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-downloaders = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-e2e-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-engine-local = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-engine-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-eth-wire = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-eth-wire-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum-forks = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-ethereum-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-evm = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-evm-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-exex = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-exex-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-execution-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-execution-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-fs-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-network = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-network-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-network-peers = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-node-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-core = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-events = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-builder-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-validator = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-provider = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-prune = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-prune-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-revm = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-rpc = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-engine-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-eth-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-eth-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-rpc-server-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-stages = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-stages-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-static-file = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-static-file-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-storage-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-storage-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-storage-overlay = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-tasks = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-tracing = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-transaction-pool = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-trie = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-trie-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-trie-db = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } +reth = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-basic-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-chain-state = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-chainspec = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-cli-commands = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-cli-runner = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-cli-util = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-consensus-common = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-db = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-db-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-db-common = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-downloaders = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-e2e-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-engine-local = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-engine-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-eth-wire = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-eth-wire-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-ethereum-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-ethereum-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-ethereum-forks = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-ethereum-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-evm = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-evm-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-exex = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-exex-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-execution-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-execution-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-fs-util = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-network = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-network-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-network-peers = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-node-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-node-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-node-core = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-node-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-node-events = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-node-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-payload-builder-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-payload-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-payload-util = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-payload-validator = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-provider = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-prune = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-prune-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-revm = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-rpc = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-rpc-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-rpc-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-rpc-engine-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-rpc-eth-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-rpc-eth-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-rpc-server-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-stages = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-stages-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-static-file = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-static-file-types = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-storage-api = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-storage-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-storage-overlay = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-tasks = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-tracing = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-transaction-pool = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-trie = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } +reth-trie-common = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac", default-features = false } +reth-trie-db = { git = "https://github.com/ethereum-optimism/reth", rev = "8d359d0142719d4042eaf09fcbb7e4a1f89c37ac" } # ==================== REVM (latest: op-reth versions) ==================== -revm = { version = "42.0.1", default-features = false } -revm-bytecode = { version = "42.0.0", default-features = false } -revm-database = { version = "42.0.0", default-features = false } -revm-state = { version = "42.0.0", default-features = false } -revm-primitives = { version = "42.0.0", default-features = false } -revm-interpreter = { version = "42.0.0", default-features = false } -revm-database-interface = { version = "42.0.0", default-features = false } +revm = { version = "43.0.2", default-features = false } +revm-bytecode = { version = "43.0.0", default-features = false } +revm-database = { version = "43.0.0", default-features = false } +revm-state = { version = "43.0.0", default-features = false } +revm-primitives = { version = "43.0.0", default-features = false } +revm-interpreter = { version = "43.0.1", default-features = false } +revm-database-interface = { version = "43.0.0", default-features = false } op-revm = { version = "20.0.0", path = "op-revm/", default-features = false } -revm-inspectors = "0.42.0" +revm-inspectors = "0.43.0" # ==================== ALLOY ==================== alloy-chains = { version = "0.2.33", default-features = false } alloy-dyn-abi = "1.6.1" alloy-eip2124 = { version = "0.2.0", default-features = false } -alloy-eip7928 = { version = "0.4.5", default-features = false } -alloy-evm = { version = "0.38.0", default-features = false } +alloy-eip7928 = { version = "0.4.10", default-features = false } +alloy-evm = { version = "0.39.0", default-features = false } alloy-primitives = { version = "1.6.1", default-features = false, features = [ "map-foldhash", ] } @@ -457,45 +457,45 @@ alloy-sol-macro = "1.6.1" alloy-sol-types = { version = "1.6.1", default-features = false } alloy-trie = { version = "0.9.4", default-features = false } -alloy-hardforks = { version = "0.4.7", default-features = false } - -alloy-consensus = { version = "2.3.0", default-features = false } -alloy-contract = { version = "2.3.0", default-features = false } -alloy-eips = { version = "2.3.0", default-features = false } -alloy-genesis = { version = "2.3.0", default-features = false } -alloy-json-rpc = { version = "2.3.0", default-features = false } -alloy-network = { version = "2.3.0", default-features = false } -alloy-network-primitives = { version = "2.3.0", default-features = false } -alloy-node-bindings = { version = "2.3.0", default-features = false } -alloy-provider = { version = "2.3.0", features = [ +alloy-hardforks = { version = "0.4.8", default-features = false } + +alloy-consensus = { version = "2.4.2", default-features = false } +alloy-contract = { version = "2.4.2", default-features = false } +alloy-eips = { version = "2.4.2", default-features = false } +alloy-genesis = { version = "2.4.2", default-features = false } +alloy-json-rpc = { version = "2.4.2", default-features = false } +alloy-network = { version = "2.4.2", default-features = false } +alloy-network-primitives = { version = "2.4.2", default-features = false } +alloy-node-bindings = { version = "2.4.2", default-features = false } +alloy-provider = { version = "2.4.2", features = [ "reqwest", "debug-api", ], default-features = false } -alloy-pubsub = { version = "2.3.0", default-features = false } -alloy-rpc-client = { version = "2.3.0", default-features = false } -alloy-rpc-types = { version = "2.3.0", features = [ +alloy-pubsub = { version = "2.4.2", default-features = false } +alloy-rpc-client = { version = "2.4.2", default-features = false } +alloy-rpc-types = { version = "2.4.2", features = [ "eth", ], default-features = false } -alloy-rpc-types-admin = { version = "2.3.0", default-features = false } -alloy-rpc-types-anvil = { version = "2.3.0", default-features = false } -alloy-rpc-types-beacon = { version = "2.3.0", default-features = false } -alloy-rpc-types-debug = { version = "2.3.0", default-features = false } -alloy-rpc-types-engine = { version = "2.3.0", default-features = false } -alloy-rpc-types-eth = { version = "2.3.0", default-features = false } -alloy-rpc-types-mev = { version = "2.3.0", default-features = false } -alloy-rpc-types-trace = { version = "2.3.0", default-features = false } -alloy-rpc-types-txpool = { version = "2.3.0", default-features = false } -alloy-serde = { version = "2.3.0", default-features = false } -alloy-signer = { version = "2.3.0", default-features = false } +alloy-rpc-types-admin = { version = "2.4.2", default-features = false } +alloy-rpc-types-anvil = { version = "2.4.2", default-features = false } +alloy-rpc-types-beacon = { version = "2.4.2", default-features = false } +alloy-rpc-types-debug = { version = "2.4.2", default-features = false } +alloy-rpc-types-engine = { version = "2.4.2", default-features = false } +alloy-rpc-types-eth = { version = "2.4.2", default-features = false } +alloy-rpc-types-mev = { version = "2.4.2", default-features = false } +alloy-rpc-types-trace = { version = "2.4.2", default-features = false } +alloy-rpc-types-txpool = { version = "2.4.2", default-features = false } +alloy-serde = { version = "2.4.2", default-features = false } +alloy-signer = { version = "2.4.2", default-features = false } # sp1-sdk's dynamic_signer builder method uses alloy-signer 1.x, distinct from the workspace's 2.x. sp1-alloy-signer = { package = "alloy-signer", version = "1.0", default-features = false } -alloy-signer-local = { version = "2.3.0", default-features = false } -alloy-transport = { version = "2.3.0" } -alloy-transport-http = { version = "2.3.0", features = [ +alloy-signer-local = { version = "2.4.2", default-features = false } +alloy-transport = { version = "2.4.2" } +alloy-transport-http = { version = "2.4.2", features = [ "reqwest-rustls-tls", ], default-features = false } -alloy-transport-ipc = { version = "2.3.0", default-features = false } -alloy-transport-ws = { version = "2.3.0", default-features = false } +alloy-transport-ipc = { version = "2.4.2", default-features = false } +alloy-transport-ws = { version = "2.4.2", default-features = false } # ==================== OP-ALLOY (from crates.io) ==================== op-alloy = { version = "2.0.0", path = "op-alloy/crates/op-alloy", default-features = false } diff --git a/rust/alloy-op-evm/Cargo.toml b/rust/alloy-op-evm/Cargo.toml index 5da8f70aac5..dbbd00de0c0 100644 --- a/rust/alloy-op-evm/Cargo.toml +++ b/rust/alloy-op-evm/Cargo.toml @@ -50,6 +50,9 @@ std = [ "thiserror/std", ] gmp = ["alloy-evm/gmp"] +# Compile against revm's feature-gated async database fields; mainly a CI feature-unification check. +# Host targets only: revm's fiber stack does not build for wasm or MIPS. +asyncdb = ["std", "op-revm/asyncdb"] metrics = ["std", "dep:metrics"] engine = ["op-alloy/rpc-types-engine"] rpc = ["alloy-evm/rpc", "op-alloy/rpc-types"] diff --git a/rust/alloy-op-evm/src/block/mod.rs b/rust/alloy-op-evm/src/block/mod.rs index 0d838eb7de3..9468a1b1436 100644 --- a/rust/alloy-op-evm/src/block/mod.rs +++ b/rust/alloy-op-evm/src/block/mod.rs @@ -847,14 +847,15 @@ fn validate_block_gas( Ok(()) } -/// UPSTREAM-MIRROR(copy): alloy-evm@0.38.0 `alloy_evm::eth::block::EthBlockExecutor` +/// UPSTREAM-MIRROR(copy): alloy-evm@0.39.0 `alloy_evm::eth::block::EthBlockExecutor` /// /// Mirrors upstream's `BlockExecutor` impl, reusing its `EthTxResult` for the inner result /// but reimplementing every method. Known divergences to re-confirm on each bump: upstream /// tracks regular and state block gas separately and returns `GasOutput::with_state_gas`, /// this tracks `gas_used`/`evm_gas_used` and returns `GasOutput::new`; upstream's admission /// check clamps the transaction gas limit by `cfg.tx_gas_limit_cap`, `validate_block_gas` -/// does not. +/// does not. Upstream's Amsterdam state-gas capacity check is inapplicable until an OP fork maps +/// to Amsterdam semantics. impl BlockExecutor for OpBlockExecutor where E: PostExecEvm< diff --git a/rust/alloy-op-evm/src/env.rs b/rust/alloy-op-evm/src/env.rs index ed474383d5c..2c693b92362 100644 --- a/rust/alloy-op-evm/src/env.rs +++ b/rust/alloy-op-evm/src/env.rs @@ -51,7 +51,7 @@ pub fn spec_by_timestamp_after_bedrock(chain_spec: impl OpHardforks, timestamp: OpSpecId::BEDROCK } -/// UPSTREAM-MIRROR(copy): alloy-evm@0.38.0 `alloy_evm::eth::env::EvmEnvInput` +/// UPSTREAM-MIRROR(copy): alloy-evm@0.39.0 `alloy_evm::eth::env::EvmEnvInput` /// /// Omits upstream `excess_blob_gas` and `slot_number`; OP uses synthetic blob values and zero slot. /// Internal helper for constructing EVM environment from block header fields. @@ -120,7 +120,7 @@ pub fn evm_env_for_op_next_block( ) } -/// UPSTREAM-MIRROR(copy): alloy-evm@0.38.0 `alloy_evm::eth::env::EvmEnv::for_eth` +/// UPSTREAM-MIRROR(copy): alloy-evm@0.39.0 `alloy_evm::eth::env::EvmEnv::for_eth` /// /// Copies upstream environment construction with OP fork mapping and blob semantics. Upstream /// sets `cfg_env.tx_gas_limit_cap` explicitly at Osaka; this leaves it unset and relies on revm's diff --git a/rust/alloy-op-evm/src/lib.rs b/rust/alloy-op-evm/src/lib.rs index 62c3d6f82ad..fae0b6933ed 100644 --- a/rust/alloy-op-evm/src/lib.rs +++ b/rust/alloy-op-evm/src/lib.rs @@ -85,27 +85,35 @@ pub struct OpEvm, } +/// UPSTREAM-MIRROR(copy): revm-context@43.0.2 `revm_context::Evm::with_inspector` +/// +/// Rebuilds `evm` with its inspector replaced by `f(inspector)`. Upstream `with_inspector` takes +/// the new inspector by value, so it cannot derive it from the old one. +/// +/// revm's [`Evm`](revm::context::Evm) has feature-gated fields, so it must not be constructed or +/// destructured exhaustively here: Cargo feature unification can enable those fields without this +/// crate knowing. Construct through the upstream constructor instead, carrying over the frame +/// stack; every field not named below is reset to its default. In revm 43 the only such field is +/// `async_stack` (under `revm/asyncdb`), a lazily allocated fiber stack, so resetting it only drops +/// a cached allocation. On a revm bump, compare `Evm`'s fields against the ones carried over here. +fn map_inspector( + evm: revm::context::Evm, + f: impl FnOnce(INSP) -> OINSP, +) -> revm::context::Evm { + let revm::context::Evm { ctx, inspector, instruction, precompiles, frame_stack, .. } = evm; + let mut evm = + revm::context::Evm::new_with_inspector(ctx, f(inspector), instruction, precompiles); + evm.frame_stack = frame_stack; + evm +} + impl OpEvm { /// Consumes self and return the inner EVM instance. pub fn into_inner( self, ) -> op_revm::OpEvm, I, EthInstructions>, P> { - let op_revm::OpEvm(revm::context::Evm { - ctx, - inspector, - instruction, - precompiles, - frame_stack, - }) = self.inner; - - op_revm::OpEvm(revm::context::Evm { - ctx, - inspector: inspector.into_inner(), - instruction, - precompiles, - frame_stack, - }) + op_revm::OpEvm(map_inspector(self.inner.0, |inspector| inspector.into_inner())) } /// Provides a reference to the EVM context. @@ -134,25 +142,18 @@ impl OpEvm { inspect: bool, refund_policy: R, ) -> Self { - let op_revm::OpEvm(revm::context::Evm { - ctx, - inspector, - instruction, - precompiles, - frame_stack, - }) = evm; + Self::from_inner( + op_revm::OpEvm(map_inspector(evm.0, |inspector| { + post_exec::PostExecCompositeInspector::new_with_post_exec(inspector, refund_policy) + })), + inspect, + ) + } + /// Wraps an inner EVM whose inspector already carries the post-exec refund policy. + fn from_inner(inner: OpEvmInner, inspect: bool) -> Self { Self { - inner: op_revm::OpEvm(revm::context::Evm { - ctx, - inspector: post_exec::PostExecCompositeInspector::new_with_post_exec( - inspector, - refund_policy, - ), - instruction, - precompiles, - frame_stack, - }), + inner, inspect, post_exec_tracking_active: false, last_tx_post_exec_result: Default::default(), @@ -193,12 +194,17 @@ impl OpEvm { .with_db(db) .with_block(input.block_env) .with_cfg(input.cfg_env) - .build_op_with_inspector(inspector) + // Wrap the inspector before building, rather than via `new_with_refund_policy`, so the + // EVM's frame stack is only allocated once. + .build_op_with_inspector(post_exec::PostExecCompositeInspector::new_with_post_exec( + inspector, + refund_policy, + )) .with_precompiles(PrecompilesMap::from_static( OpPrecompiles::new_with_spec(spec_id).precompiles(), )); - Self::new_with_refund_policy(inner, inspect, refund_policy) + Self::from_inner(inner, inspect) } } @@ -329,7 +335,7 @@ impl DerefMut for OpEvm { } } -/// UPSTREAM-MIRROR(copy): alloy-evm@0.38.0 `alloy_evm::eth::EthEvm` +/// UPSTREAM-MIRROR(copy): alloy-evm@0.39.0 `alloy_evm::eth::EthEvm` /// /// Mirrors upstream's `Evm` impl for `EthEvm`, adding the OP transaction wrapper, the post-exec /// transaction short-circuit and the post-exec refund tracking. A method added to the `Evm` diff --git a/rust/alloy-op-evm/src/tx.rs b/rust/alloy-op-evm/src/tx.rs index 7089fa85ab8..7caa6675ca0 100644 --- a/rust/alloy-op-evm/src/tx.rs +++ b/rust/alloy-op-evm/src/tx.rs @@ -80,7 +80,7 @@ impl OpTxEnv for OpTx { } } -/// UPSTREAM-MIRROR(delegate): revm-context-interface@42.0.0 `revm_context_interface::Transaction` +/// UPSTREAM-MIRROR(delegate): revm-context-interface@43.0.1 `revm_context_interface::Transaction` /// /// Forwards the required getters and `effective_gas_price` to the inner `OpTransaction`, /// which overrides `tx_type` and `effective_gas_price` for deposits. The remaining defaulted diff --git a/rust/alloy-op-hardforks/src/lib.rs b/rust/alloy-op-hardforks/src/lib.rs index 730512da3b8..7033a27e6b6 100644 --- a/rust/alloy-op-hardforks/src/lib.rs +++ b/rust/alloy-op-hardforks/src/lib.rs @@ -175,7 +175,7 @@ impl OpHardfork { *self as usize } - /// UPSTREAM-MIRROR(set): alloy-hardforks@0.4.7 `alloy_hardforks::EthereumHardfork` + /// UPSTREAM-MIRROR(set): alloy-hardforks@0.4.8 `alloy_hardforks::EthereumHardfork` /// /// A new upstream variant needs an explicit decision here. The `VARIANTS` loop below /// only smoke-tests lookup; semantic mappings remain explicit assertions. @@ -820,6 +820,7 @@ mod tests { // L1 forks newer than the latest implied one are not activated by any OP fork. assert_eq!(OpHardfork::activating_op_fork(EthereumHardfork::Bpo1), None); assert_eq!(OpHardfork::activating_op_fork(EthereumHardfork::Amsterdam), None); + assert_eq!(OpHardfork::activating_op_fork(EthereumHardfork::Bogota), None); } #[test] diff --git a/rust/kona/bin/client/src/fpvm_evm/precompiles/provider.rs b/rust/kona/bin/client/src/fpvm_evm/precompiles/provider.rs index 3602e6f4f40..e85a848b1f5 100644 --- a/rust/kona/bin/client/src/fpvm_evm/precompiles/provider.rs +++ b/rust/kona/bin/client/src/fpvm_evm/precompiles/provider.rs @@ -96,7 +96,7 @@ where true } - /// UPSTREAM-MIRROR(copy): revm-handler@42.0.1 `revm_handler::EthPrecompiles::run` + /// UPSTREAM-MIRROR(copy): revm-handler@43.0.2 `revm_handler::EthPrecompiles::run` /// /// FPVM acceleration replaces dispatch, while output conversion delegates to revm. Re-check /// input materialization, execution errors, and gas/reservoir propagation across both paths. diff --git a/rust/kona/sp1/programs/Cargo.lock b/rust/kona/sp1/programs/Cargo.lock index 9fd0c9790f8..16851e60797 100644 --- a/rust/kona/sp1/programs/Cargo.lock +++ b/rust/kona/sp1/programs/Cargo.lock @@ -133,9 +133,9 @@ dependencies = [ [[package]] name = "alloy-eip7928" -version = "0.4.2" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951e1d988b5753bc424b837c98ce0dc575031db99e7cd01833d3a5053b97951a" +checksum = "1cb19c9d53b507960f649e5689f7098e556696023fe1b57b67f2181ed54bc5b7" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "alloy-evm" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b307a52f91f7f3aad56b5cb4f54e5eb17dd0b3f4b2c82823301499fe1c6fdaf" +checksum = "7b6bd5f7e5ce9858bac99275e3f548c3b63bb3e5806da0142dc0b2f518d3ec4a" dependencies = [ "alloy-consensus", "alloy-eips", @@ -199,9 +199,9 @@ dependencies = [ [[package]] name = "alloy-hardforks" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ba208044232d14d4adbfa77e57d6329f51bc1acc21f5667bb7db72d88a0831" +checksum = "865371fb677c005f7cb0ea9c2847a1ba4fdb042caf6428b1769fee20368bbfc7" dependencies = [ "alloy-chains", "alloy-eip2124", @@ -2671,9 +2671,9 @@ dependencies = [ [[package]] name = "reth-codecs" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f0dd7f542fbcae0e490ebe13f3eababcc05547375246ff7f62700b533cf3f01" +checksum = "a6bac09d9d84a412ae151149ec870d6eb7770335c5eb63f209453d81deff8d39" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2689,9 +2689,9 @@ dependencies = [ [[package]] name = "reth-codecs-derive" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e508fcbb8cb775639dbbb56b81b62756d4322f28e76c60a52aa32575f993fe" +checksum = "0101b1f474563c4c48c04fc2477199279a53d9c19b65301c6fd2131cf6e4a330" dependencies = [ "proc-macro2", "quote", @@ -2700,18 +2700,18 @@ dependencies = [ [[package]] name = "reth-zstd-compressors" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80addacffc5df9398c55919f8993922d2b688f2aa5753708fdd658ca3cc63e39" +checksum = "dbdee2f0ad09dc32b43ab52641f8239766a66de4345834bad27d5cfa2f62864d" dependencies = [ "zstd", ] [[package]] name = "revm" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c7fcd426beab3b91300a6d0d5eb8d583c0fad0fba451126e19fd51443eca62" +checksum = "55f2322f5ea197fac72c2cdc88cb501b2a7db0b0009911133fd3dda45bfceedd" dependencies = [ "revm-bytecode", "revm-context", @@ -2728,9 +2728,9 @@ dependencies = [ [[package]] name = "revm-bytecode" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537356bdec80dbc04e4e6bb688b3441ff7cf18eecdcf3cac23150633c46467f1" +checksum = "c8d38e16b72ec1c836ec8490562bfb21003165ea8bc496086bf345680a6e6c41" dependencies = [ "bitvec", "revm-primitives", @@ -2738,9 +2738,9 @@ dependencies = [ [[package]] name = "revm-context" -version = "42.0.0" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6512f05f83378e29b2b016fa5bd7f5a533e3625548be4113732e1a536c2564" +checksum = "c16835bc2ead203219a18fcc84c2c71879ad6b890e8a71150cf7f10e4e355dc4" dependencies = [ "bitvec", "cfg-if", @@ -2754,9 +2754,9 @@ dependencies = [ [[package]] name = "revm-context-interface" -version = "42.0.0" +version = "43.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "103fff818b10311034c0c11ff8760294ee0e3c320daab3c5717990fe8ee2617b" +checksum = "e3b4109bdceaca5ee6e27bf41f6b156f2b15892dc5bb47d3530bc4d3b3060077" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -2769,9 +2769,9 @@ dependencies = [ [[package]] name = "revm-database" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df72760eab0852100e748c7cb03ce0221626d60ac14534118c84c5cc894fb4c9" +checksum = "31d764afa9a1c9278c05d40461b07319d21ccb39c1bdf0e9dde7e5ea7d9be53d" dependencies = [ "derive_more", "either", @@ -2783,9 +2783,9 @@ dependencies = [ [[package]] name = "revm-database-interface" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9286c059a11be1dee814cafdc3a3ade57521c8caa050785a52c19a9d894f400" +checksum = "d2a27e4440c2ef4932afdaa28a1d1ac8601504c7030c1a387b5e307d07d864d1" dependencies = [ "auto_impl", "either", @@ -2796,9 +2796,9 @@ dependencies = [ [[package]] name = "revm-handler" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09126175c3fa482e71e80cc28c6bb17e681911e472b94d4f7f73dd6780411798" +checksum = "73a7409031d87ec281b74efff65d7a4dbea9d80727a55dbc7e4b3fd77b5e03fb" dependencies = [ "auto_impl", "derive-where", @@ -2814,9 +2814,9 @@ dependencies = [ [[package]] name = "revm-inspector" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa55b208b52f0c083ea68147c78866eeecadd7c0071a614f477de316b60648e" +checksum = "7a56f37224afd628f7244aa6965609ada04b440ed8ab7a19f55e4291df5a0112" dependencies = [ "auto_impl", "either", @@ -2830,9 +2830,9 @@ dependencies = [ [[package]] name = "revm-interpreter" -version = "42.0.0" +version = "43.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd310927437752ce4bac6997b385772823b84843f04c82e151993bec1265a5ed" +checksum = "932f7fe05a2cdeb08195dd7e88a09a4da7c3660cdc6e62720839c77ba77f65aa" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -2842,9 +2842,9 @@ dependencies = [ [[package]] name = "revm-precompile" -version = "42.0.1" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2431091420999795df6a200b9f7933defe3d654710560a895e6bcabbd9954a5" +checksum = "ac4dc0279f2a44770faa8c93d008df684440cf573c91b8e0e39d0d581abf7b3d" dependencies = [ "ark-bls12-381 0.6.0", "ark-bn254", @@ -2865,9 +2865,9 @@ dependencies = [ [[package]] name = "revm-primitives" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef5564c1bce219fd08beca43d4f39fdcbc19193fa4f604c0c6b58950a13194a" +checksum = "f1f4ba1a5757fe4398262290422c371556fcebf236f762f7ed7ff2c56768a63c" dependencies = [ "alloy-primitives", "once_cell", @@ -2875,9 +2875,9 @@ dependencies = [ [[package]] name = "revm-state" -version = "42.0.0" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4ae66db3abfcb565854dbfc95513bfa440b3dc390ddf8e50b0363d12a6fa79" +checksum = "7cd02082cf1baca01e8bc17456c45136bdc66632395a98db1c1a2afe4c6ea87f" dependencies = [ "alloy-eip7928", "bitflags", diff --git a/rust/kona/sp1/programs/Cargo.toml b/rust/kona/sp1/programs/Cargo.toml index 8d5e2290fab..38004f3645e 100644 --- a/rust/kona/sp1/programs/Cargo.toml +++ b/rust/kona/sp1/programs/Cargo.toml @@ -126,7 +126,7 @@ kona-sp1-range-vkeys = { path = "../crates/range-vkeys" } # Feature anchor only: revm's `bn` forwards to revm-precompile/bn so the guest # build uses the SP1-patched substrate-bn backend for bn128. -revm = { version = "42.0.1", default-features = false, features = ["bn"] } +revm = { version = "43.0.2", default-features = false, features = ["bn"] } sp1-lib = { version = "6.8.1", features = ["verify"] } sp1-zkvm = { version = "6.8.1", features = ["verify"] } @@ -137,7 +137,7 @@ anyhow = { version = "1.0.101", default-features = false } [patch.crates-io] sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.10.9-sp1-6.2.0" } -# revm-precompile 42 resolves the 0.11 line next to the 0.10 one; a patch only covers the version it names. +# revm-precompile 43 resolves the 0.11 line next to the 0.10 one; a patch only covers the version it names. sha2-0-11 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.11.0-sp1-6.2.0" } sha3 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", tag = "patch-sha3-0.11.0-sp1-6.0.0" } crypto-bigint = { git = "https://github.com/sp1-patches/RustCrypto-bigint", tag = "patch-0.5.5-sp1-6.2.0" } diff --git a/rust/op-reth/bin/Cargo.toml b/rust/op-reth/bin/Cargo.toml index cf8fe7550cf..8d164eb5191 100644 --- a/rust/op-reth/bin/Cargo.toml +++ b/rust/op-reth/bin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "op-reth" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/chainspec/Cargo.toml b/rust/op-reth/crates/chainspec/Cargo.toml index 4ea75226ad9..d1b2375b223 100644 --- a/rust/op-reth/crates/chainspec/Cargo.toml +++ b/rust/op-reth/crates/chainspec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-chainspec" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/cli/Cargo.toml b/rust/op-reth/crates/cli/Cargo.toml index e26ca8fd231..d1223ac5eca 100644 --- a/rust/op-reth/crates/cli/Cargo.toml +++ b/rust/op-reth/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-cli" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/cli/src/lib.rs b/rust/op-reth/crates/cli/src/lib.rs index 513a2452f64..c4c1f00eed1 100644 --- a/rust/op-reth/crates/cli/src/lib.rs +++ b/rust/op-reth/crates/cli/src/lib.rs @@ -32,7 +32,7 @@ use reth_cli_runner::CliRunner; use reth_db::DatabaseEnv; use reth_node_builder::{NodeBuilder, WithLaunchContext}; use reth_node_core::{ - args::{LogArgs, TraceArgs}, + args::{DefaultEngineValues, LogArgs, TraceArgs}, version::version_metadata, }; use reth_optimism_node::args::RollupArgs; @@ -80,18 +80,84 @@ pub struct Cli< } /// Upstream reth CLI arguments that op-reth does not support, as -/// `(subcommand, argument id, error shown when used)` entries. +/// `(subcommand, argument id, error shown when used)` entries. The subcommand is matched by name +/// at any nesting level; [`ANY_SUBCOMMAND`] matches every subcommand. /// /// These arguments live in upstream arg structs that op-reth reuses, so they cannot be removed at /// the type level. They are hidden from all help output and rejected with a hard error after /// parsing. Add new entries here as further unsupported upstream options are identified /// (tracked in [#21687](https://github.com/ethereum-optimism/optimism/issues/21687)). -const DENIED_ARGS: &[(&str, &str, &str)] = &[("node", "minimal", MINIMAL_REMOVED_HELP)]; +const DENIED_ARGS: &[(&str, &str, &str)] = &[ + ("node", "minimal", MINIMAL_REMOVED_HELP), + ("node", "max_bals", BAL_ARGS_UNSUPPORTED_HELP), + ("node", "cache_computed_bals", BAL_ARGS_UNSUPPORTED_HELP), + ("node", "prewarm_bals", BAL_ARGS_UNSUPPORTED_HELP), + // Part of the database args, which most subcommands take. + (ANY_SUBCOMMAND, "balstore_cache_size", BAL_ARGS_UNSUPPORTED_HELP), + ("node", "bal_parallel_execution_disabled", BAL_ARGS_UNSUPPORTED_HELP), + ("node", "bal_parallel_state_root_disabled", BAL_ARGS_UNSUPPORTED_HELP), + ("node", "disable_bal_batch_io", BAL_ARGS_UNSUPPORTED_HELP), +]; + +/// `DENIED_ARGS` subcommand wildcard. +const ANY_SUBCOMMAND: &str = "*"; + +/// Returns the `DENIED_ARGS` entries that apply to the subcommand named `subcommand`. +fn denied_args_for( + subcommand: &str, +) -> impl Iterator { + DENIED_ARGS.iter().filter(move |(sub, _, _)| *sub == ANY_SUBCOMMAND || *sub == subcommand) +} + +/// Hides `DENIED_ARGS` and the state masking flag on `cmd` and all of its nested subcommands. +fn hide_denied_args(cmd: clap::Command) -> clap::Command { + let name = cmd.get_name().to_string(); + // `mut_subcommand`/`mut_arg` move the modified entry to the end of help output, so use the + // order-preserving `mut_subcommands`/`mut_args` instead. + cmd.mut_args(|arg| { + let id = arg.get_id().as_str(); + if (name == "node" && id == STATE_MASKING_ARG) || + denied_args_for(&name).any(|(_, arg_id, _)| *arg_id == id) + { + arg.hide(true) + } else { + arg + } + }) + .mut_subcommands(hide_denied_args) +} + +/// Returns the error of the first `DENIED_ARGS` entry set on the command line anywhere in the +/// selected subcommand chain. +fn find_denied_arg(matches: &clap::ArgMatches) -> Option<&'static str> { + let (name, sub) = matches.subcommand()?; + denied_args_for(name) + .find(|(_, id, _)| { + // `value_source` panics on ids the subcommand doesn't define, so check that first. + sub.try_get_raw(id).is_ok() && + sub.value_source(id) == Some(clap::parser::ValueSource::CommandLine) + }) + .map(|(_, _, help)| *help) + .or_else(|| find_denied_arg(sub)) +} /// Startup error for `--minimal`, which configures pruning (including block-body pruning) that /// op-node derivation cannot tolerate. const MINIMAL_REMOVED_HELP: &str = "--minimal is not supported by op-reth and has been removed.\n\nIt prunes block bodies to a fixed 10,064-block window, which breaks op-node derivation\n(op-node reads the L1-info deposit transaction from historical block bodies).\n\nFor a pruned (non-archive) node, use the supported pruning recipe instead:\n --prune.minimum-distance \n --prune.receipts.distance \n --prune.account-history.distance \n --prune.storage-history.distance \nDo NOT prune block bodies.\n\nSee https://docs.optimism.io/node-operators/guides/management/archive-node#pruning-op-reth"; +/// Startup error for block access list options, which are not useful on OP chains. +const BAL_ARGS_UNSUPPORTED_HELP: &str = "Block access list options are not supported by op-reth.\n\nOP blocks do not carry EIP-7928 block access lists."; + +/// Argument id of upstream `--engine.num-state-masking-blocks`. +/// +/// op-reth runs with state masking off: it defaults the flag to 0, hides it, and rejects any +/// nonzero value from the command line or `RETH_ENGINE_NUM_STATE_MASKING_BLOCKS`. Unlike +/// `DENIED_ARGS`, an explicit 0 stays accepted. See [`STATE_MASKING_UNSUPPORTED_HELP`]. +const STATE_MASKING_ARG: &str = "num_state_masking_blocks"; + +/// Startup error for a nonzero state masking window. +const STATE_MASKING_UNSUPPORTED_HELP: &str = "--engine.num-state-masking-blocks must be 0 on op-reth.\n\nState masking leaves the on-disk state trie behind the persisted tip. After an unclean shutdown\nwith masking on, op-reth releases before reth v2.6.0 cannot open the datadir, and upstream\nstill has open bugs in the masked-trie code paths."; + impl Cli { /// Parses only the default CLI arguments, rejecting `DENIED_ARGS` pub fn parse_args() -> Self { @@ -114,23 +180,14 @@ where Ext: clap::Args + fmt::Debug, Rpc: RpcModuleValidator, { - /// Returns the clap command with all `DENIED_ARGS` hidden from help output. + /// Returns the clap command with all `DENIED_ARGS` and the state masking flag hidden from help + /// output. pub fn command_with_denied_args_hidden() -> clap::Command { - // `mut_subcommand`/`mut_arg` move the modified entry to the end of help output, so use - // the order-preserving `mut_subcommands`/`mut_args` instead. - ::command().mut_subcommands(|sc| { - let name = sc.get_name().to_string(); - sc.mut_args(|arg| { - if DENIED_ARGS - .iter() - .any(|(sub, arg_id, _)| *sub == name && *arg_id == arg.get_id().as_str()) - { - arg.hide(true) - } else { - arg - } - }) - }) + // Default state masking to off before clap reads the global engine defaults. If another + // caller initialized them first, the post-parse check still rejects a nonzero value. + let _ = DefaultEngineValues::default().with_num_state_masking_blocks(0).try_init(); + + ::command().mut_subcommands(hide_denied_args) } /// Parses the CLI from the process arguments, hiding `DENIED_ARGS` from help output and @@ -154,12 +211,17 @@ where let mut cmd = Self::command_with_denied_args_hidden(); let mut matches = cmd.try_get_matches_from_mut(itr)?; // Clap still accepts hidden arguments, so denied ones are rejected post-parse. - for (subcommand, arg_id, help) in DENIED_ARGS { - if let Some(sub) = matches.subcommand_matches(subcommand) && - sub.value_source(arg_id) == Some(clap::parser::ValueSource::CommandLine) - { - return Err(cmd.error(clap::error::ErrorKind::ValueValidation, *help)); - } + if let Some(help) = find_denied_arg(&matches) { + return Err(cmd.error(clap::error::ErrorKind::ValueValidation, help)); + } + // Checks the effective value, so a nonzero value from the environment or from engine + // defaults initialized elsewhere is rejected too. + if let Some(node) = matches.subcommand_matches("node") && + node.get_one::(STATE_MASKING_ARG).is_some_and(|blocks| *blocks != 0) + { + return Err( + cmd.error(clap::error::ErrorKind::ValueValidation, STATE_MASKING_UNSUPPORTED_HELP) + ); } ::from_arg_matches_mut(&mut matches) } @@ -240,6 +302,100 @@ mod test { assert!(help.contains("--full"), "other pruning args must stay visible:\n{help}"); } + #[test] + fn deny_bal_args_on_every_subcommand() { + for args in [ + &["op-reth", "node", "--engine.disable-bal-parallel-execution"][..], + &["op-reth", "node", "--rpc-cache.max-bals", "10"], + &["op-reth", "node", "--db.balstore-cache-size", "10"], + &["op-reth", "prune", "--db.balstore-cache-size", "10"], + &["op-reth", "db", "--db.balstore-cache-size", "10", "stats"], + &["op-reth", "stage", "drop", "--db.balstore-cache-size", "10", "headers"], + ] { + let err = Cli::::try_parse_with_denied_args_from(args) + .unwrap_err(); + assert_eq!(err.kind(), clap::error::ErrorKind::ValueValidation, "{args:?}"); + let msg = err.to_string(); + assert!(msg.contains("Block access list options are not supported"), "{args:?}: {msg}"); + } + } + + #[test] + fn deny_bal_args_hidden_from_nested_help() { + let mut cmd = Cli::::command_with_denied_args_hidden(); + for path in [&["prune"][..], &["db"], &["stage", "drop"], &["proofs", "snapshot", "init"]] { + let mut sub = &mut cmd; + for name in path { + sub = sub.find_subcommand_mut(name).expect("subcommand"); + } + let help = sub.render_long_help().to_string(); + assert!( + !help.contains("--db.balstore-cache-size"), + "--db.balstore-cache-size must be hidden from {path:?} help:\n{help}" + ); + assert!(help.contains("--datadir"), "other args must stay visible in {path:?} help"); + } + } + + #[test] + fn state_masking_defaults_to_off() { + let cli = Cli::::try_parse_with_denied_args_from([ + "op-reth", "node", + ]) + .unwrap(); + match cli.command { + Commands::Node(command) => assert_eq!(command.engine.num_state_masking_blocks(), 0), + _ => panic!("unexpected command"), + } + } + + #[test] + fn state_masking_accepts_explicit_zero() { + let cli = Cli::::try_parse_with_denied_args_from([ + "op-reth", + "node", + "--engine.num-state-masking-blocks", + "0", + ]) + .unwrap(); + match cli.command { + Commands::Node(command) => assert_eq!(command.engine.num_state_masking_blocks(), 0), + _ => panic!("unexpected command"), + } + } + + #[test] + fn state_masking_rejects_nonzero() { + let err = Cli::::try_parse_with_denied_args_from([ + "op-reth", + "node", + "--engine.num-state-masking-blocks", + "30", + ]) + .unwrap_err(); + assert_eq!(err.kind(), clap::error::ErrorKind::ValueValidation); + let msg = err.to_string(); + assert!(msg.contains("--engine.num-state-masking-blocks must be 0 on op-reth"), "{msg}"); + } + + #[test] + fn state_masking_hidden_from_help() { + let mut cmd = Cli::::command_with_denied_args_hidden(); + let help = cmd + .find_subcommand_mut("node") + .expect("node subcommand") + .render_long_help() + .to_string(); + assert!( + !help.contains("--engine.num-state-masking-blocks"), + "state masking must be hidden from node help:\n{help}" + ); + assert!( + help.contains("--engine.persistence-threshold"), + "other engine args must stay visible:\n{help}" + ); + } + #[test] fn deny_list_does_not_affect_other_args() { let cli = Cli::::try_parse_with_denied_args_from([ diff --git a/rust/op-reth/crates/cli/tests/snapshots/cli.snap b/rust/op-reth/crates/cli/tests/snapshots/cli.snap index cc8c7e36180..4e1ba9b5c5c 100644 --- a/rust/op-reth/crates/cli/tests/snapshots/cli.snap +++ b/rust/op-reth/crates/cli/tests/snapshots/cli.snap @@ -86,7 +86,7 @@ arg: --max-seen-tx-history [action: Set] [num-args: 1] [default: 320] he arg: --max-pending-imports [action: Set] [num-args: 1] [default: 4096] help: Max number of transactions to import concurrently. arg: --pooled-tx-response-soft-limit [action: Set] [num-args: 1] [default: 2097152] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions\nto pack in one response.\nSpec'd at 2MiB. arg: --pooled-tx-pack-soft-limit [action: Set] [num-args: 1] [default: 131072] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions to\nrequest in one request. -arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Max capacity of cache of hashes for transactions pending fetch. +arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Maximum number of announced transaction hashes to track, including inflight requests. arg: --tx-channel-memory-limit [action: Set] [num-args: 1] [default: 1073741824] help: Memory limit (in bytes) for the channel that buffers transaction events flowing\nfrom the network manager to the transactions manager. arg: --net-if.experimental [action: Set] [num-args: 1] [conflicts: --addr] help: Name of network interface used to communicate with peers arg: --tx-propagation-policy [action: Set] [num-args: 1] [default: All] help: Transaction Propagation Policy @@ -102,6 +102,8 @@ arg: --http [action: SetTrue] [num-args: 0] [default: false] [default-values-if: arg: --http.addr [action: Set] [num-args: 1] [default: 127.0.0.1] help: Http server address to listen on arg: --http.port [action: Set] [num-args: 1] [default: 8545] help: Http server port to listen on arg: --http.disable-compression [action: SetTrue] [num-args: 0] [default: false] help: Disable compression for HTTP responses +arg: --http.compression [action: Append] [num-args: 1] [value-delimiter: ','] [possible: zstd, gzip, deflate, br] help: Comma-separated list of allowed compression algorithms for HTTP responses +arg: --http.decompression [action: Append] [num-args: 1] [value-delimiter: ','] [possible: zstd, gzip, deflate, br] help: Comma-separated list of allowed decompression algorithms for HTTP requests arg: --http.api [action: Set] [num-args: 1] [possible: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots, miner, mev, testing] help: Rpc Modules to be configured for the HTTP server arg: --http.corsdomain [action: Set] [num-args: 1] help: Http Corsdomain to allow request from arg: --ws [action: SetTrue] [num-args: 0] [default: false] help: Enable the WS-RPC server @@ -114,7 +116,8 @@ arg: --ipcpath [action: Set] [num-args: 1] [default: /tmp/reth.ipc] he arg: --ipc.permissions [action: Set] [num-args: 1] help: Set the permissions for the IPC socket file, in octal format arg: --authrpc.addr [action: Set] [num-args: 1] [default: 127.0.0.1] help: Auth server address to listen on arg: --authrpc.port [action: Set] [num-args: 1] [default: 8551] help: Auth server port to listen on -arg: --authrpc.jwtsecret [action: Set] [num-args: 1] [global] help: Path to a JWT secret to use for the authenticated engine-API RPC server +arg: --authrpc.jwtsecret [action: Set] [num-args: 1] [conflicts: --authrpc.jwtsecret-hex] [global] help: Path to a JWT secret to use for the authenticated engine-API RPC server +arg: --authrpc.jwtsecret-hex [action: Set] [num-args: 1] [conflicts: --authrpc.jwtsecret] [global] help: Hex encoded JWT secret to use for the authenticated engine-API RPC server arg: --auth-ipc [action: SetTrue] [num-args: 0] [default: false] help: Enable auth engine API over IPC arg: --auth-ipc.path [action: Set] [num-args: 1] [default: /tmp/reth_engine_api.ipc] help: Filename for auth IPC socket/pipe within the datadir arg: --disable-auth-server [action: SetTrue] [num-args: 0] [aliases: disable-engine-api] [default: false] help: Disable the auth/engine API server @@ -141,10 +144,12 @@ arg: --rpc.forwarder [action: Set] [num-args: 1] [aliases: rpc-forwa arg: --builder.disallow [action: Set] [num-args: 1] help: Path to file containing disallowed addresses, json-encoded list of strings. Block validation API will reject blocks containing transactions from these addresses arg: --rpc-cache.max-blocks [action: Set] [num-args: 1] [default: 5000] help: Max number of blocks in cache arg: --rpc-cache.max-receipts [action: Set] [num-args: 1] [default: 2000] help: Max number receipts in cache -arg: --rpc-cache.max-headers [action: Set] [num-args: 1] [aliases: rpc-cache.max-envs] [default: 1000] help: Max number of headers in cache -arg: --rpc-cache.max-bals [action: Set] [num-args: 1] [default: 1000] help: Max number of block access lists in cache +arg: --rpc-cache.max-headers [action: Set] [num-args: 1] [aliases: rpc-cache.max-envs] [default: 1000] [hidden] help: Legacy no-op retained for CLI compatibility +arg: --rpc-cache.max-bals [action: Set] [num-args: 1] [default: 1000] [hidden] help: Max number of block access lists in cache +arg: --rpc-cache.cache-computed-bals [action: SetTrue] [num-args: 0] [hidden] help: Cache block access lists computed by RPC requests for transaction tracing +arg: --rpc-cache.prewarm-bals [action: Set] [num-args: 0..=1] [default-missing-values: ["0"]] [hidden] [require-equals] help: Replay new canonical blocks to cache block access lists until native BAL support arg: --rpc-cache.max-concurrent-db-requests [action: Set] [num-args: 1] [default: 512] help: Max number of concurrent database requests -arg: --rpc-cache.max-cached-tx-hashes [action: Set] [num-args: 1] [default: 30000] help: Maximum number of transaction hashes to cache for transaction lookups +arg: --rpc-cache.max-cached-tx-hashes [action: Set] [num-args: 1] [default: 100000] help: Maximum number of transaction hashes to cache for transaction lookups arg: --gpo.blocks [action: Set] [num-args: 1] [default: 20] help: Number of recent blocks to check for gas price arg: --gpo.ignoreprice [action: Set] [num-args: 1] [default: 0] help: Gas Price below which gpo will ignore transactions arg: --gpo.maxprice [action: Set] [num-args: 1] [default: 500000000000] help: Maximum transaction priority fee(or gasprice before London Fork) to be recommended by gpo @@ -215,7 +220,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --dev [action: SetTrue] [num-args: 0] [aliases: auto-mine] [default: false] help: Start the node in dev mode arg: --dev.block-max-transactions [action: Set] [num-args: 1] [conflicts: --dev.block-time] help: How many transactions to mine per block @@ -247,8 +252,9 @@ arg: --prune.bodies.pre-merge [action: SetTrue] [num-args: 0] [conflicts: --prun arg: --prune.bodies.distance [action: Set] [num-args: 1] [conflicts: --prune.bodies.before, --prune.bodies.pre-merge] help: Prune bodies before the `head-N` block number. In other words, keep last N + 1 blocks arg: --prune.bodies.before [action: Set] [num-args: 1] [conflicts: --prune.bodies.distance, --prune.bodies.pre-merge] help: Prune storage history before the specified block number. The specified block number is not pruned arg: --prune.minimum-distance [action: Set] [num-args: 1] help: Minimum pruning distance from the tip. This controls the safety margin for reorgs and manual unwinds -arg: --engine.persistence-threshold [action: Set] [num-args: 1] [default: 7] help: Configure persistence threshold for the engine. This determines how many canonical blocks must be in-memory, ahead of the last persisted block, before flushing canonical blocks to disk again +arg: --engine.persistence-threshold [action: Set] [num-args: 1] [env: RETH_ENGINE_PERSISTENCE_THRESHOLD] [default: 50] help: Configure persistence threshold for the engine. This determines how many canonical blocks must be in-memory, ahead of the last persisted block, before flushing canonical blocks to disk again arg: --engine.persistence-backpressure-threshold [action: Set] [num-args: 1] help: Configure the maximum number of blocks beyond the in-memory buffer target that may await persistence before engine API processing stalls +arg: --engine.num-state-masking-blocks [action: Set] [num-args: 1] [env: RETH_ENGINE_NUM_STATE_MASKING_BLOCKS] [default: 0] [hidden] help: Configure how many of the blocks being persisted should only mask state/trie writes instead of durably persisting their state/trie updates in the current cycle arg: --engine.memory-block-buffer-target [action: Set] [num-args: 1] help: Configure the target number of blocks to keep in memory arg: --engine.invalid-header-cache-hit-eviction-threshold [action: Set] [num-args: 1] [default: 128] help: Configure how many cache hits an invalid header can accumulate before it is evicted and reprocessed arg: --engine.legacy-state-root [action: SetTrue] [num-args: 0] [default: false] [hidden] help: CAUTION: This CLI flag has no effect anymore, use --engine.state-root-fallback if you want to force synchronous state root computation @@ -280,9 +286,9 @@ arg: --engine.state-root-task-timeout [action: Set] [n arg: --engine.share-execution-cache-with-payload-builder [action: SetTrue] [num-args: 0] [default: false] help: Whether to share execution cache with the payload builder arg: --engine.share-sparse-trie-with-payload-builder [action: SetTrue] [num-args: 0] [default: false] help: Whether to share the sparse trie with the payload builder arg: --engine.suppress-persistence-during-build [action: SetTrue] [num-args: 0] [default: false] help: Suppress persistence while building a payload -arg: --engine.disable-bal-parallel-execution [action: SetTrue] [num-args: 0] [default: false] help: Disable BAL (Block Access List, EIP-7928) based parallel execution -arg: --engine.disable-bal-parallel-state-root [action: SetTrue] [num-args: 0] [default: false] help: Disable BAL-driven parallel state root computation. This is only valid together with `--engine.disable-bal-parallel-execution` -arg: --engine.disable-bal-batch-io [action: SetTrue] [num-args: 0] [default: false] help: Disable BAL (Block Access List) storage prefetch IO during prewarming. When set, BAL storage slots are not read into the execution cache +arg: --engine.disable-bal-parallel-execution [action: SetTrue] [num-args: 0] [default: false] [hidden] help: Disable BAL (Block Access List, EIP-7928) based parallel execution +arg: --engine.disable-bal-parallel-state-root [action: SetTrue] [num-args: 0] [default: false] [hidden] help: Disable BAL-driven parallel state root computation. This is only valid together with `--engine.disable-bal-parallel-execution` +arg: --engine.disable-bal-batch-io [action: SetTrue] [num-args: 0] [default: false] [hidden] help: Disable BAL (Block Access List) storage prefetch IO during prewarming. When set, BAL storage slots are not read into the execution cache arg: --era.enable [action: SetTrue] [num-args: 0] [default: false] help: Enable import from ERA1 files arg: --era.path [action: Set] [num-args: 1] help: The path to a directory for import. arg: --era.url [action: Set] [num-args: 1] help: The URL to a remote host where the ERA1 files are hosted. @@ -343,7 +349,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -370,7 +376,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -407,7 +413,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -480,7 +486,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --table [action: Set] [num-args: 1] help: The table name to diff. If not specified, all tables are diffed. arg: --output [action: Set] [num-args: 1] [required] help: The output directory for the diff report. @@ -634,7 +640,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -687,7 +693,7 @@ arg: --max-seen-tx-history [action: Set] [num-args: 1] [default: 320] he arg: --max-pending-imports [action: Set] [num-args: 1] [default: 4096] help: Max number of transactions to import concurrently. arg: --pooled-tx-response-soft-limit [action: Set] [num-args: 1] [default: 2097152] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions\nto pack in one response.\nSpec'd at 2MiB. arg: --pooled-tx-pack-soft-limit [action: Set] [num-args: 1] [default: 131072] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions to\nrequest in one request. -arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Max capacity of cache of hashes for transactions pending fetch. +arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Maximum number of announced transaction hashes to track, including inflight requests. arg: --tx-channel-memory-limit [action: Set] [num-args: 1] [default: 1073741824] help: Memory limit (in bytes) for the channel that buffers transaction events flowing\nfrom the network manager to the transactions manager. arg: --net-if.experimental [action: Set] [num-args: 1] [conflicts: --addr] help: Name of network interface used to communicate with peers arg: --tx-propagation-policy [action: Set] [num-args: 1] [default: All] help: Transaction Propagation Policy @@ -717,7 +723,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -746,7 +752,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -802,7 +808,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -864,7 +870,7 @@ arg: --max-seen-tx-history [action: Set] [num-args: 1] [default: 320] he arg: --max-pending-imports [action: Set] [num-args: 1] [default: 4096] help: Max number of transactions to import concurrently. arg: --pooled-tx-response-soft-limit [action: Set] [num-args: 1] [default: 2097152] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions\nto pack in one response.\nSpec'd at 2MiB. arg: --pooled-tx-pack-soft-limit [action: Set] [num-args: 1] [default: 131072] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions to\nrequest in one request. -arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Max capacity of cache of hashes for transactions pending fetch. +arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Maximum number of announced transaction hashes to track, including inflight requests. arg: --tx-channel-memory-limit [action: Set] [num-args: 1] [default: 1073741824] help: Memory limit (in bytes) for the channel that buffers transaction events flowing\nfrom the network manager to the transactions manager. arg: --net-if.experimental [action: Set] [num-args: 1] [conflicts: --addr] help: Name of network interface used to communicate with peers arg: --tx-propagation-policy [action: Set] [num-args: 1] [default: All] help: Transaction Propagation Policy @@ -923,7 +929,7 @@ arg: --max-seen-tx-history [action: Set] [num-args: 1] [default: 320] he arg: --max-pending-imports [action: Set] [num-args: 1] [default: 4096] help: Max number of transactions to import concurrently. arg: --pooled-tx-response-soft-limit [action: Set] [num-args: 1] [default: 2097152] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions\nto pack in one response.\nSpec'd at 2MiB. arg: --pooled-tx-pack-soft-limit [action: Set] [num-args: 1] [default: 131072] help: Experimental, for usage in research. Sets the max accumulated byte size of transactions to\nrequest in one request. -arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Max capacity of cache of hashes for transactions pending fetch. +arg: --max-tx-pending-fetch [action: Set] [num-args: 1] [default: 25600] help: Maximum number of announced transaction hashes to track, including inflight requests. arg: --tx-channel-memory-limit [action: Set] [num-args: 1] [default: 1073741824] help: Memory limit (in bytes) for the channel that buffers transaction events flowing\nfrom the network manager to the transactions manager. arg: --net-if.experimental [action: Set] [num-args: 1] [conflicts: --addr] help: Name of network interface used to communicate with peers arg: --tx-propagation-policy [action: Set] [num-args: 1] [default: All] help: Transaction Propagation Policy @@ -985,7 +991,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1029,7 +1035,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1075,7 +1081,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1108,7 +1114,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1140,7 +1146,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1175,7 +1181,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1205,7 +1211,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment @@ -1234,7 +1240,7 @@ arg: --db.read-transaction-timeout [action: Set] [num arg: --db.max-readers [action: Set] [num-args: 1] help: Maximum number of readers allowed to access the database concurrently arg: --db.sync-mode [action: Set] [num-args: 1] help: Controls how aggressively the database synchronizes data to disk arg: --db.rocksdb-block-cache-size [action: Set] [num-args: 1] help: `RocksDB` block cache size (e.g., 512MB, 4GB) -arg: --db.balstore-cache-size [action: Set] [num-args: 1] help: Number of recent blocks to keep in the in-memory BAL store cache +arg: --db.balstore-cache-size [action: Set] [num-args: 1] [hidden] help: Number of recent blocks to keep in the in-memory BAL store cache arg: --db.disable-metrics [action: SetTrue] [num-args: 0] help: Disable built-in database metrics arg: --static-files.blocks-per-file.headers [action: Set] [num-args: 1] help: Number of blocks per file for the headers segment arg: --static-files.blocks-per-file.transactions [action: Set] [num-args: 1] help: Number of blocks per file for the transactions segment diff --git a/rust/op-reth/crates/consensus/Cargo.toml b/rust/op-reth/crates/consensus/Cargo.toml index 00df89a5a9a..3e8916300ef 100644 --- a/rust/op-reth/crates/consensus/Cargo.toml +++ b/rust/op-reth/crates/consensus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-consensus" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true @@ -17,6 +17,7 @@ reth-execution-types.workspace = true reth-chainspec.workspace = true reth-consensus-common.workspace = true reth-consensus.workspace = true +reth-ethereum-consensus.workspace = true reth-primitives-traits.workspace = true reth-storage-api.workspace = true reth-storage-errors.workspace = true @@ -47,6 +48,9 @@ reth-optimism-chainspec.workspace = true [dev-dependencies] reth-optimism-chainspec = { workspace = true, features = ["superchain-configs"] } reth-provider = { workspace = true, features = ["test-utils"] } +reth-chain-state = { workspace = true, features = ["test-utils"] } +reth-stages-types.workspace = true +reth-storage-overlay.workspace = true reth-db-common.workspace = true reth-revm.workspace = true reth-trie.workspace = true @@ -64,6 +68,7 @@ std = [ "reth-chainspec/std", "reth-consensus/std", "reth-consensus-common/std", + "reth-ethereum-consensus/std", "reth-primitives-traits/std", "reth-optimism-forks/std", "reth-optimism-chainspec/std", diff --git a/rust/op-reth/crates/consensus/src/lib.rs b/rust/op-reth/crates/consensus/src/lib.rs index 6b072702f9c..43852870f77 100644 --- a/rust/op-reth/crates/consensus/src/lib.rs +++ b/rust/op-reth/crates/consensus/src/lib.rs @@ -34,7 +34,7 @@ use reth_primitives_traits::{ }; mod proof; -pub use proof::calculate_receipt_root_no_memo_optimism; +pub use proof::calculate_receipt_root_optimism; #[cfg(feature = "std")] mod sdm_metrics; diff --git a/rust/op-reth/crates/consensus/src/proof.rs b/rust/op-reth/crates/consensus/src/proof.rs index 7fedc49ad0d..57e9d645c3d 100644 --- a/rust/op-reth/crates/consensus/src/proof.rs +++ b/rust/op-reth/crates/consensus/src/proof.rs @@ -9,7 +9,7 @@ use reth_optimism_forks::OpHardforks; use reth_optimism_primitives::DepositReceipt; /// Calculates the receipt root for a header. -pub(crate) fn calculate_receipt_root_optimism( +pub fn calculate_receipt_root_optimism( receipts: &[ReceiptWithBloom<&R>], chain_spec: impl OpHardforks, timestamp: u64, @@ -39,43 +39,6 @@ pub(crate) fn calculate_receipt_root_optimism( ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_2718(buf)) } -/// Calculates the receipt root for a header for the reference type of an OP receipt. -/// -/// NOTE: Prefer calculate receipt root optimism if you have log blooms memoized. -pub fn calculate_receipt_root_no_memo_optimism( - receipts: &[R], - chain_spec: impl OpHardforks, - timestamp: u64, -) -> B256 { - // There is a minor bug in op-geth and op-erigon where in the Regolith hardfork, - // the receipt root calculation does not include the deposit nonce in the receipt - // encoding. In the Regolith Hardfork, we must strip the deposit nonce from the - // receipts before calculating the receipt root. This was corrected in the Canyon - // hardfork. - if chain_spec.is_regolith_active_at_timestamp(timestamp) && - !chain_spec.is_canyon_active_at_timestamp(timestamp) - { - let receipts = receipts - .iter() - .map(|r| { - let mut r = (*r).clone(); - if let Some(receipt) = r.as_deposit_receipt_mut() { - receipt.deposit_nonce = None; - } - r - }) - .collect::>(); - - return ordered_trie_root_with_encoder(&receipts, |r, buf| { - r.with_bloom_ref().encode_2718(buf); - }); - } - - ordered_trie_root_with_encoder(receipts, |r, buf| { - r.with_bloom_ref().encode_2718(buf); - }) -} - #[cfg(test)] mod tests { use super::*; diff --git a/rust/op-reth/crates/consensus/src/validation/isthmus.rs b/rust/op-reth/crates/consensus/src/validation/isthmus.rs index 3ab3fb8fd9d..2a4bc4d7da5 100644 --- a/rust/op-reth/crates/consensus/src/validation/isthmus.rs +++ b/rust/op-reth/crates/consensus/src/validation/isthmus.rs @@ -127,22 +127,34 @@ where #[cfg(test)] mod test { use super::*; - use alloc::sync::Arc; + use alloc::{collections::BTreeMap, sync::Arc}; use alloy_chains::Chain; use alloy_consensus::Header; use alloy_primitives::{B256, U256, keccak256}; use core::str::FromStr; + use reth_chain_state::{ExecutedBlock, test_utils::TestBlockBuilder}; use reth_db_common::init::init_genesis; use reth_optimism_chainspec::OpChainSpecBuilder; use reth_optimism_node::OpNode; + use reth_primitives_traits::Account; use reth_provider::{ - StateWriter, providers::BlockchainProvider, - test_utils::create_test_provider_factory_with_node_types, + BlockWriter, LatestStateProviderRef, StateWriter, StorageSettings, StorageSettingsCache, + TrieWriter, + providers::BlockchainProvider, + test_utils::{create_test_provider_factory, create_test_provider_factory_with_node_types}, }; use reth_revm::db::BundleState; - use reth_storage_api::StateProviderFactory; + use reth_stages_types::{FinishCheckpoint, StageCheckpoint, StageId}; + use reth_storage_api::{ + DatabaseProviderROFactory, StageCheckpointWriter, StateProviderBox, StateProviderFactory, + StateRootProvider, + }; + use reth_storage_overlay::{OverlayManager, OverlayStateProviderFactory}; use reth_trie::{HashedStorage, test_utils::storage_root_prehashed}; - use reth_trie_common::HashedPostState; + use reth_trie_common::{ + ComputedTrieData, HashedPostState, HashedPostStateSorted, + updates::{StorageTrieUpdatesSorted, TrieUpdatesSorted}, + }; #[test] fn l2tol1_message_passer_no_withdrawals() { @@ -191,4 +203,193 @@ mod test { ) .unwrap(); } + + /// Hashed slot with the given first two bytes, so that the storage trie has stored branch + /// nodes at depth one that cache the hashes of their children. + fn hashed_slot(first: u8, second: u8) -> B256 { + let mut slot = keccak256([first, second]); + slot.0[0] = first; + slot.0[1] = second; + slot + } + + /// Writes hashed state and trie updates the way `save_blocks` does under partial persistence: + /// updates of `batch` that are overwritten by the in-memory `mask` blocks are omitted. + fn write_state_trie( + provider: &P, + batch: &[ExecutedBlock], + mask: &[ExecutedBlock], + ) { + let hashed_state = HashedPostStateSorted::disjointed_merge_batch( + &ExecutedBlock::hashed_state_refs(batch), + &ExecutedBlock::hashed_state_refs(mask), + ); + provider.write_hashed_state(&hashed_state).unwrap(); + let trie_updates = TrieUpdatesSorted::disjointed_merge_batch( + &ExecutedBlock::trie_updates_refs(batch), + &ExecutedBlock::trie_updates_refs(mask), + ); + provider.write_trie_updates_sorted(&trie_updates).unwrap(); + } + + /// The withdrawals root is computed on a state provider whose database trie tables are a + /// partial persistence snapshot (`Finish.partial_state_trie` behind `Finish`), with the masking + /// suffix and further unpersisted blocks only held in memory. It must equal the storage root of + /// the complete post-block storage of the `L2ToL1MessagePasser`. + #[rstest::rstest] + fn l2tol1_message_passer_root_over_masked_state_trie( + #[values(StorageSettings::v1(), StorageSettings::v2())] settings: StorageSettings, + #[values(true, false)] masked: bool, + ) { + let hashed_address = keccak256(L2_TO_L1_MESSAGE_PASSER_ADDRESS); + + // Storage changes per block number. Block 1 is fully persisted, blocks 2..=4 are persisted + // below the partial state trie frontier, blocks 5..=6 are the masking suffix (persisted + // except for hashed state and trie) and block 7 is only in memory. The masking suffix + // changes siblings of slots changed in blocks 2..=4, so the database keeps branch nodes + // whose cached child hashes predate blocks 2..=4. + let base = (0..=u8::MAX) + .flat_map(|first| { + [0x00, 0x80].map(|second| (hashed_slot(first, second), U256::from(1))) + }) + .collect::>(); + let changes: [Vec<(B256, U256)>; 8] = [ + vec![], + base, + vec![ + (hashed_slot(0x10, 0x00), U256::from(2)), + (hashed_slot(0x11, 0x42), U256::from(2)), + (hashed_slot(0x20, 0x00), U256::ZERO), + ], + vec![(hashed_slot(0x30, 0x00), U256::from(3))], + vec![(hashed_slot(0x40, 0x80), U256::from(4))], + vec![ + (hashed_slot(0x30, 0x00), U256::from(5)), + (hashed_slot(0x31, 0x00), U256::from(5)), + (hashed_slot(0x50, 0x00), U256::from(5)), + (hashed_slot(0x60, 0x80), U256::ZERO), + ], + vec![ + (hashed_slot(0x1f, 0x80), U256::ZERO), + (hashed_slot(0x50, 0x00), U256::from(6)), + (hashed_slot(0x70, 0x00), U256::from(6)), + ], + vec![(hashed_slot(0x50, 0x00), U256::from(7)), (hashed_slot(0x80, 0x00), U256::ZERO)], + ]; + // Storage updates of the block whose withdrawals root is computed, on top of block 7. + let block_updates = vec![ + (hashed_slot(0x90, 0x42), U256::from(1)), + (hashed_slot(0xa0, 0x00), U256::from(8)), + (hashed_slot(0xb0, 0x80), U256::ZERO), + ]; + + // Per-block hashed state and trie updates, computed on a fully persisted reference + // database. Like the engine's trie updates, a block's storage trie updates only contain + // the nodes it modified. + let reference = create_test_provider_factory(); + reference.set_storage_settings_cache(settings); + let mut storage_nodes = BTreeMap::new(); + let blocks = TestBlockBuilder::eth() + .get_executed_blocks(0..changes.len() as u64) + .zip(&changes) + .map(|(block, changes)| { + let mut hashed_state = HashedPostState::default().with_storages([( + hashed_address, + HashedStorage::from_iter(changes.iter().copied()), + )]); + if block.recovered_block().number == 1 { + hashed_state = + hashed_state.with_accounts([(hashed_address, Some(Account::default()))]); + } + let provider = reference.provider().unwrap(); + let (_, trie_updates) = LatestStateProviderRef::new(&provider) + .state_root_with_updates(hashed_state.clone()) + .unwrap(); + drop(provider); + let hashed_state = hashed_state.into_sorted(); + let trie_updates = trie_updates.into_sorted(); + let provider_rw = reference.provider_rw().unwrap(); + provider_rw.write_hashed_state(&hashed_state).unwrap(); + provider_rw.write_trie_updates_sorted(&trie_updates).unwrap(); + provider_rw.commit().unwrap(); + + let modified_storage_nodes = trie_updates + .storage_tries_ref() + .get(&hashed_address) + .map(|storage_trie| storage_trie.storage_nodes_ref()) + .unwrap_or_default() + .iter() + .filter(|(path, node)| match node { + Some(node) => { + storage_nodes.insert(*path, node.clone()).as_ref() != Some(node) + } + None => storage_nodes.remove(path).is_some(), + }) + .cloned() + .collect(); + let trie_updates = TrieUpdatesSorted::new( + trie_updates.account_nodes_ref().to_vec(), + core::iter::once(( + hashed_address, + StorageTrieUpdatesSorted { storage_nodes: modified_storage_nodes }, + )) + .collect(), + ); + + ExecutedBlock::new( + Arc::clone(&block.recovered_block), + Arc::clone(&block.execution_output), + ComputedTrieData::new(Arc::new(hashed_state), Arc::new(trie_updates)), + ) + }) + .collect::>(); + + let factory = create_test_provider_factory(); + factory.set_storage_settings_cache(settings); + let provider_rw = factory.provider_rw().unwrap(); + for block in &blocks[..=6] { + provider_rw.insert_block(block.recovered_block()).unwrap(); + } + write_state_trie(&*provider_rw, &blocks[1..=1], &[]); + let partial_state_trie = if masked { + write_state_trie(&*provider_rw, &blocks[2..=4], &blocks[5..=6]); + 4 + } else { + write_state_trie(&*provider_rw, &blocks[2..=6], &[]); + 6 + }; + provider_rw + .save_stage_checkpoint( + StageId::Finish, + StageCheckpoint::new(6).with_finish_stage_checkpoint(FinishCheckpoint { + partial_state_trie: Some(partial_state_trie), + }), + ) + .unwrap(); + provider_rw.commit().unwrap(); + + let overlay_manager = OverlayManager::default(); + for block in &blocks[5..=7] { + overlay_manager.insert_block(block.clone()); + } + let state_provider_factory = OverlayStateProviderFactory::new( + factory, + overlay_manager.overlay_builder(blocks[7].recovered_block().hash()), + ); + let state: StateProviderBox = + Box::new(state_provider_factory.database_provider_ro().unwrap()); + + let mut expected_storage = BTreeMap::new(); + for (slot, value) in changes.iter().flatten().chain(&block_updates) { + expected_storage.insert(*slot, *value); + } + expected_storage.retain(|_, value| !value.is_zero()); + + let withdrawals_root = withdrawals_root_prehashed( + HashedStorage::from_iter(block_updates.iter().copied()), + state, + ) + .unwrap(); + assert_eq!(withdrawals_root, storage_root_prehashed(expected_storage)); + } } diff --git a/rust/op-reth/crates/consensus/src/validation/mod.rs b/rust/op-reth/crates/consensus/src/validation/mod.rs index ebb5273046b..3e49ae52392 100644 --- a/rust/op-reth/crates/consensus/src/validation/mod.rs +++ b/rust/op-reth/crates/consensus/src/validation/mod.rs @@ -14,11 +14,12 @@ use alloy_eips::Encodable2718; use alloy_primitives::{B256, Bloom, Bytes}; use alloy_trie::EMPTY_ROOT_HASH; use reth_consensus::ConsensusError; +use reth_ethereum_consensus::compare_receipts_root_and_logs_bloom; use reth_optimism_forks::OpHardforks; use reth_optimism_primitives::DepositReceipt; use reth_primitives_traits::{BlockBody, GotExpected, receipt::gas_spent_by_transactions}; -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_consensus_common::validation::validate_body_against_header` /// /// Copies the generic body/header checks and replaces withdrawals-root handling after Isthmus. @@ -85,7 +86,7 @@ where Ok(()) } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_ethereum_consensus::validation::validate_block_post_execution` /// /// Copies upstream post-execution validation with OP receipt roots and Jovian DA accounting. @@ -163,9 +164,9 @@ pub fn validate_block_post_execution( Ok(()) } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 `reth_ethereum_consensus::validation::verify_receipts` +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 `reth_ethereum_consensus::validation::verify_receipts` /// -/// Copies the private upstream helper and substitutes OP receipt-root calculation. +/// Copies the upstream helper, substituting OP receipt-root calculation. /// Verify the calculated receipts root against the expected receipts root. fn verify_receipts_optimism( expected_receipts_root: B256, @@ -192,33 +193,6 @@ fn verify_receipts_optimism( Ok(()) } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 -/// `reth_ethereum_consensus::validation::compare_receipts_root_and_logs_bloom` -/// -/// Kept identical to the private upstream comparison helper. -/// Compare the calculated receipts root with the expected receipts root, also compare -/// the calculated logs bloom with the expected logs bloom. -fn compare_receipts_root_and_logs_bloom( - calculated_receipts_root: B256, - calculated_logs_bloom: Bloom, - expected_receipts_root: B256, - expected_logs_bloom: Bloom, -) -> Result<(), ConsensusError> { - if calculated_receipts_root != expected_receipts_root { - return Err(ConsensusError::BodyReceiptRootDiff( - GotExpected { got: calculated_receipts_root, expected: expected_receipts_root }.into(), - )); - } - - if calculated_logs_bloom != expected_logs_bloom { - return Err(ConsensusError::BodyBloomLogDiff( - GotExpected { got: calculated_logs_bloom, expected: expected_logs_bloom }.into(), - )); - } - - Ok(()) -} - #[cfg(test)] mod tests { use super::*; diff --git a/rust/op-reth/crates/evm/Cargo.toml b/rust/op-reth/crates/evm/Cargo.toml index 415418d7c3e..449b7193667 100644 --- a/rust/op-reth/crates/evm/Cargo.toml +++ b/rust/op-reth/crates/evm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-evm" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/evm/src/build.rs b/rust/op-reth/crates/evm/src/build.rs index 07e999a1fd2..b9ee3aff77c 100644 --- a/rust/op-reth/crates/evm/src/build.rs +++ b/rust/op-reth/crates/evm/src/build.rs @@ -1,4 +1,4 @@ -use alloc::sync::Arc; +use alloc::{sync::Arc, vec::Vec}; use alloy_consensus::{ Block, BlockBody, EMPTY_OMMER_ROOT_HASH, Header, TxReceipt, constants::EMPTY_WITHDRAWALS, proofs, @@ -6,11 +6,11 @@ use alloy_consensus::{ use alloy_eips::{eip7685::EMPTY_REQUESTS_HASH, merge::BEACON_NONCE}; use alloy_evm::block::BlockExecutorFactory; use alloy_op_evm::OpBlockExecutionCtx; -use alloy_primitives::logs_bloom; +use alloy_primitives::Bloom; use reth_evm::execute::{BlockAssembler, BlockAssemblerInput}; use reth_execution_errors::BlockExecutionError; use reth_execution_types::BlockExecutionResult; -use reth_optimism_consensus::{calculate_receipt_root_no_memo_optimism, isthmus}; +use reth_optimism_consensus::{calculate_receipt_root_optimism, isthmus}; use reth_optimism_forks::OpHardforks; use reth_optimism_primitives::DepositReceipt; use reth_primitives_traits::{Receipt, SignedTransaction}; @@ -30,7 +30,7 @@ impl OpBlockAssembler { } impl OpBlockAssembler { - /// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_evm_ethereum::EthBlockAssembler::assemble_block` /// /// Copies upstream block assembly with OP receipt roots, withdrawals, and DA fields. @@ -61,9 +61,13 @@ impl OpBlockAssembler { let timestamp = evm_env.block_env.timestamp().saturating_to(); let transactions_root = proofs::calculate_transaction_root(&transactions); + // Reuse the receipt blooms for the block bloom instead of hashing every log twice. + let receipts_with_bloom = + receipts.iter().map(TxReceipt::with_bloom_ref).collect::>(); let receipts_root = - calculate_receipt_root_no_memo_optimism(receipts, &self.chain_spec, timestamp); - let logs_bloom = logs_bloom(receipts.iter().flat_map(|r| r.logs())); + calculate_receipt_root_optimism(&receipts_with_bloom, &self.chain_spec, timestamp); + let logs_bloom = + receipts_with_bloom.iter().fold(Bloom::ZERO, |acc, receipt| acc | receipt.bloom_ref()); let mut requests_hash = None; diff --git a/rust/op-reth/crates/evm/src/config.rs b/rust/op-reth/crates/evm/src/config.rs index 0515a63aecf..a3de8d5006e 100644 --- a/rust/op-reth/crates/evm/src/config.rs +++ b/rust/op-reth/crates/evm/src/config.rs @@ -25,7 +25,7 @@ pub struct OpNextBlockEnvAttributes { impl reth_rpc_eth_api::helpers::pending_block::BuildPendingEnv for OpNextBlockEnvAttributes { - /// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_rpc_eth_api::helpers::pending_block::NextBlockEnvAttributes::build_pending_env` /// /// Copies upstream pending-environment defaults for the OP attribute type, except that diff --git a/rust/op-reth/crates/evm/src/lib.rs b/rust/op-reth/crates/evm/src/lib.rs index 7980ad02497..3452cf43cc3 100644 --- a/rust/op-reth/crates/evm/src/lib.rs +++ b/rust/op-reth/crates/evm/src/lib.rs @@ -242,7 +242,7 @@ where } } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 `reth_evm_ethereum::EthEvmConfig` +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 `reth_evm_ethereum::EthEvmConfig` /// /// Mirrors upstream `ConfigureEvm` plumbing with OP environments and execution context. impl ConfigureEvm for OpEvmConfig @@ -342,7 +342,7 @@ where } } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 `reth_evm_ethereum::EthEvmConfig` +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 `reth_evm_ethereum::EthEvmConfig` /// /// Mirrors upstream payload-to-EVM configuration with OP payload and fork semantics. /// `tx_iterator_for_payload` recovers senders directly; upstream routes the same recovery through diff --git a/rust/op-reth/crates/exex/Cargo.toml b/rust/op-reth/crates/exex/Cargo.toml index e112dd325eb..f7435701a97 100644 --- a/rust/op-reth/crates/exex/Cargo.toml +++ b/rust/op-reth/crates/exex/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-exex" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true @@ -42,6 +42,7 @@ reth-optimism-node.workspace = true reth-optimism-chainspec.workspace = true reth-primitives-traits.workspace = true reth-ethereum-primitives.workspace = true +reth-evm-ethereum.workspace = true reth-exex-test-utils.workspace = true tempfile.workspace = true diff --git a/rust/op-reth/crates/exex/src/lib.rs b/rust/op-reth/crates/exex/src/lib.rs index c5fde1718b5..8a9bcb49c25 100644 --- a/rust/op-reth/crates/exex/src/lib.rs +++ b/rust/op-reth/crates/exex/src/lib.rs @@ -15,9 +15,10 @@ use reth_execution_types::Chain; use reth_exex::{ExExContext, ExExEvent, ExExNotification}; use reth_node_api::{FullNodeComponents, NodePrimitives, NodeTypes}; use reth_optimism_trie::{ - OpProofStoragePruner, OpProofsProviderRO, OpProofsStore, engine::EngineHandle, + CanonicalInMemoryStateProvider, OpProofStoragePruner, OpProofsProviderRO, OpProofsStore, + engine::EngineHandle, }; -use reth_provider::BlockNumReader; +use reth_provider::{BlockHashReader, BlockNumReader}; use reth_trie::{HashedPostStateSorted, SortedTrieData, updates::TrieUpdatesSorted}; use std::sync::Arc; use tracing::{debug, info}; @@ -194,6 +195,7 @@ where impl OpProofsExEx where Node: FullNodeComponents>, + Node::Provider: CanonicalInMemoryStateProvider, Primitives: NodePrimitives, Primitives::Block: Clone, Storage: OpProofsStore + Clone + 'static, @@ -312,10 +314,23 @@ where (**trie_updates).clone(), (**hashed_state).clone(), )?; - } else { + } else if let Err(err) = engine_handle.execute_block(block) { // Slow path: execute the block in full (no trie data, or verification interval - // hit). - engine_handle.execute_block(block)?; + // hit). Execution reads bytecode reth has not persisted from reth's in-memory + // chain, so a block from a fork reth has since left can fail. Leave that block to + // the sync loop, which executes reth's canonical block at this height. + if self.ctx.provider().block_hash(block_number)? == Some(block.hash()) { + return Err(err.into()); + } + debug!( + target: "optimism::exex", + block_number, + block_hash = ?block.hash(), + %err, + "Block left reth's chain during proofs execution; syncing to reth's chain", + ); + engine_handle.sync_to(new.tip().number())?; + return Ok(()); } } @@ -458,11 +473,26 @@ mod tests { trie_data.insert(n, data); } + mk_chain(blocks, from, trie_data) + } + + fn mk_chain_without_updates( + from: u64, + to: u64, + ) -> Chain { + mk_chain((from..=to).map(mk_block).collect(), from, BTreeMap::new()) + } + + fn mk_chain( + blocks: Vec>, + first_block: u64, + trie_data: BTreeMap, + ) -> Chain { let execution_outcome: ExecutionOutcome = ExecutionOutcome { bundle: Default::default(), receipts: Vec::new(), requests: Vec::new(), - first_block: from, + first_block, }; Chain::new(blocks, execution_outcome, trie_data) @@ -890,6 +920,181 @@ mod tests { assert_eq!(err.to_string(), "No blocks found"); } + #[tokio::test] + async fn handle_notification_schedules_execution_on_gap_without_trie_data() { + let dir = tempdir_path(); + let store = Arc::new(MdbxProofsStorage::new(dir.as_path()).expect("env")); + init_storage(store.clone()); + + let (ctx, _handle) = + reth_exex_test_utils::test_exex_context().await.expect("exex test context"); + let pruner = OpProofStoragePruner::new(store.clone(), ctx.components.provider.clone(), 20); + let engine_handle = EngineHandle::spawn_with_thresholds( + ctx.components.components.evm_config.clone(), + ctx.components.provider.clone(), + store.clone(), + pruner, + 1, + 2, + ); + let exex = build_test_exex(ctx, store.clone()); + + // Without pre-computed trie data this notification needs EVM execution. The proofs DB + // is still at genesis, so blocks 1..4 must be indexed before executing this range. The + // engine schedules catch-up; the empty test provider has no blocks to replay. + let notif = + ExExNotification::ChainCommitted { new: Arc::new(mk_chain_without_updates(5, 10)) }; + exex.handle_notification(notif, &engine_handle) + .expect("missing predecessor blocks should schedule catch-up"); + + engine_handle.flush(); + let latest = + store.provider_ro().expect("provider ro").get_latest_block().expect("get").number; + assert_eq!(latest, 0); + } + + /// Returns block 1 sealed with `state_root`, built on the genesis block the tests' proofs store + /// is initialized with. + fn block_one_with_state_root(state_root: B256) -> RecoveredBlock { + let header = alloy_consensus::Header { + number: 1, + parent_hash: hash_for_num(0), + state_root, + ..Default::default() + }; + reth_primitives_traits::SealedBlock::seal_slow(Block { header, body: Default::default() }) + .try_recover() + .expect("empty block") + } + + /// Makes `block` reth's canonical block at its height. + fn make_canonical( + handle: &reth_exex_test_utils::TestExExHandle, + provider: &impl reth_provider::CanonChainTracker
, + block: &RecoveredBlock, + ) { + use reth_provider::BlockWriter; + + let rw = handle.provider_factory.provider_rw().expect("provider rw"); + rw.insert_block(block).expect("insert block"); + rw.commit().expect("commit"); + provider.set_canonical_head(block.clone_sealed_header()); + } + + #[tokio::test] + async fn handle_notification_hands_block_reth_replaced_to_sync_loop() { + use reth_optimism_trie::engine::EngineError; + use std::time::{Duration, Instant}; + + let dir = tempdir_path(); + let store = Arc::new(MdbxProofsStorage::new(dir.as_path()).expect("env")); + init_storage(store.clone()); + + let (ctx, handle) = + reth_exex_test_utils::test_exex_context().await.expect("exex test context"); + let provider = ctx.components.provider.clone(); + let pruner = OpProofStoragePruner::new(store.clone(), provider.clone(), 20); + // The test context's EVM config is a no-op that cannot execute blocks. + let engine_handle = EngineHandle::spawn_with_thresholds( + reth_evm_ethereum::EthEvmConfig::mainnet(), + provider.clone(), + store.clone(), + pruner, + 1, + 2, + ); + let exex = build_test_exex(ctx, store.clone()); + + // The notification's block 1 builds on the proofs tip, but its header's state root is not + // the one execution produces, so its execution fails. + let err = engine_handle.execute_block(&mk_block(1)).expect_err("state root should differ"); + let EngineError::StateRootMismatch { current_state_hash, .. } = err else { + panic!("expected a state root mismatch, got {err}"); + }; + + // reth's canonical block 1 has the state root execution produces, standing in for the + // block that replaced the notification's block in a reorg. + let canonical = block_one_with_state_root(current_state_hash); + make_canonical(&handle, &provider, &canonical); + + let notif = + ExExNotification::ChainCommitted { new: Arc::new(mk_chain_without_updates(1, 1)) }; + exex.handle_notification(notif, &engine_handle) + .expect("a failed block reth has replaced should not stop the ExEx"); + + // Only the sync loop can index reth's block 1: the ExEx stopped at the failed block. + let deadline = Instant::now() + Duration::from_secs(30); + loop { + let latest = store.provider_ro().expect("provider ro").get_latest_block().expect("get"); + if latest.number == 1 { + assert_eq!(latest.hash, canonical.hash()); + break; + } + assert!(Instant::now() < deadline, "sync loop did not index reth's block 1"); + std::thread::sleep(Duration::from_millis(100)); + } + } + + #[tokio::test] + async fn handle_notification_propagates_failed_execution_of_canonical_block() { + assert_failure_of_canonical_block_stops_exex(0, false).await; + } + + #[tokio::test] + async fn handle_notification_propagates_failed_verification_of_canonical_block() { + assert_failure_of_canonical_block_stops_exex(1, true).await; + } + + /// Asserts that the ExEx stops when reth's canonical block 1 fails proofs execution, both on + /// the execution path and at the verification interval. + async fn assert_failure_of_canonical_block_stops_exex( + verification_interval: u64, + with_trie_data: bool, + ) { + let dir = tempdir_path(); + let store = Arc::new(MdbxProofsStorage::new(dir.as_path()).expect("env")); + init_storage(store.clone()); + + let (ctx, handle) = + reth_exex_test_utils::test_exex_context().await.expect("exex test context"); + let provider = ctx.components.provider.clone(); + let pruner = OpProofStoragePruner::new(store.clone(), provider.clone(), 20); + // The test context's EVM config is a no-op that cannot execute blocks. + let engine_handle = EngineHandle::spawn_with_thresholds( + reth_evm_ethereum::EthEvmConfig::mainnet(), + provider.clone(), + store.clone(), + pruner, + 1, + 2, + ); + let exex = OpProofsExEx::builder(ctx, store.clone()) + .with_proofs_history_window(20) + .with_verification_interval(verification_interval) + .build(); + + // reth's canonical block 1 is the notification's block, whose header's state root is not + // the one execution produces. Executing it again would fail the same way, so the failure + // stops the ExEx. + let block = mk_block(1); + make_canonical(&handle, &provider, &block); + let chain = if with_trie_data { + mk_chain_with_updates(1, 1, None) + } else { + mk_chain_without_updates(1, 1) + }; + let notif = ExExNotification::ChainCommitted { new: Arc::new(chain) }; + let err = exex + .handle_notification(notif, &engine_handle) + .expect_err("a failed block reth still has should stop the ExEx"); + assert!(err.to_string().contains("State root mismatch for block 1"), "{err:#}"); + + engine_handle.flush(); + let latest = + store.provider_ro().expect("provider ro").get_latest_block().expect("get").number; + assert_eq!(latest, 0); + } + #[tokio::test] async fn handle_notification_schedules_async_on_gap() { // MDBX proofs storage diff --git a/rust/op-reth/crates/flashblocks/Cargo.toml b/rust/op-reth/crates/flashblocks/Cargo.toml index 1577c25f504..85a0f2128c5 100644 --- a/rust/op-reth/crates/flashblocks/Cargo.toml +++ b/rust/op-reth/crates/flashblocks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-flashblocks" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/hardforks/Cargo.toml b/rust/op-reth/crates/hardforks/Cargo.toml index 2d8a23eeab5..ed42a322bee 100644 --- a/rust/op-reth/crates/hardforks/Cargo.toml +++ b/rust/op-reth/crates/hardforks/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-forks" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/hardforks/src/lib.rs b/rust/op-reth/crates/hardforks/src/lib.rs index 7d15cadc1d2..13ab39e3844 100644 --- a/rust/op-reth/crates/hardforks/src/lib.rs +++ b/rust/op-reth/crates/hardforks/src/lib.rs @@ -23,7 +23,7 @@ use alloy_primitives::U256; use once_cell::sync::Lazy as LazyLock; use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition, Hardfork}; -/// UPSTREAM-MIRROR(set): reth@rev:0fbe428 `reth_ethereum_forks::DEV_HARDFORKS` +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_ethereum_forks::DEV_HARDFORKS` /// /// Mirrors reth's dev hardfork list with OP forks interleaved. Upstream includes an explicit /// Osaka entry; this list activates those semantics through Karst instead. Re-diff every L1 diff --git a/rust/op-reth/crates/node/Cargo.toml b/rust/op-reth/crates/node/Cargo.toml index 634692d9de3..3b2ae956567 100644 --- a/rust/op-reth/crates/node/Cargo.toml +++ b/rust/op-reth/crates/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-node" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true @@ -89,8 +89,6 @@ alloy-genesis = { workspace = true, optional = true } serde_json = { workspace = true, optional = true } [dev-dependencies] -reth-basic-payload-builder.workspace = true -reth-node-metrics.workspace = true reth-optimism-node = { workspace = true, features = ["test-utils"] } reth-db = { workspace = true, features = ["test-utils"] } reth-db-common.workspace = true diff --git a/rust/op-reth/crates/node/src/node.rs b/rust/op-reth/crates/node/src/node.rs index a26277892f4..9a64e0c3b6b 100644 --- a/rust/op-reth/crates/node/src/node.rs +++ b/rust/op-reth/crates/node/src/node.rs @@ -39,6 +39,7 @@ use reth_node_builder::{ RethRpcMiddleware, RethRpcServerHandles, RpcAddOns, RpcContext, RpcHandle, }, }; +use reth_node_core::args::RpcStateCacheArgs; use reth_optimism_chainspec::{OpChainSpec, OpHardfork}; use reth_optimism_consensus::OpBeaconConsensus; use reth_optimism_evm::{ConfigurePostExecEvm, OpEvmConfig, OpRethReceiptBuilder}; @@ -396,10 +397,19 @@ impl OpNode { } /// Launches an OP node, optionally installing proof history, then waits for it to exit. +/// +/// Fails if the engine config enables state masking, which op-reth does not support. pub async fn launch_node( builder: WithLaunchContext>, node: OpNode, ) -> eyre::Result<(), ErrReport> { + // op-reth's CLI already defaults masking to 0 and rejects nonzero values; this catches + // callers that build a `NodeConfig` without that CLI. + eyre::ensure!( + builder.config().engine.num_state_masking_blocks() == 0, + "--engine.num-state-masking-blocks must be 0 on op-reth: state masking is not supported" + ); + let builder = if node.args.proofs_history { // Defaults to `/historical-proofs` when not supplied — see // [`ProofsHistoryStorageArgs::resolve_storage_path`]. @@ -776,10 +786,54 @@ where /// RPC methods an OP node does not serve, on any transport. /// -/// Upstream installs `eth_getMultiProof` by default, no OP user has asked for it, and a -/// proofs-history node could not answer it consistently from its pruned state window. Drop an -/// entry from this list once there is a user for the method. -const UNSERVED_RPC_METHODS: &[&str] = &["eth_getMultiProof"]; +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_rpc_eth_api::EthApi` +/// +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_rpc_api::DebugApi` +/// +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_rpc_api::EngineEthApi` +/// +/// Upstream installs these methods as part of the full `eth` and `debug` APIs, and the auth-port +/// `eth` namespace. +/// `eth_getMultiProof` has no OP users and a proofs-history node could not answer it consistently +/// from its pruned state window. The block access list methods are explicitly disabled because OP +/// execution data does not carry EIP-7928 BALs and reconstruction has not been tested against +/// OP-specific state transitions. Do not expose them until that behavior is tested; re-check this +/// list whenever upstream changes the `EthApi`, `DebugApi` or `EngineEthApi` method set. +const UNSERVED_RPC_METHODS: &[&str] = &[ + "eth_getMultiProof", + "eth_getBlockAccessListByBlockHash", + "eth_getBlockAccessListByBlockNumber", + "eth_getBlockAccessList", + "eth_getBlockAccessListRaw", + "debug_getRawBlockAccessList", +]; + +/// Rejects the RPC cache options that compute EIP-7928 block access lists by re-executing blocks. +/// +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_node_core::args::RpcStateCacheArgs` +/// +/// Upstream replays every new canonical block to compute its BAL with `--rpc-cache.prewarm-bals` +/// until a block carries a `block_access_list_hash`, which OP blocks never do, and transaction +/// tracing positions its replay state from computed BALs cached with +/// `--rpc-cache.cache-computed-bals`. Both rely on the BAL reconstruction that +/// [`UNSERVED_RPC_METHODS`] withholds, so an OP node refuses to start with either. The other +/// block access list options only tune BAL handling that OP blocks never trigger. +/// +/// op-reth's CLI already rejects every block access list option (`DENIED_ARGS` in +/// `reth-optimism-cli`), and these two have no environment variable, so this check only fires for +/// code that builds a `NodeConfig` without that CLI. Add new upstream BAL flags to `DENIED_ARGS`, +/// and here too if they re-execute blocks or feed tracing. +fn ensure_no_computed_bals(cache: &RpcStateCacheArgs) -> eyre::Result<()> { + eyre::ensure!( + cache.prewarm_bals.is_none(), + "--rpc-cache.prewarm-bals is not supported on OP chains: OP blocks carry no EIP-7928 block access lists" + ); + eyre::ensure!( + !cache.cache_computed_bals, + "--rpc-cache.cache-computed-bals is not supported on OP chains: OP blocks carry no EIP-7928 block access lists" + ); + Ok(()) +} /// Removes [`UNSERVED_RPC_METHODS`] from the http/ws/ipc modules and from the auth module. fn remove_unserved_rpc_methods(modules: &mut TransportRpcModules, auth_module: &mut AuthRpcModule) { @@ -820,6 +874,8 @@ where self, ctx: reth_node_api::AddOnsContext<'_, N>, ) -> eyre::Result { + ensure_no_computed_bals(&ctx.config.rpc.rpc_state_cache)?; + let Self { rpc_add_ons, da_config, @@ -1900,6 +1956,33 @@ mod tests { assert!(UNSERVED_RPC_METHODS.contains(&"eth_getMultiProof")); } + #[test] + fn block_access_list_methods_are_unserved() { + for method in [ + "eth_getBlockAccessListByBlockHash", + "eth_getBlockAccessListByBlockNumber", + "eth_getBlockAccessList", + "eth_getBlockAccessListRaw", + "debug_getRawBlockAccessList", + ] { + assert!(UNSERVED_RPC_METHODS.contains(&method), "{method} is served"); + } + } + + #[test] + fn computed_bal_cache_options_are_rejected() { + ensure_no_computed_bals(&RpcStateCacheArgs::default()).unwrap(); + + for prewarm_bals in [0, 64] { + let cache = + RpcStateCacheArgs { prewarm_bals: Some(prewarm_bals), ..Default::default() }; + assert!(ensure_no_computed_bals(&cache).is_err(), "prewarm {prewarm_bals} accepted"); + } + + let cache = RpcStateCacheArgs { cache_computed_bals: true, ..Default::default() }; + assert!(ensure_no_computed_bals(&cache).is_err()); + } + #[test] fn unserved_methods_are_removed_from_every_transport() { let mut modules = TransportRpcModules::default() diff --git a/rust/op-reth/crates/node/tests/it/main.rs b/rust/op-reth/crates/node/tests/it/main.rs index ae2d4c4c9d4..e6aa471c047 100644 --- a/rust/op-reth/crates/node/tests/it/main.rs +++ b/rust/op-reth/crates/node/tests/it/main.rs @@ -20,6 +20,4 @@ mod estimate_gas_7825; mod p2p_version; -mod payload_handoff; - const fn main() {} diff --git a/rust/op-reth/crates/node/tests/it/p2p_version.rs b/rust/op-reth/crates/node/tests/it/p2p_version.rs index 09983fe1b0e..c61d64a2642 100644 --- a/rust/op-reth/crates/node/tests/it/p2p_version.rs +++ b/rust/op-reth/crates/node/tests/it/p2p_version.rs @@ -11,10 +11,10 @@ use reth_rpc_api::servers::AdminApiServer; use std::time::Duration; use tokio::time::{sleep, timeout}; -const EXPECTED_ETH_VERSION: u64 = 69; +const EXPECTED_ETH_VERSION: u64 = 71; #[tokio::test] -async fn peers_negotiate_eth_69() -> eyre::Result<()> { +async fn peers_negotiate_eth_71() -> eyre::Result<()> { // This test intermittently segfaults during teardown, after the body below has // passed (ethereum-optimism/optimism#20973). The handler outlives the body, so it // reports the faulting thread and stack when that happens. diff --git a/rust/op-reth/crates/node/tests/it/payload_handoff.rs b/rust/op-reth/crates/node/tests/it/payload_handoff.rs deleted file mode 100644 index d37d86dc1ed..00000000000 --- a/rust/op-reth/crates/node/tests/it/payload_handoff.rs +++ /dev/null @@ -1,382 +0,0 @@ -//! Real OP payload jobs must not stop Engine API traffic while persistence hands off its overlay. - -use alloy_genesis::Genesis; -use alloy_primitives::B256; -use alloy_rpc_types_engine::{ForkchoiceState, PayloadId, PayloadStatus}; -use jsonrpsee::{core::client::ClientT, rpc_params}; -use op_alloy_rpc_types_engine::OpExecutionPayloadEnvelopeV3; -use reth_basic_payload_builder::{ - BuildArguments, BuildOutcome, HeaderForPayload, MissingPayloadBehaviour, PayloadBuilder, - PayloadConfig, -}; -use reth_chainspec::EthChainSpec; -use reth_e2e_test_utils::{transaction::TransactionTestContext, wallet::Wallet}; -use reth_node_api::PayloadAttributes; -use reth_node_builder::{ - BuilderContext, FullNodeTypes, Node, NodeBuilder, NodeConfig, - components::{BasicPayloadServiceBuilder, PayloadBuilderBuilder}, -}; -use reth_node_metrics::recorder::install_prometheus_recorder; -use reth_optimism_chainspec::OpChainSpecBuilder; -use reth_optimism_node::{OpNode, utils::optimism_payload_attributes}; -use reth_payload_builder::{PayloadBuilderError, PayloadKind}; -use reth_provider::{BlockNumReader, ChainSpecProvider, DatabaseProviderFactory}; -use reth_tasks::Runtime; -use reth_transaction_pool::TransactionPool; -use std::{future::Future, process::Command, sync::Arc, time::Duration}; -use tokio::sync::{mpsc, oneshot}; - -const GUARD: Duration = Duration::from_secs(20); -const ABANDONED_TIMESTAMP: u64 = 5; - -/// Dropping this also releases the worker, including when an assertion fails. -#[derive(Debug)] -struct BuildGate { - id: PayloadId, - release: oneshot::Sender<()>, - finished: oneshot::Receiver, -} - -impl BuildGate { - async fn release(self) { - let _ = self.release.send(()); - assert!(guard("cancelled worker did not finish", self.finished).await.unwrap()); - } -} - -/// Decorates the real builder, without replacing any build result or lease management. -#[derive(Clone, Debug)] -struct GatedBuilder { - inner: B, - entered: mpsc::UnboundedSender, -} - -impl PayloadBuilder for GatedBuilder { - type Attributes = B::Attributes; - type BuiltPayload = B::BuiltPayload; - - fn try_build( - &self, - args: BuildArguments, - ) -> Result, PayloadBuilderError> { - // Let the first attempt produce a real best payload. Hold its replacement attempt so - // normal getPayload can return that best payload while the detached worker still owns - // the BasicPayloadJob lease. The abandoned job instead stalls on its first attempt. - let finished = (args.best_payload.is_some() || - args.config.attributes.timestamp() == ABANDONED_TIMESTAMP) - .then(|| { - let (release, wait) = oneshot::channel(); - let (finished, done) = oneshot::channel(); - let gate = BuildGate { id: args.config.payload_id(), release, finished: done }; - if self.entered.send(gate).is_ok() { - let _ = wait.blocking_recv(); - } - finished - }); - let cancelled = args.cancel.is_cancelled(); - let result = self.inner.try_build(args); - if let Some(finished) = finished { - let _ = finished.send(cancelled); - } - result - } - - fn on_missing_payload( - &self, - args: BuildArguments, - ) -> MissingPayloadBehaviour { - self.inner.on_missing_payload(args) - } - - fn build_empty_payload( - &self, - config: PayloadConfig>, - ) -> Result { - self.inner.build_empty_payload(config) - } -} - -struct GatedBuilderFactory { - inner: B, - entered: mpsc::UnboundedSender, -} - -impl PayloadBuilderBuilder for GatedBuilderFactory -where - N: FullNodeTypes, - Pool: TransactionPool, - Evm: Send, - B: PayloadBuilderBuilder, -{ - type PayloadBuilder = GatedBuilder; - - async fn build_payload_builder( - self, - ctx: &BuilderContext, - pool: Pool, - evm: Evm, - ) -> eyre::Result { - Ok(GatedBuilder { - inner: self.inner.build_payload_builder(ctx, pool, evm).await?, - entered: self.entered, - }) - } -} - -async fn guard(message: &str, future: impl Future) -> T { - tokio::time::timeout(GUARD, future).await.unwrap_or_else(|_| panic!("{message}")) -} - -async fn wait_until(message: &str, mut ready: impl FnMut() -> bool) { - guard(message, async { - while !ready() { - tokio::task::yield_now().await; - } - }) - .await; -} - -fn persistence_completions() -> u64 { - // This histogram is recorded by EngineApiTreeHandler::finish_persistence, not the disk - // writer. Once observed, the engine must pass through its active-build handoff branch - // before it can receive another request. Disk height alone cannot establish that ordering. - install_prometheus_recorder() - .handle() - .render() - .lines() - .find_map(|line| { - line.strip_prefix("reth_consensus_engine_beacon_persistence_duration_count ") - .map(|count| count.parse().unwrap()) - }) - .unwrap_or_default() -} - -#[test] -fn pending_handoff_keeps_engine_responsive_and_drains() { - // Metrics handles are cached globally upstream. A fresh process makes the rendezvous - // specific to this node, even under cargo test with other node tests running concurrently. - const CHILD: &str = "OP_RETH_HANDOFF_TEST_CHILD"; - if std::env::var_os(CHILD).is_none() { - let output = Command::new(std::env::current_exe().unwrap()) - .args([ - "--exact", - "payload_handoff::pending_handoff_keeps_engine_responsive_and_drains", - "--nocapture", - ]) - .env(CHILD, "1") - .output() - .unwrap(); - assert!( - output.status.success(), - "handoff regression failed: {}\n{}\n{}", - output.status, - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr), - ); - return; - } - - super::crash_backtrace::install(); - // Also bound startup/teardown: a blocked OS worker can outlive Tokio's async timeout. - let (_watchdog, watchdog_rx) = std::sync::mpsc::channel::<()>(); - std::thread::spawn(move || { - if matches!( - watchdog_rx.recv_timeout(Duration::from_secs(180)), - Err(std::sync::mpsc::RecvTimeoutError::Timeout) - ) { - eprintln!("handoff regression exceeded its process hang guard"); - std::process::exit(1); - } - }); - tokio::runtime::Builder::new_multi_thread() - .worker_threads(2) - .enable_all() - .build() - .unwrap() - .block_on(run_handoff_scenario()) - .unwrap(); -} - -async fn run_handoff_scenario() -> eyre::Result<()> { - let genesis: Genesis = serde_json::from_str(include_str!("../assets/genesis.json"))?; - let chain_spec = Arc::new( - OpChainSpecBuilder::optimism_sepolia().genesis(genesis).ecotone_activated().build(), - ); - let wallet = Wallet::default().with_chain_id(chain_spec.chain_id()); - let mut config = NodeConfig::test().map_chain(chain_spec).with_unused_ports(); - config.network.discovery.discv5_port = Some(0); - config.network.discovery.discv5_port_ipv6 = Some(0); - config.engine.persistence_threshold = 0; - config.engine.memory_block_buffer_target = Some(0); - config.engine.num_state_masking_blocks = 0; - config.engine.suppress_persistence_during_build = false; - config.builder.interval = Duration::from_millis(1); - config.builder.deadline = Duration::from_secs(300); - // Four overlapping replacement attempts and one abandoned first attempt. - config.builder.max_payload_tasks = 8; - - let (entered, mut gates) = mpsc::unbounded_channel(); - let op_node = OpNode::default(); - let node = NodeBuilder::new(config) - .testing_node(Runtime::test()) - .with_types::() - .with_components(op_node.components().payload(BasicPayloadServiceBuilder::new( - GatedBuilderFactory { inner: op_node.payload_builder(), entered }, - ))) - .with_add_ons(op_node.add_ons()) - .launch() - .await? - .node; - let engine = &node.add_ons_handle.beacon_engine_handle; - let client = node.auth_server_handle().http_client(); - let memory = node.provider.canonical_in_memory_state(); - let disk_height = || node.provider.database_provider_ro().unwrap().last_block_number().unwrap(); - let handed_off_height = || memory.get_persisted_num_hash().map_or(0, |block| block.number); - let mut head = node.provider.chain_spec().genesis_hash(); - let mut held = Vec::new(); - - for number in 1..=4 { - let mut attrs = optimism_payload_attributes(number); - attrs.0.transactions = Some(vec![ - TransactionTestContext::optimism_l1_block_info_tx( - wallet.chain_id, - wallet.inner.clone(), - number - 1, - ) - .await, - ]); - let fcu = guard( - "FCU blocked behind a payload worker's persisted handoff", - engine.fork_choice_updated(ForkchoiceState::same_hash(head), Some(attrs)), - ) - .await?; - assert!(fcu.payload_status.is_valid()); - let id = fcu.payload_id.unwrap(); - let gate = guard("replacement build did not enter its gate", gates.recv()).await.unwrap(); - assert_eq!(gate.id, id); - held.push(gate); - - // Exercise the normal authenticated getPayload RPC, not a fabricated build outcome. - let payload: OpExecutionPayloadEnvelopeV3 = guard( - "getPayload waited for the replacement worker instead of returning the best payload", - client.request("engine_getPayloadV3", rpc_params![id]), - ) - .await?; - assert_eq!(payload.execution_payload.payload_inner.payload_inner.block_number, number); - head = payload.execution_payload.payload_inner.payload_inner.block_hash; - let status: PayloadStatus = guard( - "newPayload blocked behind a payload worker's persisted handoff", - client.request( - "engine_newPayloadV3", - rpc_params![ - payload.execution_payload, - Vec::::new(), - payload.parent_beacon_block_root - ], - ), - ) - .await?; - assert!(status.is_valid()); - let fcu = guard( - "canonical FCU blocked behind a payload worker's persisted handoff", - engine.fork_choice_updated(ForkchoiceState::same_hash(head), None), - ) - .await?; - assert!(fcu.payload_status.is_valid()); - - if number == 1 { - wait_until("engine did not observe persistence completion", || { - persistence_completions() > 0 - }) - .await; - } - assert_eq!(disk_height(), 1, "a pending handoff must retain its persistence frontier"); - assert_eq!(handed_off_height(), 0, "live worker leases must protect the old overlay"); - } - - // Abandon a first attempt with no best payload. Dropping resolve_kind's response receiver - // cancels the real service job; it cannot cancel the detached blocking worker's lease. - let attrs = optimism_payload_attributes(ABANDONED_TIMESTAMP); - let id = guard( - "FCU could not start the abandoned build", - engine.fork_choice_updated(ForkchoiceState::same_hash(head), Some(attrs)), - ) - .await? - .payload_id - .unwrap(); - let abandoned = guard("abandoned worker did not enter its gate", gates.recv()).await.unwrap(); - assert_eq!(abandoned.id, id); - drop(node.payload_builder_handle.resolve_kind(id, PayloadKind::Earliest)); - assert!( - guard( - "cancelled job remained in the payload service", - node.payload_builder_handle.payload_timestamp(id) - ) - .await - .is_none() - ); - abandoned.release().await; - - // Drain newer workers first. The oldest detached worker must still protect the handoff. - while held.len() > 1 { - held.pop().unwrap().release().await; - } - assert_eq!(disk_height(), 1); - assert_eq!(handed_off_height(), 0); - held.pop().unwrap().release().await; - wait_until("finite payload workload never released persistence", || { - disk_height() == 4 && handed_off_height() == 4 - }) - .await; - - // A new build after the drain must use the caught-up provider and persist normally too. - let mut attrs = optimism_payload_attributes(6); - attrs.0.transactions = Some(vec![ - TransactionTestContext::optimism_l1_block_info_tx(wallet.chain_id, wallet.inner.clone(), 4) - .await, - ]); - let id = guard( - "FCU did not recover after leases drained", - engine.fork_choice_updated(ForkchoiceState::same_hash(head), Some(attrs)), - ) - .await? - .payload_id - .unwrap(); - let gate = guard("post-handoff worker did not enter its gate", gates.recv()).await.unwrap(); - assert_eq!(gate.id, id); - let payload: OpExecutionPayloadEnvelopeV3 = guard( - "post-handoff getPayload stalled", - client.request("engine_getPayloadV3", rpc_params![id]), - ) - .await?; - gate.release().await; - assert_eq!(payload.execution_payload.payload_inner.payload_inner.block_number, 5); - head = payload.execution_payload.payload_inner.payload_inner.block_hash; - let status: PayloadStatus = guard( - "post-handoff newPayload stalled", - client.request( - "engine_newPayloadV3", - rpc_params![ - payload.execution_payload, - Vec::::new(), - payload.parent_beacon_block_root - ], - ), - ) - .await?; - assert!(status.is_valid()); - assert!( - guard( - "post-handoff canonical FCU stalled", - engine.fork_choice_updated(ForkchoiceState::same_hash(head), None), - ) - .await? - .payload_status - .is_valid() - ); - wait_until("post-handoff build never persisted", || { - disk_height() == 5 && handed_off_height() == 5 - }) - .await; - Ok(()) -} diff --git a/rust/op-reth/crates/node/tests/it/rpc.rs b/rust/op-reth/crates/node/tests/it/rpc.rs index 2bb4cc42b8c..749c38f94a3 100644 --- a/rust/op-reth/crates/node/tests/it/rpc.rs +++ b/rust/op-reth/crates/node/tests/it/rpc.rs @@ -4,19 +4,26 @@ use alloy_consensus::{SignableTransaction, TxEip1559}; use alloy_genesis::Genesis; use alloy_network::{TxSignerSync, eip2718::Encodable2718}; use alloy_primitives::{Address, Bytes, TxKind}; -use jsonrpsee::{RpcModule, server::ServerBuilder}; +use jsonrpsee::{ + RpcModule, + core::client::{ClientT, Error as ClientError}, + rpc_params, + server::ServerBuilder, + types::error::METHOD_NOT_FOUND_CODE, +}; use reth_chainspec::EthChainSpec; use reth_e2e_test_utils::wallet::Wallet; use reth_network::types::NatResolver; use reth_node_builder::{NodeBuilder, NodeHandle}; use reth_node_core::{ - args::{NetworkArgs, RpcServerArgs}, + args::{NetworkArgs, RpcServerArgs, RpcStateCacheArgs}, node_config::NodeConfig, }; use reth_optimism_chainspec::{OP_SEPOLIA, OpChainSpecBuilder}; use reth_optimism_node::{OpNode, args::RollupArgs}; use reth_rpc_api::{EthConfigApiClient, servers::AdminApiServer}; use reth_rpc_eth_api::helpers::EthTransactions; +use reth_rpc_server_types::RpcModuleSelection; use reth_tasks::Runtime; use reth_transaction_pool::TransactionPool; use std::sync::Arc; @@ -139,3 +146,85 @@ async fn test_eth_config_endpoint_exists() -> eyre::Result<()> { Ok(()) } + +/// Methods that re-execute a block to compute its EIP-7928 block access list. +const BLOCK_ACCESS_LIST_METHODS: [&str; 5] = [ + "eth_getBlockAccessListByBlockHash", + "eth_getBlockAccessListByBlockNumber", + "eth_getBlockAccessList", + "eth_getBlockAccessListRaw", + "debug_getRawBlockAccessList", +]; + +async fn assert_block_access_list_methods_unserved(client: &impl ClientT, transport: &str) { + for method in BLOCK_ACCESS_LIST_METHODS { + let res = client.request::(method, rpc_params![]).await; + match res { + Err(ClientError::Call(err)) if err.code() == METHOD_NOT_FOUND_CODE => {} + other => panic!("{method} is served over {transport}: {other:?}"), + } + } +} + +#[tokio::test] +async fn test_block_access_list_methods_unserved() -> eyre::Result<()> { + reth_tracing::init_test_tracing(); + + let exec = Runtime::test(); + let mut network_args = NetworkArgs::default().with_unused_ports(); + network_args.discovery.discv5_port = Some(0); + network_args.discovery.discv5_port_ipv6 = Some(0); + let node_config = + NodeConfig::test().map_chain(OP_SEPOLIA.clone()).with_network(network_args).with_rpc( + RpcServerArgs::default() + .with_unused_ports() + .with_http() + .with_http_api(RpcModuleSelection::All), + ); + + let NodeHandle { node, node_exit_future: _ } = + NodeBuilder::new(node_config).testing_node(exec).node(OpNode::default()).launch().await?; + let handles = node.add_ons_handle.rpc_server_handles(); + + assert_block_access_list_methods_unserved(&handles.rpc.http_client().unwrap(), "http").await; + assert_block_access_list_methods_unserved(&handles.auth.http_client(), "auth").await; + + Ok(()) +} + +#[tokio::test] +async fn test_computed_bal_cache_options_rejected() -> eyre::Result<()> { + reth_tracing::init_test_tracing(); + + let exec = Runtime::test(); + for (flag, cache) in [ + ( + "--rpc-cache.prewarm-bals", + RpcStateCacheArgs { prewarm_bals: Some(0), ..Default::default() }, + ), + ( + "--rpc-cache.cache-computed-bals", + RpcStateCacheArgs { cache_computed_bals: true, ..Default::default() }, + ), + ] { + let mut network_args = NetworkArgs::default().with_unused_ports(); + network_args.discovery.discv5_port = Some(0); + network_args.discovery.discv5_port_ipv6 = Some(0); + let mut rpc = RpcServerArgs::default().with_unused_ports().with_http(); + rpc.rpc_state_cache = cache; + let node_config = NodeConfig::test() + .map_chain(OP_SEPOLIA.clone()) + .with_network(network_args) + .with_rpc(rpc); + + let launched = NodeBuilder::new(node_config) + .testing_node(exec.clone()) + .node(OpNode::default()) + .launch() + .await; + let err = launched.err().unwrap_or_else(|| panic!("node launched with {flag}")); + assert!(err.to_string().contains(flag), "unexpected error for {flag}: {err:#}"); + } + + Ok(()) +} diff --git a/rust/op-reth/crates/payload/Cargo.toml b/rust/op-reth/crates/payload/Cargo.toml index 973e0658a26..a7ebfc9b484 100644 --- a/rust/op-reth/crates/payload/Cargo.toml +++ b/rust/op-reth/crates/payload/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-payload-builder" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/payload/src/lib.rs b/rust/op-reth/crates/payload/src/lib.rs index 3b1e5a6ddc2..ff2bc08fda0 100644 --- a/rust/op-reth/crates/payload/src/lib.rs +++ b/rust/op-reth/crates/payload/src/lib.rs @@ -84,7 +84,7 @@ where // `block_to_payload` and `From> for OpExecData` are // separate conversion paths to the same type. OP execution data does not // currently carry a BAL, so both paths intentionally discard it. - /// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_ethereum_engine_primitives::EthPayloadTypes::block_to_payload` /// /// Mirrors the upstream conversion while constructing OP execution data. diff --git a/rust/op-reth/crates/payload/src/payload.rs b/rust/op-reth/crates/payload/src/payload.rs index 4ec535e6e88..5eefa020e5b 100644 --- a/rust/op-reth/crates/payload/src/payload.rs +++ b/rust/op-reth/crates/payload/src/payload.rs @@ -449,7 +449,7 @@ impl BuiltPayload for OpBuiltPayload { } } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_ethereum_engine_primitives::EthBuiltPayload::into_execution_data` /// /// Counterpart to `OpPayloadTypes::block_to_payload`; the two conversion paths are kept diff --git a/rust/op-reth/crates/payload/src/validator.rs b/rust/op-reth/crates/payload/src/validator.rs index 9a41c8d3913..f03fc8abbe7 100644 --- a/rust/op-reth/crates/payload/src/validator.rs +++ b/rust/op-reth/crates/payload/src/validator.rs @@ -5,7 +5,7 @@ use alloy_consensus::Block; use derive_more::{Constructor, Deref}; use op_alloy_rpc_types_engine::{OpExecutionData, OpExecutionPayloadEnvelope, OpPayloadError}; use reth_optimism_forks::OpHardforks; -use reth_payload_validator::{cancun, prague, shanghai}; +use reth_payload_validator::{amsterdam, cancun, prague, shanghai}; use reth_primitives_traits::{Block as _, SealedBlock, SignedTransaction}; /// Execution payload validator. @@ -37,7 +37,7 @@ where } } -/// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_ethereum_payload_builder::validator::ensure_well_formed_payload` /// /// Copies upstream's ordered payload checks with OP payload fields and fork activation. @@ -90,5 +90,10 @@ where chain_spec.is_prague_active_at_timestamp(sealed_block.timestamp), )?; + amsterdam::ensure_well_formed_fields( + &sealed_block, + chain_spec.is_amsterdam_active_at_timestamp(sealed_block.timestamp), + )?; + Ok(sealed_block) } diff --git a/rust/op-reth/crates/post-exec-replay/Cargo.toml b/rust/op-reth/crates/post-exec-replay/Cargo.toml index 820e8cbdc1f..b4e557eb4ec 100644 --- a/rust/op-reth/crates/post-exec-replay/Cargo.toml +++ b/rust/op-reth/crates/post-exec-replay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-post-exec-replay" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/primitives/Cargo.toml b/rust/op-reth/crates/primitives/Cargo.toml index 937aea3efa8..14abe5209ff 100644 --- a/rust/op-reth/crates/primitives/Cargo.toml +++ b/rust/op-reth/crates/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-primitives" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/reth/Cargo.toml b/rust/op-reth/crates/reth/Cargo.toml index 98b48b5f92f..1778aad2921 100644 --- a/rust/op-reth/crates/reth/Cargo.toml +++ b/rust/op-reth/crates/reth/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-op" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/rpc/Cargo.toml b/rust/op-reth/crates/rpc/Cargo.toml index 1a59c2078cf..6b853be110b 100644 --- a/rust/op-reth/crates/rpc/Cargo.toml +++ b/rust/op-reth/crates/rpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-rpc" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true @@ -14,6 +14,7 @@ workspace = true [dependencies] # reth reth-basic-payload-builder.workspace = true +reth-errors.workspace = true reth-evm.workspace = true reth-primitives-traits.workspace = true reth-storage-api.workspace = true @@ -98,6 +99,7 @@ strum.workspace = true alloy-op-hardforks.workspace = true alloy-genesis.workspace = true reth-optimism-chainspec = { workspace = true, features = ["superchain-configs"] } +reth-optimism-evm = { workspace = true, features = ["rpc"] } rstest.workspace = true [features] diff --git a/rust/op-reth/crates/rpc/src/debug.rs b/rust/op-reth/crates/rpc/src/debug.rs index 71b5ffa426e..6e3ff58c827 100644 --- a/rust/op-reth/crates/rpc/src/debug.rs +++ b/rust/op-reth/crates/rpc/src/debug.rs @@ -231,7 +231,7 @@ where let state_provider = this .state_provider_factory - .state_provider(Some(BlockId::Hash(parent_hash.into()))) + .state_provider(BlockId::Hash(parent_hash.into())) .await .map_err(PayloadBuilderError::other)?; @@ -277,7 +277,7 @@ where let state_provider = this .state_provider_factory - .state_provider(Some(BlockId::Hash(block.parent_hash().into()))) + .state_provider(BlockId::Hash(block.parent_hash().into())) .await .map_err(EthApiError::from)?; let db = StateProviderDatabase::new(&state_provider); diff --git a/rust/op-reth/crates/rpc/src/engine.rs b/rust/op-reth/crates/rpc/src/engine.rs index 5d835449215..c9af7067d1e 100644 --- a/rust/op-reth/crates/rpc/src/engine.rs +++ b/rust/op-reth/crates/rpc/src/engine.rs @@ -19,7 +19,7 @@ use reth_storage_api::{BalProvider, BlockReader, HeaderProvider, StateProviderFa use reth_transaction_pool::TransactionPool; use tracing::{debug, trace}; -/// UPSTREAM-MIRROR(set): reth@rev:0fbe428 `reth_rpc_engine_api::capabilities::CAPABILITIES` +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_rpc_engine_api::capabilities::CAPABILITIES` /// /// Advertised capabilities must stay in step with the methods declared on [`OpEngineApi`]. /// The list of all supported Engine capabilities available over the engine endpoint. @@ -50,7 +50,7 @@ pub const OP_ENGINE_CAPABILITIES: &[&str] = &[ /// #[cfg_attr(not(feature = "client"), rpc(server, namespace = "engine"), server_bounds(Engine::PayloadAttributes: jsonrpsee::core::DeserializeOwned))] #[cfg_attr(feature = "client", rpc(server, client, namespace = "engine", client_bounds(Engine::PayloadAttributes: jsonrpsee::core::Serialize + Clone), server_bounds(Engine::PayloadAttributes: jsonrpsee::core::DeserializeOwned)))] -/// UPSTREAM-MIRROR(set): reth@rev:0fbe428 `reth_rpc_api::EngineApi` +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_rpc_api::EngineApi` /// /// Re-declares the engine RPC surface rather than extending upstream's trait. A method added /// upstream produces no diff here, so compare the method sets on each bump and update diff --git a/rust/op-reth/crates/rpc/src/eth/mod.rs b/rust/op-reth/crates/rpc/src/eth/mod.rs index 77b337d41b0..10454035b7e 100644 --- a/rust/op-reth/crates/rpc/src/eth/mod.rs +++ b/rust/op-reth/crates/rpc/src/eth/mod.rs @@ -14,7 +14,7 @@ use crate::{ eth::{receipt::OpReceiptConverter, transaction::OpTxInfoMapper}, }; use alloy_consensus::Header; -use alloy_primitives::U256; +use alloy_primitives::{Bloom, U256}; use alloy_rpc_types_eth::Filter; use eyre::WrapErr; use futures::StreamExt; @@ -28,7 +28,7 @@ use reth_node_api::{FullNodeComponents, FullNodeTypes, HeaderTy, NodeTypes}; use reth_node_builder::rpc::{EthApiBuilder, EthApiCtx}; use reth_optimism_evm::ConfigurePostExecEvm; use reth_optimism_flashblocks::{ - FlashBlockBuildInfo, FlashBlockCompleteSequence, FlashBlockCompleteSequenceRx, + FlashBlock, FlashBlockBuildInfo, FlashBlockCompleteSequence, FlashBlockCompleteSequenceRx, FlashBlockConsensusClient, FlashBlockRx, FlashBlockService, FlashblockCachedReceipt, FlashblocksListeners, PendingBlockRx, PendingFlashBlock, WsFlashBlockStream, }; @@ -43,7 +43,8 @@ use reth_rpc_eth_api::{ }, }; use reth_rpc_eth_types::{ - EthStateCache, FeeHistoryCache, GasPriceOracle, logs_utils::matching_block_logs_with_tx_hashes, + EthApiSettings, EthStateCache, FeeHistoryCache, GasPriceOracle, + logs_utils::matching_block_logs_with_tx_hashes, }; use reth_storage_api::ProviderHeader; use reth_tasks::{ @@ -63,6 +64,45 @@ use tracing::{info, warn}; /// Maximum duration to wait for a fresh flashblock when one is being built. const MAX_FLASHBLOCK_WAIT_DURATION: Duration = Duration::from_millis(50); +/// Returns the logs in `fb`'s receipts that match `filter`, attributed to block `block_number`. +fn flashblock_logs( + converter: &C, + filter: &Filter, + block_number: u64, + timestamp: u64, + fb: &FlashBlock, +) -> Vec> +where + C: RpcConvert>, +{ + let receipts = fb.metadata.receipts.iter().map(|(tx, receipt)| (*tx, receipt)); + + // A flashblock is a payload, not a sealed block: only the number, hash and timestamp the log + // fields need are known here, so the header handed to the converter carries exactly those. + // `matching_block_logs_with_tx_hashes` skips blocks whose logs bloom does not match the + // filter, so the bloom is set to all ones: the receipts are scanned right after, so a real + // bloom would save nothing and only cost hashing every log. Everything else is zeroed and + // must not be read. + let header = SealedHeader::new( + Header { + number: block_number, + timestamp, + logs_bloom: Bloom::repeat_byte(0xff), + ..Default::default() + }, + fb.diff.block_hash, + ); + + match matching_block_logs_with_tx_hashes(converter, filter, &header, receipts, false) { + Ok(logs) => logs, + // Unreachable with the current OP converter: `convert_log` always returns `Ok`. + Err(err) => { + warn!(target: "rpc::eth", %err, "failed to convert flashblock logs"); + Vec::new() + } + } +} + /// Adapter for [`EthApiInner`], which holds all the data required to serve core `eth_` API. pub type EthApiNodeBackend = EthApiInner; @@ -168,34 +208,13 @@ impl OpEthApi { return futures::future::ready(Some(Vec::new())); }; - let receipts = - fb.metadata.receipts.iter().map(|(tx, receipt)| (*tx, receipt)); - - // A flashblock is a payload, not a sealed block: only the number, - // hash and timestamp the log fields need are known here, so the header - // handed to the converter carries exactly those. Everything else is - // zeroed and must not be read. - let header = SealedHeader::new( - Header { number: block_number, timestamp, ..Default::default() }, - fb.diff.block_hash, - ); - - let all_logs = match matching_block_logs_with_tx_hashes( + futures::future::ready(Some(flashblock_logs( &converter, &filter, - &header, - receipts, - false, - ) { - Ok(logs) => logs, - // Unreachable with the current OP converter: `convert_log` always returns `Ok`. - Err(err) => { - warn!(target: "rpc::eth", %err, "failed to convert flashblock logs"); - Vec::new() - } - }; - - futures::future::ready(Some(all_logs)) + block_number, + timestamp, + &fb, + ))) }, ) .flat_map(futures::stream::iter) @@ -263,6 +282,10 @@ where type NetworkTypes = Rpc::Network; type RpcConvert = Rpc; + fn eth_api_settings(&self) -> &EthApiSettings { + self.inner.eth_api.eth_api_settings() + } + fn converter(&self) -> &Self::RpcConvert { self.inner.eth_api.converter() } @@ -417,6 +440,8 @@ where { } +// Upstream's `FullEthApi` requires this helper trait even when its RPC methods are not served. +// op-reth explicitly removes the untested BAL endpoints in `op-reth/crates/node/src/node.rs`. impl GetBlockAccessList for OpEthApi where N: RpcNodeCore, @@ -679,3 +704,54 @@ where )) } } + +#[cfg(test)] +mod tests { + use super::*; + use alloy_consensus::Receipt; + use alloy_primitives::{Address, B256, Log, LogData}; + use reth_optimism_chainspec::OP_MAINNET; + use reth_optimism_evm::{OpEvmConfig, tx::OpTxEnvConverter}; + use reth_optimism_primitives::OpPrimitives; + use reth_storage_api::noop::NoopProvider; + + const ADDRESS: Address = Address::repeat_byte(0xaa); + const TOPIC: B256 = B256::repeat_byte(0xbb); + + fn flashblock() -> FlashBlock { + let receipt = OpReceipt::Eip1559(Receipt { + status: true.into(), + cumulative_gas_used: 21_000, + logs: vec![Log { + address: ADDRESS, + data: LogData::new_unchecked(vec![TOPIC], Default::default()), + }], + }); + let mut fb = FlashBlock::default(); + fb.diff.block_hash = B256::repeat_byte(0x01); + fb.metadata.receipts.insert(B256::repeat_byte(0x02), receipt); + fb + } + + #[test] + fn flashblock_logs_match_address_and_topic_filters() { + let provider = NoopProvider::<_, OpPrimitives>::new(OP_MAINNET.clone()); + let converter = RpcConverter::::new(OpReceiptConverter::new( + provider.clone(), + )) + .with_mapper(OpTxInfoMapper::new(provider)) + .with_tx_env_converter(OpTxEnvConverter); + let fb = flashblock(); + + for filter in + [Filter::new(), Filter::new().address(ADDRESS), Filter::new().event_signature(TOPIC)] + { + let logs = flashblock_logs(&converter, &filter, 1, 2, &fb); + assert_eq!(logs.len(), 1, "filter {filter:?}"); + assert_eq!(logs[0].address(), ADDRESS); + } + + let unrelated = Filter::new().address(Address::repeat_byte(0xcc)); + assert!(flashblock_logs(&converter, &unrelated, 1, 2, &fb).is_empty()); + } +} diff --git a/rust/op-reth/crates/rpc/src/eth/proofs.rs b/rust/op-reth/crates/rpc/src/eth/proofs.rs index ec04f421257..8f1cc5e93e9 100644 --- a/rust/op-reth/crates/rpc/src/eth/proofs.rs +++ b/rust/op-reth/crates/rpc/src/eth/proofs.rs @@ -1,6 +1,9 @@ //! Historical proofs RPC server implementation. -use crate::{metrics::EthApiExtMetrics, state::OpStateProviderFactory}; +use crate::{ + metrics::EthApiExtMetrics, + state::{OpStateProviderFactory, ensure_within_proofs_window}, +}; use alloy_eips::BlockId; use alloy_primitives::Address; use alloy_rpc_types_eth::EIP1186AccountProofResponse; @@ -9,14 +12,16 @@ use async_trait::async_trait; use jsonrpsee::proc_macros::rpc; use jsonrpsee_core::RpcResult; use jsonrpsee_types::error::ErrorObject; +use reth_errors::RethError; use reth_optimism_trie::{OpProofsStorage, OpProofsStore}; use reth_provider::StateProofProvider; use reth_rpc_api::eth::helpers::FullEthApi; -use std::time::Instant; +use reth_rpc_eth_api::FromEthApiError; +use reth_rpc_eth_types::EthApiError; /// The `eth_` proof methods served from the historical proofs storage. /// -/// UPSTREAM-MIRROR(set): reth@rev:0fbe428 `reth_rpc_eth_api::EthApi` +/// UPSTREAM-MIRROR(set): reth@rev:8d359d0 `reth_rpc_eth_api::EthApi` /// /// Re-declares the proof methods that are answered from historical proofs rather than live state. /// A proof method added to upstream's `EthApi` produces no diff here, so diff the two method sets @@ -39,7 +44,8 @@ pub trait EthApiOverride { #[derive(Debug)] /// Overrides applied to the `eth_` namespace of the RPC API for historical proofs ExEx. pub struct EthApiExt { - state_provider_factory: OpStateProviderFactory, + eth_api: Eth, + preimage_store: OpProofsStorage

, metrics: EthApiExtMetrics, } @@ -51,11 +57,51 @@ where { /// Creates a new instance of the `EthApiExt`. pub fn new(eth_api: Eth, preimage_store: OpProofsStorage

) -> Self { - let metrics = EthApiExtMetrics::default(); - Self { - state_provider_factory: OpStateProviderFactory::new(eth_api, preimage_store), - metrics, - } + Self { eth_api, preimage_store, metrics: EthApiExtMetrics::default() } + } + + /// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 + /// `reth_rpc_eth_api::helpers::state::EthState::get_proof` + /// + /// Uses the OP proofs-history state provider while preserving upstream permit and blocking-task + /// behavior. Upstream's `ensure_within_proof_window` bounds the distance from the tip by + /// `max_proof_window`; a proofs-history node instead serves its proofs storage window. Unlike + /// upstream, which takes the permit first and then checks its window, this checks the window + /// before taking the permit, so out-of-window requests never wait for one. + async fn get_proof_inner( + &self, + address: Address, + keys: Vec, + block_id: BlockId, + ) -> Result { + ensure_within_proofs_window(&self.eth_api, &self.preimage_store, block_id) + .map_err(Eth::Error::from_eth_err)?; + + let permit = self + .eth_api + .acquire_owned_tracing() + .await + .map_err(RethError::other) + .map_err(EthApiError::Internal)?; + let preimage_store = self.preimage_store.clone(); + + self.eth_api + .spawn_blocking_io_fut(move |eth_api| async move { + // Hold the proof permit for the full lifetime of the blocking task, including + // after the requesting future is cancelled. + let _permit = permit; + let state_provider_factory = OpStateProviderFactory::new(eth_api, preimage_store); + let state = state_provider_factory + .state_provider(block_id) + .await + .map_err(Eth::Error::from_eth_err)?; + let storage_keys = keys.iter().map(|key| key.as_b256()).collect::>(); + let proof = state + .proof(Default::default(), address, &storage_keys) + .map_err(Eth::Error::from_eth_err)?; + Ok(proof.into_eip1186_response(keys)) + }) + .await } } @@ -72,32 +118,9 @@ where keys: Vec, block_number: Option, ) -> RpcResult { - let start = Instant::now(); - self.metrics.get_proof_requests.increment(1); - - let storage_keys = keys.iter().map(|key| key.as_b256()).collect::>(); - - let result = async { - let proof = self - .state_provider_factory - .state_provider(block_number) - .await - .map_err(Into::into)? - .proof(Default::default(), address, &storage_keys) - .map_err(Into::into)?; - - Ok(proof.into_eip1186_response(keys)) - } - .await; - - match &result { - Ok(_) => { - self.metrics.get_proof_latency.record(start.elapsed().as_secs_f64()); - self.metrics.get_proof_successful_responses.increment(1); - } - Err(_) => self.metrics.get_proof_failures.increment(1), - } - - result + self.metrics + .record_get_proof(self.get_proof_inner(address, keys, block_number.unwrap_or_default())) + .await + .map_err(Into::into) } } diff --git a/rust/op-reth/crates/rpc/src/eth/transaction.rs b/rust/op-reth/crates/rpc/src/eth/transaction.rs index 45e8ea0d328..56b7c183f6b 100644 --- a/rust/op-reth/crates/rpc/src/eth/transaction.rs +++ b/rust/op-reth/crates/rpc/src/eth/transaction.rs @@ -79,7 +79,7 @@ where Ok(hash) } - /// UPSTREAM-MIRROR(override): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(override): reth@rev:8d359d0 /// `reth_rpc_eth_api::helpers::EthTransactions::send_raw_transaction_sync` /// /// Derived from the upstream default: the timeout computation is taken verbatim and the @@ -171,7 +171,7 @@ where /// /// With flashblocks, we should also lookup the pending block for the transaction /// because this is considered confirmed/mined. - /// UPSTREAM-MIRROR(override): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(override): reth@rev:8d359d0 /// `reth_rpc_eth_api::helpers::EthTransactions::transaction_receipt` /// /// Extends the upstream default with a flashblock receipt lookup. @@ -208,7 +208,7 @@ where OpEthApiError: FromEvmError, Rpc: RpcConvert, { - /// UPSTREAM-MIRROR(override): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(override): reth@rev:8d359d0 /// `reth_rpc_eth_api::helpers::LoadTransaction::transaction_by_hash` /// /// Inserts a flashblock lookup between upstream's disk and pool lookups, and does not diff --git a/rust/op-reth/crates/rpc/src/metrics.rs b/rust/op-reth/crates/rpc/src/metrics.rs index 17ac94f6aa6..e478c87bceb 100644 --- a/rust/op-reth/crates/rpc/src/metrics.rs +++ b/rust/op-reth/crates/rpc/src/metrics.rs @@ -28,16 +28,38 @@ impl SequencerMetrics { #[metrics(scope = "optimism_rpc.eth_api_ext")] pub struct EthApiExtMetrics { /// How long it takes to handle a `eth_getProof` request successfully - pub(crate) get_proof_latency: Histogram, + get_proof_latency: Histogram, /// Total number of `eth_getProof` requests - pub(crate) get_proof_requests: Counter, + get_proof_requests: Counter, /// Total number of successful `eth_getProof` responses - pub(crate) get_proof_successful_responses: Counter, + get_proof_successful_responses: Counter, /// Total number of failures handling `eth_getProof` requests - pub(crate) get_proof_failures: Counter, + get_proof_failures: Counter, +} + +impl EthApiExtMetrics { + /// Records an `eth_getProof` request while preserving the existing metric semantics. + pub(crate) async fn record_get_proof(&self, f: F) -> Result + where + F: Future>, + { + let start = Instant::now(); + self.get_proof_requests.increment(1); + let result = f.await; + + match &result { + Ok(_) => { + self.get_proof_latency.record(start.elapsed().as_secs_f64()); + self.get_proof_successful_responses.increment(1); + } + Err(_) => self.get_proof_failures.increment(1), + } + + result + } } /// Types of debug apis diff --git a/rust/op-reth/crates/rpc/src/state.rs b/rust/op-reth/crates/rpc/src/state.rs index 90c2109a59b..577efa78508 100644 --- a/rust/op-reth/crates/rpc/src/state.rs +++ b/rust/op-reth/crates/rpc/src/state.rs @@ -2,7 +2,6 @@ use alloy_eips::BlockId; use derive_more::Constructor; -use jsonrpsee_types::error::ErrorObject; use reth_optimism_trie::{ OpProofsStorage, OpProofsStorageError, OpProofsStore, api::OpProofsProviderRO, provider::OpProofsStateProviderRef, @@ -20,51 +19,24 @@ pub struct OpStateProviderFactory { impl<'a, Eth, P> OpStateProviderFactory where - Eth: FullEthApi + Send + Sync + 'static, - ErrorObject<'static>: From, + Eth: FullEthApi + 'static, P: OpProofsStore + Clone + 'a, { /// Creates a state provider for the given block id. pub async fn state_provider( &'a self, - block_id: Option, + block_id: BlockId, ) -> ProviderResult> { - let block_id = block_id.unwrap_or_default(); - // Check whether the distance to the block exceeds the maximum configured window. - let block_number = self - .eth_api - .provider() - .block_number_for_id(block_id)? - .ok_or(EthApiError::HeaderNotFound(block_id)) - .map_err(ProviderError::other)?; - - // The proofs storage is canonical-only and is overlaid by block number, so a hash that - // names a non-canonical block would be served canonical state for its height. - if let BlockId::Hash(hash) = block_id && - self.eth_api.provider().block_hash(block_number)? != Some(hash.block_hash) - { - return Err(ProviderError::other(EthApiError::HeaderNotFound(block_id))); - } + let block_number = canonical_block_number(&self.eth_api, block_id)?; let historical_provider = self.eth_api.state_at_block_id(block_id).await.map_err(ProviderError::other)?; let provider_ro = self.preimage_store.provider_ro().map_err(ProviderError::from)?; - // An empty proof window is semantically equivalent to an out-of-window lookup for - // the proofs RPC: there's no proof for that block. Any other storage error is real - // and propagates up. - let window = match provider_ro.get_proof_window() { - Ok(w) => w, - Err(OpProofsStorageError::NoBlocksFound) => { - return Err(ProviderError::StateForNumberNotFound(block_number)); - } - Err(err) => return Err(ProviderError::from(err)), - }; - - if block_number < window.earliest.number || block_number > window.latest.number { - return Err(ProviderError::StateForNumberNotFound(block_number)); - } + // Check the window in the transaction the overlay reads from, so pruning cannot move it + // in between. + ensure_in_proof_window(&provider_ro, block_number)?; let external_overlay_provider = OpProofsStateProviderRef::new(historical_provider, provider_ro, block_number); @@ -72,3 +44,106 @@ where Ok(Box::new(external_overlay_provider)) } } + +/// Resolves `block_id` to a canonical block number inside the proofs storage window. +/// +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 +/// `reth_rpc_eth_api::helpers::state::EthState::ensure_within_proof_window` +/// +/// Stands in for upstream's check in the historical `eth_getProof` path. Both resolve the block +/// and reject an unknown one with `HeaderNotFound`. Upstream then bounds the distance from the tip +/// by `max_proof_window`; this instead requires a canonical block inside the proofs storage +/// window. On a bump, diff upstream's body for new conditions that should also apply here. +/// +/// Callers that serve a proof check this before taking a proof permit, so out-of-window requests +/// are rejected without holding a permit or a blocking-task slot. +/// [`OpStateProviderFactory::state_provider`] checks the window again in the transaction it +/// reads from, because pruning can move it in between. +pub fn ensure_within_proofs_window( + eth_api: &Eth, + preimage_store: &OpProofsStorage

, + block_id: BlockId, +) -> ProviderResult +where + Eth: FullEthApi, + P: OpProofsStore, +{ + let block_number = canonical_block_number(eth_api, block_id)?; + let provider_ro = preimage_store.provider_ro().map_err(ProviderError::from)?; + ensure_in_proof_window(&provider_ro, block_number)?; + Ok(block_number) +} + +/// Resolves `block_id` to a block number, rejecting a hash that names a non-canonical block. +fn canonical_block_number( + eth_api: &Eth, + block_id: BlockId, +) -> ProviderResult { + let block_number = eth_api + .provider() + .block_number_for_id(block_id)? + .ok_or(EthApiError::HeaderNotFound(block_id)) + .map_err(ProviderError::other)?; + + // The proofs storage is canonical-only and is overlaid by block number, so a hash that + // names a non-canonical block would be served canonical state for its height. + if let BlockId::Hash(hash) = block_id && + eth_api.provider().block_hash(block_number)? != Some(hash.block_hash) + { + return Err(ProviderError::other(EthApiError::HeaderNotFound(block_id))); + } + + Ok(block_number) +} + +/// Rejects a block outside the proofs storage window visible to `provider`. +fn ensure_in_proof_window( + provider: &impl OpProofsProviderRO, + block_number: u64, +) -> ProviderResult<()> { + // An empty proof window is semantically equivalent to an out-of-window lookup for the proofs + // RPC: there's no proof for that block. Any other storage error is real and propagates up. + let window = match provider.get_proof_window() { + Ok(w) => w, + Err(OpProofsStorageError::NoBlocksFound) => { + return Err(ProviderError::StateForNumberNotFound(block_number)); + } + Err(err) => return Err(ProviderError::from(err)), + }; + + if block_number < window.earliest.number || block_number > window.latest.number { + return Err(ProviderError::StateForNumberNotFound(block_number)); + } + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use alloy_eips::BlockNumHash; + use alloy_primitives::B256; + use reth_optimism_trie::{InMemoryProofsStorage, OpProofsInitProvider}; + + #[test] + fn proof_window_check_rejects_blocks_outside_the_stored_window() { + let storage = InMemoryProofsStorage::new(); + assert!(matches!( + ensure_in_proof_window(&storage.provider_ro().unwrap(), 10), + Err(ProviderError::StateForNumberNotFound(10)) + )); + + let init = storage.initialization_provider().unwrap(); + init.set_initial_state_anchor(BlockNumHash::new(10, B256::repeat_byte(1))).unwrap(); + init.commit_initial_state().unwrap(); + + let provider = storage.provider_ro().unwrap(); + ensure_in_proof_window(&provider, 10).unwrap(); + for block_number in [9, 11] { + assert!(matches!( + ensure_in_proof_window(&provider, block_number), + Err(ProviderError::StateForNumberNotFound(n)) if n == block_number + )); + } + } +} diff --git a/rust/op-reth/crates/storage/Cargo.toml b/rust/op-reth/crates/storage/Cargo.toml index 4543fa9d8b9..9802dc27871 100644 --- a/rust/op-reth/crates/storage/Cargo.toml +++ b/rust/op-reth/crates/storage/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-storage" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/trie/Cargo.toml b/rust/op-reth/crates/trie/Cargo.toml index 6f5295f0a04..2e896e40b74 100644 --- a/rust/op-reth/crates/trie/Cargo.toml +++ b/rust/op-reth/crates/trie/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-trie" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true @@ -13,12 +13,14 @@ workspace = true [dependencies] # reth +reth-chain-state.workspace = true reth-db = { workspace = true, features = ["mdbx"] } reth-evm.workspace = true reth-execution-errors.workspace = true reth-primitives-traits.workspace = true reth-provider.workspace = true reth-revm.workspace = true +reth-stages-types.workspace = true reth-trie = { workspace = true, features = ["serde"] } reth-trie-common = { workspace = true, features = ["serde"] } reth-trie-db.workspace = true @@ -83,6 +85,7 @@ serial_test.workspace = true [features] test-utils = [ + "reth-chain-state/test-utils", "reth-codecs/test-utils", "reth-db/test-utils", "reth-ethereum-primitives?/test-utils", @@ -93,7 +96,8 @@ test-utils = [ "reth-tasks/test-utils", "reth-trie/test-utils", "reth-trie-common/test-utils", - "reth-trie-db/test-utils" + "reth-trie-db/test-utils", + "reth-stages-types/test-utils" ] serde-bincode-compat = [ "reth-trie-common/serde-bincode-compat", diff --git a/rust/op-reth/crates/trie/src/db/store/backfill.rs b/rust/op-reth/crates/trie/src/db/store/backfill.rs index f99e34bb96a..6b55dce41d4 100644 --- a/rust/op-reth/crates/trie/src/db/store/backfill.rs +++ b/rust/op-reth/crates/trie/src/db/store/backfill.rs @@ -21,7 +21,7 @@ use alloy_eips::{BlockNumHash, eip1898::BlockWithParent}; use alloy_primitives::{B256, BlockNumber}; use reth_db::{ BlockNumberList, - cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW}, + cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, models::sharded_key::ShardedKey, table::Table, transaction::{DbTx, DbTxMut}, @@ -378,10 +378,6 @@ impl MdbxProofsProvider let mut count = 0u64; let mut cur = self.tx.cursor_dup_write::()?; for (hashed_address, nodes) in trie_updates.storage_tries_ref() { - if nodes.is_deleted && cur.seek_exact(*hashed_address)?.is_some() { - cur.delete_current_duplicates()?; - count += 1; - } for (nibbles, maybe_node) in nodes.storage_nodes_ref() { let subkey = StoredNibblesSubKey(*nibbles); let existing = cur @@ -434,10 +430,6 @@ impl MdbxProofsProvider let mut count = 0u64; let mut cur = self.tx.cursor_dup_write::()?; for (hashed_addr, storage) in hashed_post_state.account_storages() { - if storage.wiped && cur.seek_exact(*hashed_addr)?.is_some() { - cur.delete_current_duplicates()?; - count += 1; - } for (slot, value) in &storage.storage_slots { let existing = cur .seek_by_key_subkey(*hashed_addr, *slot)? diff --git a/rust/op-reth/crates/trie/src/db/store/snapshot_tests.rs b/rust/op-reth/crates/trie/src/db/store/snapshot_tests.rs index 823dfc91140..bc158db896a 100644 --- a/rust/op-reth/crates/trie/src/db/store/snapshot_tests.rs +++ b/rust/op-reth/crates/trie/src/db/store/snapshot_tests.rs @@ -552,7 +552,7 @@ fn write_update_snapshot_deletes_destroyed_account_leaf() { } #[test] -fn write_update_snapshot_wipes_all_storage_slots() { +fn write_update_snapshot_deletes_all_explicit_storage_slots() { let db = setup_db(); let old_anchor = anchor(10, 0x10); let new_anchor = anchor(9, 0x09); @@ -575,14 +575,17 @@ fn write_update_snapshot_wipes_all_storage_slots() { { let provider = MdbxProofsProvider::new(db.tx_mut().expect("rw")); let mut storages: B256Map = B256Map::default(); - storages.insert(addr, HashedStorageSorted { storage_slots: vec![], wiped: true }); + storages.insert( + addr, + HashedStorageSorted { storage_slots: vec![(slot_1, U256::ZERO), (slot_2, U256::ZERO)] }, + ); let sorted_post_state = HashedPostStateSorted::new(Vec::new(), storages); let diff = BlockStateDiff { sorted_trie_updates: TrieUpdates::default().into_sorted(), sorted_post_state, }; let counts = provider.update_snapshot(new_anchor, &diff).expect("update"); - assert_eq!(counts.hashed_storages_written_total, 1, "wipe counts once per address"); + assert_eq!(counts.hashed_storages_written_total, 2); OpProofsBackfillProvider::commit(provider).expect("commit"); } @@ -590,16 +593,16 @@ fn write_update_snapshot_wipes_all_storage_slots() { let mut cur = tx.cursor_dup_read::().expect("cur"); assert!( cur.seek_by_key_subkey(addr, slot_1).expect("seek").is_none_or(|e| e.key != slot_1), - "slot 1 must be wiped", + "slot 1 must be deleted", ); assert!( cur.seek_by_key_subkey(addr, slot_2).expect("seek").is_none_or(|e| e.key != slot_2), - "slot 2 must be wiped (delete_current_duplicates drops every dup, not just the first)", + "slot 2 must be deleted", ); } #[test] -fn write_update_snapshot_wipes_then_adds_slots_in_same_block() { +fn write_update_snapshot_deletes_then_adds_slots_in_same_block() { let db = setup_db(); let old_anchor = anchor(10, 0x10); let new_anchor = anchor(9, 0x09); @@ -631,8 +634,12 @@ fn write_update_snapshot_wipes_then_adds_slots_in_same_block() { storages.insert( addr, HashedStorageSorted { - storage_slots: vec![(slot_new_a, new_value_a), (slot_new_b, new_value_b)], - wiped: true, + storage_slots: vec![ + (slot_old_1, U256::ZERO), + (slot_old_2, U256::ZERO), + (slot_new_a, new_value_a), + (slot_new_b, new_value_b), + ], }, ); let sorted_post_state = HashedPostStateSorted::new(Vec::new(), storages); @@ -641,15 +648,14 @@ fn write_update_snapshot_wipes_then_adds_slots_in_same_block() { sorted_post_state, }; let counts = provider.update_snapshot(new_anchor, &diff).expect("update"); - // The wipe counts once + one per new slot. - assert_eq!(counts.hashed_storages_written_total, 3); + assert_eq!(counts.hashed_storages_written_total, 4); OpProofsBackfillProvider::commit(provider).expect("commit"); } let tx = db.tx().expect("ro"); let mut cur = tx.cursor_dup_read::().expect("cur"); - // Old slots are gone (wipe phase). + // Old slots are gone. assert!( cur.seek_by_key_subkey(addr, slot_old_1).expect("seek").is_none_or(|e| e.key != slot_old_1), "old slot 1 must be wiped", @@ -695,10 +701,7 @@ fn write_update_snapshot_deletes_zero_value_storage_slot() { { let provider = MdbxProofsProvider::new(db.tx_mut().expect("rw")); let mut storages: B256Map = B256Map::default(); - storages.insert( - addr, - HashedStorageSorted { storage_slots: vec![(slot, U256::ZERO)], wiped: false }, - ); + storages.insert(addr, HashedStorageSorted { storage_slots: vec![(slot, U256::ZERO)] }); let sorted_post_state = HashedPostStateSorted::new(Vec::new(), storages); let diff = BlockStateDiff { sorted_trie_updates: TrieUpdates::default().into_sorted(), @@ -720,7 +723,7 @@ fn write_update_snapshot_deletes_zero_value_storage_slot() { } #[test] -fn write_update_snapshot_deletes_storage_trie_when_is_deleted() { +fn write_update_snapshot_deletes_explicit_storage_trie_node() { let db = setup_db(); let old_anchor = anchor(10, 0x10); let new_anchor = anchor(9, 0x09); @@ -739,14 +742,15 @@ fn write_update_snapshot_deletes_storage_trie_when_is_deleted() { { let provider = MdbxProofsProvider::new(db.tx_mut().expect("rw")); let mut updates = TrieUpdates::default(); - let st = StorageTrieUpdates { is_deleted: true, ..Default::default() }; + let mut st = StorageTrieUpdates::default(); + st.removed_nodes.insert(path); updates.storage_tries.insert(addr, st); let diff = BlockStateDiff { sorted_trie_updates: updates.into_sorted(), sorted_post_state: HashedPostStateSorted::default(), }; let counts = provider.update_snapshot(new_anchor, &diff).expect("update"); - assert_eq!(counts.storage_trie_updates_written_total, 1, "is_deleted counts once"); + assert_eq!(counts.storage_trie_updates_written_total, 1); OpProofsBackfillProvider::commit(provider).expect("commit"); } @@ -756,7 +760,7 @@ fn write_update_snapshot_deletes_storage_trie_when_is_deleted() { cur.seek_by_key_subkey(addr, StoredNibblesSubKey(path)) .expect("seek") .is_none_or(|e| e.nibbles != StoredNibblesSubKey(path)), - "is_deleted must drop every storage-trie row under the address", + "the explicitly removed storage-trie node must be deleted", ); } diff --git a/rust/op-reth/crates/trie/src/db/store/tests.rs b/rust/op-reth/crates/trie/src/db/store/tests.rs index 73c4e0c7c42..d6a62a91569 100644 --- a/rust/op-reth/crates/trie/src/db/store/tests.rs +++ b/rust/op-reth/crates/trie/src/db/store/tests.rs @@ -689,7 +689,7 @@ fn store_trie_updates_deleted_storage_trie() { } #[test] -fn store_trie_updates_wiped_storage_trie_nodes() { +fn store_trie_updates_deleted_storage_trie_nodes() { let db = setup_db(); let addr_wiped = B256::from([0x10; 32]); @@ -710,11 +710,11 @@ fn store_trie_updates_wiped_storage_trie_nodes() { OpProofsInitProvider::commit(provider).expect("commit"); } - // Build diff that wipes addr_wiped's storage trie and adds a node for addr_live + // Delete addr_wiped's storage trie nodes and add a node for addr_live. let mut trie_updates = TrieUpdates::default(); - let mut wiped_updates = StorageTrieUpdates::default(); - wiped_updates.set_deleted(true); - trie_updates.storage_tries.insert(addr_wiped, wiped_updates); + let mut deleted_updates = StorageTrieUpdates::default(); + deleted_updates.removed_nodes.extend([p1, p2]); + trie_updates.storage_tries.insert(addr_wiped, deleted_updates); let live_path = Nibbles::from_nibbles_unchecked([0xEE, 0xFF]); let live_node = BranchNodeCompact::default(); @@ -744,7 +744,7 @@ fn store_trie_updates_wiped_storage_trie_nodes() { } #[test] -fn store_trie_updates_wiped_storage() { +fn store_trie_updates_deleted_storage() { let db = setup_db(); let addr = B256::from([0x55; 32]); @@ -762,9 +762,11 @@ fn store_trie_updates_wiped_storage() { OpProofsInitProvider::commit(provider).expect("commit"); } - // Build diff that wipes storage + // Delete both storage slots. let mut post_state = HashedPostState::default(); - post_state.storages.insert(addr, HashedStorage::new(true)); + post_state + .storages + .insert(addr, HashedStorage::from_iter([(s1, U256::ZERO), (s2, U256::ZERO)])); let diff = BlockStateDiff { sorted_trie_updates: TrieUpdates::default().into_sorted(), sorted_post_state: post_state.into_sorted(), @@ -796,7 +798,7 @@ fn store_trie_updates_wiped_storage() { } #[test] -fn store_trie_updates_wiped_and_non_wiped_mixed_order() { +fn store_trie_updates_deleted_and_live_mixed_order() { let db = setup_db(); let addr_wiped = B256::from([0x01; 32]); @@ -817,9 +819,9 @@ fn store_trie_updates_wiped_and_non_wiped_mixed_order() { OpProofsInitProvider::commit(provider).expect("commit"); } - // Build diff: wipe addr_wiped, update addr_live + // Delete addr_wiped's slot and update addr_live. let mut post_state = HashedPostState::default(); - post_state.storages.insert(addr_wiped, HashedStorage::new(true)); + post_state.storages.insert(addr_wiped, HashedStorage::from_iter([(ws1, U256::ZERO)])); let mut live_storage = HashedStorage::default(); live_storage.storage.insert(ls1, lv1_new); post_state.storages.insert(addr_live, live_storage); @@ -1790,10 +1792,9 @@ fn hashed_storages_no_duplicates_multiple_slots() { assert!(slots.iter().all(|(k, _)| *k != slot_b), "slot_b should be gone"); } -/// Regression: wipe followed by re-add in same block must leave exactly the -/// new slots, no ghosts from pre-wipe state. +/// Regression: deleting one slot while adding another must not leave duplicate entries. #[test] -fn hashed_storages_wipe_then_readd_no_duplicates() { +fn hashed_storages_delete_then_add_no_duplicates() { let db = setup_db(); let addr = B256::from([0xEE; 32]); @@ -1811,11 +1812,11 @@ fn hashed_storages_wipe_then_readd_no_duplicates() { assert_eq!(count_hashed_storage_entries(&db, addr), 1); - // Block 1: wipe + write new_slot + // Block 1: delete old_slot and write new_slot. { let mut post_state = HashedPostState::default(); - let mut storage = HashedStorage::new(true); // wiped = true - storage.storage.insert(new_slot, U256::from(42u64)); + let storage = + HashedStorage::from_iter([(old_slot, U256::ZERO), (new_slot, U256::from(42u64))]); post_state.storages.insert(addr, storage); let diff = BlockStateDiff { @@ -1825,16 +1826,15 @@ fn hashed_storages_wipe_then_readd_no_duplicates() { store_block(&db, make_block_ref(1, B256::repeat_byte(0x01), B256::ZERO), diff); } - // Exactly 1 entry: only new_slot, old_slot wiped + // Exactly 1 entry: only new_slot remains. let slots = collect_hashed_storage_slots(&db, addr); - assert_eq!(slots.len(), 1, "after wipe+add: exactly 1 entry"); + assert_eq!(slots.len(), 1, "after delete+add: exactly 1 entry"); assert_eq!(slots[0], (new_slot, U256::from(42u64))); - // Block 2: wipe + re-add the same new_slot with different value + // Block 2: update new_slot. { let mut post_state = HashedPostState::default(); - let mut storage = HashedStorage::new(true); - storage.storage.insert(new_slot, U256::from(84u64)); + let storage = HashedStorage::from_iter([(new_slot, U256::from(84u64))]); post_state.storages.insert(addr, storage); let diff = BlockStateDiff { @@ -1846,7 +1846,7 @@ fn hashed_storages_wipe_then_readd_no_duplicates() { // Still exactly 1 entry let slots = collect_hashed_storage_slots(&db, addr); - assert_eq!(slots.len(), 1, "after second wipe+add: exactly 1 entry"); + assert_eq!(slots.len(), 1, "after update: exactly 1 entry"); assert_eq!(slots[0], (new_slot, U256::from(84u64))); } diff --git a/rust/op-reth/crates/trie/src/db/store/write.rs b/rust/op-reth/crates/trie/src/db/store/write.rs index e6556acad35..aefa93e754a 100644 --- a/rust/op-reth/crates/trie/src/db/store/write.rs +++ b/rust/op-reth/crates/trie/src/db/store/write.rs @@ -184,51 +184,6 @@ fn append_storage_trie_entry( Ok(()) } -/// Snapshot all existing storage-trie nodes for `hashed_address` into the changeset and -/// collector, then delete them from the state table. -/// -/// Returns the set of nibble subkeys that were snapshotted so the caller can avoid -/// double-recording changeset entries for those nodes in the subsequent per-node loop. -/// -/// Used for the `is_deleted` (full-wipe) path in [`MdbxProofsProvider::write_storage_trie`]. -fn snapshot_and_wipe_storage_trie( - state_cursor: &mut ( - impl DbCursorRO - + DbDupCursorRO - + DbDupCursorRW - ), - cs_cursor: &mut impl DbDupCursorRW, - cs_key: BlockNumberHashedAddress, - collector: &mut HistoryCollector, -) -> OpProofsStorageResult> { - let hashed_address = cs_key.0.1; - let mut wiped_nibbles = BTreeSet::new(); - if let Some((_key, first_entry)) = state_cursor.seek_exact(hashed_address)? { - wiped_nibbles.insert(first_entry.nibbles.clone()); - append_storage_trie_entry( - cs_cursor, - cs_key, - first_entry.nibbles, - Some(first_entry.node), - collector, - )?; - while let Some((_, entry)) = state_cursor.next_dup()? { - wiped_nibbles.insert(entry.nibbles.clone()); - append_storage_trie_entry( - cs_cursor, - cs_key, - entry.nibbles, - Some(entry.node), - collector, - )?; - } - if state_cursor.seek_exact(hashed_address)?.is_some() { - state_cursor.delete_current_duplicates()?; - } - } - Ok(wiped_nibbles) -} - /// Write a single storage-trie node update: snapshot the old node into the changeset, /// record in the history collector, then apply the new value (upsert or delete). /// @@ -273,36 +228,6 @@ fn append_hashed_storage_entry( Ok(()) } -/// Snapshot all existing hashed-storage slots for `hashed_address` into the changeset and -/// collector, delete them from the state table, and return the set of slot keys that were wiped. -/// -/// Used for the `is_wiped` (full-wipe) path in [`MdbxProofsProvider::write_hashed_storages`]. -fn snapshot_and_wipe_hashed_storage( - state_cursor: &mut ( - impl DbCursorRO - + DbDupCursorRO - + DbDupCursorRW - ), - cs_cursor: &mut impl DbDupCursorRW, - cs_key: BlockNumberHashedAddress, - collector: &mut HistoryCollector, -) -> OpProofsStorageResult { - let hashed_address = cs_key.0.1; - let mut wiped_slots = alloy_primitives::map::B256Set::default(); - if let Some(entry) = state_cursor.seek_by_key_subkey(hashed_address, B256::ZERO)? { - append_hashed_storage_entry(cs_cursor, cs_key, entry, collector)?; - wiped_slots.insert(entry.key); - while let Some(entry) = state_cursor.next_dup_val()? { - append_hashed_storage_entry(cs_cursor, cs_key, entry, collector)?; - wiped_slots.insert(entry.key); - } - if state_cursor.seek_exact(hashed_address)?.is_some() { - state_cursor.delete_current_duplicates()?; - } - } - Ok(wiped_slots) -} - /// Write a single hashed-storage slot update: snapshot the old value into the changeset, /// record in the history collector, then apply the new value (upsert or delete). /// @@ -685,9 +610,6 @@ impl MdbxProofsProvider { } /// Write storage trie branch-node updates for one block. - /// - /// Handles the `is_deleted` wipe path (snapshot all existing nodes into - /// the changeset before clearing) as well as per-node updates. fn write_storage_trie( block_number: BlockNumber, updates: &TrieUpdatesSorted, @@ -700,48 +622,16 @@ impl MdbxProofsProvider { for (hashed_address, nodes) in updates.storage_tries_ref() { let cs_key = BlockNumberHashedAddress((block_number, *hashed_address)); - - if nodes.is_deleted { - let wiped_nibbles = - snapshot_and_wipe_storage_trie(state_cursor, cs_cursor, cs_key, collector)?; + for (nibbles, maybe_node) in nodes.storage_nodes_ref() { + write_storage_trie_node( + state_cursor, + cs_cursor, + cs_key, + StoredNibblesSubKey(*nibbles), + maybe_node, + collector, + )?; count += 1; - - // After a wipe the state table is empty for this address, so there is no - // old node to seek or delete. Nodes whose nibbles were already snapshotted - // above must not be recorded again (that would create conflicting duplicate - // changeset entries). Brand-new nibbles get a `None` old-value entry so - // that unwind knows to delete them. - for (nibbles, maybe_node) in nodes.storage_nodes_ref() { - let subkey = StoredNibblesSubKey(*nibbles); - if !wiped_nibbles.contains(&subkey) { - append_storage_trie_entry( - cs_cursor, - cs_key, - subkey.clone(), - None, - collector, - )?; - } - if let Some(node) = maybe_node { - state_cursor.upsert( - *hashed_address, - &StorageTrieEntry { nibbles: subkey, node: node.clone() }, - )?; - } - count += 1; - } - } else { - for (nibbles, maybe_node) in nodes.storage_nodes_ref() { - write_storage_trie_node( - state_cursor, - cs_cursor, - cs_key, - StoredNibblesSubKey(*nibbles), - maybe_node, - collector, - )?; - count += 1; - } } } Ok(count) @@ -787,9 +677,6 @@ impl MdbxProofsProvider { } /// Write hashed-storage updates for one block. - /// - /// Handles the `is_wiped` path (snapshot all existing slots into the - /// changeset before clearing) as well as per-slot updates. fn write_hashed_storages( block_number: BlockNumber, post_state: &HashedPostStateSorted, @@ -802,44 +689,16 @@ impl MdbxProofsProvider { for (hashed_address, storage) in &post_state.storages { let cs_key = BlockNumberHashedAddress((block_number, *hashed_address)); - - if storage.is_wiped() { - // Snapshot + wipe existing slots; track what was wiped so the - // new-slots loop below doesn't double-append changeset entries. - let wiped_slots = - snapshot_and_wipe_hashed_storage(state_cursor, cs_cursor, cs_key, collector)?; - - // Write new slots. Slots not seen during the wipe get a zero - // old-value entry in the changeset. - for (storage_key, value) in storage.storage_slots_ref() { - if !wiped_slots.contains(storage_key) { - append_hashed_storage_entry( - cs_cursor, - cs_key, - StorageEntry { key: *storage_key, value: U256::ZERO }, - collector, - )?; - } - if *value != U256::ZERO { - state_cursor.upsert( - *hashed_address, - &StorageEntry { key: *storage_key, value: *value }, - )?; - } - count += 1; - } - } else { - for (storage_key, value) in storage.storage_slots_ref() { - write_hashed_storage_slot( - state_cursor, - cs_cursor, - cs_key, - *storage_key, - *value, - collector, - )?; - count += 1; - } + for (storage_key, value) in storage.storage_slots_ref() { + write_hashed_storage_slot( + state_cursor, + cs_cursor, + cs_key, + *storage_key, + *value, + collector, + )?; + count += 1; } } Ok(count) diff --git a/rust/op-reth/crates/trie/src/engine/buffer/overlay.rs b/rust/op-reth/crates/trie/src/engine/buffer/overlay.rs index 74c30b43fcf..ffe8fca2874 100644 --- a/rust/op-reth/crates/trie/src/engine/buffer/overlay.rs +++ b/rust/op-reth/crates/trie/src/engine/buffer/overlay.rs @@ -10,8 +10,9 @@ use reth_provider::{ }; use reth_revm::db::BundleState; use reth_trie::{ - AccountProof, ExecutionWitnessMode, HashedPostState, HashedStorage, MultiProof, - MultiProofTargets, StorageMultiProof, TrieInput, updates::TrieUpdates, + AccountProof, DecodedMultiProofV2, ExecutionWitnessMode, HashedPostState, HashedStorage, + MultiProof, MultiProofTargets, MultiProofTargetsV2, StorageMultiProof, TrieInput, + updates::TrieUpdates, }; use std::{ fmt::Debug, @@ -97,16 +98,11 @@ where // Check buffer via trie_input cache let state = &self.trie_input().state; - // Check for storage updates or wipes in the overlay - if let Some(account_storage) = state.storages.get(&hashed_address) { - // Check specific slot - if let Some(value) = account_storage.storage.get(&hashed_slot) { - return Ok(Some(*value)); - } - // If the whole storage was wiped in the overlay (e.g. reused address), we return 0 - if account_storage.wiped { - return Ok(Some(StorageValue::ZERO)); - } + // Check for storage updates in the overlay + if let Some(account_storage) = state.storages.get(&hashed_address) && + let Some(value) = account_storage.storage.get(&hashed_slot) + { + return Ok(Some(*value)); } // Check if account was destroyed in the overlay (implicit storage wipe) @@ -220,6 +216,15 @@ where self.inner.multiproof(input, targets) } + fn multiproof_v2( + &self, + mut input: TrieInput, + targets: MultiProofTargetsV2, + ) -> ProviderResult { + input.prepend_self(self.trie_input().clone()); + self.inner.multiproof_v2(input, targets) + } + fn witness( &self, mut input: TrieInput, @@ -281,7 +286,7 @@ impl<'a, P> HashedPostStateProvider for MemoryOverlayOpProofsStateProviderRef<'a where P: OpProofsProviderRO + Clone, { - /// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_chain_state::MemoryOverlayStateProviderRef::hashed_post_state` /// /// Uses the OP proofs-buffer trie input instead of upstream's executed-block overlay. diff --git a/rust/op-reth/crates/trie/src/engine/canonical_state.rs b/rust/op-reth/crates/trie/src/engine/canonical_state.rs new file mode 100644 index 00000000000..6b9eb28aa7c --- /dev/null +++ b/rust/op-reth/crates/trie/src/engine/canonical_state.rs @@ -0,0 +1,31 @@ +//! Access to reth's canonical in-memory state for providers the engine is generic over. + +use reth_chain_state::CanonicalInMemoryState; +use reth_primitives_traits::NodePrimitives; +use reth_provider::{ + NodePrimitivesProvider, + noop::NoopProvider, + providers::{BlockchainProvider, ProviderNodeTypes}, +}; + +/// A type that provides access to the [`CanonicalInMemoryState`]. +/// +/// This exposes the canonical blocks that are not yet on disk, for example to read the execution +/// outcome of a block whose state is not yet persisted. +pub trait CanonicalInMemoryStateProvider: NodePrimitivesProvider + Send + Sync { + /// Returns a handle to the canonical in-memory state. + fn canonical_in_memory_state(&self) -> CanonicalInMemoryState; +} + +impl CanonicalInMemoryStateProvider for BlockchainProvider { + fn canonical_in_memory_state(&self) -> CanonicalInMemoryState { + // Resolves to the inherent method, which clones the provider's shared handle. + self.canonical_in_memory_state() + } +} + +impl CanonicalInMemoryStateProvider for NoopProvider { + fn canonical_in_memory_state(&self) -> CanonicalInMemoryState { + CanonicalInMemoryState::empty() + } +} diff --git a/rust/op-reth/crates/trie/src/engine/handle.rs b/rust/op-reth/crates/trie/src/engine/handle.rs index 354189abd22..9382163b293 100644 --- a/rust/op-reth/crates/trie/src/engine/handle.rs +++ b/rust/op-reth/crates/trie/src/engine/handle.rs @@ -1,7 +1,8 @@ //! [`EngineHandle`] — the public, cloneable, Send + Sync interface. use super::{ - DEFAULT_BACKPRESSURE_THRESHOLD, DEFAULT_PERSISTENCE_THRESHOLD, EngineAction, + CanonicalInMemoryStateProvider, DEFAULT_BACKPRESSURE_THRESHOLD, DEFAULT_PERSISTENCE_THRESHOLD, + EngineAction, error::EngineError, runner::Engine, service_guard::ServiceGuard, @@ -12,9 +13,7 @@ use alloy_eips::eip1898::BlockWithParent; use crossbeam_channel::{Sender, bounded}; use reth_evm::ConfigureEvm; use reth_primitives_traits::{NodePrimitives, RecoveredBlock}; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; use reth_trie_common::{HashedPostStateSorted, updates::TrieUpdatesSorted}; use std::{panic, sync::Arc, thread}; use tracing::error; @@ -40,9 +39,8 @@ impl EngineHandle where Evm: ConfigureEvm> + 'static, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader + Clone + 'static, @@ -70,9 +68,8 @@ impl EngineHandle where Evm: ConfigureEvm> + 'static, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/mod.rs b/rust/op-reth/crates/trie/src/engine/mod.rs index fc24a514588..30538dfcd8b 100644 --- a/rust/op-reth/crates/trie/src/engine/mod.rs +++ b/rust/op-reth/crates/trie/src/engine/mod.rs @@ -12,6 +12,9 @@ mod buffer; pub mod persistence; mod tasks; +mod canonical_state; +pub use canonical_state::CanonicalInMemoryStateProvider; + mod error; pub use error::EngineError; @@ -65,9 +68,8 @@ impl EngineAction { Primitives: reth_primitives_traits::NodePrimitives, >, Provider: reth_provider::BlockHashReader - + reth_provider::StateReader + + CanonicalInMemoryStateProvider + reth_provider::DatabaseProviderFactory - + reth_provider::StateProviderFactory + reth_provider::BlockReader + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/runner.rs b/rust/op-reth/crates/trie/src/engine/runner.rs index 1b5cf24eeed..fd6da2e2d8a 100644 --- a/rust/op-reth/crates/trie/src/engine/runner.rs +++ b/rust/op-reth/crates/trie/src/engine/runner.rs @@ -1,17 +1,14 @@ //! [`Engine`] — the thin event-loop dispatcher. use super::{ - DEFAULT_BACKPRESSURE_THRESHOLD, DEFAULT_PERSISTENCE_THRESHOLD, EngineAction, - IDLE_FLUSH_INTERVAL, error::EngineError, state::EngineState as State, + CanonicalInMemoryStateProvider, DEFAULT_BACKPRESSURE_THRESHOLD, DEFAULT_PERSISTENCE_THRESHOLD, + EngineAction, IDLE_FLUSH_INTERVAL, error::EngineError, state::EngineState as State, }; use crate::{OpProofStoragePruner, OpProofsStore}; use crossbeam_channel::Receiver; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, - TransactionVariant, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory, TransactionVariant}; use std::{ ops::ControlFlow, time::{Duration, Instant}, @@ -35,7 +32,7 @@ fn next_sync_backoff(current: Duration) -> Duration { pub(super) struct Engine where Evm: ConfigureEvm, - Provider: StateReader + DatabaseProviderFactory + StateProviderFactory + BlockReader, + Provider: CanonicalInMemoryStateProvider + DatabaseProviderFactory + BlockReader, { state: State, incoming: Receiver>>, @@ -49,9 +46,8 @@ impl Engine where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/state.rs b/rust/op-reth/crates/trie/src/engine/state.rs index 734b0be061f..3e2dcb80d73 100644 --- a/rust/op-reth/crates/trie/src/engine/state.rs +++ b/rust/op-reth/crates/trie/src/engine/state.rs @@ -3,7 +3,7 @@ #[cfg(feature = "metrics")] use super::metrics::EngineMetrics; use super::{ - DEFAULT_PERSISTENCE_TIMEOUT_SECS, + CanonicalInMemoryStateProvider, DEFAULT_PERSISTENCE_TIMEOUT_SECS, buffer::state::TrieBufferState, error::EngineError, persistence::{PersistenceHandle, error::PersistenceError}, @@ -13,9 +13,7 @@ use alloy_eips::{NumHash, eip1898::BlockWithParent}; use crossbeam_channel::{Receiver, RecvError, RecvTimeoutError, bounded}; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; use std::time::Duration; #[cfg(feature = "metrics")] use std::time::Instant; @@ -152,7 +150,7 @@ impl PersistenceState { pub(crate) struct EngineState where Evm: ConfigureEvm, - Provider: StateReader + DatabaseProviderFactory + StateProviderFactory + BlockReader, + Provider: CanonicalInMemoryStateProvider + DatabaseProviderFactory + BlockReader, { /// The highest block number the engine should sync to between processing actions. pub(crate) sync_target: u64, @@ -172,9 +170,8 @@ impl EngineState where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/tasks/execute_block.rs b/rust/op-reth/crates/trie/src/engine/tasks/execute_block.rs index 1f0914d4336..2d5f2036068 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/execute_block.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/execute_block.rs @@ -1,14 +1,16 @@ use super::super::state::EngineState; use crate::{ - BlockStateDiff, OpProofsStore, engine::EngineError, provider::OpProofsStateProviderRef, + BlockStateDiff, OpProofsStore, + engine::{CanonicalInMemoryStateProvider, EngineError}, + provider::OpProofsStateProviderRef, }; use alloy_eips::{NumHash, eip1898::BlockWithParent}; use crossbeam_channel::Sender; use reth_evm::{ConfigureEvm, execute::Executor}; use reth_primitives_traits::{AlloyBlockHeader, BlockBody, NodePrimitives, RecoveredBlock}; use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, HashedPostStateProvider, ProviderError, - StateProviderFactory, StateReader, StateRootProvider, + BlockHashReader, BlockReader, DatabaseProviderFactory, HashedPostStateProvider, + StateRootProvider, }; use reth_revm::database::StateProviderDatabase; use reth_trie_common::EMPTY_ROOT_HASH; @@ -25,9 +27,8 @@ impl ExecuteBlockTask { where Evm: ConfigureEvm>, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader + Clone + 'static, @@ -46,9 +47,8 @@ where Block: reth_primitives_traits::Block, Evm: ConfigureEvm>, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader + Clone + 'static, @@ -101,25 +101,12 @@ where let block_ref = BlockWithParent::new(block.parent_hash(), NumHash::new(block.number(), block.hash())); - let parent_state = match state.provider.state_by_block_hash(block.parent_hash()) { - Ok(p) => p, - Err(ProviderError::StateForHashNotFound(hash)) => { - // Recoverable: either a transient reorg race or reth still materializing state - // (staged sync mid-flight). Skip; subsequent notifications will resync us. - // Logged at debug to avoid flooding during long catch-up phases - debug!( - target: "trie::engine::task", - block_number = block.number(), - parent_hash = ?hash, - "Parent state not available in reth; skipping execute_block", - ); - return Ok(()); - } - Err(e) => return Err(e.into()), - }; - - let inner_provider = OpProofsStateProviderRef::new( - parent_state, + let auxiliary = super::reth_auxiliary::RethAuxiliaryProvider::new( + &state.provider, + NumHash::new(parent_block_number, block.parent_hash()), + ); + let inner_provider = OpProofsStateProviderRef::with_auxiliary( + Box::new(auxiliary), state.storage.provider_ro()?, parent_block_number, ); diff --git a/rust/op-reth/crates/trie/src/engine/tasks/flush.rs b/rust/op-reth/crates/trie/src/engine/tasks/flush.rs index dd9a6e4a67a..1568346da25 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/flush.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/flush.rs @@ -1,11 +1,9 @@ use super::super::state::EngineState; -use crate::OpProofsStore; +use crate::{OpProofsStore, engine::CanonicalInMemoryStateProvider}; use crossbeam_channel::Sender; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; pub(crate) struct FlushTask { pub(crate) reply: Sender<()>, @@ -16,9 +14,8 @@ impl FlushTask { where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/tasks/index_block.rs b/rust/op-reth/crates/trie/src/engine/tasks/index_block.rs index e9d2adbc35a..4a15e8d3355 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/index_block.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/index_block.rs @@ -1,12 +1,13 @@ use super::super::state::EngineState; -use crate::{BlockStateDiff, OpProofsStore, engine::EngineError}; +use crate::{ + BlockStateDiff, OpProofsStore, + engine::{CanonicalInMemoryStateProvider, EngineError}, +}; use alloy_eips::eip1898::BlockWithParent; use crossbeam_channel::Sender; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; use reth_trie_common::{HashedPostStateSorted, updates::TrieUpdatesSorted}; use std::time::Instant; use tracing::{debug, info}; @@ -23,9 +24,8 @@ impl IndexBlockTask { where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, @@ -45,9 +45,8 @@ fn run( where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/tasks/mod.rs b/rust/op-reth/crates/trie/src/engine/tasks/mod.rs index 9e9e39759c0..8be7d8944dc 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/mod.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/mod.rs @@ -9,6 +9,7 @@ mod execute_block; mod flush; mod index_block; mod reorg; +mod reth_auxiliary; mod sync_to; mod unwind; diff --git a/rust/op-reth/crates/trie/src/engine/tasks/reorg.rs b/rust/op-reth/crates/trie/src/engine/tasks/reorg.rs index 0f178e30879..9ba17a8efe9 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/reorg.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/reorg.rs @@ -1,12 +1,13 @@ use super::super::state::EngineState; -use crate::{BlockStateDiff, OpProofsStore, engine::EngineError}; +use crate::{ + BlockStateDiff, OpProofsStore, + engine::{CanonicalInMemoryStateProvider, EngineError}, +}; use alloy_eips::eip1898::BlockWithParent; use crossbeam_channel::Sender; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; use reth_trie_common::{HashedPostStateSorted, updates::TrieUpdatesSorted}; use std::{sync::Arc, time::Instant}; use tracing::{debug, info}; @@ -22,9 +23,8 @@ impl ReorgTask { where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, @@ -41,9 +41,8 @@ fn run( where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/tasks/reth_auxiliary.rs b/rust/op-reth/crates/trie/src/engine/tasks/reth_auxiliary.rs new file mode 100644 index 00000000000..1f7415ae72e --- /dev/null +++ b/rust/op-reth/crates/trie/src/engine/tasks/reth_auxiliary.rs @@ -0,0 +1,280 @@ +//! Bytecode and block-hash reads without constructing reth's historical state provider. + +use crate::engine::CanonicalInMemoryStateProvider; +use alloy_eips::{BlockHashOrNumber, BlockNumHash}; +use alloy_primitives::{B256, BlockNumber}; +use reth_chain_state::BlockState; +use reth_db::{tables, transaction::DbTx}; +use reth_primitives_traits::Bytecode; +use reth_provider::{ + BlockHashReader, BytecodeReader, DBProvider, DatabaseProviderFactory, ProviderResult, +}; +use std::sync::Arc; + +/// Reads the bytecode and block hashes needed to execute the child of `parent`. +/// +/// reth's in-memory chain ending at `parent` is captured once, on construction. reth removes a +/// block from memory only after persisting it, so every block older than the snapshot was already +/// on disk when it was taken. Reads check the snapshot first and then the database. In-memory +/// reads stay on `parent`'s ancestry if reth reorgs after construction. If `parent` was already +/// off reth's canonical chain at construction, it has no snapshot, and code it deployed before +/// persistence is unavailable; execution then fails the state-root check rather than committing. +pub(super) struct RethAuxiliaryProvider<'a, P: CanonicalInMemoryStateProvider> { + provider: &'a P, + parent: BlockNumHash, + /// reth's in-memory chain ending at `parent`, if `parent` was in memory. + in_memory: Option>>, +} + +impl<'a, P: CanonicalInMemoryStateProvider> RethAuxiliaryProvider<'a, P> { + pub(super) fn new(provider: &'a P, parent: BlockNumHash) -> Self { + let in_memory = provider.canonical_in_memory_state().state_by_hash(parent.hash); + Self { provider, parent, in_memory } + } +} + +impl

BlockHashReader for RethAuxiliaryProvider<'_, P> +where + P: CanonicalInMemoryStateProvider + BlockHashReader, +{ + fn block_hash(&self, number: BlockNumber) -> ProviderResult> { + if number > self.parent.number { + return Ok(None); + } + if number == self.parent.number { + return Ok(Some(self.parent.hash)); + } + if let Some(state) = self + .in_memory + .as_ref() + .and_then(|state| state.block_on_chain(BlockHashOrNumber::Number(number))) + { + return Ok(Some(state.hash())); + } + // Below the snapshot, the block was persisted before the snapshot was taken, so reth's + // canonical hash at this height is `parent`'s ancestor unless reth has since unwound + // persisted blocks. A wrong hash can only change BLOCKHASH results, which the state-root + // check catches. + self.provider.block_hash(number) + } + + fn canonical_hashes_range( + &self, + start: BlockNumber, + end: BlockNumber, + ) -> ProviderResult> { + let end = end.min(self.parent.number.saturating_add(1)); + let mut hashes = Vec::with_capacity(end.saturating_sub(start) as usize); + for number in start..end { + let Some(hash) = self.block_hash(number)? else { break }; + hashes.push(hash); + } + Ok(hashes) + } +} + +impl

BytecodeReader for RethAuxiliaryProvider<'_, P> +where + P: CanonicalInMemoryStateProvider + DatabaseProviderFactory, +{ + fn bytecode_by_hash(&self, code_hash: &B256) -> ProviderResult> { + // Code deployed by a block in the snapshot may not be on disk yet. + if let Some(code) = + self.in_memory.iter().flat_map(|state| state.chain()).find_map(|state| { + state.block_ref().execution_outcome().state.contracts.get(code_hash).cloned() + }) + { + return Ok(Some(Bytecode(code))); + } + // Bytecode is persisted with execution data, independently of the trie frontier. + let provider = self.provider.database_provider_ro()?; + Ok(provider.tx_ref().get::(*code_hash)?) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use alloy_consensus::Header; + use alloy_primitives::{Bytes, keccak256}; + use reth_chain_state::{CanonicalInMemoryState, ExecutedBlock, NewCanonicalChain}; + use reth_db::transaction::DbTxMut; + use reth_ethereum_primitives::{Block, EthPrimitives, Receipt}; + use reth_primitives_traits::{RecoveredBlock, SealedBlock}; + use reth_provider::{ + BlockExecutionOutput, NodePrimitivesProvider, test_utils::create_test_provider_factory, + }; + + /// Stands in for reth's `BlockchainProvider`. Block hashes come from reth's current in-memory + /// chain, then from the database, which reports `persisted_hash` at every height. + struct Reader { + factory: F, + state: CanonicalInMemoryState, + persisted_hash: B256, + } + + impl Reader { + fn new(factory: F) -> Self { + Self { + factory, + state: CanonicalInMemoryState::empty(), + persisted_hash: B256::repeat_byte(0xcc), + } + } + } + + impl NodePrimitivesProvider for Reader { + type Primitives = EthPrimitives; + } + + impl CanonicalInMemoryStateProvider for Reader { + fn canonical_in_memory_state(&self) -> CanonicalInMemoryState { + self.state.clone() + } + } + + impl DatabaseProviderFactory for Reader { + type DB = F::DB; + type Provider = F::Provider; + type ProviderRW = F::ProviderRW; + + fn database_provider_ro(&self) -> ProviderResult { + self.factory.database_provider_ro() + } + + fn database_provider_rw(&self) -> ProviderResult { + self.factory.database_provider_rw() + } + } + + impl BlockHashReader for Reader { + fn block_hash(&self, number: BlockNumber) -> ProviderResult> { + Ok(Some(self.state.hash_by_number(number).unwrap_or(self.persisted_hash))) + } + + fn canonical_hashes_range( + &self, + start: BlockNumber, + end: BlockNumber, + ) -> ProviderResult> { + (start..end).map(|number| Ok(self.block_hash(number)?.unwrap())).collect() + } + } + + fn contract() -> (B256, Bytecode) { + let code = Bytecode::new_raw(Bytes::from_static(&[0x60, 0x01, 0x60, 0x00, 0x55, 0x00])); + (keccak256(code.original_bytes()), code) + } + + fn executed_block( + number: BlockNumber, + parent_hash: B256, + contracts: impl IntoIterator, + ) -> ExecutedBlock { + let header = Header { number, parent_hash, ..Default::default() }; + let block = SealedBlock::seal_slow(Block { header, body: Default::default() }); + let mut output = BlockExecutionOutput:: { + result: Default::default(), + state: Default::default(), + }; + output.state.contracts.extend(contracts.into_iter().map(|(hash, code)| (hash, code.0))); + ExecutedBlock::new( + Arc::new(RecoveredBlock::new_sealed(block, Vec::new())), + Arc::new(output), + Default::default(), + ) + } + + /// Commits blocks `1..=3` to reth's in-memory state, deploying `contract()` in block 2. + fn commit_in_memory_chain(state: &CanonicalInMemoryState) -> Vec { + let first = executed_block(1, B256::repeat_byte(0xaa), []); + let second = executed_block(2, first.recovered_block().hash(), [contract()]); + let third = executed_block(3, second.recovered_block().hash(), []); + let blocks = vec![first, second, third]; + state.update_chain(NewCanonicalChain::Commit { new: blocks.clone() }); + blocks + } + + #[test] + fn block_hashes_follow_parent_ancestry_across_reorg() { + let reader = Reader::new(create_test_provider_factory()); + let blocks = commit_in_memory_chain(&reader.state); + let hashes: Vec<_> = blocks.iter().map(|block| block.recovered_block().hash()).collect(); + let auxiliary = RethAuxiliaryProvider::new(&reader, blocks[2].recovered_block().num_hash()); + + // reth reorgs blocks 2 and 3 onto another fork after the snapshot is taken. + let fork_second = executed_block(2, hashes[0], []); + let fork_third = executed_block(3, fork_second.recovered_block().hash(), []); + let fork_hashes = + [fork_second.recovered_block().hash(), fork_third.recovered_block().hash()]; + reader.state.update_chain(NewCanonicalChain::Reorg { + new: vec![fork_second, fork_third], + old: blocks[1..].to_vec(), + }); + assert_eq!(reader.block_hash(2).unwrap(), Some(fork_hashes[0])); + + // In-memory heights still come from the parent's chain, not reth's new canonical chain. + assert_eq!(auxiliary.block_hash(1).unwrap(), Some(hashes[0])); + assert_eq!(auxiliary.block_hash(2).unwrap(), Some(hashes[1])); + assert_eq!(auxiliary.block_hash(3).unwrap(), Some(hashes[2])); + assert_eq!(auxiliary.block_hash(4).unwrap(), None); + // Below the snapshot, reth's persisted canonical chain is the parent's ancestry. + assert_eq!(auxiliary.block_hash(0).unwrap(), Some(reader.persisted_hash)); + assert_eq!( + auxiliary.canonical_hashes_range(0, u64::MAX).unwrap(), + [reader.persisted_hash, hashes[0], hashes[1], hashes[2]] + ); + } + + #[test] + fn in_memory_parent_reads_persisted_bytecode() { + let reader = Reader::new(create_test_provider_factory()); + let blocks = commit_in_memory_chain(&reader.state); + let auxiliary = RethAuxiliaryProvider::new(&reader, blocks[2].recovered_block().num_hash()); + + // Code deployed below the in-memory window is only on disk. + let code = Bytecode::new_raw(Bytes::from_static(&[0x00])); + let hash = keccak256(code.original_bytes()); + let provider = reader.database_provider_rw().unwrap(); + provider.tx_ref().put::(hash, code.clone()).unwrap(); + provider.commit().unwrap(); + + assert_eq!(auxiliary.bytecode_by_hash(&hash).unwrap(), Some(code)); + let (in_memory_hash, in_memory_code) = contract(); + assert_eq!(auxiliary.bytecode_by_hash(&in_memory_hash).unwrap(), Some(in_memory_code)); + } + + #[test] + fn snapshot_outlives_eviction() { + let reader = Reader::new(create_test_provider_factory()); + let blocks = commit_in_memory_chain(&reader.state); + let parent = blocks[2].recovered_block().num_hash(); + let auxiliary = RethAuxiliaryProvider::new(&reader, parent); + + // reth persists and evicts the chain after the snapshot is taken. The test database never + // receives the bytecode, so it can only come from the snapshot. + reader.state.remove_persisted_blocks(parent); + assert!(reader.state.state_by_hash(parent.hash).is_none()); + + let (hash, code) = contract(); + assert_eq!(auxiliary.bytecode_by_hash(&hash).unwrap(), Some(code)); + assert_eq!(auxiliary.block_hash(2).unwrap(), Some(blocks[1].recovered_block().hash())); + } + + #[test] + fn persisted_parent_reads_database() { + let reader = Reader::new(create_test_provider_factory()); + let (hash, code) = contract(); + let parent = BlockNumHash::new(10, B256::repeat_byte(0x10)); + let auxiliary = RethAuxiliaryProvider::new(&reader, parent); + assert_eq!(auxiliary.bytecode_by_hash(&hash).unwrap(), None); + + let provider = reader.database_provider_rw().unwrap(); + provider.tx_ref().put::(hash, code.clone()).unwrap(); + provider.commit().unwrap(); + + assert_eq!(auxiliary.bytecode_by_hash(&hash).unwrap(), Some(code)); + assert_eq!(auxiliary.block_hash(10).unwrap(), Some(parent.hash)); + assert_eq!(auxiliary.block_hash(9).unwrap(), Some(reader.persisted_hash)); + } +} diff --git a/rust/op-reth/crates/trie/src/engine/tasks/sync_to.rs b/rust/op-reth/crates/trie/src/engine/tasks/sync_to.rs index ecfd2956c1a..54819014471 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/sync_to.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/sync_to.rs @@ -1,10 +1,8 @@ use super::super::state::EngineState; -use crate::OpProofsStore; +use crate::{OpProofsStore, engine::CanonicalInMemoryStateProvider}; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; use tracing::debug; pub(crate) struct SyncToTask { @@ -16,9 +14,8 @@ impl SyncToTask { where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/engine/tasks/unwind.rs b/rust/op-reth/crates/trie/src/engine/tasks/unwind.rs index 33ef48d57c2..bc8a7c4a785 100644 --- a/rust/op-reth/crates/trie/src/engine/tasks/unwind.rs +++ b/rust/op-reth/crates/trie/src/engine/tasks/unwind.rs @@ -1,12 +1,13 @@ use super::super::state::EngineState; -use crate::{OpProofsStore, engine::EngineError}; +use crate::{ + OpProofsStore, + engine::{CanonicalInMemoryStateProvider, EngineError}, +}; use alloy_eips::eip1898::BlockWithParent; use crossbeam_channel::Sender; use reth_evm::ConfigureEvm; use reth_primitives_traits::BlockTy; -use reth_provider::{ - BlockHashReader, BlockReader, DatabaseProviderFactory, StateProviderFactory, StateReader, -}; +use reth_provider::{BlockHashReader, BlockReader, DatabaseProviderFactory}; use tracing::{debug, info}; pub(crate) struct UnwindTask { @@ -19,9 +20,8 @@ impl UnwindTask { where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, @@ -38,9 +38,8 @@ fn run( where Evm: ConfigureEvm, Provider: BlockHashReader - + StateReader + + CanonicalInMemoryStateProvider + DatabaseProviderFactory - + StateProviderFactory + BlockReader> + Clone + 'static, diff --git a/rust/op-reth/crates/trie/src/error.rs b/rust/op-reth/crates/trie/src/error.rs index 355f9b1ea32..085a6e8cad7 100644 --- a/rust/op-reth/crates/trie/src/error.rs +++ b/rust/op-reth/crates/trie/src/error.rs @@ -127,6 +127,41 @@ pub enum OpProofsStorageError { Please clear proofs data and retry initialization." )] InitializeStorageInconsistentState, + /// The source database's hashed-state and trie tables lag its block tip, so they describe no + /// single block and cannot seed the proofs storage. + #[error( + "reth database state is not durable at its tip #{db_tip}: hashed state and trie tables \ + are only persisted through #{partial_state_trie}. This happens while a node is running \ + on this datadir, after an unclean shutdown, or when the datadir was copied from a \ + running node. Stop any node running on this datadir, start `op-reth node` on it so it \ + repairs its state, stop it cleanly, then re-run initialization." + )] + InitializeSourceStateTrieLagging { + /// Block number of reth's Finish checkpoint. + db_tip: u64, + /// Highest block whose hashed state and trie are durable in reth's database. + partial_state_trie: u64, + }, + /// reth's database tip moved past the initialization anchor before the copy, so the copied + /// tables would not describe the anchored block. + #[error( + "reth database tip moved from #{anchor} to #{db_tip} during initialization. Stop any \ + node running on this datadir, then re-run initialization." + )] + InitializeSourceTipMoved { + /// Block number read as the chain tip when initialization started. + anchor: u64, + /// Block number of reth's Finish checkpoint in the copy transaction. + db_tip: u64, + }, + /// reth's repair unwind of a lagging hashed-state/trie frontier was interrupted, so those + /// tables are half-unwound. + #[error( + "reth database is in the middle of repairing its state (an interrupted partial state \ + trie unwind). Start `op-reth node` on this datadir so it completes the repair, stop it \ + cleanly, then re-run initialization." + )] + InitializeSourceStateTrieUnwindPending, /// The snapshot has never been initialized — no init job has run yet. #[error("Snapshot is not initialized")] SnapshotNotInitialized, diff --git a/rust/op-reth/crates/trie/src/in_memory.rs b/rust/op-reth/crates/trie/src/in_memory.rs index eb9c9376dca..7564c5e5f08 100644 --- a/rust/op-reth/crates/trie/src/in_memory.rs +++ b/rust/op-reth/crates/trie/src/in_memory.rs @@ -98,38 +98,9 @@ impl InMemoryStorageInner { } for (hashed_address, storage) in &block_state_diff.sorted_post_state.storages { - // Handle wiped storage: iterate all existing values and mark them as deleted - // This is an expensive operation and should never happen for blocks going forward. - if storage.wiped { - // Collect latest values for each slot up to the current block - let mut slot_to_latest: std::collections::BTreeMap = - std::collections::BTreeMap::new(); - - for ((block, address, slot), value) in &self.hashed_storages { - if *block < block_number && *address == *hashed_address { - if let Some((existing_block, _)) = slot_to_latest.get(slot) { - if *block > *existing_block { - slot_to_latest.insert(*slot, (*block, *value)); - } - } else { - slot_to_latest.insert(*slot, (*block, *value)); - } - } - } - - // Store zero values for all non-zero slots to mark them as deleted - for (slot, (_, value)) in slot_to_latest { - if !value.is_zero() { - self.hashed_storages - .insert((block_number, *hashed_address, slot), U256::ZERO); - result.hashed_storages_written_total += 1; - } - } - } else { - for (slot, value) in storage.storage_slots_ref() { - self.hashed_storages.insert((block_number, *hashed_address, *slot), *value); - result.hashed_storages_written_total += 1; - } + for (slot, value) in storage.storage_slots_ref() { + self.hashed_storages.insert((block_number, *hashed_address, *slot), *value); + result.hashed_storages_written_total += 1; } } diff --git a/rust/op-reth/crates/trie/src/initialize.rs b/rust/op-reth/crates/trie/src/initialize.rs index 2a9f218a0f1..6391d797ac2 100644 --- a/rust/op-reth/crates/trie/src/initialize.rs +++ b/rust/op-reth/crates/trie/src/initialize.rs @@ -16,6 +16,7 @@ use reth_db::{ transaction::DbTx, }; use reth_primitives_traits::{Account, StorageEntry}; +use reth_stages_types::StageId; use reth_trie_common::{ BranchNodeCompact, Nibbles, PackedStorageTrieEntry, PackedStoredNibbles, PackedStoredNibblesSubKey, StorageTrieEntry, StoredNibbles, StoredNibblesSubKey, @@ -29,6 +30,14 @@ const INITIALIZE_STORAGE_THRESHOLD: usize = 100000; /// Threshold for logging progress during initialization const INITIALIZE_LOG_THRESHOLD: usize = 100000; +/// Metadata key under which reth records a partial state trie repair unwind in progress. +/// +/// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 +/// `reth_node_builder::launch::common::PARTIAL_STATE_TRIE_UNWIND_METADATA_KEY` +/// +/// Private upstream; only its presence is read here, not the marker's contents. +const PARTIAL_STATE_TRIE_UNWIND_METADATA_KEY: &str = "partial_state_trie_unwind"; + /// Controls which reth DB table codec is used when reading trie data during initialization. /// /// Reth stores trie nibbles in two formats depending on when the node was first synced: @@ -425,6 +434,51 @@ impl InitializationJob { Ok(()) } + /// Refuses a source database whose hashed-state/trie frontier lags its Finish checkpoint. + /// + /// With state masking, reth persists block data through the Finish checkpoint while the + /// hashed-state and trie tables hold a merge that omits updates later overwritten by the + /// in-memory masking suffix. Only `op-reth node` launch repairs this (by unwinding to the + /// partial frontier), so copying the tables before that would seed a state that matches no + /// block. An interrupted repair leaves Finish at the unwind target but the hashed-state and + /// trie tables half-unwound; reth records that with a metadata marker until the unwind + /// completes. + /// + /// The caller reads `best_number` in an earlier transaction, so a node still running on the + /// datadir can persist past it before the copy. Refuse when this transaction's Finish + /// checkpoint no longer matches, so the anchor and the copied tables describe the same block. + fn ensure_source_state_trie_durable( + &self, + best_number: u64, + ) -> Result<(), OpProofsStorageError> { + if self + .tx + .get::(PARTIAL_STATE_TRIE_UNWIND_METADATA_KEY.to_string())? + .is_some() + { + return Err(OpProofsStorageError::InitializeSourceStateTrieUnwindPending); + } + let Some(finish) = self.tx.get::(StageId::Finish.to_string())? + else { + return Ok(()); + }; + if finish.block_number != best_number { + return Err(OpProofsStorageError::InitializeSourceTipMoved { + anchor: best_number, + db_tip: finish.block_number, + }); + } + match finish.finish_stage_checkpoint().and_then(|finish| finish.partial_state_trie()) { + Some(partial_state_trie) if partial_state_trie < finish.block_number => { + Err(OpProofsStorageError::InitializeSourceStateTrieLagging { + db_tip: finish.block_number, + partial_state_trie, + }) + } + _ => Ok(()), + } + } + /// Run the initialization job. pub fn run(&self, best_number: u64, best_hash: B256) -> Result<(), OpProofsStorageError> { let provider = self.storage.initialization_provider()?; @@ -433,10 +487,12 @@ impl InitializationJob { match anchor.status { InitialStateStatus::Completed => return Ok(()), InitialStateStatus::NotStarted => { + self.ensure_source_state_trie_durable(best_number)?; provider.set_initial_state_anchor(BlockNumHash::new(best_number, best_hash))?; provider.commit()?; } InitialStateStatus::InProgress => { + self.ensure_source_state_trie_durable(best_number)?; self.validate_anchor_block(&anchor, best_number, best_hash)?; drop(provider); // Release the RW transaction before initialize_trie opens a new one } @@ -1631,4 +1687,158 @@ mod tests { let addresses = store.storage_branch_addresses.lock().unwrap(); assert_eq!(*addresses, vec![a, b, c], "addresses must be flushed in sorted (cursor) order"); } + + // ── Source DB with a lagging hashed-state/trie frontier ───────────── + + mod partial_state_trie { + use super::*; + use crate::{ + OpProofsHashedAccountCursorFactory, OpProofsTrieCursorFactory, + test_utils::{ + build_chain_with_partial_state_trie, create_storage, storage_contract_slot0, + }, + }; + use reth_db::Database; + use reth_primitives_traits::AlloyBlockHeader; + use reth_provider::{HeaderProvider, StorageSettingsCache}; + use reth_trie::StateRoot; + + /// Returns the proofs storage's slot-0 value and state root at `block`, and the header's + /// state root. + fn seeded_state( + factory: &reth_provider::ProviderFactory< + reth_provider::test_utils::MockNodeTypesWithDB, + >, + storage: &Arc, + block: u64, + ) -> (Option, B256, B256) { + let (hashed_address, hashed_slot) = storage_contract_slot0(); + let ro = storage.provider_ro().unwrap(); + let mut cursor = ro.storage_hashed_cursor(hashed_address, block).unwrap(); + let slot0 = cursor.seek(hashed_slot).unwrap().filter(|(k, _)| *k == hashed_slot); + let root = StateRoot::new( + OpProofsTrieCursorFactory::new(&ro, block), + OpProofsHashedAccountCursorFactory::new(&ro, block), + ) + .root() + .unwrap(); + let header_root = + factory.header_by_number(block).unwrap().expect("header").state_root(); + (slot0.map(|(_, v)| v), root, header_root) + } + + fn layout( + factory: &reth_provider::ProviderFactory< + reth_provider::test_utils::MockNodeTypesWithDB, + >, + ) -> RethTrieStorageLayout { + if factory.cached_storage_settings().is_v2() { + RethTrieStorageLayout::Packed + } else { + RethTrieStorageLayout::Legacy + } + } + + /// Control: a fully flushed source seeds exactly the tip's state. + #[test] + fn run_seeds_tip_state_when_state_trie_is_durable() { + let (factory, tip, tip_hash) = build_chain_with_partial_state_trie(6, 6); + let storage = create_storage(); + let tx = factory.db_ref().tx().unwrap(); + InitializationJob::new(storage.clone(), tx, layout(&factory)) + .run(tip, tip_hash) + .unwrap(); + + let (slot0, root, header_root) = seeded_state(&factory, &storage, tip); + assert_eq!(slot0, Some(U256::from(tip))); + assert_eq!(root, header_root); + } + + /// State masking leaves the hashed-state/trie tables behind the Finish checkpoint until + /// `op-reth node` repairs them on launch. Initialization must refuse such a source + /// instead of anchoring a state that matches no block at the tip. + #[test] + fn run_refuses_lagging_state_trie() { + let (factory, tip, tip_hash) = build_chain_with_partial_state_trie(6, 3); + let storage = create_storage(); + let tx = factory.db_ref().tx().unwrap(); + let result = + InitializationJob::new(storage.clone(), tx, layout(&factory)).run(tip, tip_hash); + + match result { + Err(OpProofsStorageError::InitializeSourceStateTrieLagging { + db_tip: 6, + partial_state_trie: 3, + }) => {} + Ok(()) => { + let (slot0, root, header_root) = seeded_state(&factory, &storage, tip); + panic!( + "initialization anchored at #{tip} from a lagging state trie: \ + seeded slot0 = {slot0:?} (tip value {tip}), \ + seeded state root {root} vs header #{tip} state root {header_root}" + ); + } + Err(err) => panic!("unexpected error: {err:?}"), + } + assert!(matches!( + storage.provider_ro().unwrap().get_earliest_block(), + Err(OpProofsStorageError::NoBlocksFound) + )); + } + + /// The anchor comes from an earlier read than the copy, so a node still running on the + /// datadir can persist past it in between. Initialization must refuse instead of + /// anchoring the earlier block over tables from a later one. + #[test] + fn run_refuses_tip_moved_since_anchor() { + let (factory, _, _) = build_chain_with_partial_state_trie(6, 6); + let hash = reth_provider::BlockHashReader::block_hash(&factory, 5).unwrap().unwrap(); + let storage = create_storage(); + let tx = factory.db_ref().tx().unwrap(); + let result = InitializationJob::new(storage.clone(), tx, layout(&factory)).run(5, hash); + + assert!( + matches!( + result, + Err(OpProofsStorageError::InitializeSourceTipMoved { anchor: 5, db_tip: 6 }) + ), + "unexpected result: {result:?}" + ); + assert!(matches!( + storage.provider_ro().unwrap().get_earliest_block(), + Err(OpProofsStorageError::NoBlocksFound) + )); + } + + /// reth's repair unwind moves Finish to the partial frontier first and unwinds the + /// hashing and trie stages after it, so an interrupted repair shows a plain Finish + /// checkpoint over half-unwound tables. Only the unwind marker reveals it. + #[test] + fn run_refuses_interrupted_repair_unwind() { + let (factory, _, _) = build_chain_with_partial_state_trie(6, 3); + let tx = factory.db_ref().tx_mut().unwrap(); + tx.put::( + StageId::Finish.to_string(), + reth_stages_types::StageCheckpoint::new(3), + ) + .unwrap(); + tx.put::(PARTIAL_STATE_TRIE_UNWIND_METADATA_KEY.to_string(), vec![]) + .unwrap(); + tx.commit().unwrap(); + + let hash = reth_provider::BlockHashReader::block_hash(&factory, 3).unwrap().unwrap(); + let storage = create_storage(); + let tx = factory.db_ref().tx().unwrap(); + let result = InitializationJob::new(storage.clone(), tx, layout(&factory)).run(3, hash); + + assert!( + matches!(result, Err(OpProofsStorageError::InitializeSourceStateTrieUnwindPending)), + "unexpected result: {result:?}" + ); + assert!(matches!( + storage.provider_ro().unwrap().get_earliest_block(), + Err(OpProofsStorageError::NoBlocksFound) + )); + } + } } diff --git a/rust/op-reth/crates/trie/src/lib.rs b/rust/op-reth/crates/trie/src/lib.rs index ce080dcba8a..02cce3ee938 100644 --- a/rust/op-reth/crates/trie/src/lib.rs +++ b/rust/op-reth/crates/trie/src/lib.rs @@ -58,7 +58,7 @@ pub mod proof; pub mod provider; pub mod engine; -pub use engine::EngineHandle; +pub use engine::{CanonicalInMemoryStateProvider, EngineHandle}; pub mod cursor; #[cfg(not(feature = "metrics"))] diff --git a/rust/op-reth/crates/trie/src/proof.rs b/rust/op-reth/crates/trie/src/proof.rs index 075ac6ef757..cbdd2160434 100644 --- a/rust/op-reth/crates/trie/src/proof.rs +++ b/rust/op-reth/crates/trie/src/proof.rs @@ -17,8 +17,9 @@ use reth_trie::{ witness::TrieWitness, }; use reth_trie_common::{ - AccountProof, HashedPostState, HashedPostStateSorted, HashedStorage, MultiProof, - MultiProofTargets, StorageMultiProof, StorageProof, TrieInput, updates::TrieUpdates, + AccountProof, DecodedMultiProofV2, HashedPostState, HashedPostStateSorted, HashedStorage, + MultiProof, MultiProofTargets, MultiProofTargetsV2, StorageMultiProof, StorageProof, TrieInput, + updates::TrieUpdates, }; /// Extends [`Proof`] with operations specific for working with [`crate::OpProofsStorage`]. @@ -42,6 +43,14 @@ pub trait DatabaseProof

{ input: TrieInput, targets: MultiProofTargets, ) -> Result; + + /// Generates the state [`DecodedMultiProofV2`] for target hashed account and storage keys. + fn overlay_multiproof_v2( + provider: P, + block_number: u64, + input: TrieInput, + targets: MultiProofTargetsV2, + ) -> Result; } impl

DatabaseProof

@@ -101,6 +110,28 @@ where .with_prefix_sets_mut(input.prefix_sets) .multiproof(targets) } + + /// Generates the state [`DecodedMultiProofV2`] for target hashed account and storage keys. + fn overlay_multiproof_v2( + provider: P, + block_number: u64, + input: TrieInput, + targets: MultiProofTargetsV2, + ) -> Result { + let nodes_sorted = input.nodes.into_sorted(); + let state_sorted = input.state.into_sorted(); + Self::from_provider(provider.clone(), block_number) + .with_trie_cursor_factory(InMemoryTrieCursorFactory::new( + OpProofsTrieCursorFactory::new(provider.clone(), block_number), + &nodes_sorted, + )) + .with_hashed_cursor_factory(HashedPostStateCursorFactory::new( + OpProofsHashedAccountCursorFactory::new(provider, block_number), + &state_sorted, + )) + .with_prefix_sets_mut(input.prefix_sets) + .multiproof_v2(targets) + } } /// Extends [`StorageProof`] with operations specific for working with [`crate::OpProofsStorage`]. diff --git a/rust/op-reth/crates/trie/src/provider.rs b/rust/op-reth/crates/trie/src/provider.rs index 2d36ae50d74..6dc7e525372 100644 --- a/rust/op-reth/crates/trie/src/provider.rs +++ b/rust/op-reth/crates/trie/src/provider.rs @@ -8,7 +8,6 @@ use crate::{ }, }; use alloy_primitives::keccak256; -use derive_more::Constructor; use reth_primitives_traits::{Account, Bytecode}; use reth_provider::{ AccountReader, BlockHashReader, BytecodeReader, HashedPostStateProvider, ProviderError, @@ -25,16 +24,23 @@ use reth_trie::{ witness::TrieWitness, }; use reth_trie_common::{ - AccountProof, HashedPostState, HashedStorage, KeccakKeyHasher, MultiProof, MultiProofTargets, - StorageMultiProof, StorageProof, TrieInput, updates::TrieUpdates, + AccountProof, DecodedMultiProofV2, HashedPostState, HashedStorage, KeccakKeyHasher, MultiProof, + MultiProofTargets, MultiProofTargetsV2, StorageMultiProof, StorageProof, TrieInput, + updates::TrieUpdates, }; use std::fmt::Debug; +/// The reth data needed alongside the account, storage, and trie state in the proofs DB. +/// +/// Bytecode is immutable and addressed by hash; neither lookup requires a historical state view. +pub(crate) trait OpProofsAuxiliaryProvider: BlockHashReader + BytecodeReader {} + +impl OpProofsAuxiliaryProvider for T {} + /// State provider for external proofs storage. -#[derive(Constructor)] pub struct OpProofsStateProviderRef<'a, P> { - /// Historical state provider for non-state related tasks. - latest: Box, + /// Reader for bytecode and block hashes. + auxiliary: Box, /// Storage provider for state lookups. provider: P, @@ -43,6 +49,27 @@ pub struct OpProofsStateProviderRef<'a, P> { block_number: BlockNumber, } +impl<'a, P> OpProofsStateProviderRef<'a, P> { + /// Creates a proofs state provider using an existing reth state provider for bytecode and + /// block-hash reads. Account, storage, and trie reads come from the proofs storage. + pub fn new( + auxiliary: Box, + provider: P, + block_number: BlockNumber, + ) -> Self { + Self::with_auxiliary(Box::new(auxiliary), provider, block_number) + } + + /// Creates a proofs state provider without requiring a full reth state provider. + pub(crate) const fn with_auxiliary( + auxiliary: Box, + provider: P, + block_number: BlockNumber, + ) -> Self { + Self { auxiliary, provider, block_number } + } +} + impl<'a, P> Debug for OpProofsStateProviderRef<'a, P> where P: Debug, @@ -63,7 +90,7 @@ impl From for ProviderError { impl<'a, P> BlockHashReader for OpProofsStateProviderRef<'a, P> { fn block_hash(&self, number: BlockNumber) -> ProviderResult> { - self.latest.block_hash(number) + self.auxiliary.block_hash(number) } fn canonical_hashes_range( @@ -71,7 +98,7 @@ impl<'a, P> BlockHashReader for OpProofsStateProviderRef<'a, P> { start: BlockNumber, end: BlockNumber, ) -> ProviderResult> { - self.latest.canonical_hashes_range(start, end) + self.auxiliary.canonical_hashes_range(start, end) } } @@ -177,6 +204,15 @@ where .map_err(ProviderError::from) } + fn multiproof_v2( + &self, + input: TrieInput, + targets: MultiProofTargetsV2, + ) -> ProviderResult { + Proof::overlay_multiproof_v2(self.provider.clone(), self.block_number, input, targets) + .map_err(ProviderError::from) + } + fn witness( &self, input: TrieInput, @@ -193,7 +229,7 @@ impl<'a, P> HashedPostStateProvider for OpProofsStateProviderRef<'a, P> where P: OpProofsProviderRO + Clone, { - /// UPSTREAM-MIRROR(copy): reth@rev:0fbe428 + /// UPSTREAM-MIRROR(copy): reth@rev:8d359d0 /// `reth_provider::LatestStateProviderRef::hashed_post_state` /// /// Mirrors the hashing/zeroing sequence, using historical OP proofs cursors instead of @@ -247,7 +283,7 @@ where impl<'a, P> BytecodeReader for OpProofsStateProviderRef<'a, P> { fn bytecode_by_hash(&self, code_hash: &B256) -> ProviderResult> { - self.latest.bytecode_by_hash(code_hash) + self.auxiliary.bytecode_by_hash(code_hash) } } diff --git a/rust/op-reth/crates/trie/src/test_utils.rs b/rust/op-reth/crates/trie/src/test_utils.rs index c29f2b834ca..a69f2816318 100644 --- a/rust/op-reth/crates/trie/src/test_utils.rs +++ b/rust/op-reth/crates/trie/src/test_utils.rs @@ -331,6 +331,73 @@ pub(crate) fn build_chain_with_storage_writes_and_initialize_storage( (provider_factory, storage, last_number, last_hash) } +/// Slot of [`STORAGE_CONTRACT`] that each storage-call block sets to its block number. +pub(crate) fn storage_contract_slot0() -> (B256, B256) { + (keccak256(STORAGE_CONTRACT), keccak256(B256::ZERO)) +} + +/// Builds `num_blocks` storage-writing blocks and persists them with reth's +/// [`save_blocks`](reth_provider::DatabaseProvider::save_blocks) in one cycle that advances the +/// database tip to `num_blocks` but the hashed-state/trie frontier only to `partial_state_trie`, +/// as the engine does with state masking enabled. The on-disk result is what an unclean +/// shutdown leaves behind; `partial_state_trie == num_blocks` is a full flush. +/// +/// Trie data for each block is computed against a second, fully persisted factory, mirroring the +/// engine's in-memory overlay. +pub(crate) fn build_chain_with_partial_state_trie( + num_blocks: u64, + partial_state_trie: u64, +) -> (ProviderFactory, u64, B256) { + use reth_chain_state::ExecutedBlock; + use reth_provider::SaveBlocksInput; + use reth_trie::ComputedTrieData; + + let key_pair = deterministic_keypair(); + let sender = public_key_to_address(key_pair.public_key()); + let chain_spec = chain_spec_with_address(sender); + + let shadow = create_test_provider_factory_with_chain_spec(chain_spec.clone()); + init_genesis(&shadow).unwrap(); + let target = create_test_provider_factory_with_chain_spec(chain_spec.clone()); + init_genesis(&target).unwrap(); + + let mut blocks = Vec::new(); + let mut last_hash = chain_spec.genesis_hash(); + for n in 1..=num_blocks { + let mut block = build_storage_call_block(n, last_hash, &chain_spec, key_pair, n - 1); + let exec = execute_block(&mut block, &shadow, &chain_spec); + let (hashed_state, trie_updates) = { + let provider = shadow.provider().unwrap(); + let state = LatestStateProviderRef::new(&provider); + let hashed_state = state.hashed_post_state(&exec.state).unwrap(); + let (root, trie_updates) = state.state_root_with_updates(hashed_state.clone()).unwrap(); + assert_eq!(root, block.state_root()); + (hashed_state.into_sorted(), trie_updates.into_sorted()) + }; + last_hash = block.hash(); + let executed = ExecutedBlock::new( + Arc::new(block), + Arc::new(exec), + ComputedTrieData::new(Arc::new(hashed_state), Arc::new(trie_updates)), + ); + + let provider_rw = shadow.provider_rw().unwrap(); + provider_rw + .save_blocks(&SaveBlocksInput::new(vec![executed.clone()], n - 1, n - 1, n, n)) + .unwrap(); + provider_rw.commit().unwrap(); + blocks.push(executed); + } + + let provider_rw = target.provider_rw().unwrap(); + provider_rw + .save_blocks(&SaveBlocksInput::new(blocks, 0, 0, num_blocks, partial_state_trie)) + .unwrap(); + provider_rw.commit().unwrap(); + + (target, num_blocks, last_hash) +} + /// Fixtures for `HashedPostStateProvider` tests over the proofs storage: persisted storage /// seeding, bundles with destroyed accounts, and a provider whose storage reads fail. pub(crate) mod destroyed_accounts { diff --git a/rust/op-reth/crates/trie/tests/lib.rs b/rust/op-reth/crates/trie/tests/lib.rs index 1725135c477..34efd3d7b8b 100644 --- a/rust/op-reth/crates/trie/tests/lib.rs +++ b/rust/op-reth/crates/trie/tests/lib.rs @@ -1262,14 +1262,11 @@ fn test_large_batch_operations(storage: S) -> Result<(), OpPro Ok(()) } -/// Test wiped storage in [`HashedPostState`] -/// -/// When `store_trie_updates` receives a [`HashedPostState`] with wiped=true for a storage entry, -/// it should iterate all existing values for that address and create deletion entries for them. +/// Test explicit storage deletions in [`HashedPostState`]. #[test_case(InMemoryProofsStorage::new(); "InMemory")] #[test_case(create_mdbx_proofs_storage(); "Mdbx")] #[serial] -fn test_store_trie_updates_with_wiped_storage( +fn test_store_trie_updates_with_deleted_storage( storage: S, ) -> Result<(), OpProofsStorageError> { use reth_trie::HashedStorage; @@ -1302,17 +1299,18 @@ fn test_store_trie_updates_with_wiped_storage( assert_eq!(found_slots[2], (B256::repeat_byte(0x30), U256::from(300))); assert_eq!(found_slots[3], (B256::repeat_byte(0x40), U256::from(400))); - // Now create a HashedPostState with wiped=true for this address at block 100 + // Delete every storage slot at block 100. let mut post_state = HashedPostState::default(); - let wiped_storage = HashedStorage::new(true); // wiped=true, empty storage map - post_state.storages.insert(hashed_address, wiped_storage); + let deleted_storage = + HashedStorage::from_iter(storage_slots.iter().map(|(slot, _)| (*slot, U256::ZERO))); + post_state.storages.insert(hashed_address, deleted_storage); let block_state_diff = BlockStateDiff { sorted_trie_updates: TrieUpdatesSorted::default(), sorted_post_state: post_state.into_sorted(), }; - // Store the wiped state + // Store the deleted state. let provider_rw = storage.provider_rw().expect("provider rw"); provider_rw.store_trie_updates(block_ref, block_state_diff)?; provider_rw.commit()?; @@ -1426,7 +1424,7 @@ fn test_store_trie_updates_comprehensive( // Add storage for an address let storage_addr = B256::repeat_byte(0x50); - let mut hashed_storage = HashedStorage::new(false); + let mut hashed_storage = HashedStorage::default(); hashed_storage.storage.insert(B256::repeat_byte(0x01), U256::from(111)); hashed_storage.storage.insert(B256::repeat_byte(0x02), U256::from(222)); hashed_storage.storage.insert(B256::repeat_byte(0x03), U256::ZERO); // Deleted storage @@ -1596,7 +1594,7 @@ fn test_replace_updates_applies_all_updates( initial_trie_updates_100.account_nodes.insert(common_branch_path, initial_branch.clone()); let mut initial_post_state_100 = HashedPostState::default(); - let mut initial_storage_100 = HashedStorage::new(false); + let mut initial_storage_100 = HashedStorage::default(); initial_storage_100.storage.insert(initial_storage_slot, initial_storage_value); initial_post_state_100.storages.insert(initial_storage_addr, initial_storage_100); @@ -1685,7 +1683,7 @@ fn test_replace_updates_applies_all_updates( let mut new_post_state = HashedPostState::default(); new_post_state.accounts.insert(new_account_addr, Some(new_account)); - let mut new_storage = HashedStorage::new(false); + let mut new_storage = HashedStorage::default(); new_storage.storage.insert(new_storage_slot, new_storage_value); new_post_state.storages.insert(new_storage_addr, new_storage); diff --git a/rust/op-reth/crates/trie/tests/live.rs b/rust/op-reth/crates/trie/tests/live.rs index 648bbc1cc0b..26acd703190 100644 --- a/rust/op-reth/crates/trie/tests/live.rs +++ b/rust/op-reth/crates/trie/tests/live.rs @@ -2,7 +2,7 @@ use alloy_consensus::{BlockHeader, Header, TxEip2930, constants::ETH_TO_WEI}; use alloy_genesis::{Genesis, GenesisAccount}; -use alloy_primitives::{Address, B256, TxKind, U256, keccak256}; +use alloy_primitives::{Address, B256, Bytes, TxKind, U256, keccak256}; use derive_more::Constructor; use reth_chainspec::{ChainSpec, ChainSpecBuilder, EthereumHardfork, MAINNET, MIN_TRANSACTION_GAS}; use reth_db::Database; @@ -12,7 +12,8 @@ use reth_evm::{ConfigureEvm, execute::Executor}; use reth_evm_ethereum::EthEvmConfig; use reth_node_api::{NodePrimitives, NodeTypesWithDB}; use reth_optimism_trie::{ - MdbxProofsStorage, OpProofStoragePruner, OpProofsStorage, OpProofsStore, RethTrieStorageLayout, + MdbxProofsStorage, OpProofStoragePruner, OpProofsProviderRO, OpProofsStorage, OpProofsStore, + RethTrieStorageLayout, engine::{EngineError, EngineHandle}, initialize::InitializationJob, }; @@ -53,8 +54,12 @@ fn sign_tx_with_key_pair(key_pair: Keypair, tx: Transaction) -> TransactionSigne /// Specification for a transaction within a block #[derive(Debug, Clone)] struct TxSpec { - /// Recipient address for the transaction - to: Address, + /// Call recipient or contract creation. + to: TxKind, + /// Transaction input, including initcode for deployments. + data: Bytes, + /// Maximum execution gas. + gas_limit: u64, /// Value to transfer (in wei) value: U256, /// Nonce for the transaction (will be automatically assigned if None) @@ -64,7 +69,13 @@ struct TxSpec { impl TxSpec { /// Create a simple transfer transaction const fn transfer(to: Address, value: U256) -> Self { - Self { to, value, nonce: None } + Self { + to: TxKind::Call(to), + data: Bytes::new(), + gas_limit: MIN_TRANSACTION_GAS, + value, + nonce: None, + } } } @@ -126,9 +137,10 @@ fn create_block_from_spec( TxEip2930 { chain_id: chain_spec.chain.id(), nonce, - gas_limit: MIN_TRANSACTION_GAS, + gas_limit: tx_spec.gas_limit, + input: tx_spec.data.clone(), gas_price: 1_500_000_000, - to: TxKind::Call(tx_spec.to), + to: tx_spec.to, value: tx_spec.value, ..Default::default() } @@ -137,7 +149,7 @@ fn create_block_from_spec( }) .collect(); - let gas_total = transactions.len() as u64 * MIN_TRANSACTION_GAS; + let gas_total = spec.txs.iter().map(|tx| tx.gas_limit).sum::(); Block { header: Header { @@ -619,3 +631,87 @@ where run_test_scenario(scenario, provider_factory, chain_spec, key_pair, storage) } + +/// Re-execution uses proofs state and persisted bytecode even when reth cannot construct the +/// parent-state provider. The parent deploys a contract; its child executes the deployed code. +#[test] +#[serial] +fn execute_deployed_contract_without_reth_parent_state() -> eyre::Result<()> { + use reth_db::{tables, transaction::DbTxMut}; + use reth_provider::StateProviderFactory; + + let key_pair = Keypair::new(&Secp256k1::new(), &mut rng()); + let sender = public_key_to_address(key_pair.public_key()); + let contract = sender.create(0); + let chain_spec = chain_spec_with_address(sender); + let factory = create_test_provider_factory_with_chain_spec(chain_spec.clone()); + init_genesis(&factory)?; + let storage: OpProofsStorage> = create_mdbx_proofs_storage().into(); + { + let tx = factory.db_ref().tx()?; + InitializationJob::new(storage.clone(), tx, RethTrieStorageLayout::Legacy) + .run(0, chain_spec.genesis_hash())?; + } + let blockchain = BlockchainProvider::new(factory.clone())?; + let pruner = OpProofStoragePruner::new(storage.clone(), blockchain.clone(), 1000); + let engine = EngineHandle::spawn_with_thresholds( + EthEvmConfig::ethereum(chain_spec.clone()), + blockchain.clone(), + storage.clone(), + pruner, + 1, + 2, + ); + let mut nonce = 0; + // Initcode returns runtime code that writes 1 to storage slot 0. + let deployment = BlockSpec::new(vec![TxSpec { + to: TxKind::Create, + data: Bytes::from_static(&[ + 0x60, 0x06, 0x60, 0x0c, 0x60, 0x00, 0x39, 0x60, 0x06, 0x60, 0x00, 0xf3, 0x60, 0x01, + 0x60, 0x00, 0x55, 0x00, + ]), + gas_limit: 100_000, + value: U256::ZERO, + nonce: None, + }]); + let mut parent = create_block_from_spec( + &deployment, + 1, + chain_spec.genesis_hash(), + &chain_spec, + key_pair, + &mut nonce, + ); + let output = execute_block(&mut parent, &factory, &chain_spec)?; + engine.execute_block(&parent)?; + commit_block_to_database(&parent, &output, &factory)?; + + let call = BlockSpec::new(vec![TxSpec { + to: TxKind::Call(contract), + data: Bytes::new(), + gas_limit: 100_000, + value: U256::ZERO, + nonce: None, + }]); + let mut child = + create_block_from_spec(&call, 2, parent.hash(), &chain_spec, key_pair, &mut nonce); + let output = execute_block(&mut child, &factory, &chain_spec)?; + assert_eq!( + output.state.account(&contract).unwrap().storage_slot(U256::ZERO), + Some(U256::from(1)) + ); + + // Model the unavailable-parent failure without deleting the bytecode or proofs state. + let rw = factory.provider_rw()?; + rw.tx_ref().delete::(parent.hash(), None)?; + rw.commit()?; + assert!(matches!( + blockchain.state_by_block_hash(parent.hash()), + Err(reth_provider::ProviderError::StateForHashNotFound(_)) + )); + + engine.execute_block(&child)?; + engine.flush(); + assert_eq!(storage.provider_ro()?.get_latest_block()?.number, 2); + Ok(()) +} diff --git a/rust/op-reth/crates/txpool/Cargo.toml b/rust/op-reth/crates/txpool/Cargo.toml index 50ad217d1c9..9b87f069af2 100644 --- a/rust/op-reth/crates/txpool/Cargo.toml +++ b/rust/op-reth/crates/txpool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reth-optimism-txpool" -version = "1.11.3" +version = "2.0.0" edition.workspace = true rust-version.workspace = true license.workspace = true diff --git a/rust/op-reth/crates/txpool/src/pool.rs b/rust/op-reth/crates/txpool/src/pool.rs index 298cc27cdca..fda20dbad70 100644 --- a/rust/op-reth/crates/txpool/src/pool.rs +++ b/rust/op-reth/crates/txpool/src/pool.rs @@ -12,7 +12,7 @@ use std::{ }; use alloy_consensus::Transaction; -use alloy_eips::eip7594::BlobTransactionSidecarVariant; +use alloy_eips::eip7594::{BlobCellMask, BlobTransactionSidecarVariant}; use alloy_primitives::{Address, B256, TxHash}; use metrics::Counter; use reth_eth_wire_types::HandleMempoolData; @@ -362,6 +362,7 @@ where delegate!(fn queued_transactions(&self) -> Vec>>); delegate!(fn pending_and_queued_txn_count(&self) -> (usize, usize)); delegate!(fn all_transactions(&self) -> AllPoolTransactions); + delegate!(fn all_transactions_by_sender(&self, sender: Address) -> AllPoolTransactions); delegate!(fn all_transaction_hashes(&self) -> Vec); delegate!(fn remove_transactions(&self, hashes: Vec) -> Vec>>); delegate!(fn remove_transactions_and_descendants(&self, hashes: Vec) -> Vec>>); @@ -403,7 +404,7 @@ where delegate!(fn get_blobs_for_versioned_hashes_v1(&self, versioned_hashes: &[B256]) -> Result>, BlobStoreError>); delegate!(fn get_blobs_for_versioned_hashes_v2(&self, versioned_hashes: &[B256]) -> Result>, BlobStoreError>); delegate!(fn get_blobs_for_versioned_hashes_v3(&self, versioned_hashes: &[B256]) -> Result>, BlobStoreError>); - delegate!(fn get_blobs_for_versioned_hashes_v4(&self, versioned_hashes: &[B256], indices_bitarray: alloy_primitives::B128) -> Result>, BlobStoreError>); + delegate!(fn get_blobs_for_versioned_hashes_v4(&self, versioned_hashes: &[B256], cell_mask: BlobCellMask) -> Result>, BlobStoreError>); delegate!(fn has_blobs_for_versioned_hashes(&self, versioned_hashes: &[B256]) -> Result, BlobStoreError>); } diff --git a/rust/op-reth/crates/txpool/src/validator.rs b/rust/op-reth/crates/txpool/src/validator.rs index 6e9cbb614b5..691d1eeaebf 100644 --- a/rust/op-reth/crates/txpool/src/validator.rs +++ b/rust/op-reth/crates/txpool/src/validator.rs @@ -354,7 +354,7 @@ where } } -/// UPSTREAM-MIRROR(delegate): reth@rev:0fbe428 +/// UPSTREAM-MIRROR(delegate): reth@rev:8d359d0 /// `reth_transaction_pool::validate::EthTransactionValidator` /// /// Wraps the Ethereum validator. Re-check newly defaulted batch methods and upstream overrides; diff --git a/rust/op-revm/Cargo.toml b/rust/op-revm/Cargo.toml index 4866fff9e48..693c6143d3a 100644 --- a/rust/op-revm/Cargo.toml +++ b/rust/op-revm/Cargo.toml @@ -52,6 +52,9 @@ std = [ ] serde = ["dep:serde", "revm/serde", "alloy-eips/serde", "alloy-primitives/serde", "op-alloy-consensus/serde"] portable = ["revm/portable"] +# Compile against revm's feature-gated async database fields; mainly a CI feature-unification check. +# Host targets only: revm's fiber stack does not build for wasm or MIPS. +asyncdb = ["std", "revm/asyncdb"] dev = [ "revm/dev", diff --git a/rust/op-revm/src/api/exec.rs b/rust/op-revm/src/api/exec.rs index 4d3c05f18ee..66064ccb983 100644 --- a/rust/op-revm/src/api/exec.rs +++ b/rust/op-revm/src/api/exec.rs @@ -48,7 +48,7 @@ impl OpContextTr for T where /// Type alias for the error type of the `OpEvm`. pub type OpError = EVMError<<::Db as Database>::Error, OpTransactionError>; -/// UPSTREAM-MIRROR(copy): revm-handler@42.0.1 `revm_handler::api::ExecuteEvm` +/// UPSTREAM-MIRROR(copy): revm-handler@43.0.2 `revm_handler::api::ExecuteEvm` /// /// Copies upstream's `ExecuteEvm` implementation with `OpHandler` substituted for /// `MainnetHandler`. Re-diff the bodies when the upstream implementation changes. @@ -95,7 +95,7 @@ where } } -/// UPSTREAM-MIRROR(copy): revm-handler@42.0.1 `revm_handler::api::ExecuteCommitEvm` +/// UPSTREAM-MIRROR(copy): revm-handler@43.0.2 `revm_handler::api::ExecuteCommitEvm` /// /// Copies the upstream commit implementation for the OP EVM. impl ExecuteCommitEvm @@ -109,7 +109,7 @@ where } } -/// UPSTREAM-MIRROR(copy): revm-inspector@42.0.1 `revm_inspector::mainnet_inspect::InspectEvm` +/// UPSTREAM-MIRROR(copy): revm-inspector@43.0.2 `revm_inspector::mainnet_inspect::InspectEvm` /// /// Copies the upstream inspector implementation with `OpHandler`. impl InspectEvm @@ -132,7 +132,7 @@ where } } -/// UPSTREAM-MIRROR(copy): revm-inspector@42.0.1 `revm_inspector::mainnet_inspect::InspectCommitEvm` +/// UPSTREAM-MIRROR(copy): revm-inspector@43.0.2 `revm_inspector::mainnet_inspect::InspectCommitEvm` /// /// Mirrors the upstream marker implementation for inspector commits. impl InspectCommitEvm @@ -144,7 +144,7 @@ where { } -/// UPSTREAM-MIRROR(copy): revm-handler@42.0.1 `revm_handler::system_call::SystemCallEvm` +/// UPSTREAM-MIRROR(copy): revm-handler@43.0.2 `revm_handler::system_call::SystemCallEvm` /// /// Copies upstream system-call setup with `OpHandler`. impl SystemCallEvm @@ -169,7 +169,7 @@ where } } -/// UPSTREAM-MIRROR(copy): revm-inspector@42.0.1 +/// UPSTREAM-MIRROR(copy): revm-inspector@43.0.2 /// `revm_inspector::mainnet_inspect::InspectSystemCallEvm` /// /// Copies upstream inspected system-call setup with `OpHandler`. diff --git a/rust/op-revm/src/evm.rs b/rust/op-revm/src/evm.rs index 84ddcc2ec5f..9d6bf727473 100644 --- a/rust/op-revm/src/evm.rs +++ b/rust/op-revm/src/evm.rs @@ -32,13 +32,12 @@ impl + Clone>>, INSP> /// Create a new Optimism EVM. pub fn new(ctx: CTX, inspector: INSP) -> Self { let spec: OpSpecId = ctx.cfg().spec().into(); - Self(Evm { + Self(Evm::new_with_inspector( ctx, inspector, - instruction: EthInstructions::new_mainnet_with_spec(spec.into()), - precompiles: OpPrecompiles::new_with_spec(spec), - frame_stack: FrameStack::new_prealloc(8), - }) + EthInstructions::new_mainnet_with_spec(spec.into()), + OpPrecompiles::new_with_spec(spec), + )) } /// Consumes self and returns the inner context. @@ -64,7 +63,7 @@ impl OpEvm { } } -/// UPSTREAM-MIRROR(delegate): revm-inspector@42.0.1 `revm_inspector::InspectorEvmTr` +/// UPSTREAM-MIRROR(delegate): revm-inspector@43.0.2 `revm_inspector::InspectorEvmTr` /// /// Forwards inspector EVM access to the inner mainnet-shaped EVM. impl InspectorEvmTr for OpEvm @@ -103,7 +102,7 @@ where } } -/// UPSTREAM-MIRROR(delegate): revm-handler@42.0.1 `revm_handler::EvmTr` +/// UPSTREAM-MIRROR(delegate): revm-handler@43.0.2 `revm_handler::EvmTr` /// /// Forwards selected EVM operations to the inner EVM. Re-check newly defaulted methods and /// upstream overrides that this wrapper would otherwise miss. diff --git a/rust/op-revm/src/handler.rs b/rust/op-revm/src/handler.rs index 739848dc6b1..1a56dda37e6 100644 --- a/rust/op-revm/src/handler.rs +++ b/rust/op-revm/src/handler.rs @@ -80,7 +80,7 @@ where type Error = ERROR; type HaltReason = OpHaltReason; - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::validate_env` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::validate_env` /// /// Deposits return before `validation::validate_env`; non-deposits add the /// `enveloped_tx` requirement and then delegate. Re-check changes to the upstream @@ -110,10 +110,10 @@ where self.mainnet.validate_env(evm) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 /// `revm_handler::Handler::validate_against_state_and_deduct_caller` /// - /// UPSTREAM-MIRROR(copy): revm-handler@42.0.1 + /// UPSTREAM-MIRROR(copy): revm-handler@43.0.2 /// `revm_handler::pre_execution::validate_against_state_and_deduct_caller` /// /// The non-deposit arm copies the upstream helper with the L1-fee deduction inserted @@ -199,7 +199,7 @@ where Ok(()) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::tx_gas` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::tx_gas` /// /// Deposits are force-included from L1 and are exempt from EIP-7825's per-transaction gas /// limit cap (), so @@ -221,7 +221,7 @@ where GasTracker::new(tx_gas_limit, remaining, reservoir) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::last_frame_result` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::last_frame_result` /// /// Structure and comments are taken verbatim from the upstream default: the frame is /// settled into the transaction-level gas exactly as upstream does, and the @@ -299,7 +299,7 @@ where Ok(()) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::reimburse_caller` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::reimburse_caller` /// /// Delegates to upstream `post_execution::reimburse_caller`, adding the operator-fee /// refund for non-deposits. Re-check that the upstream helper's signature and semantics @@ -321,7 +321,7 @@ where reimburse_caller(evm.ctx(), frame_result.gas(), additional_refund).map_err(From::from) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::refund` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::refund` /// /// Same as upstream except that pre-Regolith deposits get no refund at all. fn refund( @@ -346,7 +346,7 @@ where Ok(()) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::reward_beneficiary` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::reward_beneficiary` /// /// Returns early for deposits, otherwise calls the upstream implementation and then pays /// the three OP vaults. Re-check on any change to how upstream computes the beneficiary @@ -400,7 +400,7 @@ where Ok(()) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::execution_result` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::execution_result` /// /// Reproduces the upstream teardown (`take_error`, `post_execution::output`, `commit_tx`, /// clearing local state and the frame stack) with the post-Regolith halted-deposit @@ -433,7 +433,7 @@ where Ok(exec_result) } - /// UPSTREAM-MIRROR(override): revm-handler@42.0.1 `revm_handler::Handler::catch_error` + /// UPSTREAM-MIRROR(override): revm-handler@43.0.2 `revm_handler::Handler::catch_error` /// /// Re-derive upstream error-path cleanup, currently `journal.discard_tx()`, /// when the default or journal semantics change. diff --git a/rust/op-revm/src/precompiles.rs b/rust/op-revm/src/precompiles.rs index 23e510389a0..0e7e6b04c0a 100644 --- a/rust/op-revm/src/precompiles.rs +++ b/rust/op-revm/src/precompiles.rs @@ -48,7 +48,7 @@ impl OpPrecompiles { } } -/// UPSTREAM-MIRROR(set): revm-precompile@42.0.1 `revm_precompile::Precompiles` +/// UPSTREAM-MIRROR(set): revm-precompile@43.0.2 `revm_precompile::Precompiles` /// /// Fjord extends the upstream Cancun set with P256 verification. Re-check the /// inherited address set and gas parameters on each bump. @@ -63,7 +63,7 @@ pub fn fjord() -> &'static Precompiles { }) } -/// UPSTREAM-MIRROR(set): revm-precompile@42.0.1 `revm_precompile::Precompiles` +/// UPSTREAM-MIRROR(set): revm-precompile@43.0.2 `revm_precompile::Precompiles` /// /// Granite replaces the inherited pairing implementation. /// Returns precompiles for Granite spec. @@ -77,7 +77,7 @@ pub fn granite() -> &'static Precompiles { }) } -/// UPSTREAM-MIRROR(set): revm-precompile@42.0.1 `revm_precompile::Precompiles` +/// UPSTREAM-MIRROR(set): revm-precompile@43.0.2 `revm_precompile::Precompiles` /// /// Isthmus extends the inherited set with Prague BLS precompiles and OP pricing. /// Returns precompiles for isthmus spec. @@ -97,7 +97,7 @@ pub fn isthmus() -> &'static Precompiles { }) } -/// UPSTREAM-MIRROR(set): revm-precompile@42.0.1 `revm_precompile::Precompiles` +/// UPSTREAM-MIRROR(set): revm-precompile@43.0.2 `revm_precompile::Precompiles` /// /// Karst replaces the inherited Osaka-sensitive precompiles. /// Returns precompiles for karst spec. @@ -117,7 +117,7 @@ pub fn karst() -> &'static Precompiles { }) } -/// UPSTREAM-MIRROR(set): revm-precompile@42.0.1 `revm_precompile::Precompiles` +/// UPSTREAM-MIRROR(set): revm-precompile@43.0.2 `revm_precompile::Precompiles` /// /// Jovian replaces variable-input precompiles in the inherited set. /// Returns precompiles for jovian spec. diff --git a/rust/op-revm/src/spec.rs b/rust/op-revm/src/spec.rs index 84d3a7de3f5..5143b7be06b 100644 --- a/rust/op-revm/src/spec.rs +++ b/rust/op-revm/src/spec.rs @@ -34,7 +34,7 @@ pub enum OpSpecId { } impl OpSpecId { - /// UPSTREAM-MIRROR(set): revm-primitives@42.0.0 `revm_primitives::hardfork::SpecId` + /// UPSTREAM-MIRROR(set): revm-primitives@43.0.0 `revm_primitives::hardfork::SpecId` /// /// Maps each OP fork onto the L1 fork whose semantics it activates. A new upstream /// `SpecId` needs a decision here: which OP fork (if any) turns it on. diff --git a/rust/op-revm/src/transaction/abstraction.rs b/rust/op-revm/src/transaction/abstraction.rs index 6c129c3fe47..af60e02ad58 100644 --- a/rust/op-revm/src/transaction/abstraction.rs +++ b/rust/op-revm/src/transaction/abstraction.rs @@ -95,7 +95,7 @@ impl SystemCallTx for OpTransaction { } } -/// UPSTREAM-MIRROR(delegate): revm-context-interface@42.0.0 `revm_context_interface::Transaction` +/// UPSTREAM-MIRROR(delegate): revm-context-interface@43.0.1 `revm_context_interface::Transaction` /// /// Forwards the primitive getters to `self.base` and overrides `tx_type` and /// `effective_gas_price` for deposits. Everything not listed here inherits the upstream