diff --git a/Cargo.lock b/Cargo.lock index 85dc805..15f3ab5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -419,7 +419,7 @@ dependencies = [ "lru 0.13.0", "parking_lot", "pin-project", - "reqwest 0.12.25", + "reqwest 0.12.26", "serde", "serde_json", "thiserror 2.0.17", @@ -488,7 +488,7 @@ dependencies = [ "alloy-transport-ws", "futures", "pin-project", - "reqwest 0.12.25", + "reqwest 0.12.26", "serde", "serde_json", "tokio", @@ -806,7 +806,7 @@ checksum = "4198a1ee82e562cab85e7f3d5921aab725d9bd154b6ad5017f82df1695877c97" dependencies = [ "alloy-json-rpc", "alloy-transport", - "reqwest 0.12.25", + "reqwest 0.12.26", "serde_json", "tower", "tracing", @@ -1347,9 +1347,9 @@ checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" [[package]] name = "async-compression" -version = "0.4.35" +version = "0.4.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07a926debf178f2d355197f9caddb08e54a9329d44748034bba349c5848cb519" +checksum = "98ec5f6c2f8bc326c994cb9e241cc257ddaba9afa8555a43cffbb5dd86efaa37" dependencies = [ "compression-codecs", "compression-core", @@ -2013,9 +2013,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" dependencies = [ "serde_core", ] @@ -2353,9 +2353,9 @@ dependencies = [ [[package]] name = "compression-codecs" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34a3cbbb8b6eca96f3a5c4bf6938d5b27ced3675d69f95bb51948722870bc323" +checksum = "b0f7ac3e5b97fdce45e8922fb05cae2c37f7bbd63d30dd94821dacfd8f3f2bf2" dependencies = [ "brotli", "compression-core", @@ -6915,9 +6915,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.25" +version = "0.12.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6eff9328d40131d43bd911d42d79eb6a47312002a4daefc9e37f17e74a7701a" +checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" dependencies = [ "base64 0.22.1", "bytes 1.11.0", @@ -6965,7 +6965,7 @@ checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" [[package]] name = "reth" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-rpc-types", "aquamarine", @@ -7011,7 +7011,7 @@ dependencies = [ [[package]] name = "reth-basic-payload-builder" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7020,7 +7020,7 @@ dependencies = [ "futures-util", "metrics", "reth-chain-state", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-payload-builder", "reth-payload-builder-primitives", "reth-payload-primitives", @@ -7035,7 +7035,7 @@ dependencies = [ [[package]] name = "reth-chain-state" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7051,7 +7051,7 @@ dependencies = [ "reth-errors", "reth-ethereum-primitives", "reth-execution-types", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-storage-api", "reth-trie", @@ -7066,7 +7066,7 @@ dependencies = [ [[package]] name = "reth-chainspec" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-chains", "alloy-consensus", @@ -7086,7 +7086,7 @@ dependencies = [ [[package]] name = "reth-cli" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-genesis", "clap", @@ -7100,7 +7100,7 @@ dependencies = [ [[package]] name = "reth-cli-commands" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-chains", "alloy-consensus", @@ -7122,7 +7122,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "ratatui", - "reqwest 0.12.25", + "reqwest 0.12.26", "reth-chainspec", "reth-cli", "reth-cli-runner", @@ -7183,7 +7183,7 @@ dependencies = [ [[package]] name = "reth-cli-runner" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "reth-tasks", "tokio", @@ -7193,7 +7193,7 @@ dependencies = [ [[package]] name = "reth-cli-util" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -7211,7 +7211,7 @@ dependencies = [ [[package]] name = "reth-codecs" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7231,7 +7231,7 @@ dependencies = [ [[package]] name = "reth-codecs-derive" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "convert_case 0.7.1", "proc-macro2", @@ -7242,7 +7242,7 @@ dependencies = [ [[package]] name = "reth-config" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "eyre", "humantime-serde", @@ -7257,7 +7257,7 @@ dependencies = [ [[package]] name = "reth-consensus" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -7270,7 +7270,7 @@ dependencies = [ [[package]] name = "reth-consensus-common" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7282,7 +7282,7 @@ dependencies = [ [[package]] name = "reth-consensus-debug-client" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7294,7 +7294,7 @@ dependencies = [ "derive_more 2.1.0", "eyre", "futures", - "reqwest 0.12.25", + "reqwest 0.12.26", "reth-node-api", "reth-primitives-traits", "reth-tracing", @@ -7307,7 +7307,7 @@ dependencies = [ [[package]] name = "reth-db" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "derive_more 2.1.0", @@ -7318,7 +7318,7 @@ dependencies = [ "reth-db-api", "reth-fs-util", "reth-libmdbx", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-nippy-jar", "reth-static-file-types", "reth-storage-errors", @@ -7333,7 +7333,7 @@ dependencies = [ [[package]] name = "reth-db-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-genesis", @@ -7361,7 +7361,7 @@ dependencies = [ [[package]] name = "reth-db-common" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-genesis", @@ -7395,7 +7395,7 @@ dependencies = [ [[package]] name = "reth-db-models" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -7410,7 +7410,7 @@ dependencies = [ [[package]] name = "reth-discv4" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -7436,7 +7436,7 @@ dependencies = [ [[package]] name = "reth-discv5" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -7449,7 +7449,7 @@ dependencies = [ "rand 0.9.2", "reth-chainspec", "reth-ethereum-forks", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-peers", "secp256k1 0.30.0", "thiserror 2.0.17", @@ -7460,7 +7460,7 @@ dependencies = [ [[package]] name = "reth-dns-discovery" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "data-encoding", @@ -7484,7 +7484,7 @@ dependencies = [ [[package]] name = "reth-downloaders" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7501,7 +7501,7 @@ dependencies = [ "reth-db", "reth-db-api", "reth-ethereum-primitives", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-p2p", "reth-network-peers", "reth-primitives-traits", @@ -7519,7 +7519,7 @@ dependencies = [ [[package]] name = "reth-ecies" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "aes", "alloy-primitives", @@ -7550,7 +7550,7 @@ dependencies = [ [[package]] name = "reth-engine-local" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -7572,7 +7572,7 @@ dependencies = [ [[package]] name = "reth-engine-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7597,7 +7597,7 @@ dependencies = [ [[package]] name = "reth-engine-service" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "futures", "pin-project", @@ -7620,7 +7620,7 @@ dependencies = [ [[package]] name = "reth-engine-tree" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7643,7 +7643,7 @@ dependencies = [ "reth-ethereum-primitives", "reth-evm", "reth-execution-types", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-p2p", "reth-payload-builder", "reth-payload-primitives", @@ -7675,7 +7675,7 @@ dependencies = [ [[package]] name = "reth-engine-util" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-rpc-types-engine", @@ -7703,7 +7703,7 @@ dependencies = [ [[package]] name = "reth-era" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7719,13 +7719,13 @@ dependencies = [ [[package]] name = "reth-era-downloader" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "bytes 1.11.0", "eyre", "futures-util", - "reqwest 0.12.25", + "reqwest 0.12.26", "reth-fs-util", "sha2 0.10.9", "tokio", @@ -7734,7 +7734,7 @@ dependencies = [ [[package]] name = "reth-era-utils" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -7756,7 +7756,7 @@ dependencies = [ [[package]] name = "reth-errors" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "reth-consensus", "reth-execution-errors", @@ -7767,7 +7767,7 @@ dependencies = [ [[package]] name = "reth-eth-wire" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-chains", "alloy-primitives", @@ -7781,7 +7781,7 @@ dependencies = [ "reth-ecies", "reth-eth-wire-types", "reth-ethereum-forks", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-peers", "reth-primitives-traits", "serde", @@ -7796,7 +7796,7 @@ dependencies = [ [[package]] name = "reth-eth-wire-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-chains", "alloy-consensus", @@ -7820,7 +7820,7 @@ dependencies = [ [[package]] name = "reth-ethereum-cli" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "clap", "eyre", @@ -7842,7 +7842,7 @@ dependencies = [ [[package]] name = "reth-ethereum-consensus" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7858,7 +7858,7 @@ dependencies = [ [[package]] name = "reth-ethereum-engine-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -7876,7 +7876,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eip2124", "alloy-hardforks", @@ -7890,7 +7890,7 @@ dependencies = [ [[package]] name = "reth-ethereum-payload-builder" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7919,7 +7919,7 @@ dependencies = [ [[package]] name = "reth-ethereum-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7937,7 +7937,7 @@ dependencies = [ [[package]] name = "reth-etl" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "rayon", "reth-db-api", @@ -7947,7 +7947,7 @@ dependencies = [ [[package]] name = "reth-evm" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7959,7 +7959,7 @@ dependencies = [ "metrics", "reth-execution-errors", "reth-execution-types", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-storage-api", "reth-storage-errors", @@ -7970,7 +7970,7 @@ dependencies = [ [[package]] name = "reth-evm-ethereum" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -7992,7 +7992,7 @@ dependencies = [ [[package]] name = "reth-execution-errors" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-evm", "alloy-primitives", @@ -8005,7 +8005,7 @@ dependencies = [ [[package]] name = "reth-execution-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8023,7 +8023,7 @@ dependencies = [ [[package]] name = "reth-exex" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8040,7 +8040,7 @@ dependencies = [ "reth-evm", "reth-exex-types", "reth-fs-util", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-node-api", "reth-node-core", "reth-payload-builder", @@ -8061,7 +8061,7 @@ dependencies = [ [[package]] name = "reth-exex-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -8075,7 +8075,7 @@ dependencies = [ [[package]] name = "reth-fs-util" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "serde", "serde_json", @@ -8085,7 +8085,7 @@ dependencies = [ [[package]] name = "reth-invalid-block-hooks" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -8112,7 +8112,7 @@ dependencies = [ [[package]] name = "reth-ipc" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "bytes 1.11.0", "futures", @@ -8132,7 +8132,7 @@ dependencies = [ [[package]] name = "reth-libmdbx" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "bitflags 2.10.0", "byteorder", @@ -8149,7 +8149,7 @@ dependencies = [ [[package]] name = "reth-mdbx-sys" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "bindgen 0.70.1", "cc", @@ -8158,7 +8158,7 @@ dependencies = [ [[package]] name = "reth-metrics" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "futures", "metrics", @@ -8182,7 +8182,7 @@ dependencies = [ [[package]] name = "reth-net-banlist" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", ] @@ -8190,11 +8190,11 @@ dependencies = [ [[package]] name = "reth-net-nat" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "futures-util", "if-addrs", - "reqwest 0.12.25", + "reqwest 0.12.26", "serde_with", "thiserror 2.0.17", "tokio", @@ -8204,7 +8204,7 @@ dependencies = [ [[package]] name = "reth-network" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8233,7 +8233,7 @@ dependencies = [ "reth-ethereum-forks", "reth-ethereum-primitives", "reth-fs-util", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-net-banlist", "reth-network-api", "reth-network-p2p", @@ -8259,7 +8259,7 @@ dependencies = [ [[package]] name = "reth-network-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -8284,7 +8284,7 @@ dependencies = [ [[package]] name = "reth-network-p2p" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8307,7 +8307,7 @@ dependencies = [ [[package]] name = "reth-network-peers" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -8322,7 +8322,7 @@ dependencies = [ [[package]] name = "reth-network-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eip2124", "humantime-serde", @@ -8336,7 +8336,7 @@ dependencies = [ [[package]] name = "reth-nippy-jar" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "anyhow", "bincode", @@ -8353,7 +8353,7 @@ dependencies = [ [[package]] name = "reth-node-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-rpc-types-engine", "eyre", @@ -8377,7 +8377,7 @@ dependencies = [ [[package]] name = "reth-node-builder" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8446,7 +8446,7 @@ dependencies = [ [[package]] name = "reth-node-core" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8498,7 +8498,7 @@ dependencies = [ [[package]] name = "reth-node-ethereum" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-network", @@ -8536,7 +8536,7 @@ dependencies = [ [[package]] name = "reth-node-ethstats" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -8560,7 +8560,7 @@ dependencies = [ [[package]] name = "reth-node-events" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8584,7 +8584,7 @@ dependencies = [ [[package]] name = "reth-node-metrics" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "eyre", "http 1.4.0", @@ -8594,7 +8594,7 @@ dependencies = [ "metrics-process", "metrics-util", "procfs 0.17.0", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-tasks", "tikv-jemalloc-ctl", "tokio", @@ -8605,7 +8605,7 @@ dependencies = [ [[package]] name = "reth-node-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "reth-chainspec", "reth-db-api", @@ -8617,7 +8617,7 @@ dependencies = [ [[package]] name = "reth-optimism-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8636,7 +8636,7 @@ dependencies = [ [[package]] name = "reth-payload-builder" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -8645,7 +8645,7 @@ dependencies = [ "metrics", "reth-chain-state", "reth-ethereum-engine-primitives", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-payload-builder-primitives", "reth-payload-primitives", "reth-primitives-traits", @@ -8657,7 +8657,7 @@ dependencies = [ [[package]] name = "reth-payload-builder-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "pin-project", "reth-payload-primitives", @@ -8669,7 +8669,7 @@ dependencies = [ [[package]] name = "reth-payload-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -8688,7 +8688,7 @@ dependencies = [ [[package]] name = "reth-payload-validator" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-rpc-types-engine", @@ -8698,7 +8698,7 @@ dependencies = [ [[package]] name = "reth-primitives" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "c-kzg", @@ -8712,7 +8712,7 @@ dependencies = [ [[package]] name = "reth-primitives-traits" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8745,7 +8745,7 @@ dependencies = [ [[package]] name = "reth-provider" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8769,7 +8769,7 @@ dependencies = [ "reth-evm", "reth-execution-types", "reth-fs-util", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-nippy-jar", "reth-node-types", "reth-primitives-traits", @@ -8791,7 +8791,7 @@ dependencies = [ [[package]] name = "reth-prune" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -8804,7 +8804,7 @@ dependencies = [ "reth-db-api", "reth-errors", "reth-exex-types", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-provider", "reth-prune-types", @@ -8819,7 +8819,7 @@ dependencies = [ [[package]] name = "reth-prune-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "arbitrary", @@ -8833,7 +8833,7 @@ dependencies = [ [[package]] name = "reth-ress-protocol" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -8852,7 +8852,7 @@ dependencies = [ [[package]] name = "reth-ress-provider" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -8879,7 +8879,7 @@ dependencies = [ [[package]] name = "reth-revm" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "reth-primitives-traits", @@ -8892,7 +8892,7 @@ dependencies = [ [[package]] name = "reth-rpc" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -8936,7 +8936,7 @@ dependencies = [ "reth-evm", "reth-evm-ethereum", "reth-execution-types", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-api", "reth-network-peers", "reth-network-types", @@ -8971,7 +8971,7 @@ dependencies = [ [[package]] name = "reth-rpc-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-genesis", @@ -8999,7 +8999,7 @@ dependencies = [ [[package]] name = "reth-rpc-builder" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-network", "alloy-provider", @@ -9012,7 +9012,7 @@ dependencies = [ "reth-consensus", "reth-evm", "reth-ipc", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-api", "reth-node-core", "reth-primitives-traits", @@ -9037,7 +9037,7 @@ dependencies = [ [[package]] name = "reth-rpc-convert" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-json-rpc", @@ -9057,7 +9057,7 @@ dependencies = [ [[package]] name = "reth-rpc-engine-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -9069,7 +9069,7 @@ dependencies = [ "parking_lot", "reth-chainspec", "reth-engine-primitives", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-payload-builder", "reth-payload-builder-primitives", "reth-payload-primitives", @@ -9087,7 +9087,7 @@ dependencies = [ [[package]] name = "reth-rpc-eth-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -9132,7 +9132,7 @@ dependencies = [ [[package]] name = "reth-rpc-eth-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -9150,14 +9150,14 @@ dependencies = [ "jsonrpsee-types", "metrics", "rand 0.9.2", - "reqwest 0.12.25", + "reqwest 0.12.26", "reth-chain-state", "reth-chainspec", "reth-errors", "reth-ethereum-primitives", "reth-evm", "reth-execution-types", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-revm", "reth-rpc-convert", @@ -9179,7 +9179,7 @@ dependencies = [ [[package]] name = "reth-rpc-layer" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-rpc-types-engine", "http 1.4.0", @@ -9193,7 +9193,7 @@ dependencies = [ [[package]] name = "reth-rpc-server-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -9209,7 +9209,7 @@ dependencies = [ [[package]] name = "reth-stages" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -9221,7 +9221,7 @@ dependencies = [ "itertools 0.14.0", "num-traits", "rayon", - "reqwest 0.12.25", + "reqwest 0.12.26", "reth-chainspec", "reth-codecs", "reth-config", @@ -9260,7 +9260,7 @@ dependencies = [ [[package]] name = "reth-stages-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -9270,7 +9270,7 @@ dependencies = [ "metrics", "reth-consensus", "reth-errors", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network-p2p", "reth-primitives-traits", "reth-provider", @@ -9287,7 +9287,7 @@ dependencies = [ [[package]] name = "reth-stages-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "arbitrary", @@ -9301,7 +9301,7 @@ dependencies = [ [[package]] name = "reth-static-file" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "parking_lot", @@ -9321,7 +9321,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "clap", @@ -9333,7 +9333,7 @@ dependencies = [ [[package]] name = "reth-storage-api" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -9356,7 +9356,7 @@ dependencies = [ [[package]] name = "reth-storage-errors" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-eips", "alloy-primitives", @@ -9372,7 +9372,7 @@ dependencies = [ [[package]] name = "reth-tasks" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "auto_impl", "dyn-clone", @@ -9380,7 +9380,7 @@ dependencies = [ "metrics", "pin-project", "rayon", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "thiserror 2.0.17", "tokio", "tracing", @@ -9390,7 +9390,7 @@ dependencies = [ [[package]] name = "reth-testing-utils" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -9406,7 +9406,7 @@ dependencies = [ [[package]] name = "reth-tokio-util" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "tokio", "tokio-stream", @@ -9416,7 +9416,7 @@ dependencies = [ [[package]] name = "reth-tracing" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "clap", "eyre", @@ -9431,7 +9431,7 @@ dependencies = [ [[package]] name = "reth-transaction-pool" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -9452,7 +9452,7 @@ dependencies = [ "reth-ethereum-primitives", "reth-execution-types", "reth-fs-util", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-storage-api", "reth-tasks", @@ -9472,7 +9472,7 @@ dependencies = [ [[package]] name = "reth-trie" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-eips", @@ -9483,7 +9483,7 @@ dependencies = [ "itertools 0.14.0", "metrics", "reth-execution-errors", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-stages-types", "reth-storage-errors", @@ -9497,7 +9497,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-consensus", "alloy-primitives", @@ -9525,7 +9525,7 @@ dependencies = [ [[package]] name = "reth-trie-db" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "reth-db-api", @@ -9539,7 +9539,7 @@ dependencies = [ [[package]] name = "reth-trie-parallel" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -9549,7 +9549,7 @@ dependencies = [ "rayon", "reth-db-api", "reth-execution-errors", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-provider", "reth-storage-errors", "reth-trie", @@ -9564,7 +9564,7 @@ dependencies = [ [[package]] name = "reth-trie-sparse" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -9573,7 +9573,7 @@ dependencies = [ "metrics", "rayon", "reth-execution-errors", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-primitives-traits", "reth-trie-common", "smallvec", @@ -9583,7 +9583,7 @@ dependencies = [ [[package]] name = "reth-trie-sparse-parallel" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -9591,7 +9591,7 @@ dependencies = [ "metrics", "rayon", "reth-execution-errors", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-trie-common", "reth-trie-sparse", "smallvec", @@ -9601,7 +9601,7 @@ dependencies = [ [[package]] name = "reth-zstd-compressors" version = "1.7.0" -source = "git+https://github.com/bnb-chain/reth.git?tag=v0.0.6#6316e5ce379c6f781703d075c9487f88631e0a28" +source = "git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root#8d4f8cafda3ea358e77224305c2f4d64901c1c3e" dependencies = [ "zstd", ] @@ -9662,6 +9662,7 @@ dependencies = [ "phf", "prost 0.12.6", "rand 0.9.2", + "rayon", "reth", "reth-basic-payload-builder", "reth-chain-state", @@ -9673,6 +9674,7 @@ dependencies = [ "reth-discv4", "reth-engine-local", "reth-engine-primitives", + "reth-engine-tree", "reth-eth-wire", "reth-eth-wire-types", "reth-ethereum-engine-primitives", @@ -9681,7 +9683,8 @@ dependencies = [ "reth-ethereum-primitives", "reth-evm", "reth-evm-ethereum", - "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?tag=v0.0.6)", + "reth-execution-types", + "reth-metrics 1.7.0 (git+https://github.com/bnb-chain/reth.git?branch=debug-trie-root)", "reth-network", "reth-network-api", "reth-network-p2p", @@ -9699,8 +9702,12 @@ dependencies = [ "reth-tasks", "reth-tracing", "reth-transaction-pool", + "reth-trie", "reth-trie-common", "reth-trie-db", + "reth-trie-parallel", + "reth-trie-sparse", + "reth-trie-sparse-parallel", "revm", "schnellru", "scrypt 0.11.0", diff --git a/Cargo.toml b/Cargo.toml index 6b9749e..73900e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,45 +13,51 @@ name = "reth-bsc" path = "src/main.rs" [dependencies] -reth = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-cli = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-cli-commands = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-basic-payload-builder = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-db = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-engine-local = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-chainspec = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-cli-util = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-discv4 = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6", features = ["test-utils"] } -reth-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-ethereum-forks = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6", features = ["serde"] } -reth-ethereum-payload-builder = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-payload-builder-primitives = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-chain-state = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-ethereum-primitives = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-eth-wire = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-eth-wire-types = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-evm = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-evm-ethereum = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-metrics = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-node-core = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-revm = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-network = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6", features = ["test-utils"] } -reth-network-p2p = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-network-api = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-node-ethereum = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6", features = ["test-utils"] } -reth-network-peers = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-payload-primitives = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-ethereum-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-primitives = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-primitives-traits = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-provider = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6", features = ["test-utils"] } -reth-rpc-eth-api = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-rpc-engine-api = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-tracing = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-trie-common = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-trie-db = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-tasks = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } -reth-transaction-pool = { git = "https://github.com/bnb-chain/reth.git", tag = "v0.0.6" } +reth = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-cli = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-cli-commands = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-basic-payload-builder = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-db = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-engine-local = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-chainspec = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-cli-util = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-discv4 = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root", features = ["test-utils"] } +reth-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-ethereum-forks = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root", features = ["serde"] } +reth-ethereum-payload-builder = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-payload-builder-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-chain-state = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-ethereum-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-eth-wire = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-eth-wire-types = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-evm = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-evm-ethereum = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-metrics = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-node-core = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-revm = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-network = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root", features = ["test-utils"] } +reth-network-p2p = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-network-api = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-node-ethereum = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root", features = ["test-utils"] } +reth-network-peers = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-payload-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-ethereum-engine-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-primitives = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-primitives-traits = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-provider = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root", features = ["test-utils"] } +reth-rpc-eth-api = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-rpc-engine-api = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-tracing = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-trie-common = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-trie-db = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-trie = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-trie-parallel = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-trie-sparse = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-trie-sparse-parallel = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-execution-types = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-tasks = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-transaction-pool = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } +reth-engine-tree = { git = "https://github.com/bnb-chain/reth.git", branch = "debug-trie-root" } revm = "29.0.0" # alloy dependencies @@ -97,6 +103,7 @@ hex = "0.4" lazy_static = "1.4.0" lru = "0.12" metrics = "0.24" +rayon = "1.11" phf = { version = "0.11", features = ["macros"] } once_cell = { version = "1.19", default-features = false, features = ["alloc"] } parity-bytes = { version = "0.1.2", default-features = false } diff --git a/src/node/engine.rs b/src/node/engine.rs index 948e7f4..071ccfd 100644 --- a/src/node/engine.rs +++ b/src/node/engine.rs @@ -72,6 +72,7 @@ pub struct BscPayloadServiceBuilder; impl PayloadServiceBuilder for BscPayloadServiceBuilder where Node: FullNodeTypes, + ::Provider: reth_provider::NewCanonicalChainSubscriptions, Pool: TransactionPool> + Clone + 'static, diff --git a/src/node/evm/builder.rs b/src/node/evm/builder.rs index f0e2c41..36fb68c 100644 --- a/src/node/evm/builder.rs +++ b/src/node/evm/builder.rs @@ -2,10 +2,20 @@ use crate::{BscPrimitives, hardforks::BscHardforks, node::evm::{assembler::{BscB use reth_evm::execute::{BlockBuilder, BlockBuilderOutcome, BlockExecutionError, ExecutorTx}; use alloy_evm::eth::receipt_builder::ReceiptBuilder; use reth_primitives_traits::{HeaderTy, NodePrimitives, Recovered, RecoveredBlock, SealedHeader, SignerRecoverable, TxTy}; -use reth_provider::StateProvider; +use reth_provider::{ + BlockNumReader, BlockReader, DatabaseProviderFactory, HeaderProvider, StateProvider, +}; use revm::database::{State, states::bundle_state::BundleRetention}; use alloy_evm::{Evm, block::BlockExecutor}; use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks}; +use crate::node::trie_root::{ + current_payload_build_attempt, current_payload_build_trace_id, + insert_payload_processor_hook_drop, take_payload_processor_started, + wait_take_payload_processor_state_root, PayloadProcessorKey, RootDebugger, + StateRootCompareState, +}; +use parking_lot::Mutex; +use std::sync::Arc; /// rewrite BasicBlockBuilder, mainly about the finish() trait. @@ -52,6 +62,56 @@ where } } +/// A [`BscBlockBuilder`] variant that can compute state root using `ParallelStateRoot`. +/// +/// This is used in the validator/miner payload build path where we have access to a +/// `DatabaseProviderFactory` (the node provider). +pub struct BscBlockBuilderWithFactory<'a, EVM, Spec, R, Factory> +where + R: ReceiptBuilder, + Spec: EthChainSpec + EthereumHardforks + BscHardforks + Hardforks + Clone, +{ + /// The block executor used to execute transactions. + pub executor: BscBlockExecutor<'a, EVM, Spec, R>, + /// The transactions executed in this block. + pub transactions: Vec>>, + /// The parent block execution context. + pub ctx: BscBlockExecutionCtx<'a>, + /// The shared context for block execution. + pub shared_ctx: BscExecutionSharedCtx, + /// The sealed parent block header. + pub parent: &'a SealedHeader>, + /// The assembler used to build the block. + pub assembler: &'a BscBlockAssembler, + /// Provider factory for creating a consistent DB view in parallel state root computation. + pub provider_factory: Factory, +} + +impl<'a, EVM, Spec, R, Factory> BscBlockBuilderWithFactory<'a, EVM, Spec, R, Factory> +where + R: ReceiptBuilder, + Spec: EthChainSpec + EthereumHardforks + BscHardforks + Hardforks + Clone, +{ + pub fn new( + executor: BscBlockExecutor<'a, EVM, Spec, R>, + ctx: BscBlockExecutionCtx<'a>, + shared_ctx: BscExecutionSharedCtx, + assembler: &'a BscBlockAssembler, + parent: &'a SealedHeader>, + provider_factory: Factory, + ) -> Self { + Self { + executor, + transactions: Vec::new(), + ctx, + shared_ctx, + parent, + assembler, + provider_factory, + } + } +} + impl<'a, DB, EVM, Spec, R> BlockBuilder for BscBlockBuilder<'a, EVM, Spec, R> where BscBlockExecutor<'a, EVM, Spec, R>: alloy_evm::block::BlockExecutor< @@ -99,7 +159,22 @@ where state: impl StateProvider, ) -> Result, BlockExecutionError> { let finish_start = std::time::Instant::now(); + // Build-attempt key used to correlate payload_processor/parallel results. + // + // Miner may build multiple candidate payloads under the same parent; using only parent + // would cause cross-attempt overwrites in global caches. + // + // IMPORTANT: must be captured before `executor.finish()` consumes the executor. + let trace_id = current_payload_build_trace_id().unwrap_or(0); + let attempt = current_payload_build_attempt().unwrap_or(0); + let key = PayloadProcessorKey::new(self.parent.number, self.parent.hash(), trace_id, attempt); let (evm, result) = self.executor.finish()?; + // `executor.finish()` executes system transactions and then drops the executor (and its + // state hook sender) on return. Record the time right after system tx execution completes. + insert_payload_processor_hook_drop(key, std::time::Instant::now()); + // NOTE: `executor.finish()` consumes the executor and runs system transactions. + // This ensures any installed state hook (e.g. payload_processor) sees user txs + system txs, + // and will be dropped automatically after `finish()` returns. let (db, evm_env) = evm.finish(); let assembled_system_txs = self.shared_ctx.inner.borrow().assembled_system_txs.clone(); @@ -109,9 +184,31 @@ where // calculate the state root let state_root_start = std::time::Instant::now(); let hashed_state = state.hashed_post_state(&db.bundle_state); - let (state_root, trie_updates) = state - .state_root_with_updates(hashed_state.clone()) - .map_err(BlockExecutionError::other)?; + + // 1) If payload_processor was started, wait for its sparse trie result (authoritative). + // 2) Otherwise, fall back to the legacy serial state-root calculation. + // + // NOTE: This consumes the "started" marker to avoid unbounded growth and to reduce races. + let mut state_root_source = + if take_payload_processor_started(key) { "payload_processor" } else { "serial" }; + let (state_root, trie_updates) = if state_root_source == "payload_processor" { + // payload_processor runs on a background thread; don't wait forever if it failed. + if let Some(pp_res) = wait_take_payload_processor_state_root(key, std::time::Duration::from_secs(10)) { + (pp_res.state_root, pp_res.trie_updates) + } else { + tracing::debug!( + target: "bsc::builder", + trace_id, + parent_number = self.parent.number, + parent_hash = ?self.parent.hash(), + "PayloadProcessor state root unavailable (timeout/failed); falling back to serial" + ); + state_root_source = "serial_fallback"; + state.state_root_with_updates(hashed_state.clone()).map_err(BlockExecutionError::other)? + } + } else { + state.state_root_with_updates(hashed_state.clone()).map_err(BlockExecutionError::other)? + }; let state_root_duration = state_root_start.elapsed(); let user_tx_len = self.transactions.len(); @@ -150,8 +247,12 @@ where let assemble_duration = assemble_start.elapsed(); let finish_duration = finish_start.elapsed(); + let execution_path = if trace_id == 0 { "import_or_other" } else { "payload_build" }; tracing::debug!( target: "bsc::builder", + trace_id, + attempt, + execution_path, block_number = %block.header.number, block_hash = %block.header.hash_slow(), user_tx_len = user_tx_len, @@ -160,6 +261,7 @@ where finish_duration_ms = finish_duration.as_millis(), state_root_duration_ms = state_root_duration.as_millis(), assemble_duration_ms = assemble_duration.as_millis(), + state_root_source = state_root_source, "Succeed to seal block" ); @@ -179,3 +281,211 @@ where self.executor } } + +impl<'a, DB, EVM, Spec, R, Factory> BlockBuilder for BscBlockBuilderWithFactory<'a, EVM, Spec, R, Factory> +where + BscBlockExecutor<'a, EVM, Spec, R>: alloy_evm::block::BlockExecutor< + Evm: alloy_evm::Evm< + Spec = ::Spec, + HaltReason = ::HaltReason, + DB = &'a mut State, + >, + Transaction = ::SignedTx, + Receipt = ::Receipt, + >, + DB: reth_evm::Database + 'a, + R: ReceiptBuilder::SignedTx>, + Spec: EthChainSpec + EthereumHardforks + BscHardforks + Hardforks + Clone, + R::Transaction: Clone + SignerRecoverable, + EVM: alloy_evm::Evm, + Factory: DatabaseProviderFactory + + Clone + + Send + + Sync + + 'static, +{ + type Primitives = BscPrimitives; + type Executor = BscBlockExecutor<'a, EVM, Spec, R>; + + fn apply_pre_execution_changes(&mut self) -> Result<(), BlockExecutionError> { + self.executor.apply_pre_execution_changes() + } + + fn execute_transaction_with_commit_condition( + &mut self, + tx: impl ExecutorTx, + f: impl FnOnce( + &revm::context::result::ExecutionResult<<::Evm as alloy_evm::Evm>::HaltReason>, + ) -> alloy_evm::block::CommitChanges, + ) -> Result, BlockExecutionError> { + if let Some(gas_used) = + self.executor.execute_transaction_with_commit_condition(tx.as_executable(), f)? + { + self.transactions.push(tx.into_recovered()); + Ok(Some(gas_used)) + } else { + Ok(None) + } + } + + fn finish( + mut self, + state: impl StateProvider, + ) -> Result, BlockExecutionError> { + let finish_start = std::time::Instant::now(); + // Build-attempt key used to correlate payload_processor/parallel results. + // + // Miner may build multiple candidate payloads under the same parent; using only parent + // would cause cross-attempt overwrites in global caches. + // + // IMPORTANT: must be captured before `executor.finish()` consumes the executor. + let trace_id = current_payload_build_trace_id().unwrap_or(0); + let attempt = current_payload_build_attempt().unwrap_or(0); + let key = PayloadProcessorKey::new(self.parent.number, self.parent.hash(), trace_id, attempt); + let (evm, result) = self.executor.finish()?; + // `executor.finish()` executes system transactions and then drops the executor (and its + // state hook sender) on return. Record the time right after system tx execution completes. + insert_payload_processor_hook_drop(key, std::time::Instant::now()); + let (db, evm_env) = evm.finish(); + + let assembled_system_txs = self.shared_ctx.inner.borrow().assembled_system_txs.clone(); + // merge all transitions into bundle state + db.merge_transitions(BundleRetention::Reverts); + + // calculate the state root (serial, authoritative) + let execution_duration_ms = finish_start.elapsed().as_millis(); + let state_root_start = std::time::Instant::now(); + let hashed_state = state.hashed_post_state(&db.bundle_state); + + // Keep the provider factory alive/used (the payload_processor path now owns acceleration). + let _ = &self.provider_factory; + + // Start accelerated state-root computation in the background BEFORE we run the serial + // authoritative state-root, so we can compare overlapped timings. + let compare_state = Arc::new(Mutex::new(StateRootCompareState::default())); + { + let mut w = compare_state.lock(); + w.user_tx_len = Some(self.transactions.len()); + w.system_tx_len = Some(assembled_system_txs.len()); + w.total_tx_len = Some(self.transactions.len() + assembled_system_txs.len()); + w.execution_duration_ms = Some(execution_duration_ms); + } + // (Background) run ParallelStateRoot for comparison. + RootDebugger::spawn_parallel_state_root_compare( + self.provider_factory.clone(), + key, + hashed_state.clone(), + ); + // (Background) log Serial vs Parallel vs PayloadProcessor once all results are available. + RootDebugger::spawn_triple_compare( + key, + hashed_state.clone(), + compare_state.clone(), + ); + + // Prefer payload_processor's sparse trie root if it was started for this payload build. + // Otherwise fall back to serial state_root_with_updates. + // NOTE: consume the started marker (see root_debugger.rs). + let mut state_root_source = + if take_payload_processor_started(key) { "payload_processor" } else { "serial" }; + let (state_root, trie_updates) = if state_root_source == "payload_processor" { + if let Some(pp_res) = wait_take_payload_processor_state_root(key, std::time::Duration::from_secs(10)) { + (pp_res.state_root, pp_res.trie_updates) + } else { + tracing::debug!( + target: "bsc::builder", + trace_id, + parent_number = self.parent.number, + parent_hash = ?self.parent.hash(), + "PayloadProcessor state root unavailable (timeout/failed); falling back to serial" + ); + state_root_source = "serial_fallback"; + state + .state_root_with_updates(hashed_state.clone()) + .map_err(BlockExecutionError::other)? + } + } else { + state + .state_root_with_updates(hashed_state.clone()) + .map_err(BlockExecutionError::other)? + }; + let state_root_duration = state_root_start.elapsed(); + { + let mut w = compare_state.lock(); + w.serial_root = Some(state_root); + w.serial_duration_ms = Some(state_root_duration.as_millis()); + } + + let user_tx_len = self.transactions.len(); + let system_tx_len = assembled_system_txs.len(); + self.transactions.extend(assembled_system_txs); + let total_tx_len = self.transactions.len(); + + let (transactions, senders): (Vec<_>, Vec<_>) = + self.transactions.into_iter().map(|tx| tx.into_parts()).unzip(); + + let bsc_input: BscBlockAssemblerInput<'_, '_, BscBlockExecutorFactory> = BscBlockAssemblerInput { + evm_env, + execution_ctx: self.ctx, + parent: self.parent, + transactions: transactions.clone(), + output: &result, + bundle_state: &db.bundle_state, + state_provider: &state, + state_root, + }; + let assemble_start = std::time::Instant::now(); + let block = self.assembler.assemble_block_bsc(bsc_input)?; + let block_hash = block.header.hash_slow(); + + // Provide the final block hash to the background compare task for easy grep. + compare_state.lock().block_hash = Some(block_hash); + + // cache current validators and turn length + let current_validators = self.shared_ctx.inner.borrow().current_validators.clone(); + if let Some((validators, vote_addresses)) = current_validators { + VALIDATOR_CACHE.lock().unwrap().insert(block.header.hash_slow(), (validators, vote_addresses)); + tracing::debug!("Succeed to update validator cache in builder, block_number: {}, block_hash: {}", block.header.number, block.header.hash_slow()); + } + if let Some(turn_length) = self.shared_ctx.inner.borrow().turn_length { + TURN_LENGTH_CACHE.lock().unwrap().insert(block.header.hash_slow(), turn_length); + tracing::debug!("Succeed to update turn length cache in builder, block_number: {}, block_hash: {}", block.header.number, block.header.hash_slow()); + } + let assemble_duration = assemble_start.elapsed(); + + let finish_duration = finish_start.elapsed(); + let execution_path = if trace_id == 0 { "import_or_other" } else { "payload_build" }; + tracing::debug!( + target: "bsc::builder", + trace_id, + attempt, + execution_path, + block_number = %block.header.number, + block_hash = %block_hash, + user_tx_len = user_tx_len, + system_tx_len = system_tx_len, + total_tx_len = total_tx_len, + finish_duration_ms = finish_duration.as_millis(), + state_root_duration_ms = state_root_duration.as_millis(), + assemble_duration_ms = assemble_duration.as_millis(), + serial_mode_used = true, + state_root_source = state_root_source, + "Succeed to seal block (state root)" + ); + + let block = RecoveredBlock::new_unhashed(block, senders); + Ok(BlockBuilderOutcome { execution_result: result, hashed_state, trie_updates, block }) + } + + fn executor_mut(&mut self) -> &mut Self::Executor { + &mut self.executor + } + + fn executor(&self) -> &Self::Executor { + &self.executor + } + + fn into_executor(self) -> Self::Executor { + self.executor + } +} diff --git a/src/node/evm/config.rs b/src/node/evm/config.rs index 918032b..ff57e1e 100644 --- a/src/node/evm/config.rs +++ b/src/node/evm/config.rs @@ -1,6 +1,6 @@ use super::{ assembler::BscBlockAssembler, - builder::BscBlockBuilder, + builder::{BscBlockBuilder, BscBlockBuilderWithFactory}, executor::BscBlockExecutor, factory::BscEvmFactory, }; @@ -25,6 +25,7 @@ use reth_revm::State; use revm::{ Inspector, context::{BlockEnv, CfgEnv}, context_interface::block::BlobExcessGasAndPrice, primitives::{hardfork::SpecId} }; +use reth_provider::{BlockReader, BlockNumReader, DatabaseProviderFactory, HeaderProvider}; use std::{borrow::Cow, cell::RefCell, convert::Infallible, rc::Rc, sync::Arc}; /// Type alias for system transactions to reduce complexity @@ -97,6 +98,32 @@ impl BscEvmConfig { pub fn bsc(chain_spec: Arc) -> Self { Self::new_with_evm_factory(chain_spec, BscEvmFactory::default()) } + + /// Wraps this config with a provider factory so the block builder can compute state root using + /// `ParallelStateRoot` (requires a consistent DB view). + pub fn with_provider_factory(self, provider_factory: Factory) -> BscEvmConfigWithFactory + where + Factory: Clone, + { + BscEvmConfigWithFactory { inner: self, provider_factory } + } +} + +/// BSC EVM config wrapper that carries a `DatabaseProviderFactory` for parallel state root. +#[derive(Clone)] +pub struct BscEvmConfigWithFactory { + inner: BscEvmConfig, + provider_factory: Factory, +} + +impl core::fmt::Debug for BscEvmConfigWithFactory { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + // Do not require `Factory: Debug` (provider factory types can be large/non-debug). + f.debug_struct("BscEvmConfigWithFactory") + .field("inner", &self.inner) + .field("provider_factory", &"") + .finish() + } } impl BscEvmConfig { @@ -399,6 +426,93 @@ where } } +impl ConfigureEvm for BscEvmConfigWithFactory +where + Self: Send + Sync + Unpin + Clone + 'static, + Factory: DatabaseProviderFactory + + Clone + + Send + + Sync + + Unpin + + 'static, +{ + type Primitives = BscPrimitives; + type Error = Infallible; + type NextBlockEnvCtx = NextBlockEnvAttributes; + type BlockExecutorFactory = BscBlockExecutorFactory; + type BlockAssembler = BscBlockAssembler; + + fn block_executor_factory(&self) -> &Self::BlockExecutorFactory { + ::block_executor_factory(&self.inner) + } + + fn block_assembler(&self) -> &Self::BlockAssembler { + ::block_assembler(&self.inner) + } + + fn evm_env(&self, header: &Header) -> EvmEnv { + ::evm_env(&self.inner, header) + } + + fn next_evm_env( + &self, + parent: &Header, + attributes: &Self::NextBlockEnvCtx, + ) -> Result, Self::Error> { + ::next_evm_env(&self.inner, parent, attributes) + } + + fn context_for_block<'a>( + &self, + block: &'a SealedBlock>, + ) -> ExecutionCtxFor<'a, Self> { + ::context_for_block(&self.inner, block) + } + + fn context_for_next_block( + &self, + parent: &SealedHeader>, + attributes: Self::NextBlockEnvCtx, + ) -> ExecutionCtxFor<'_, Self> { + ::context_for_next_block(&self.inner, parent, attributes) + } + + fn create_block_builder<'a, DB, I>( + &'a self, + evm: EvmFor, I>, + parent: &'a SealedHeader>, + ctx: ::ExecutionCtx<'a>, + ) -> impl BlockBuilder< + Primitives = Self::Primitives, + Executor: BlockExecutorFor<'a, Self::BlockExecutorFactory, DB, I>, + > + where + DB: Database, + I: InspectorFor> + 'a, + { + // Mirror the inner implementation but return the builder variant that has access to the + // provider factory, enabling parallel state root. + let shared_ctx = BscExecutionSharedCtx::default(); + let bsc_executor = BscBlockExecutor::new( + evm, + ctx.clone(), + shared_ctx.clone(), + self.block_executor_factory().spec().clone(), + *self.block_executor_factory().receipt_builder(), + SystemContract::new(self.block_executor_factory().spec().clone()), + ); + + BscBlockBuilderWithFactory::new( + bsc_executor, + ctx, + shared_ctx, + self.block_assembler(), + parent, + self.provider_factory.clone(), + ) + } +} + impl ConfigureEngineEvm for BscEvmConfig where Self: Send + Sync + Unpin + Clone + 'static, @@ -429,6 +543,32 @@ where } } +impl ConfigureEngineEvm for BscEvmConfigWithFactory +where + Self: Send + Sync + Unpin + Clone + 'static, + Factory: DatabaseProviderFactory + + Clone + + Send + + Sync + + Unpin + + 'static, +{ + fn evm_env_for_payload(&self, payload: &BscExecutionData) -> EvmEnv { + >::evm_env_for_payload(&self.inner, payload) + } + + fn context_for_payload<'a>(&self, payload: &'a BscExecutionData) -> BscBlockExecutionCtx<'a> { + >::context_for_payload(&self.inner, payload) + } + + fn tx_iterator_for_payload( + &self, + payload: &BscExecutionData, + ) -> impl ExecutableTxIterator { + >::tx_iterator_for_payload(&self.inner, payload) + } +} + /// Map the latest active hardfork at the given timestamp or block number to a [`BscHardfork`]. pub fn revm_spec_by_timestamp_and_block_number( chain_spec: impl BscHardforks, diff --git a/src/node/evm/executor.rs b/src/node/evm/executor.rs index f14f969..acd2ee0 100644 --- a/src/node/evm/executor.rs +++ b/src/node/evm/executor.rs @@ -1,6 +1,6 @@ use super::patch::HertzPatchManager; use crate::{ - consensus::{SYSTEM_ADDRESS, parlia::{Parlia, Snapshot, VoteAddress}}, evm::transaction::BscTxEnv, hardforks::BscHardforks, metrics::{BscBlockchainMetrics, BscConsensusMetrics, BscExecutorMetrics, BscRewardsMetrics, BscVoteMetrics}, node::evm::config::BscExecutionSharedCtx, system_contracts::{ + consensus::{parlia::{Parlia, Snapshot, VoteAddress}}, evm::transaction::BscTxEnv, hardforks::BscHardforks, metrics::{BscBlockchainMetrics, BscConsensusMetrics, BscExecutorMetrics, BscRewardsMetrics, BscVoteMetrics}, node::evm::config::BscExecutionSharedCtx, system_contracts::{ SystemContract, feynman_fork::ValidatorElectionInfo, get_upgrade_system_contracts, is_system_transaction } }; @@ -25,7 +25,8 @@ use revm::{ result::{ExecutionResult, ResultAndState}, }, - state::Bytecode, + state::{Account as RevmAccount, Bytecode, EvmState}, + Database as RevmDatabase, DatabaseCommit, }; use tracing::{error, warn, info, debug, trace}; @@ -105,6 +106,42 @@ where BscTxEnv: IntoTxEnv<::Tx>, R::Transaction: Into, { + /// Emit an artificial state update to the installed state hook for accounts whose state was + /// mutated outside of `evm.transact(...)` (e.g. via `apply_transition`, `increment_balances`). + /// + /// This is required for the background `PayloadProcessor` comparison, which only observes + /// state updates via the hook. + pub(crate) fn emit_state_hook_for_accounts( + &mut self, + source: StateChangeSource, + accounts: impl IntoIterator, + ) -> Result<(), BlockExecutionError> { + let tx_id = match source { + StateChangeSource::Transaction(i) => i, + _ => 0, + }; + + let mut updates: EvmState = EvmState::default(); + for address in accounts { + let info = self + .evm + .db_mut() + .basic(address) + .map_err(BlockExecutionError::other)? + .unwrap_or_default(); + let mut account = RevmAccount::default(); + account.info = info; + account.transaction_id = tx_id; + account.mark_touch(); + updates.insert(address, account); + } + + if !updates.is_empty() { + self.system_caller.on_state(source, &updates); + } + Ok(()) + } + /// Creates a new BscBlockExecutor. pub(crate) fn new( evm: EVM, @@ -269,6 +306,8 @@ where let transition = account.change(info, Default::default()); self.evm.db_mut().apply_transition(vec![(address, transition)]); + // Notify payload_processor hook about this direct state mutation. + self.emit_state_hook_for_accounts(StateChangeSource::Transaction(self.receipts.len()), [address])?; Ok(()) } @@ -310,6 +349,11 @@ where let transition = account.change(new_info, Default::default()); self.evm.db_mut().apply_transition(vec![(HISTORY_STORAGE_ADDRESS, transition)]); + // Notify payload_processor hook about this direct state mutation. + self.emit_state_hook_for_accounts( + StateChangeSource::Transaction(self.receipts.len()), + [HISTORY_STORAGE_ADDRESS], + )?; info!( target: "bsc::executor::prague", @@ -417,10 +461,11 @@ where return Ok(None); } - let mut temp_state = state.clone(); - temp_state.remove(&SYSTEM_ADDRESS); + // Forward full state changes to the state hook. + // + // PayloadProcessor relies on these updates to compute the correct post-state root. self.system_caller - .on_state(StateChangeSource::Transaction(self.receipts.len()), &temp_state); + .on_state(StateChangeSource::Transaction(self.receipts.len()), &state); let gas_used = result.gas_used(); @@ -474,9 +519,10 @@ where f(&result); - let mut temp_state = state.clone(); - temp_state.remove(&SYSTEM_ADDRESS); - self.system_caller.on_state(StateChangeSource::Transaction(self.receipts.len()), &temp_state); + // Forward full state changes to the state hook. + // + // PayloadProcessor relies on these updates to compute the correct post-state root. + self.system_caller.on_state(StateChangeSource::Transaction(self.receipts.len()), &state); let gas_used = result.gas_used(); self.gas_used += gas_used; diff --git a/src/node/evm/post_execution.rs b/src/node/evm/post_execution.rs index c1ff942..5358d0b 100644 --- a/src/node/evm/post_execution.rs +++ b/src/node/evm/post_execution.rs @@ -363,9 +363,10 @@ where let result_and_state = self.evm.transact(tx_env).map_err(BlockExecutionError::other)?; let ResultAndState { result, state } = result_and_state; - let mut temp_state = state.clone(); - temp_state.remove(&SYSTEM_ADDRESS); - self.system_caller.on_state(StateChangeSource::Transaction(self.receipts.len()), &temp_state); + // Forward full state changes to the state hook. + // + // PayloadProcessor relies on these updates to compute the correct post-state root. + self.system_caller.on_state(StateChangeSource::Transaction(self.receipts.len()), &state); let gas_used = result.gas_used(); self.gas_used += gas_used; @@ -415,6 +416,13 @@ where .increment_balances(balance_increment) .map_err(BlockExecutionError::other)?; + // These balance movements are applied directly (not via `evm.transact`), so we must emit + // them to the optional state hook for the background PayloadProcessor comparison. + self.emit_state_hook_for_accounts( + StateChangeSource::Transaction(self.receipts.len()), + [SYSTEM_ADDRESS, validator], + )?; + let system_reward_balance = self .evm .db_mut() diff --git a/src/node/miner/bsc_miner.rs b/src/node/miner/bsc_miner.rs index 3564096..9007baf 100644 --- a/src/node/miner/bsc_miner.rs +++ b/src/node/miner/bsc_miner.rs @@ -4,6 +4,7 @@ use crate::{ node::{ engine::BscBuiltPayload, evm::config::BscEvmConfig, + trie_root::RootDebuggerUpdater, miner::{ config::{MiningConfig, keystore}, payload::{BscPayloadBuilder, BscPayloadJob, BscPayloadJobHandle}, signer::init_global_signer_from_k256, util::prepare_new_attributes }, @@ -20,7 +21,10 @@ use reth_ethereum_payload_builder::EthereumBuilderConfig; use reth_payload_primitives::BuiltPayload; use reth_primitives::TransactionSigned; use reth_primitives_traits::{SealedHeader, BlockBody}; -use reth_provider::{BlockNumReader, HeaderProvider, CanonStateSubscriptions, CanonStateNotification}; +use reth_provider::{ + BlockNumReader, BlockReader, CanonStateNotification, CanonStateSubscriptions, + DatabaseProviderFactory, HeaderProvider, NewCanonicalChainSubscriptions, +}; use reth_tasks::TaskExecutor; use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; @@ -58,13 +62,26 @@ pub struct SubmitContext { } /// NewWorkWorker responsible for listening to canonical state changes and triggering mining. -pub struct NewWorkWorker { +pub struct NewWorkWorker +where + Provider: HeaderProvider
+ + BlockNumReader + + reth_provider::StateProviderFactory + + CanonStateSubscriptions + + NewCanonicalChainSubscriptions + + reth_provider::NodePrimitivesProvider + + Clone + + Send + + Sync + + 'static, +{ validator_address: Address, provider: Provider, snapshot_provider: Arc, mining_queue_tx: mpsc::UnboundedSender, consensus: Arc>, pre_cached: Option, + root_debugger: RootDebuggerUpdater, } impl NewWorkWorker @@ -73,6 +90,7 @@ where + BlockNumReader + reth_provider::StateProviderFactory + CanonStateSubscriptions + + NewCanonicalChainSubscriptions + reth_provider::NodePrimitivesProvider + Clone + Send @@ -86,6 +104,12 @@ where mining_queue_tx: mpsc::UnboundedSender, consensus: Arc>, ) -> Self { + // Keep enough canonical block overlays to bridge DB lag. + // + // If this is too small (e.g. 128), sparse/parallel root computation will frequently fall + // back to serial with errors like: + // `missing trie overlay blocks for range X..=Y (have 128)`. + let root_debugger = RootDebuggerUpdater::new(&provider, 4096); Self { validator_address, provider, @@ -93,6 +117,7 @@ where mining_queue_tx, consensus, pre_cached: None, + root_debugger, } } @@ -108,6 +133,9 @@ where loop { match notifications.next().await { Some(event) => { + // Keep trie root overlay cache up-to-date. + self.root_debugger.drain(); + let committed = event.committed(); let tip = committed.tip(); let is_reorg = matches!(event, CanonStateNotification::Reorg { .. }); @@ -432,8 +460,10 @@ where Provider: HeaderProvider
+ BlockNumReader + reth_provider::StateProviderFactory + + DatabaseProviderFactory + CanonStateSubscriptions + Clone + + Unpin + Send + Sync + 'static, @@ -565,7 +595,8 @@ where self.validator_address ); - let evm_config = BscEvmConfig::new(self.chain_spec.clone()); + let evm_config = BscEvmConfig::new(self.chain_spec.clone()) + .with_provider_factory(self.provider.clone()); let payload_builder = BscPayloadBuilder::new( self.provider.clone(), self.pool.clone(), @@ -1008,7 +1039,19 @@ where } /// Miner that handles block production for BSC. -pub struct BscMiner { +pub struct BscMiner +where + Provider: HeaderProvider
+ + BlockNumReader + + reth_provider::StateProviderFactory + + CanonStateSubscriptions + + NewCanonicalChainSubscriptions + + reth_provider::NodePrimitivesProvider + + Clone + + Send + + Sync + + 'static, +{ validator_address: Address, signing_key: SigningKey, new_work_worker: NewWorkWorker, @@ -1026,8 +1069,11 @@ where Provider: HeaderProvider
+ BlockNumReader + reth_provider::StateProviderFactory + + DatabaseProviderFactory + CanonStateSubscriptions + + NewCanonicalChainSubscriptions + Clone + + Unpin + Send + Sync + 'static, diff --git a/src/node/miner/payload.rs b/src/node/miner/payload.rs index 8fdd67c..b201d9f 100644 --- a/src/node/miner/payload.rs +++ b/src/node/miner/payload.rs @@ -7,11 +7,23 @@ use crate::node::evm::config::BscEvmConfig; use crate::node::miner::bid_simulator::BidSimulator; use crate::node::miner::bsc_miner::{MiningContext, SubmitContext}; use crate::node::pool::BlacklistedAddressError; -use reth_provider::StateProviderFactory; +use crate::node::trie_root::{ + insert_payload_processor_state_root, insert_payload_processor_state_root_error, mark_payload_processor_started, payload_build_trace_id_scope, + current_payload_build_attempt, + payload_build_attempt_scope, + take_payload_processor_hook_drop, + PayloadProcessorKey, PayloadProcessorStateRootResult, +}; +use alloy_evm::block::BlockExecutor; +use reth_provider::{BlockNumReader, HeaderProvider, StateProviderFactory}; use reth_revm::{database::StateProviderDatabase, db::State}; use reth_evm::{ConfigureEvm, NextBlockEnvAttributes}; use reth_evm::execute::BlockBuilder; use alloy_evm::Evm; +use reth_evm::execute::WithTxEnv; +use reth_evm::TxEnvFor; +use reth_engine_primitives::TreeConfig; +use reth_engine_tree::tree::{ExecutionEnv, PayloadProcessor}; use reth_payload_primitives::{PayloadBuilderError, BuiltPayload}; use reth::transaction_pool::{TransactionPool, PoolTransaction}; use reth_primitives::TransactionSigned; @@ -42,6 +54,8 @@ use reth_chainspec::EthChainSpec; use reth_chainspec::EthereumHardforks; use crate::consensus::eip4844::{calc_blob_fee, BLOB_TX_BLOB_GAS_PER_BLOB}; use std::sync::atomic::{AtomicU64, Ordering}; +use std::convert::Infallible; +use crate::node::trie_root::trie_overlay_cache; /// Delay left over for mining calculation @@ -125,7 +139,14 @@ pub struct BscPayloadBuilder { impl BscPayloadBuilder where - Client: StateProviderFactory + 'static, + Client: StateProviderFactory + + reth_provider::DatabaseProviderFactory< + Provider: reth_provider::BlockNumReader + reth_provider::HeaderProvider + reth_provider::BlockReader + > + + Clone + + Send + + Sync + + 'static, EvmConfig: ConfigureEvm + 'static, ::Primitives: reth_primitives_traits::NodePrimitives< BlockHeader = alloy_consensus::Header, @@ -163,6 +184,11 @@ where /// /// Returns a `Result` containing the built payload or an error. pub async fn build_payload(&self, args: BscBuildArguments) -> Result> { + // NOTE: payload building is async and may hop threads; use task-local trace_id so the + // synchronous `builder.finish()` can still disambiguate per-attempt root computation. + let trace_id_scope = args.trace_id; + payload_build_trace_id_scope(trace_id_scope, async move { + (|| -> Result> { let build_start = std::time::Instant::now(); let BscBuildArguments { mut cached_reads, config, cancel, trace_id, min_gas_tip } = args; let PayloadConfig { parent_header, attributes } = config; @@ -186,6 +212,164 @@ where ) .map_err(PayloadBuilderError::other)?; + // Start engine-tree's PayloadProcessor to compute sparse state root concurrently while we + // execute txs for payload building. We disable caching+prewarming (no tx execution in + // prewarm task) and only use the state update stream via the state_hook. + let parent_number = parent_header.number(); + let parent_hash = parent_header.hash_slow(); + let attempt = current_payload_build_attempt().unwrap_or(0); + let key = PayloadProcessorKey::new(parent_number, parent_hash, trace_id, attempt); + + // Provide an empty tx iterator because we don't want PayloadProcessor to execute txs + // itself; we only stream state updates from our own executor. + type DummyTx = + WithTxEnv, reth_primitives_traits::Recovered::Primitives>>>; + let empty_txs = std::iter::empty::, Infallible>>(); + + let tree_cfg = TreeConfig::default() + .without_caching_and_prewarming(true) + .with_max_proof_task_concurrency(128); + + // Construct a minimal engine-tree ExecutionEnv. Prewarming is disabled so `evm_env` is + // effectively unused (still required by the API). + let exec_env = ExecutionEnv { evm_env: Default::default(), hash: parent_hash, parent_hash }; + + // Use a valid DB tip for the consistent view (parent may not always be persisted yet). + let provider_ro = self.client.database_provider_ro().map_err(PayloadBuilderError::other)?; + let db_last = provider_ro.best_block_number().map_err(PayloadBuilderError::other)?; + let db_tip = provider_ro + .sealed_header(db_last) + .map_err(PayloadBuilderError::other)? + .ok_or_else(|| PayloadBuilderError::other(std::io::Error::other("db tip missing")))?; + + let consistent_view = + reth_provider::providers::ConsistentDbView::new(self.client.clone(), Some((db_tip.hash(), db_last))); + // Build trie input for the parent state (DB + overlays up to parent). + // If the DB tip is behind the parent and we can't fully cover the gap from trie_overlay, + // then we skip starting payload_processor (comparison only; does not affect sealing). + let mut trie_input = reth_trie::TrieInput::default(); + let mut can_start_payload_processor = true; + // If the DB tip is exactly at the parent height but points to a different hash, then the + // parent block we're building on is not the DB's canonical tip. In that case we cannot + // build a consistent view for `parent_hash` (ConsistentDbView requires tip hash == sealed_header(number)), + // so skip starting payload_processor (comparison only). + if db_last == parent_number && db_tip.hash() != parent_hash { + can_start_payload_processor = false; + } + if db_last < parent_number { + if let Some(cache) = trie_overlay_cache() { + let needed_range = (db_last + 1)..=parent_number; + let overlays = cache.read().get_range(needed_range.clone()); + if overlays.len() != (parent_number - db_last) as usize { + can_start_payload_processor = false; + } else { + for entry in overlays { + if entry.number == parent_number && entry.hash != parent_hash { + can_start_payload_processor = false; + break; + } + let Some(nodes) = entry.trie_updates.as_deref() else { + can_start_payload_processor = false; + break; + }; + trie_input.append_cached_ref(nodes, &entry.hashed_state); + } + } + } else { + can_start_payload_processor = false; + } + } + + if can_start_payload_processor { + // Record that payload_processor is started for this parent key so the block builder + // can decide whether it should wait for the sparse root or fall back to serial. + mark_payload_processor_started(key); + let mut processor = PayloadProcessor::new( + Default::default(), + self.evm_config.clone(), + &tree_cfg, + Default::default(), + ); + let mut pp_handle = processor.spawn_without_caching_and_prewarming( + exec_env, + empty_txs, + consistent_view, + trie_input, + &tree_cfg, + ); + + // Start time for payload_processor wall-time measurement. + let pp_start = std::time::Instant::now(); + + // Attach payload_processor state hook to our executor. + builder.executor_mut().set_state_hook(Some(Box::new(pp_handle.state_hook()))); + + // Wait for the payload processor result on a background thread (do not block payload building). + std::thread::spawn(move || { + match pp_handle.state_root() { + Ok(outcome) => { + let end = std::time::Instant::now(); + let duration_ms_total = end.duration_since(pp_start).as_millis(); + // Best-effort: wait briefly for the hook-drop timestamp to be recorded. + let duration_ms_post_exec = { + let deadline = std::time::Instant::now() + std::time::Duration::from_millis(50); + loop { + if let Some(t) = take_payload_processor_hook_drop(key) { + break Some(end.duration_since(t).as_millis()); + } + if std::time::Instant::now() >= deadline { + break None; + } + std::thread::sleep(std::time::Duration::from_millis(1)); + } + }; + insert_payload_processor_state_root( + key, + PayloadProcessorStateRootResult { + state_root: outcome.state_root, + trie_updates: outcome.trie_updates, + completed_at: end, + duration_ms: duration_ms_total, + post_exec_duration_ms: duration_ms_post_exec, + }, + ); + tracing::debug!( + target: "bsc::builder", + trace_id, + parent_number, + parent_hash = ?parent_hash, + state_root = ?outcome.state_root, + duration_ms_total, + duration_ms_post_exec = ?duration_ms_post_exec, + "PayloadProcessor computed state root" + ); + } + Err(err) => { + insert_payload_processor_state_root_error(key, err.to_string()); + tracing::debug!( + target: "bsc::builder", + trace_id, + parent_number, + parent_hash = ?parent_hash, + %err, + "PayloadProcessor state root unavailable" + ); + } + } + }); + } else { + tracing::debug!( + target: "bsc::builder", + trace_id, + parent_number, + parent_hash = ?parent_hash, + db_last, + "Skip starting PayloadProcessor (missing trie_overlay coverage)" + ); + } + + // Apply pre-execution changes AFTER installing the optional payload_processor hook, so the + // hook sees any pre-execution system contract state transitions. builder.apply_pre_execution_changes().map_err(|err| { warn!( target: "payload_builder", @@ -422,6 +606,8 @@ where Err(err) => return Err(Box::new(PayloadBuilderError::evm(err))), }; + // payload_processor path: no explicit kick needed + // add to the total blob gas used if the transaction successfully executed if let Some(blob_tx) = tx.as_eip4844() { block_blob_count += blob_tx.tx().blob_versioned_hashes.len() as u64; @@ -469,6 +655,7 @@ where // add system txs to payload. let finalize_start = std::time::Instant::now(); + // Drop the hook sender so PayloadProcessor can finalize the root. let BlockBuilderOutcome { execution_result, hashed_state, trie_updates, block } = builder.finish(&state_provider)?; let mut sealed_block = Arc::new(block.sealed_block().clone()); @@ -553,6 +740,8 @@ where executed_trie: Some(ExecutedTrieUpdates::Present(Arc::new(trie_updates))), }; Ok(payload) + })() + }).await } /// Build an empty payload without any user transactions from the pool @@ -698,7 +887,16 @@ where impl BscPayloadJob where - Client: StateProviderFactory + reth_provider::HeaderProvider
+ reth_provider::BlockHashReader + Clone + 'static, + Client: StateProviderFactory + + reth_provider::DatabaseProviderFactory< + Provider: reth_provider::BlockNumReader + reth_provider::HeaderProvider + reth_provider::BlockReader + > + + reth_provider::HeaderProvider
+ + reth_provider::BlockHashReader + + Clone + + Send + + Sync + + 'static, EvmConfig: ConfigureEvm + 'static, ::Primitives: reth_primitives_traits::NodePrimitives, Block = crate::node::primitives::BscBlock, Receipt = reth_ethereum_primitives::Receipt>, Pool: TransactionPool> + 'static, @@ -802,7 +1000,7 @@ where timeout_ms = self.timeout.as_millis(), "Outer loop: Job already timeout, returning best payload" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; }; tokio::select! { @@ -823,8 +1021,11 @@ where let builder = self.builder.clone(); let build_args = self.build_args.clone(); + let attempt = self.retries; self.join_handle.spawn(async move { - builder.build_payload(build_args).await + payload_build_attempt_scope(attempt, async move { + builder.build_payload(build_args).await + }).await }); } None => { @@ -881,7 +1082,7 @@ where retries = self.retries, "Job already timeout, returning best payload immediately" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; }; tokio::select! { @@ -897,7 +1098,7 @@ where job_elapsed_ms = self.job_start_time.elapsed().as_millis(), "try return best payload due to has no time" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; } // Abort by new head. @@ -933,7 +1134,7 @@ where last_cost_time = ?elapsed, "try return best payload due to mining_delay < elapsed" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; } else if std::time::Duration::from_millis(mining_delay) < elapsed * TIME_MULTIPLIER { if let Err(err) = self.try_build_tx.send(()) { warn!( @@ -945,7 +1146,7 @@ where error = ?err, "Failed to send to try build queue" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; } debug!( target: "bsc::miner::payload", @@ -969,7 +1170,7 @@ where error = ?err, "Failed to send to try build queue" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; } debug!( target: "bsc::miner::payload", @@ -1000,7 +1201,7 @@ where retries = self.retries, "Failed to build payload task" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; }, Some(Err(join_err)) => { let elapsed = start_time.elapsed(); @@ -1014,7 +1215,7 @@ where error = %join_err, "Failed to join payload build task" ); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; }, None => { // No task completed, continue to next iteration @@ -1037,7 +1238,7 @@ where "Try return best payload due to has no time" ); self.build_args.cancel.clone().cancel(); - return self.try_return_best_payload(); + return self.try_return_best_payload().await; } // Abort by new head. @@ -1062,7 +1263,7 @@ where } /// Try to return the best payload to result channel - fn try_return_best_payload(&mut self) -> Result<(), Box> { + async fn try_return_best_payload(&mut self) -> Result<(), Box> { let best_bid = self.simulator.get_best_bid(self.mining_ctx.parent_header.hash()); if let Some(bid) = best_bid { info!( @@ -1101,6 +1302,78 @@ where // If in-turn, build an empty payload as fallback if self.mining_ctx.is_inturn { + // If there is an in-flight build task (or a finished one not yet joined), wait for + // it briefly before building an empty payload. + // + // This avoids producing empty blocks while a "real" payload is already being built. + if !self.join_handle.is_empty() { + let grace = std::time::Duration::from_millis(200); + let wait_start = std::time::Instant::now(); + let wait_until = std::time::Instant::now() + grace; + + while std::time::Instant::now() < wait_until && !self.join_handle.is_empty() { + let remaining = wait_until.saturating_duration_since(std::time::Instant::now()); + match tokio::time::timeout(remaining, self.join_handle.join_next()).await { + Ok(Some(Ok(Ok(payload)))) => { + let payload_tx_count = payload.block().body().transaction_count(); + let waited_ms = wait_start.elapsed().as_millis(); + info!( + target: "bsc::miner::payload", + trace_id = self.trace_id, + block_number = payload.block().header().number(), + block_hash = %payload.block().hash(), + is_inturn = self.mining_ctx.is_inturn, + tx_count = payload_tx_count, + waited_ms, + grace_ms = grace.as_millis(), + "Received in-flight payload build result during empty-payload fallback; using it" + ); + self.potential_payloads.push(payload); + break; + } + Ok(Some(Ok(Err(err)))) => { + warn!( + target: "bsc::miner::payload", + trace_id = self.trace_id, + is_inturn = self.mining_ctx.is_inturn, + %err, + "In-flight payload build failed during empty-payload fallback" + ); + } + Ok(Some(Err(err))) => { + warn!( + target: "bsc::miner::payload", + trace_id = self.trace_id, + is_inturn = self.mining_ctx.is_inturn, + %err, + "Failed to join in-flight payload build task during empty-payload fallback" + ); + } + Ok(None) => break, // nothing left to join + Err(_) => break, // timeout + } + } + + // If waiting produced a payload, try to send it. + if let Some(best_payload) = self.pick_best_payload() { + if let Err(err) = self.result_tx.send(SubmitContext { + mining_ctx: self.mining_ctx.clone(), + payload: best_payload, + cancel: self.build_args.cancel.clone(), + }) { + warn!( + target: "bsc::miner::payload", + trace_id = self.trace_id, + is_inturn = self.mining_ctx.is_inturn, + error = %err, + "Failed to send joined payload to result channel" + ); + return Err(Box::new(BscPayloadJobError::ResultChannelSendError(err.to_string()))); + } + return Ok(()); + } + } + warn!( target: "bsc::miner::payload", trace_id = self.trace_id, diff --git a/src/node/mod.rs b/src/node/mod.rs index 688a413..f177502 100644 --- a/src/node/mod.rs +++ b/src/node/mod.rs @@ -32,6 +32,7 @@ pub mod miner; pub mod network; pub mod primitives; pub mod storage; +pub mod trie_root; pub mod vote_producer; pub mod vote_journal; @@ -79,6 +80,7 @@ impl BscNode { > where Node: FullNodeTypes, + ::Provider: reth_provider::NewCanonicalChainSubscriptions, { ComponentsBuilder::default() .node_types::() @@ -100,6 +102,7 @@ impl NodeTypes for BscNode { impl Node for BscNode where N: FullNodeTypes, + ::Provider: reth_provider::NewCanonicalChainSubscriptions, { type ComponentsBuilder = ComponentsBuilder< N, @@ -124,6 +127,7 @@ where impl DebugNode for BscNode where N: FullNodeComponents, + ::Provider: reth_provider::NewCanonicalChainSubscriptions, { type RpcBlock = alloy_rpc_types::Block; diff --git a/src/node/trie_root/mod.rs b/src/node/trie_root/mod.rs new file mode 100644 index 0000000..47f2029 --- /dev/null +++ b/src/node/trie_root/mod.rs @@ -0,0 +1,25 @@ +//! Trie root acceleration module. +//! +//! This module centralizes all trie root optimization complexity (overlay cache, subscriptions, +//! parallel/sparse computation) behind a small interface so that callers can easily fall back to +//! serial computation if needed. + +pub mod root_debugger; +pub mod trie_overlay; + +pub use root_debugger::{ + insert_payload_processor_hook_drop, take_payload_processor_hook_drop, + insert_payload_processor_state_root, take_payload_processor_state_root, + insert_payload_processor_state_root_error, + mark_payload_processor_started, take_payload_processor_started, + wait_take_payload_processor_state_root, + wait_take_payload_processor_state_root_blocking, + current_payload_build_attempt, current_payload_build_trace_id, + payload_build_attempt_scope, payload_build_trace_id_scope, + PayloadProcessorKey, + PayloadProcessorStateRootResult, RootDebugger, + RootDebuggerUpdater, +}; +pub use root_debugger::StateRootCompareState; +pub use trie_overlay::{TrieOverlayCache, TrieOverlayEntry, init_trie_overlay_cache, trie_overlay_cache}; + diff --git a/src/node/trie_root/root_debugger.rs b/src/node/trie_root/root_debugger.rs new file mode 100644 index 0000000..b2beb8a --- /dev/null +++ b/src/node/trie_root/root_debugger.rs @@ -0,0 +1,854 @@ +use super::trie_overlay::{init_trie_overlay_cache, trie_overlay_cache, TrieOverlayEntry}; +use alloy_primitives::B256; +use reth_chain_state::{ExecutedTrieUpdates, NewCanonicalChain}; +use reth_evm::execute::BlockExecutionError; +use reth_provider::{ + providers::ConsistentDbView, BlockNumReader, BlockReader, DatabaseProviderFactory, HeaderProvider, + NewCanonicalChainSubscriptions, NodePrimitivesProvider, +}; +use reth_trie::{ + HashedPostState, TrieInput, +}; +use reth_trie::updates::TrieUpdates; +use reth_trie_parallel::root::ParallelStateRoot; +use parking_lot::{Condvar, Mutex}; +use std::{ + collections::{HashMap, HashSet}, + sync::{Arc, OnceLock}, + time::{Duration, Instant}, +}; +use tokio::sync::broadcast; + +tokio::task_local! { + /// Current payload build attempt id for this async task. + /// + /// This must be task-local (not thread-local) because payload building is async and may hop + /// across runtime worker threads between `.await` points. + static CURRENT_PAYLOAD_TRACE_ID: u64; +} + +tokio::task_local! { + /// Current payload build attempt counter for this async task. + /// + /// `trace_id` identifies a *payload job*, but the miner may run multiple build attempts (retries) + /// under the same `trace_id`. This disambiguates those attempts. + static CURRENT_PAYLOAD_ATTEMPT: u32; +} + +/// Runs `fut` inside a task-local scope where [`current_payload_build_trace_id`] returns `trace_id`. +pub fn payload_build_trace_id_scope( + trace_id: u64, + fut: Fut, +) -> impl std::future::Future +where + Fut: std::future::Future, +{ + CURRENT_PAYLOAD_TRACE_ID.scope(trace_id, fut) +} + +/// Runs `fut` inside a task-local scope where [`current_payload_build_attempt`] returns `attempt`. +pub fn payload_build_attempt_scope( + attempt: u32, + fut: Fut, +) -> impl std::future::Future +where + Fut: std::future::Future, +{ + CURRENT_PAYLOAD_ATTEMPT.scope(attempt, fut) +} + +/// Returns the "current payload build trace_id" for this async task (if set). +pub fn current_payload_build_trace_id() -> Option { + CURRENT_PAYLOAD_TRACE_ID.try_with(|c| *c).ok() +} + +/// Returns the "current payload build attempt" for this async task (if set). +pub fn current_payload_build_attempt() -> Option { + CURRENT_PAYLOAD_ATTEMPT.try_with(|c| *c).ok() +} + +/// Trie root accelerator facade. +/// +/// The goal is to keep all complexity localized here so callers remain simple and can always +/// downgrade to serial computation. +#[derive(Debug, Default, Clone, Copy)] +pub struct RootDebugger; + +/// Key identifying a payload build (parent block). +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct PayloadProcessorKey { + parent_number: u64, + parent_hash: B256, + /// Uniquely identifies a single payload build attempt under the same parent. + /// + /// Miner can retry payload building multiple times for the same `(parent_number, parent_hash)` + /// (different tx set -> different `block_hash`). If we key only by parent, background results + /// (payload_processor/parallel) will overwrite each other and cause false mismatches. + trace_id: u64, + /// Build attempt counter under the same `trace_id`. + /// + /// `BscPayloadJob` may spawn multiple `build_payload()` runs with the same `trace_id`. + attempt: u32, +} + +impl PayloadProcessorKey { + pub const fn new(parent_number: u64, parent_hash: B256, trace_id: u64, attempt: u32) -> Self { + Self { parent_number, parent_hash, trace_id, attempt } + } + + pub const fn parent_number(&self) -> u64 { + self.parent_number + } + + pub const fn parent_hash(&self) -> B256 { + self.parent_hash + } + + pub const fn trace_id(&self) -> u64 { + self.trace_id + } + + pub const fn attempt(&self) -> u32 { + self.attempt + } +} + +#[derive(Debug, Clone)] +pub struct PayloadProcessorStateRootResult { + pub state_root: B256, + pub trie_updates: TrieUpdates, + pub completed_at: Instant, + /// Total wall time from payload_processor start to completion. + pub duration_ms: u128, + /// Extra wall time after the hook sender is dropped (i.e. after tx execution completes). + /// + /// This approximates the "real sparse-tree tail latency" that does not overlap with + /// foreground tx execution. + pub post_exec_duration_ms: Option, +} + +#[derive(Debug, Clone)] +struct PayloadProcessorStateRootEntry { + value: Result, + /// How many consumers still need to read this result. + /// + /// We use 2 consumers: block builder (authoritative selection) + comparer (logging). + remaining_consumers: u8, +} + +#[derive(Debug, Clone)] +struct ParallelStateRootResult { + pub value: Result, + pub duration_ms: u128, +} + +static PAYLOAD_PROCESSOR_ROOTS: OnceLock>> = + OnceLock::new(); +static PAYLOAD_PROCESSOR_ROOTS_CV: OnceLock = OnceLock::new(); +static PAYLOAD_PROCESSOR_STARTED: OnceLock>> = OnceLock::new(); +static PARALLEL_STATE_ROOTS: OnceLock>> = + OnceLock::new(); +static PAYLOAD_PROCESSOR_HOOK_DROPS: OnceLock>> = + OnceLock::new(); + +fn payload_processor_roots() -> &'static Mutex> { + PAYLOAD_PROCESSOR_ROOTS.get_or_init(|| Mutex::new(HashMap::new())) +} + +fn payload_processor_roots_cv() -> &'static Condvar { + PAYLOAD_PROCESSOR_ROOTS_CV.get_or_init(Condvar::new) +} + +fn payload_processor_started() -> &'static Mutex> { + PAYLOAD_PROCESSOR_STARTED.get_or_init(|| Mutex::new(HashSet::new())) +} + +fn parallel_state_roots() -> &'static Mutex> { + PARALLEL_STATE_ROOTS.get_or_init(|| Mutex::new(HashMap::new())) +} + +fn payload_processor_hook_drops() -> &'static Mutex> { + PAYLOAD_PROCESSOR_HOOK_DROPS.get_or_init(|| Mutex::new(HashMap::new())) +} + +/// Record when the payload_processor hook sender is dropped (after system tx execution). +pub fn insert_payload_processor_hook_drop(key: PayloadProcessorKey, at: Instant) { + payload_processor_hook_drops().lock().insert(key, at); +} + +/// Take the recorded hook-drop instant (if any). +pub fn take_payload_processor_hook_drop(key: PayloadProcessorKey) -> Option { + payload_processor_hook_drops().lock().remove(&key) +} + +pub fn take_payload_processor_state_root( + key: PayloadProcessorKey, +) -> Option { + consume_payload_processor_state_root(key) +} + +/// Marks that a payload_processor was started for this key. +pub fn mark_payload_processor_started(key: PayloadProcessorKey) { + payload_processor_started().lock().insert(key); +} + +/// Consumes and returns whether a payload_processor was started for this key. +/// +/// This is designed to be used by the block builder to decide whether it should wait for the +/// payload_processor result (instead of falling back to serial). Using a take avoids races and +/// avoids unbounded growth of the started set. +pub fn take_payload_processor_started(key: PayloadProcessorKey) -> bool { + payload_processor_started().lock().remove(&key) +} + +/// Waits (up to `timeout`) for a payload_processor result, and removes it from the internal map. +pub fn wait_take_payload_processor_state_root( + key: PayloadProcessorKey, + timeout: Duration, +) -> Option { + let deadline = Instant::now() + timeout; + let mut guard = payload_processor_roots().lock(); + loop { + if let Some(entry) = guard.get_mut(&key) { + let res = entry.value.clone().ok(); + entry.remaining_consumers = entry.remaining_consumers.saturating_sub(1); + if entry.remaining_consumers == 0 { + guard.remove(&key); + } + return res; + } + + let now = Instant::now(); + if now >= deadline { + return None; + } + + let remaining = deadline - now; + let _ = payload_processor_roots_cv().wait_for(&mut guard, remaining); + } +} + +/// Waits indefinitely for a payload_processor result, and removes it from the internal map. +/// +/// Callers should only use this if they have high confidence the payload_processor was started. +pub fn wait_take_payload_processor_state_root_blocking( + key: PayloadProcessorKey, +) -> PayloadProcessorStateRootResult { + let mut guard = payload_processor_roots().lock(); + loop { + if let Some(entry) = guard.get_mut(&key) { + let res = entry.value.clone().ok(); + entry.remaining_consumers = entry.remaining_consumers.saturating_sub(1); + if entry.remaining_consumers == 0 { + guard.remove(&key); + } + if let Some(res) = res { + return res; + } + // If the payload_processor failed, keep waiting for a successful result. + // NOTE: The builder should guard against this by not waiting indefinitely in the + // authoritative path (it can fall back to serial). + } + payload_processor_roots_cv().wait(&mut guard); + } +} + +fn take_parallel_state_root(key: PayloadProcessorKey) -> Option { + parallel_state_roots().lock().remove(&key) +} + +fn consume_payload_processor_state_root(key: PayloadProcessorKey) -> Option { + let mut guard = payload_processor_roots().lock(); + let entry = guard.get_mut(&key)?; + let res = entry.value.clone().ok(); + entry.remaining_consumers = entry.remaining_consumers.saturating_sub(1); + if entry.remaining_consumers == 0 { + guard.remove(&key); + } + res +} + +pub fn insert_payload_processor_state_root( + key: PayloadProcessorKey, + value: PayloadProcessorStateRootResult, +) { + payload_processor_roots().lock().insert( + key, + PayloadProcessorStateRootEntry { value: Ok(value), remaining_consumers: 2 }, + ); + payload_processor_roots_cv().notify_all(); +} + +pub fn insert_payload_processor_state_root_error(key: PayloadProcessorKey, err: String) { + payload_processor_roots().lock().insert( + key, + PayloadProcessorStateRootEntry { value: Err(err), remaining_consumers: 2 }, + ); + payload_processor_roots_cv().notify_all(); +} + +fn insert_parallel_state_root(key: PayloadProcessorKey, value: ParallelStateRootResult) { + parallel_state_roots().lock().insert(key, value); +} + +/// Shared state used to correlate serial/accelerated state-root computations. +#[derive(Debug, Default, Clone, Copy)] +pub struct StateRootCompareState { + pub block_hash: Option, + pub user_tx_len: Option, + pub system_tx_len: Option, + pub total_tx_len: Option, + /// Approx wall time spent executing the block (txs + system txs), excluding state-root hashing. + /// + /// Measured in `builder.finish()` as time spent before starting `state_root_with_updates`. + pub execution_duration_ms: Option, + pub serial_root: Option, + pub serial_duration_ms: Option, +} + +#[derive(Debug, Default)] +struct StateRootCompareStats { + samples: u64, + serial_fastest: u64, + parallel_fastest: u64, + payload_processor_fastest: u64, + tie: u64, + + sum_total_tx_len: u128, + sum_execution_ms: u128, + sum_serial_ms: u128, + sum_parallel_ms: u128, + sum_payload_processor_total_ms: u128, + sum_payload_processor_post_exec_ms: u128, +} + +static STATE_ROOT_COMPARE_STATS: OnceLock>> = OnceLock::new(); +static STATE_ROOT_COMPARE_PRINTER_STARTED: OnceLock<()> = OnceLock::new(); + +impl RootDebugger { + fn compare_stats() -> Arc> { + STATE_ROOT_COMPARE_STATS + .get_or_init(|| Arc::new(Mutex::new(StateRootCompareStats::default()))) + .clone() + } + + fn start_compare_printer_thread_once() { + STATE_ROOT_COMPARE_PRINTER_STARTED.get_or_init(|| { + let stats = Self::compare_stats(); + std::thread::spawn(move || loop { + std::thread::sleep(Duration::from_secs(30)); + let snapshot = { + let s = stats.lock(); + ( + s.samples, + s.serial_fastest, + s.parallel_fastest, + s.payload_processor_fastest, + s.tie, + s.sum_total_tx_len, + s.sum_execution_ms, + s.sum_serial_ms, + s.sum_parallel_ms, + s.sum_payload_processor_total_ms, + s.sum_payload_processor_post_exec_ms, + ) + }; + + let ( + samples, + serial_fastest, + parallel_fastest, + payload_processor_fastest, + tie, + sum_total_tx_len, + sum_execution_ms, + sum_serial_ms, + sum_parallel_ms, + sum_payload_processor_total_ms, + sum_payload_processor_post_exec_ms, + ) = + snapshot; + + if samples == 0 { + continue; + } + + let avg_tx = (sum_total_tx_len as f64) / (samples as f64); + let avg_execution_ms = (sum_execution_ms as f64) / (samples as f64); + let avg_serial_ms = (sum_serial_ms as f64) / (samples as f64); + let avg_parallel_ms = (sum_parallel_ms as f64) / (samples as f64); + let avg_payload_processor_total_ms = + (sum_payload_processor_total_ms as f64) / (samples as f64); + let avg_payload_processor_post_exec_ms = + (sum_payload_processor_post_exec_ms as f64) / (samples as f64); + + tracing::info!( + target: "bsc::builder", + samples, + serial_fastest, + parallel_fastest, + payload_processor_fastest, + tie, + avg_total_tx_len = avg_tx, + avg_execution_ms = avg_execution_ms, + avg_serial_ms = avg_serial_ms, + avg_parallel_ms = avg_parallel_ms, + avg_payload_processor_total_ms = avg_payload_processor_total_ms, + avg_payload_processor_post_exec_ms = avg_payload_processor_post_exec_ms, + "State root compare summary (serial/parallel/payload_processor)" + ); + }); + }); + } + + fn wait_for_compare_state( + state: &Mutex, + ) -> StateRootCompareState { + let mut tries = 0usize; + loop { + let snapshot = *state.lock(); + if snapshot.block_hash.is_some() + && snapshot.serial_root.is_some() + && snapshot.serial_duration_ms.is_some() + { + return snapshot + } + tries += 1; + if tries >= 500 { + // ~5s with 10ms sleep + return snapshot + } + std::thread::sleep(Duration::from_millis(10)); + } + } + + fn record_compare_sample( + snapshot: StateRootCompareState, + parallel_ms: u128, + payload_total_ms: u128, + payload_post_exec_ms: u128, + ) { + let Some(serial_ms) = snapshot.serial_duration_ms else { return }; + let total_tx_len = snapshot.total_tx_len.unwrap_or(0) as u128; + let execution_ms = snapshot.execution_duration_ms.unwrap_or(0); + + let stats_arc = Self::compare_stats(); + let mut stats = stats_arc.lock(); + stats.samples += 1; + stats.sum_total_tx_len += total_tx_len; + stats.sum_execution_ms += execution_ms; + stats.sum_serial_ms += serial_ms; + stats.sum_parallel_ms += parallel_ms; + stats.sum_payload_processor_total_ms += payload_total_ms; + stats.sum_payload_processor_post_exec_ms += payload_post_exec_ms; + + let min_ms = serial_ms.min(parallel_ms).min(payload_post_exec_ms); + let winners = [ + (serial_ms == min_ms, 0usize), + (parallel_ms == min_ms, 1usize), + (payload_post_exec_ms == min_ms, 2usize), + ] + .into_iter() + .filter(|(is, _)| *is) + .count(); + + if winners != 1 { + stats.tie += 1; + } else if serial_ms == min_ms { + stats.serial_fastest += 1; + } else if parallel_ms == min_ms { + stats.parallel_fastest += 1; + } else { + stats.payload_processor_fastest += 1; + } + } + + /// Spawn a background `ParallelStateRoot` computation (comparison only). + pub fn spawn_parallel_state_root_compare( + provider_factory: Factory, + key: PayloadProcessorKey, + hashed_state: HashedPostState, + ) where + Factory: DatabaseProviderFactory + + Clone + + Send + + Sync + + 'static, + { + std::thread::spawn(move || { + let start = std::time::Instant::now(); + let parent_number = key.parent_number(); + let parent_hash = key.parent_hash(); + let trace_id = key.trace_id(); + let attempt = key.attempt(); + let res = Self::compute_parallel_state_root( + provider_factory, + parent_number, + parent_hash, + &hashed_state, + ); + match res { + Ok(root) => { + let duration_ms = start.elapsed().as_millis(); + insert_parallel_state_root(key, ParallelStateRootResult { value: Ok(root), duration_ms }); + tracing::debug!( + target: "bsc::builder", + trace_id, + attempt, + parent_number, + parent_hash = ?parent_hash, + state_root = ?root, + duration_ms, + "ParallelStateRoot computed state root" + ); + } + Err(err) => { + let duration_ms = start.elapsed().as_millis(); + insert_parallel_state_root(key, ParallelStateRootResult { value: Err(err.to_string()), duration_ms }); + tracing::debug!( + target: "bsc::builder", + trace_id, + attempt, + parent_number, + parent_hash = ?parent_hash, + %err, + duration_ms, + "ParallelStateRoot unavailable" + ); + } + } + }); + } + + /// Spawn a background comparer that logs Serial vs Parallel vs PayloadProcessor. + /// + /// - Serial is authoritative (foreground). + /// - ParallelStateRoot is computed by [`spawn_parallel_state_root_compare`]. + /// - PayloadProcessor result is produced during payload building and inserted via + /// [`insert_payload_processor_state_root`]. + pub fn spawn_triple_compare( + key: PayloadProcessorKey, + hashed_state: HashedPostState, + compare_state: Arc>, + ) { + // Ensure the periodic summary thread is running. + Self::start_compare_printer_thread_once(); + + std::thread::spawn(move || { + let snapshot = Self::wait_for_compare_state(&compare_state); + let block_hash = snapshot.block_hash; + let user_tx_len = snapshot.user_tx_len; + let system_tx_len = snapshot.system_tx_len; + let total_tx_len = snapshot.total_tx_len; + let execution_duration_ms = snapshot.execution_duration_ms; + let serial_root = snapshot.serial_root; + let serial_ms = snapshot.serial_duration_ms; + let parent_number = key.parent_number(); + let parent_hash = key.parent_hash(); + let trace_id = key.trace_id(); + let attempt = key.attempt(); + + let deadline = std::time::Instant::now() + Duration::from_secs(5); + let mut parallel_res: Option = None; + let mut payload_res: Option = None; + while std::time::Instant::now() < deadline + && (parallel_res.is_none() || payload_res.is_none()) + { + if parallel_res.is_none() { + parallel_res = take_parallel_state_root(key); + } + if payload_res.is_none() { + payload_res = take_payload_processor_state_root(key); + } + if parallel_res.is_some() && payload_res.is_some() { + break; + } + std::thread::sleep(Duration::from_millis(5)); + } + + let approx_change_units: usize = hashed_state.accounts.len() + + hashed_state + .storages + .values() + .map(|s| s.storage.len()) + .sum::(); + + // If we don't have all 3, still log what we have (for debugging). + let parallel_root = parallel_res.as_ref().and_then(|r| r.value.as_ref().ok().copied()); + let parallel_ms = parallel_res.as_ref().map(|r| r.duration_ms); + let parallel_err = parallel_res.as_ref().and_then(|r| r.value.as_ref().err()).map(|s| s.as_str()); + let payload_root = payload_res.as_ref().map(|r| r.state_root); + let payload_total_ms = payload_res.as_ref().map(|r| r.duration_ms); + let payload_post_exec_ms = payload_res + .as_ref() + .and_then(|r| r.post_exec_duration_ms) + .or(payload_total_ms); + + let all_present = serial_root.is_some() + && serial_ms.is_some() + && parallel_root.is_some() + && parallel_ms.is_some() + && payload_root.is_some() + && payload_total_ms.is_some() + && payload_post_exec_ms.is_some(); + + if all_present { + let serial_root = serial_root.expect("checked"); + let serial_ms = serial_ms.expect("checked"); + let parallel_root = parallel_root.expect("checked"); + let parallel_ms = parallel_ms.expect("checked"); + let payload_root = payload_root.expect("checked"); + let payload_total_ms = payload_total_ms.expect("checked"); + let payload_post_exec_ms = payload_post_exec_ms.expect("checked"); + + // Update stats. + Self::record_compare_sample(snapshot, parallel_ms, payload_total_ms, payload_post_exec_ms); + + let serial_eq_parallel = serial_root == parallel_root; + let serial_eq_payload = serial_root == payload_root; + let parallel_eq_payload = parallel_root == payload_root; + let all_equal = serial_eq_parallel && serial_eq_payload; + + let min_ms = serial_ms.min(parallel_ms).min(payload_post_exec_ms); + let winners = [ + (serial_ms == min_ms, "serial"), + (parallel_ms == min_ms, "parallel"), + (payload_post_exec_ms == min_ms, "payload_processor"), + ] + .into_iter() + .filter(|(is, _)| *is) + .map(|(_, name)| name) + .collect::>(); + let fastest_side = if winners.len() == 1 { Some(winners[0]) } else { Some("tie") }; + + if !all_equal { + tracing::error!( + target: "bsc::builder", + trace_id, + attempt, + block_number = parent_number + 1, + block_hash = ?block_hash, + user_tx_len = ?user_tx_len, + system_tx_len = ?system_tx_len, + total_tx_len = ?total_tx_len, + block_execution_duration_ms = ?execution_duration_ms, + parent_hash = ?parent_hash, + approx_change_units, + serial_state_root = ?serial_root, + serial_state_root_duration_ms = serial_ms, + parallel_state_root = ?parallel_root, + parallel_state_root_duration_ms = parallel_ms, + payload_processor_state_root = ?payload_root, + payload_processor_state_root_duration_ms_total = payload_total_ms, + payload_processor_state_root_duration_ms_post_exec = payload_post_exec_ms, + serial_eq_parallel, + serial_eq_payload, + parallel_eq_payload, + fastest_side = ?fastest_side, + "State root MISMATCH (serial vs parallel vs payload_processor)" + ); + } else { + tracing::debug!( + target: "bsc::builder", + trace_id, + attempt, + block_number = parent_number + 1, + block_hash = ?block_hash, + user_tx_len = ?user_tx_len, + system_tx_len = ?system_tx_len, + total_tx_len = ?total_tx_len, + block_execution_duration_ms = ?execution_duration_ms, + parent_hash = ?parent_hash, + approx_change_units, + serial_state_root = ?serial_root, + serial_state_root_duration_ms = serial_ms, + parallel_state_root = ?parallel_root, + parallel_state_root_duration_ms = parallel_ms, + payload_processor_state_root = ?payload_root, + payload_processor_state_root_duration_ms_total = payload_total_ms, + payload_processor_state_root_duration_ms_post_exec = payload_post_exec_ms, + fastest_side = ?fastest_side, + "State root comparison (serial vs parallel vs payload_processor)" + ); + } + } else { + tracing::debug!( + target: "bsc::builder", + trace_id, + attempt, + block_number = parent_number + 1, + block_hash = ?block_hash, + user_tx_len = ?user_tx_len, + system_tx_len = ?system_tx_len, + total_tx_len = ?total_tx_len, + block_execution_duration_ms = ?execution_duration_ms, + parent_hash = ?parent_hash, + approx_change_units, + serial_state_root = ?serial_root, + serial_state_root_duration_ms = ?serial_ms, + parallel_state_root = ?parallel_root, + parallel_state_root_duration_ms = ?parallel_ms, + parallel_state_root_err = ?parallel_err, + payload_processor_state_root = ?payload_root, + payload_processor_state_root_duration_ms_total = ?payload_total_ms, + payload_processor_state_root_duration_ms_post_exec = ?payload_post_exec_ms, + missing_parallel = parallel_res.is_none(), + missing_payload_processor = payload_res.is_none(), + "State root comparison incomplete (missing parallel/payload_processor result)" + ); + } + }); + } + + fn compute_parallel_state_root( + provider_factory: Factory, + parent_number: u64, + parent_hash: B256, + hashed_state: &HashedPostState, + ) -> Result + where + Factory: DatabaseProviderFactory + + Clone + + Send + + Sync + + 'static, + { + let provider_ro = provider_factory + .database_provider_ro() + .map_err(BlockExecutionError::other)?; + let db_last = provider_ro.best_block_number().map_err(BlockExecutionError::other)?; + + if db_last > parent_number { + return Err(BlockExecutionError::other(std::io::Error::other(format!( + "db tip ({db_last}) ahead of parent ({parent_number})" + )))); + } + + let db_tip = provider_ro + .sealed_header(db_last) + .map_err(BlockExecutionError::other)? + .ok_or_else(|| BlockExecutionError::other(std::io::Error::other("db tip missing")))?; + + // If the DB tip is exactly at the parent height but points to a different hash, then the + // parent block we're building on is not the DB's canonical tip. In that case we cannot + // build a consistent view for `parent_hash` (ConsistentDbView requires the tip hash to + // match `sealed_header(number)`), so any parallel computation would be meaningless. + if db_last == parent_number && db_tip.hash() != parent_hash { + return Err(BlockExecutionError::other(std::io::Error::other(format!( + "db tip hash mismatch at parent height: db_tip_hash={:?} parent_hash={:?} number={}", + db_tip.hash(), + parent_hash, + parent_number + )))); + } + + let consistent_view = ConsistentDbView::new(provider_factory.clone(), Some((db_tip.hash(), db_last))); + + let mut trie_input = TrieInput::default(); + if db_last < parent_number { + let cache = trie_overlay_cache().ok_or_else(|| { + BlockExecutionError::other(std::io::Error::other("trie overlay cache not initialized")) + })?; + let needed_range = (db_last + 1)..=parent_number; + let overlays = cache.read().get_range(needed_range.clone()); + if overlays.len() != (parent_number - db_last) as usize { + return Err(BlockExecutionError::other(std::io::Error::other(format!( + "missing trie overlay blocks for range {:?} (have {})", + needed_range, + overlays.len() + )))); + } + for entry in overlays { + if entry.number == parent_number && entry.hash != parent_hash { + return Err(BlockExecutionError::other(std::io::Error::other(format!( + "parent hash mismatch in overlay cache: expected={:?} got={:?}", + parent_hash, entry.hash + )))); + } + let Some(nodes) = entry.trie_updates.as_deref() else { + return Err(BlockExecutionError::other(std::io::Error::other(format!( + "missing trie_updates for overlay block {}", + entry.number + )))); + }; + trie_input.append_cached_ref(nodes, &entry.hashed_state); + } + } + + trie_input.append(hashed_state.clone()); + let (root, _updates) = ParallelStateRoot::new(consistent_view, trie_input) + .incremental_root_with_updates() + .map_err(BlockExecutionError::other)?; + Ok(root) + } +} + +/// A helper that owns the canonical-chain subscription and keeps the overlay cache up to date. +/// +/// This is intended to be used by the miner: miner calls a single `drain()` method per loop. +pub struct RootDebuggerUpdater

+where + P: NewCanonicalChainSubscriptions + NodePrimitivesProvider + Clone + Send + Sync + 'static, +{ + rx: broadcast::Receiver::Primitives>>, +} + +impl

RootDebuggerUpdater

+where + P: NewCanonicalChainSubscriptions + NodePrimitivesProvider + Clone + Send + Sync + 'static, +{ + /// Initializes overlay cache and subscribes to new canonical chain updates. + pub fn new(provider: &P, overlay_capacity: usize) -> Self { + let _ = init_trie_overlay_cache(overlay_capacity); + let rx = provider.subscribe_to_new_canonical_chain(); + Self { rx } + } + + /// Drain pending canonical chain updates and apply them to the overlay cache. + pub fn drain(&mut self) { + loop { + match self.rx.try_recv() { + Ok(update) => Self::apply_update(&update), + Err(broadcast::error::TryRecvError::Empty) => break, + Err(broadcast::error::TryRecvError::Lagged(_)) => continue, + Err(broadcast::error::TryRecvError::Closed) => break, + } + } + } + + fn apply_update(event: &NewCanonicalChain) { + let Some(cache) = trie_overlay_cache() else { return }; + let mut w = cache.write(); + match event { + NewCanonicalChain::Commit { new } => { + for exec in new { + let num = exec.block.block_number(); + let hash = exec.block.recovered_block.hash(); + let hashed_state = Arc::clone(&exec.block.hashed_state); + let trie_updates = match &exec.trie { + ExecutedTrieUpdates::Present(updates) => Some(Arc::clone(updates)), + ExecutedTrieUpdates::Missing => None, + }; + w.insert(TrieOverlayEntry { number: num, hash, hashed_state, trie_updates }); + } + } + NewCanonicalChain::Reorg { new, old } => { + for exec in old { + let num = exec.block_number(); + w.remove_range(num..=num); + } + for exec in new { + let num = exec.block.block_number(); + let hash = exec.block.recovered_block.hash(); + let hashed_state = Arc::clone(&exec.block.hashed_state); + let trie_updates = match &exec.trie { + ExecutedTrieUpdates::Present(updates) => Some(Arc::clone(updates)), + ExecutedTrieUpdates::Missing => None, + }; + w.insert(TrieOverlayEntry { number: num, hash, hashed_state, trie_updates }); + } + } + } + } +} + diff --git a/src/node/trie_root/trie_overlay.rs b/src/node/trie_root/trie_overlay.rs new file mode 100644 index 0000000..36714df --- /dev/null +++ b/src/node/trie_root/trie_overlay.rs @@ -0,0 +1,82 @@ +use alloy_primitives::B256; +use parking_lot::RwLock; +use reth_trie::{updates::TrieUpdates, HashedPostState}; +use std::{ops::RangeInclusive, sync::Arc}; +use std::sync::OnceLock; + +/// Cached per-block overlay needed to bridge DB lag for trie root computation. +/// +/// When the canonical chain head is ahead of the persisted DB tip, we can still run +/// parallel/sparse state root algorithms by supplying the missing canonical blocks' hashed state + +/// trie updates as an overlay via `TrieInput`. +#[derive(Debug, Clone)] +pub struct TrieOverlayEntry { + pub number: u64, + pub hash: B256, + pub hashed_state: Arc, + pub trie_updates: Option>, +} + +#[derive(Debug, Default)] +pub struct TrieOverlayCache { + // Keyed by block number. + by_number: std::collections::BTreeMap, + // Soft bound to keep memory predictable. + capacity: usize, +} + +impl TrieOverlayCache { + pub fn new(capacity: usize) -> Self { + Self { by_number: Default::default(), capacity } + } + + pub fn insert(&mut self, entry: TrieOverlayEntry) { + self.by_number.insert(entry.number, entry); + self.trim(); + } + + pub fn remove_range(&mut self, range: RangeInclusive) { + let keys: Vec = self.by_number.range(range).map(|(n, _)| *n).collect(); + for k in keys { + self.by_number.remove(&k); + } + } + + pub fn get_range(&self, range: RangeInclusive) -> Vec { + self.by_number + .range(range) + .map(|(_, v)| v.clone()) + .collect() + } + + pub fn get(&self, number: u64) -> Option { + self.by_number.get(&number).cloned() + } + + fn trim(&mut self) { + if self.capacity == 0 { + self.by_number.clear(); + return; + } + while self.by_number.len() > self.capacity { + // Drop the oldest. + let Some(oldest) = self.by_number.keys().next().copied() else { break }; + self.by_number.remove(&oldest); + } + } +} + +static TRIE_OVERLAY: OnceLock>> = OnceLock::new(); + +/// Initialize the global trie overlay cache. +pub fn init_trie_overlay_cache(capacity: usize) -> Arc> { + TRIE_OVERLAY + .get_or_init(|| Arc::new(RwLock::new(TrieOverlayCache::new(capacity)))) + .clone() +} + +/// Get the global trie overlay cache if initialized. +pub fn trie_overlay_cache() -> Option<&'static Arc>> { + TRIE_OVERLAY.get() +} +