mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
Compare commits
7 Commits
bal-devnet
...
fix/persis
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f43952b4c | ||
|
|
a74cb9cbc3 | ||
|
|
e25411c32b | ||
|
|
ec3323bba0 | ||
|
|
26cd132631 | ||
|
|
079f59c2be | ||
|
|
e9b079ad62 |
9
.github/assets/hive/build_simulators.sh
vendored
9
.github/assets/hive/build_simulators.sh
vendored
@@ -11,17 +11,14 @@ go build .
|
||||
|
||||
# Run each hive command in the background for each simulator and wait
|
||||
echo "Building images"
|
||||
./hive -client reth --sim "ethereum/eels" \
|
||||
--sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/bal@v2.0.0/fixtures_bal.tar.gz \
|
||||
--sim.buildarg branch=eips/amsterdam/eip-7928 \
|
||||
--sim.timelimit 1s || true &
|
||||
# TODO: test code has been moved from https://github.com/ethereum/execution-spec-tests to https://github.com/ethereum/execution-specs we need to pin eels branch with `--sim.buildarg branch=<release-branch-name>` once we have the fusaka release tagged on the new repo
|
||||
./hive -client reth --sim "ethereum/eels" --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz -sim.timelimit 1s || true &
|
||||
./hive -client reth --sim "ethereum/engine" -sim.timelimit 1s || true &
|
||||
./hive -client reth --sim "devp2p" -sim.timelimit 1s || true &
|
||||
./hive -client reth --sim "ethereum/rpc-compat" -sim.timelimit 1s || true &
|
||||
./hive -client reth --sim "smoke/genesis" -sim.timelimit 1s || true &
|
||||
./hive -client reth --sim "smoke/network" -sim.timelimit 1s || true &
|
||||
./hive -client reth --sim "ethereum/sync" -sim.timelimit 1s || true &
|
||||
|
||||
wait
|
||||
|
||||
# Run docker save in parallel, wait and exit on error
|
||||
@@ -40,7 +37,7 @@ for pid in "${saving_pids[@]}"; do
|
||||
wait "$pid" || exit
|
||||
done
|
||||
|
||||
# Make sure we don't rebuild images on the CI jobs
|
||||
# Make sure we don't rebuild images on the CI jobs
|
||||
git apply ../.github/assets/hive/no_sim_build.diff
|
||||
go build .
|
||||
mv ./hive ../hive_assets/
|
||||
|
||||
2
.github/assets/hive/load_images.sh
vendored
2
.github/assets/hive/load_images.sh
vendored
@@ -24,4 +24,4 @@ done
|
||||
|
||||
wait
|
||||
|
||||
docker image ls -a
|
||||
docker image ls -a
|
||||
|
||||
4
.github/workflows/bench.yml
vendored
4
.github/workflows/bench.yml
vendored
@@ -3,9 +3,9 @@
|
||||
on:
|
||||
pull_request:
|
||||
# TODO: Disabled temporarily for https://github.com/CodSpeedHQ/runner/issues/55
|
||||
# merge_group :
|
||||
# merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
2
.github/workflows/book.yml
vendored
2
.github/workflows/book.yml
vendored
@@ -74,4 +74,4 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
2
.github/workflows/compact.yml
vendored
2
.github/workflows/compact.yml
vendored
@@ -9,7 +9,7 @@ on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
2
.github/workflows/e2e.yml
vendored
2
.github/workflows/e2e.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
49
.github/workflows/hive.yml
vendored
49
.github/workflows/hive.yml
vendored
@@ -6,9 +6,7 @@ on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
@@ -44,7 +42,6 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: ethereum/hive
|
||||
ref: master
|
||||
path: hivetests
|
||||
|
||||
- name: Get hive commit hash
|
||||
@@ -130,29 +127,27 @@ jobs:
|
||||
# eth_ rpc methods
|
||||
- sim: ethereum/rpc-compat
|
||||
include:
|
||||
# - eth_blockNumber
|
||||
- eth_blockNumber
|
||||
- eth_call
|
||||
# - eth_chainId
|
||||
# - eth_createAccessList
|
||||
# - eth_estimateGas
|
||||
# - eth_feeHistory
|
||||
# - eth_getBalance
|
||||
# - eth_getBlockBy
|
||||
# - eth_getBlockTransactionCountBy
|
||||
# - eth_getCode
|
||||
# - eth_getProof
|
||||
# - eth_getStorage
|
||||
# - eth_getTransactionBy
|
||||
# - eth_getTransactionCount
|
||||
# - eth_getTransactionReceipt
|
||||
# - eth_sendRawTransaction
|
||||
# - eth_syncing
|
||||
# # debug_ rpc methods
|
||||
# - debug_
|
||||
- eth_chainId
|
||||
- eth_createAccessList
|
||||
- eth_estimateGas
|
||||
- eth_feeHistory
|
||||
- eth_getBalance
|
||||
- eth_getBlockBy
|
||||
- eth_getBlockTransactionCountBy
|
||||
- eth_getCode
|
||||
- eth_getProof
|
||||
- eth_getStorage
|
||||
- eth_getTransactionBy
|
||||
- eth_getTransactionCount
|
||||
- eth_getTransactionReceipt
|
||||
- eth_sendRawTransaction
|
||||
- eth_syncing
|
||||
# debug_ rpc methods
|
||||
- debug_
|
||||
|
||||
# consume-engine
|
||||
- sim: ethereum/eels/consume-engine
|
||||
limit: .*tests/amsterdam.*
|
||||
- sim: ethereum/eels/consume-engine
|
||||
limit: .*tests/osaka.*
|
||||
- sim: ethereum/eels/consume-engine
|
||||
@@ -169,10 +164,10 @@ jobs:
|
||||
limit: .*tests/homestead.*
|
||||
- sim: ethereum/eels/consume-engine
|
||||
limit: .*tests/frontier.*
|
||||
- sim: ethereum/eels/consume-engine
|
||||
limit: .*tests/paris.*
|
||||
|
||||
# consume-rlp
|
||||
- sim: ethereum/eels/consume-rlp
|
||||
limit: .*tests/amsterdam.*
|
||||
- sim: ethereum/eels/consume-rlp
|
||||
limit: .*tests/osaka.*
|
||||
- sim: ethereum/eels/consume-rlp
|
||||
@@ -189,6 +184,8 @@ jobs:
|
||||
limit: .*tests/homestead.*
|
||||
- sim: ethereum/eels/consume-rlp
|
||||
limit: .*tests/frontier.*
|
||||
- sim: ethereum/eels/consume-rlp
|
||||
limit: .*tests/paris.*
|
||||
needs:
|
||||
- prepare-reth-stable
|
||||
- prepare-reth-edge
|
||||
|
||||
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
schedule:
|
||||
# Run once a day at 3:00 UTC
|
||||
- cron: "0 3 * * *"
|
||||
|
||||
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
2
.github/workflows/stage.yml
vendored
2
.github/workflows/stage.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
3
.github/workflows/unit.yml
vendored
3
.github/workflows/unit.yml
vendored
@@ -4,10 +4,9 @@ name: unit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["**"]
|
||||
merge_group:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
4
.github/workflows/windows.yml
vendored
4
.github/workflows/windows.yml
vendored
@@ -4,9 +4,9 @@ name: windows
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: ["**"]
|
||||
branches: [main]
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
|
||||
228
Cargo.lock
generated
228
Cargo.lock
generated
@@ -122,7 +122,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-consensus"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c3a590d13de3944675987394715f37537b50b856e3b23a0e66e97d963edbf38"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
@@ -149,7 +150,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-consensus-any"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f28f769d5ea999f0d8a105e434f483456a15b4e1fcb08edbbbe1650a497ff6d"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -163,7 +165,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-contract"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "990fa65cd132a99d3c3795a82b9f93ec82b81c7de3bab0bf26ca5c73286f7186"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-dyn-abi",
|
||||
@@ -246,26 +249,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eip7928"
|
||||
version = "0.3.0"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6adac476434bf024279164dcdca299309f0c7d1e3557024eb7a83f8d9d01c6b5"
|
||||
checksum = "926b2c0d34e641cf8b17bf54ce50fda16715b9f68ad878fa6128bae410c6f890"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"arbitrary",
|
||||
"borsh",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eips"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09535cbc646b0e0c6fcc12b7597eaed12cf86dff4c4fba9507a61e71b94f30eb"
|
||||
dependencies = [
|
||||
"alloy-eip2124",
|
||||
"alloy-eip2930",
|
||||
"alloy-eip7702",
|
||||
"alloy-eip7928",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"alloy-serde",
|
||||
@@ -286,7 +287,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-evm"
|
||||
version = "0.25.2"
|
||||
source = "git+https://github.com/Rimeeeeee/evm?branch=bal-devnet-1#f29844095d4625da59d6c6dcc80c370bb570255b"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6ccc4c702c840148af1ce784cc5c6ed9274a020ef32417c5b1dbeab8c317673"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -302,13 +304,13 @@ dependencies = [
|
||||
"op-revm",
|
||||
"revm",
|
||||
"thiserror 2.0.17",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-genesis"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1005520ccf89fa3d755e46c1d992a9e795466c2e7921be2145ef1f749c5727de"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
@@ -348,7 +350,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-json-rpc"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b626409c98ba43aaaa558361bca21440c88fd30df7542c7484b9c7a1489cdb"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-types",
|
||||
@@ -362,7 +365,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-network"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89924fdcfeee0e0fa42b1f10af42f92802b5d16be614a70897382565663bf7cf"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-consensus-any",
|
||||
@@ -387,7 +391,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-network-primitives"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f0dbe56ff50065713ff8635d8712a0895db3ad7f209db9793ad8fcb6b1734aa"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -399,7 +404,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-op-evm"
|
||||
version = "0.25.2"
|
||||
source = "git+https://github.com/Rimeeeeee/evm?branch=bal-devnet-1#f29844095d4625da59d6c6dcc80c370bb570255b"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f640da852f93ddaa3b9a602b7ca41d80e0023f77a67b68aaaf511c32f1fe0ce"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -434,7 +440,6 @@ checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33"
|
||||
dependencies = [
|
||||
"alloy-rlp",
|
||||
"arbitrary",
|
||||
"borsh",
|
||||
"bytes",
|
||||
"cfg-if",
|
||||
"const-hex",
|
||||
@@ -462,7 +467,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-provider"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b56f7a77513308a21a2ba0e9d57785a9d9d2d609e77f4e71a78a1192b83ff2d"
|
||||
dependencies = [
|
||||
"alloy-chains",
|
||||
"alloy-consensus",
|
||||
@@ -506,7 +512,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-pubsub"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94813abbd7baa30c700ea02e7f92319dbcb03bff77aeea92a3a9af7ba19c5c70"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -549,7 +556,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-client"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff01723afc25ec4c5b04de399155bef7b6a96dfde2475492b1b7b4e7a4f46445"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -574,7 +582,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91bf006bb06b7d812591b6ac33395cb92f46c6a65cda11ee30b348338214f0f"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-engine",
|
||||
@@ -586,7 +595,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-admin"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b934c3bcdc6617563b45deb36a40881c8230b94d0546ea739dff7edb3aa2f6fd"
|
||||
dependencies = [
|
||||
"alloy-genesis",
|
||||
"alloy-primitives",
|
||||
@@ -597,7 +607,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-anvil"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e82145856df8abb1fefabef58cdec0f7d9abf337d4abd50c1ed7e581634acdd"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -608,7 +619,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-any"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "212ca1c1dab27f531d3858f8b1a2d6bfb2da664be0c1083971078eb7b71abe4b"
|
||||
dependencies = [
|
||||
"alloy-consensus-any",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -618,7 +630,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-beacon"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d92a9b4b268fac505ef7fb1dac9bb129d4fd7de7753f22a5b6e9f666f7f7de6"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
@@ -637,7 +650,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-debug"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bab1ebed118b701c497e6541d2d11dfa6f3c6ae31a3c52999daa802fcdcc16b7"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"derive_more",
|
||||
@@ -648,7 +662,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-engine"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "232f00fcbcd3ee3b9399b96223a8fc884d17742a70a44f9d7cef275f93e6e872"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -668,7 +683,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-eth"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5715d0bf7efbd360873518bd9f6595762136b5327a9b759a8c42ccd9b5e44945"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-consensus-any",
|
||||
@@ -689,7 +705,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-mev"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7b61941d2add2ee64646612d3eda92cbbde8e6c933489760b6222c8898c79be"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -703,7 +720,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-trace"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9763cc931a28682bd4b9a68af90057b0fbe80e2538a82251afd69d7ae00bbebf"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -716,7 +734,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-txpool"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "359a8caaa98cb49eed62d03f5bc511dd6dd5dee292238e8627a6e5690156df0f"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -727,7 +746,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-serde"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ed8531cae8d21ee1c6571d0995f8c9f0652a6ef6452fde369283edea6ab7138"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"arbitrary",
|
||||
@@ -738,7 +758,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-signer"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb10ccd49d0248df51063fce6b716f68a315dd912d55b32178c883fd48b4021d"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"async-trait",
|
||||
@@ -752,7 +773,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-signer-local"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4d992d44e6c414ece580294abbadb50e74cfd4eaa69787350a4dfd4b20eaa1b"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-network",
|
||||
@@ -840,7 +862,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-transport"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f50a9516736d22dd834cc2240e5bf264f338667cc1d9e514b55ec5a78b987ca"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"auto_impl",
|
||||
@@ -862,7 +885,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-transport-http"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a18b541a6197cf9a084481498a766fdf32fefda0c35ea6096df7d511025e9f1"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-transport",
|
||||
@@ -876,7 +900,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-transport-ipc"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8075911680ebc537578cacf9453464fd394822a0f68614884a9c63f9fbaf5e89"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-pubsub",
|
||||
@@ -895,7 +920,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-transport-ws"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "921d37a57e2975e5215f7dd0f28873ed5407c7af630d4831a4b5c737de4b0b8b"
|
||||
dependencies = [
|
||||
"alloy-pubsub",
|
||||
"alloy-transport",
|
||||
@@ -931,7 +957,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "alloy-tx-macros"
|
||||
version = "1.4.3"
|
||||
source = "git+https://github.com/Soubhik-10/alloy?branch=bal-devnet-1#4949c3918ce4c59af674ada45a406a5bd5c4fa12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2289a842d02fe63f8c466db964168bb2c7a9fdfb7b24816dbb17d45520575fb"
|
||||
dependencies = [
|
||||
"darling 0.21.3",
|
||||
"proc-macro2",
|
||||
@@ -1464,6 +1491,12 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "az"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
|
||||
|
||||
[[package]]
|
||||
name = "backon"
|
||||
version = "1.6.0"
|
||||
@@ -2367,7 +2400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3108,7 +3141,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users 0.5.2",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3438,7 +3471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4428,6 +4461,16 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gmp-mpfr-sys"
|
||||
version = "1.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60f8970a75c006bb2f8ae79c6768a116dd215fa8346a87aed99bf9d82ca43394"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.13.0"
|
||||
@@ -4816,7 +4859,7 @@ dependencies = [
|
||||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core 0.57.0",
|
||||
"windows-core 0.62.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5162,7 +5205,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6116,7 +6159,7 @@ version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6445,9 +6488,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "op-revm"
|
||||
version = "15.0.0"
|
||||
version = "14.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79c92b75162c2ed1661849fa51683b11254a5b661798360a2c24be918edafd40"
|
||||
checksum = "1475a779c73999fc803778524042319691b31f3d6699d2b560c4ed8be1db802a"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"revm",
|
||||
@@ -7212,7 +7255,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"socket2 0.6.1",
|
||||
"tracing",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7973,13 +8016,11 @@ dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"rand 0.9.2",
|
||||
"reth-chainspec",
|
||||
"reth-consensus",
|
||||
"reth-ethereum-primitives",
|
||||
"reth-primitives-traits",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8370,6 +8411,7 @@ dependencies = [
|
||||
name = "reth-engine-service"
|
||||
version = "1.10.0"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"futures",
|
||||
"pin-project",
|
||||
"reth-chainspec",
|
||||
@@ -8391,6 +8433,7 @@ dependencies = [
|
||||
"reth-prune",
|
||||
"reth-stages-api",
|
||||
"reth-tasks",
|
||||
"reth-trie-db",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
]
|
||||
@@ -8454,6 +8497,7 @@ dependencies = [
|
||||
"reth-testing-utils",
|
||||
"reth-tracing",
|
||||
"reth-trie",
|
||||
"reth-trie-db",
|
||||
"reth-trie-parallel",
|
||||
"reth-trie-sparse",
|
||||
"reth-trie-sparse-parallel",
|
||||
@@ -8488,7 +8532,6 @@ dependencies = [
|
||||
"reth-primitives-traits",
|
||||
"reth-revm",
|
||||
"reth-storage-api",
|
||||
"revm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
@@ -8704,7 +8747,6 @@ dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"reth-chainspec",
|
||||
"reth-consensus",
|
||||
"reth-consensus-common",
|
||||
@@ -8844,7 +8886,6 @@ dependencies = [
|
||||
"alloy-evm",
|
||||
"alloy-genesis",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"alloy-rpc-types-engine",
|
||||
"derive_more",
|
||||
"parking_lot",
|
||||
@@ -9349,6 +9390,7 @@ dependencies = [
|
||||
"reth-tokio-util",
|
||||
"reth-tracing",
|
||||
"reth-transaction-pool",
|
||||
"reth-trie-db",
|
||||
"secp256k1 0.30.0",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
@@ -9838,6 +9880,7 @@ dependencies = [
|
||||
"reth-tracing",
|
||||
"reth-transaction-pool",
|
||||
"reth-trie-common",
|
||||
"reth-trie-db",
|
||||
"revm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -11156,14 +11199,18 @@ dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"metrics",
|
||||
"parking_lot",
|
||||
"proptest",
|
||||
"proptest-arbitrary-interop",
|
||||
"reth-chainspec",
|
||||
"reth-db",
|
||||
"reth-db-api",
|
||||
"reth-execution-errors",
|
||||
"reth-metrics",
|
||||
"reth-primitives-traits",
|
||||
"reth-provider",
|
||||
"reth-stages-types",
|
||||
"reth-storage-api",
|
||||
"reth-storage-errors",
|
||||
"reth-trie",
|
||||
@@ -11278,9 +11325,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm"
|
||||
version = "34.0.0"
|
||||
version = "33.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2aabdebaa535b3575231a88d72b642897ae8106cf6b0d12eafc6bfdf50abfc7"
|
||||
checksum = "0c85ed0028f043f87b3c88d4a4cb6f0a76440085523b6a8afe5ff003cf418054"
|
||||
dependencies = [
|
||||
"revm-bytecode",
|
||||
"revm-context",
|
||||
@@ -11297,9 +11344,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-bytecode"
|
||||
version = "8.0.0"
|
||||
version = "7.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74d1e5c1eaa44d39d537f668bc5c3409dc01e5c8be954da6c83370bbdf006457"
|
||||
checksum = "e2c6b5e6e8dd1e28a4a60e5f46615d4ef0809111c9e63208e55b5c7058200fb0"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"phf",
|
||||
@@ -11309,9 +11356,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-context"
|
||||
version = "13.0.0"
|
||||
version = "12.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "892ff3e6a566cf8d72ffb627fdced3becebbd9ba64089c25975b9b028af326a5"
|
||||
checksum = "f038f0c9c723393ac897a5df9140b21cfa98f5753a2cb7d0f28fa430c4118abf"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"cfg-if",
|
||||
@@ -11326,9 +11373,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-context-interface"
|
||||
version = "14.0.0"
|
||||
version = "13.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57f61cc6d23678c4840af895b19f8acfbbd546142ec8028b6526c53cc1c16c98"
|
||||
checksum = "431c9a14e4ef1be41ae503708fd02d974f80ef1f2b6b23b5e402e8d854d1b225"
|
||||
dependencies = [
|
||||
"alloy-eip2930",
|
||||
"alloy-eip7702",
|
||||
@@ -11342,9 +11389,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-database"
|
||||
version = "10.0.0"
|
||||
version = "9.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "529528d0b05fe646be86223032c3e77aa8b05caa2a35447d538c55965956a511"
|
||||
checksum = "980d8d6bba78c5dd35b83abbb6585b0b902eb25ea4448ed7bfba6283b0337191"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"revm-bytecode",
|
||||
@@ -11356,23 +11403,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-database-interface"
|
||||
version = "9.0.0"
|
||||
version = "8.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7bf93ac5b91347c057610c0d96e923db8c62807e03f036762d03e981feddc1d"
|
||||
checksum = "8cce03e3780287b07abe58faf4a7f5d8be7e81321f93ccf3343c8f7755602bae"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"either",
|
||||
"revm-primitives",
|
||||
"revm-state",
|
||||
"serde",
|
||||
"thiserror 2.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm-handler"
|
||||
version = "15.0.0"
|
||||
version = "14.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0cd0e43e815a85eded249df886c4badec869195e70cdd808a13cfca2794622d2"
|
||||
checksum = "d44f8f6dbeec3fecf9fe55f78ef0a758bdd92ea46cd4f1ca6e2a946b32c367f3"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"derive-where",
|
||||
@@ -11389,9 +11435,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-inspector"
|
||||
version = "15.0.0"
|
||||
version = "14.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f3ccad59db91ef93696536a0dbaf2f6f17cfe20d4d8843ae118edb7e97947ef"
|
||||
checksum = "5617e49216ce1ca6c8826bcead0386bc84f49359ef67cde6d189961735659f93"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"either",
|
||||
@@ -11408,7 +11454,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-inspectors"
|
||||
version = "0.33.2"
|
||||
source = "git+https://github.com/paradigmxyz/revm-inspectors?branch=staging-revm#3020ea8cdc409b978871dbe89fa06b00a38e61fb"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01def7351cd9af844150b8e88980bcd11304f33ce23c3d7c25f2a8dab87c1345"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -11426,9 +11473,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-interpreter"
|
||||
version = "32.0.0"
|
||||
version = "31.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11406408597bc249392d39295831c4b641b3a6f5c471a7c41104a7a1e3564c07"
|
||||
checksum = "26ec36405f7477b9dccdc6caa3be19adf5662a7a0dffa6270cdb13a090c077e5"
|
||||
dependencies = [
|
||||
"revm-bytecode",
|
||||
"revm-context-interface",
|
||||
@@ -11439,9 +11486,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-precompile"
|
||||
version = "32.0.0"
|
||||
version = "31.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50c1285c848d240678bf69cb0f6179ff5a4aee6fc8e921d89708087197a0aff3"
|
||||
checksum = "9a62958af953cc4043e93b5be9b8497df84cc3bd612b865c49a7a7dfa26a84e2"
|
||||
dependencies = [
|
||||
"ark-bls12-381",
|
||||
"ark-bn254",
|
||||
@@ -11457,15 +11504,16 @@ dependencies = [
|
||||
"p256",
|
||||
"revm-primitives",
|
||||
"ripemd",
|
||||
"rug",
|
||||
"secp256k1 0.31.1",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "revm-primitives"
|
||||
version = "22.0.0"
|
||||
version = "21.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba580c56a8ec824a64f8a1683577876c2e1dbe5247044199e9b881421ad5dcf9"
|
||||
checksum = "29e161db429d465c09ba9cbff0df49e31049fe6b549e28eb0b7bd642fcbd4412"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"num_enum",
|
||||
@@ -11475,11 +11523,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-state"
|
||||
version = "9.0.0"
|
||||
version = "8.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "311720d4f0f239b041375e7ddafdbd20032a33b7bae718562ea188e188ed9fd3"
|
||||
checksum = "7d8be953b7e374dbdea0773cf360debed8df394ea8d82a8b240a6b5da37592fc"
|
||||
dependencies = [
|
||||
"alloy-eip7928",
|
||||
"bitflags 2.10.0",
|
||||
"revm-bytecode",
|
||||
"revm-primitives",
|
||||
@@ -11628,6 +11675,18 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rug"
|
||||
version = "1.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58ad2e973fe3c3214251a840a621812a4f40468da814b1a3d6947d433c2af11f"
|
||||
dependencies = [
|
||||
"az",
|
||||
"gmp-mpfr-sys",
|
||||
"libc",
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruint"
|
||||
version = "1.17.2"
|
||||
@@ -11639,7 +11698,6 @@ dependencies = [
|
||||
"ark-ff 0.3.0",
|
||||
"ark-ff 0.4.2",
|
||||
"ark-ff 0.5.0",
|
||||
"borsh",
|
||||
"bytes",
|
||||
"fastrlp 0.3.1",
|
||||
"fastrlp 0.4.0",
|
||||
@@ -11735,7 +11793,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.11.0",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -12621,7 +12679,7 @@ dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
"once_cell",
|
||||
"rustix 1.1.3",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -13337,7 +13395,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f7c95348f20c1c913d72157b3c6dee6ea3e30b3d19502c5a7f6d3f160dacbf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -13871,7 +13929,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
99
Cargo.toml
99
Cargo.toml
@@ -376,11 +376,11 @@ reth-era-utils = { path = "crates/era-utils" }
|
||||
reth-errors = { path = "crates/errors" }
|
||||
reth-eth-wire = { path = "crates/net/eth-wire" }
|
||||
reth-eth-wire-types = { path = "crates/net/eth-wire-types" }
|
||||
reth-ethereum-payload-builder = { path = "crates/ethereum/payload" }
|
||||
reth-ethereum-cli = { path = "crates/ethereum/cli", default-features = false }
|
||||
reth-ethereum-consensus = { path = "crates/ethereum/consensus", default-features = false }
|
||||
reth-ethereum-engine-primitives = { path = "crates/ethereum/engine-primitives", default-features = false }
|
||||
reth-ethereum-forks = { path = "crates/ethereum/hardforks", default-features = false }
|
||||
reth-ethereum-payload-builder = { path = "crates/ethereum/payload" }
|
||||
reth-ethereum-primitives = { path = "crates/ethereum/primitives", default-features = false }
|
||||
reth-ethereum = { path = "crates/ethereum/reth" }
|
||||
reth-etl = { path = "crates/etl" }
|
||||
@@ -472,29 +472,24 @@ reth-zstd-compressors = { path = "crates/storage/zstd-compressors", default-feat
|
||||
reth-ress-protocol = { path = "crates/ress/protocol" }
|
||||
reth-ress-provider = { path = "crates/ress/provider" }
|
||||
|
||||
# revm v103 (revm v34.0.0 with BAL EIP-7928 support)
|
||||
revm = { version = "34.0.0", default-features = false }
|
||||
revm-bytecode = { version = "8.0.0", default-features = false }
|
||||
revm-database = { version = "10.0.0", default-features = false }
|
||||
revm-state = { version = "9.0.0", default-features = false }
|
||||
revm-primitives = { version = "22.0.0", default-features = false }
|
||||
revm-interpreter = { version = "32.0.0", default-features = false }
|
||||
revm-database-interface = { version = "9.0.0", default-features = false }
|
||||
revm-context = { version = "13.0.0", default-features = false }
|
||||
revm-context-interface = { version = "14.0.0", default-features = false }
|
||||
revm-inspector = { version = "15.0.0", default-features = false }
|
||||
revm-handler = { version = "15.0.0", default-features = false }
|
||||
revm-precompile = { version = "32.0.0", default-features = false }
|
||||
op-revm = { version = "15.0.0", default-features = false }
|
||||
# revm
|
||||
revm = { version = "33.1.0", default-features = false }
|
||||
revm-bytecode = { version = "7.1.1", default-features = false }
|
||||
revm-database = { version = "9.0.5", default-features = false }
|
||||
revm-state = { version = "8.1.1", default-features = false }
|
||||
revm-primitives = { version = "21.0.2", default-features = false }
|
||||
revm-interpreter = { version = "31.1.0", default-features = false }
|
||||
revm-database-interface = { version = "8.0.5", default-features = false }
|
||||
op-revm = { version = "14.1.0", default-features = false }
|
||||
revm-inspectors = "0.33.2"
|
||||
|
||||
# eth
|
||||
alloy-primitives = { version = "1.5.0", default-features = false, features = ["map-foldhash"] }
|
||||
alloy-chains = { version = "0.2.5", default-features = false }
|
||||
alloy-evm = { version = "0.25.2", default-features = false }
|
||||
alloy-dyn-abi = "1.4.1"
|
||||
alloy-eip7928 = { version = "0.3.0", default-features = false }
|
||||
alloy-dyn-abi = "1.4.3"
|
||||
alloy-eip2124 = { version = "0.2.0", default-features = false }
|
||||
alloy-eip7928 = { version = "0.1.0", default-features = false }
|
||||
alloy-evm = { version = "0.25.1", default-features = false }
|
||||
alloy-primitives = { version = "1.5.0", default-features = false, features = ["map-foldhash"] }
|
||||
alloy-rlp = { version = "0.3.10", default-features = false, features = ["core-net"] }
|
||||
alloy-sol-macro = "1.5.0"
|
||||
alloy-sol-types = { version = "1.5.0", default-features = false }
|
||||
@@ -531,7 +526,7 @@ alloy-transport-ipc = { version = "1.4.3", default-features = false }
|
||||
alloy-transport-ws = { version = "1.4.3", default-features = false }
|
||||
|
||||
# op
|
||||
alloy-op-evm = { version = "0.25.2", default-features = false }
|
||||
alloy-op-evm = { version = "0.25.0", default-features = false }
|
||||
alloy-op-hardforks = "0.4.4"
|
||||
op-alloy-rpc-types = { version = "0.23.1", default-features = false }
|
||||
op-alloy-rpc-types-engine = { version = "0.23.1", default-features = false }
|
||||
@@ -748,50 +743,46 @@ vergen = "9.0.4"
|
||||
visibility = "0.1.1"
|
||||
walkdir = "2.3.3"
|
||||
vergen-git2 = "1.0.5"
|
||||
|
||||
# networking
|
||||
ipnet = "2.11"
|
||||
|
||||
[patch.crates-io]
|
||||
alloy-consensus = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-contract = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-eips = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-genesis = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-json-rpc = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-network = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-network-primitives = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-provider = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-pubsub = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-client = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-admin = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-anvil = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-beacon = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-debug = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-engine = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-eth = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-mev = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-trace = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-rpc-types-txpool = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-serde = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-signer = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-signer-local = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-transport = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-transport-http = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-transport-ipc = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
alloy-transport-ws = { git = "https://github.com/Soubhik-10/alloy", branch = "bal-devnet-1" }
|
||||
# alloy-hardforks = { git = "https://github.com/Rimeeeeee/hardforks", branch = "amsterdam" }
|
||||
# [patch.crates-io]
|
||||
# alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-network-primitives = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
# alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "3049f232fbb44d1909883e154eb38ec5962f53a3" }
|
||||
|
||||
# alloy-op-hardforks = { git = "https://github.com/Rimeeeeee/hardforks", branch = "amsterdam" }
|
||||
# op-alloy-consensus = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
|
||||
# op-alloy-network = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
|
||||
# op-alloy-rpc-types = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
|
||||
# op-alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
|
||||
# op-alloy-rpc-jsonrpsee = { git = "https://github.com/alloy-rs/op-alloy", rev = "a79d6fc" }
|
||||
#
|
||||
# alloy-evm with BAL support for revm v34/v103
|
||||
alloy-evm = { git = "https://github.com/alloy-rs/evm", branch = "staging-revm" }
|
||||
alloy-op-evm = { git = "https://github.com/alloy-rs/evm", branch = "staging-revm" }
|
||||
revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", branch = "staging-revm" }
|
||||
# revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors", rev = "1207e33" }
|
||||
#
|
||||
# jsonrpsee = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" }
|
||||
# jsonrpsee-core = { git = "https://github.com/paradigmxyz/jsonrpsee", branch = "matt/make-rpc-service-pub" }
|
||||
|
||||
@@ -541,7 +541,6 @@ impl Command {
|
||||
suggested_fee_recipient: alloy_primitives::Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
},
|
||||
transactions: transactions.to_vec(),
|
||||
extra_data: None,
|
||||
|
||||
@@ -69,7 +69,6 @@ pub(crate) fn prepare_payload_request(
|
||||
suggested_fee_recipient: Address::ZERO,
|
||||
withdrawals: shanghai_active.then(Vec::new),
|
||||
parent_beacon_block_root: cancun_active.then_some(B256::ZERO),
|
||||
slot_number: None,
|
||||
},
|
||||
forkchoice_state: ForkchoiceState {
|
||||
head_block_hash: parent_hash,
|
||||
|
||||
@@ -181,45 +181,6 @@ pub(crate) fn payload_to_new_payload(
|
||||
target_version: Option<EngineApiMessageVersion>,
|
||||
) -> eyre::Result<(EngineApiMessageVersion, serde_json::Value)> {
|
||||
let (version, params) = match payload {
|
||||
ExecutionPayload::V4(payload) => {
|
||||
let cancun = sidecar.cancun().unwrap();
|
||||
|
||||
if let Some(prague) = sidecar.prague() {
|
||||
if is_optimism {
|
||||
(
|
||||
EngineApiMessageVersion::V4,
|
||||
serde_json::to_value((
|
||||
OpExecutionPayloadV4 {
|
||||
payload_inner: payload.payload_inner,
|
||||
withdrawals_root: withdrawals_root.unwrap(),
|
||||
},
|
||||
cancun.versioned_hashes.clone(),
|
||||
cancun.parent_beacon_block_root,
|
||||
Requests::default(),
|
||||
))?,
|
||||
)
|
||||
} else {
|
||||
(
|
||||
EngineApiMessageVersion::V4,
|
||||
serde_json::to_value((
|
||||
payload,
|
||||
cancun.versioned_hashes.clone(),
|
||||
cancun.parent_beacon_block_root,
|
||||
prague.requests.requests_hash(),
|
||||
))?,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
(
|
||||
EngineApiMessageVersion::V3,
|
||||
serde_json::to_value((
|
||||
payload,
|
||||
cancun.versioned_hashes.clone(),
|
||||
cancun.parent_beacon_block_root,
|
||||
))?,
|
||||
)
|
||||
}
|
||||
}
|
||||
ExecutionPayload::V3(payload) => {
|
||||
let cancun = sidecar.cancun().unwrap();
|
||||
|
||||
@@ -242,11 +203,7 @@ pub(crate) fn payload_to_new_payload(
|
||||
)
|
||||
} else {
|
||||
// Extract actual Requests from RequestsOrHash
|
||||
let requests = prague
|
||||
.requests
|
||||
.requests()
|
||||
.cloned()
|
||||
.ok_or_else(|| eyre::eyre!("Prague sidecar has hash, not requests"))?;
|
||||
let requests = prague.requests.requests_hash();
|
||||
(
|
||||
version,
|
||||
serde_json::to_value((
|
||||
@@ -328,10 +285,7 @@ pub(crate) async fn call_forkchoice_updated<N, P: EngineApiValidWaitExt<N>>(
|
||||
) -> TransportResult<ForkchoiceUpdated> {
|
||||
// FCU V3 is used for both Cancun and Prague (there is no FCU V4)
|
||||
match message_version {
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
EngineApiMessageVersion::V3 | EngineApiMessageVersion::V4 | EngineApiMessageVersion::V5 => {
|
||||
provider.fork_choice_updated_v3_wait(forkchoice_state, payload_attributes).await
|
||||
}
|
||||
EngineApiMessageVersion::V2 => {
|
||||
|
||||
@@ -942,37 +942,35 @@ impl<N: NodePrimitives<SignedTx: SignedTransaction>> NewCanonicalChain<N> {
|
||||
pub fn to_chain_notification(&self) -> CanonStateNotification<N> {
|
||||
match self {
|
||||
Self::Commit { new } => {
|
||||
let new = Arc::new(new.iter().fold(Chain::default(), |mut chain, exec| {
|
||||
chain.append_block(
|
||||
exec.recovered_block().clone(),
|
||||
exec.execution_outcome().clone(),
|
||||
exec.trie_updates(),
|
||||
exec.hashed_state(),
|
||||
);
|
||||
chain
|
||||
}));
|
||||
CanonStateNotification::Commit { new }
|
||||
CanonStateNotification::Commit { new: Arc::new(Self::blocks_to_chain(new)) }
|
||||
}
|
||||
Self::Reorg { new, old } => {
|
||||
let new = Arc::new(new.iter().fold(Chain::default(), |mut chain, exec| {
|
||||
Self::Reorg { new, old } => CanonStateNotification::Reorg {
|
||||
new: Arc::new(Self::blocks_to_chain(new)),
|
||||
old: Arc::new(Self::blocks_to_chain(old)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a slice of executed blocks into a [`Chain`].
|
||||
fn blocks_to_chain(blocks: &[ExecutedBlock<N>]) -> Chain<N> {
|
||||
match blocks {
|
||||
[] => Chain::default(),
|
||||
[first, rest @ ..] => {
|
||||
let mut chain = Chain::from_block(
|
||||
first.recovered_block().clone(),
|
||||
first.execution_outcome().clone(),
|
||||
first.trie_updates(),
|
||||
first.hashed_state(),
|
||||
);
|
||||
for exec in rest {
|
||||
chain.append_block(
|
||||
exec.recovered_block().clone(),
|
||||
exec.execution_outcome().clone(),
|
||||
exec.trie_updates(),
|
||||
exec.hashed_state(),
|
||||
);
|
||||
chain
|
||||
}));
|
||||
let old = Arc::new(old.iter().fold(Chain::default(), |mut chain, exec| {
|
||||
chain.append_block(
|
||||
exec.recovered_block().clone(),
|
||||
exec.execution_outcome().clone(),
|
||||
exec.trie_updates(),
|
||||
exec.hashed_state(),
|
||||
);
|
||||
chain
|
||||
}));
|
||||
CanonStateNotification::Reorg { new, old }
|
||||
}
|
||||
chain
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1543,12 +1541,6 @@ mod tests {
|
||||
let block2a =
|
||||
test_block_builder.get_executed_block_with_number(2, block1.recovered_block.hash());
|
||||
|
||||
let sample_execution_outcome = ExecutionOutcome {
|
||||
receipts: vec![vec![], vec![]],
|
||||
requests: vec![Requests::default(), Requests::default()],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Test commit notification
|
||||
let chain_commit = NewCanonicalChain::Commit { new: vec![block0.clone(), block1.clone()] };
|
||||
|
||||
@@ -1562,12 +1554,20 @@ mod tests {
|
||||
expected_hashed_state.insert(0, block0.hashed_state());
|
||||
expected_hashed_state.insert(1, block1.hashed_state());
|
||||
|
||||
// Build expected execution outcome (first_block matches first block number)
|
||||
let commit_execution_outcome = ExecutionOutcome {
|
||||
receipts: vec![vec![], vec![]],
|
||||
requests: vec![Requests::default(), Requests::default()],
|
||||
first_block: 0,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
chain_commit.to_chain_notification(),
|
||||
CanonStateNotification::Commit {
|
||||
new: Arc::new(Chain::new(
|
||||
vec![block0.recovered_block().clone(), block1.recovered_block().clone()],
|
||||
sample_execution_outcome.clone(),
|
||||
commit_execution_outcome,
|
||||
expected_trie_updates,
|
||||
expected_hashed_state
|
||||
))
|
||||
@@ -1600,18 +1600,27 @@ mod tests {
|
||||
new_hashed_state.insert(1, block1a.hashed_state());
|
||||
new_hashed_state.insert(2, block2a.hashed_state());
|
||||
|
||||
// Build expected execution outcome for reorg chains (first_block matches first block
|
||||
// number)
|
||||
let reorg_execution_outcome = ExecutionOutcome {
|
||||
receipts: vec![vec![], vec![]],
|
||||
requests: vec![Requests::default(), Requests::default()],
|
||||
first_block: 1,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
chain_reorg.to_chain_notification(),
|
||||
CanonStateNotification::Reorg {
|
||||
old: Arc::new(Chain::new(
|
||||
vec![block1.recovered_block().clone(), block2.recovered_block().clone()],
|
||||
sample_execution_outcome.clone(),
|
||||
reorg_execution_outcome.clone(),
|
||||
old_trie_updates,
|
||||
old_hashed_state
|
||||
)),
|
||||
new: Arc::new(Chain::new(
|
||||
vec![block1a.recovered_block().clone(), block2a.recovered_block().clone()],
|
||||
sample_execution_outcome,
|
||||
reorg_execution_outcome,
|
||||
new_trie_updates,
|
||||
new_hashed_state
|
||||
))
|
||||
|
||||
@@ -173,7 +173,6 @@ impl<N: NodePrimitives> TestBlockBuilder<N> {
|
||||
transactions: transactions.into_iter().map(|tx| tx.into_inner()).collect(),
|
||||
ommers: Vec::new(),
|
||||
withdrawals: Some(vec![].into()),
|
||||
block_access_list: None,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -45,10 +45,6 @@ use reth_network_peers::{
|
||||
};
|
||||
use reth_primitives_traits::{sync::LazyLock, BlockHeader, SealedHeader};
|
||||
|
||||
/// The hash of an empty block access list.
|
||||
const EMPTY_BLOCK_ACCESS_LIST_HASH: B256 =
|
||||
b256!("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347");
|
||||
|
||||
/// Helper method building a [`Header`] given [`Genesis`] and [`ChainHardforks`].
|
||||
pub fn make_genesis_header(genesis: &Genesis, hardforks: &ChainHardforks) -> Header {
|
||||
// If London is activated at genesis, we set the initial base fee as per EIP-1559.
|
||||
@@ -83,12 +79,6 @@ pub fn make_genesis_header(genesis: &Genesis, hardforks: &ChainHardforks) -> Hea
|
||||
.active_at_timestamp(genesis.timestamp)
|
||||
.then_some(EMPTY_REQUESTS_HASH);
|
||||
|
||||
// If Amsterdam is activated at genesis we set block access list hash empty hash.
|
||||
let block_access_list_hash = hardforks
|
||||
.fork(EthereumHardfork::Amsterdam)
|
||||
.active_at_timestamp(genesis.timestamp)
|
||||
.then_some(EMPTY_BLOCK_ACCESS_LIST_HASH);
|
||||
|
||||
Header {
|
||||
number: genesis.number.unwrap_or_default(),
|
||||
parent_hash: genesis.parent_hash.unwrap_or_default(),
|
||||
@@ -106,7 +96,6 @@ pub fn make_genesis_header(genesis: &Genesis, hardforks: &ChainHardforks) -> Hea
|
||||
blob_gas_used,
|
||||
excess_blob_gas,
|
||||
requests_hash,
|
||||
block_access_list_hash,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
@@ -311,7 +300,6 @@ pub fn create_chain_config(
|
||||
cancun_time: timestamp(EthereumHardfork::Cancun),
|
||||
prague_time: timestamp(EthereumHardfork::Prague),
|
||||
osaka_time: timestamp(EthereumHardfork::Osaka),
|
||||
amsterdam_time: timestamp(EthereumHardfork::Amsterdam),
|
||||
bpo1_time: timestamp(EthereumHardfork::Bpo1),
|
||||
bpo2_time: timestamp(EthereumHardfork::Bpo2),
|
||||
bpo3_time: timestamp(EthereumHardfork::Bpo3),
|
||||
@@ -913,7 +901,6 @@ impl From<Genesis> for ChainSpec {
|
||||
(EthereumHardfork::Bpo3.boxed(), genesis.config.bpo3_time),
|
||||
(EthereumHardfork::Bpo4.boxed(), genesis.config.bpo4_time),
|
||||
(EthereumHardfork::Bpo5.boxed(), genesis.config.bpo5_time),
|
||||
(EthereumHardfork::Amsterdam.boxed(), genesis.config.amsterdam_time),
|
||||
];
|
||||
|
||||
let mut time_hardforks = time_hardfork_opts
|
||||
@@ -1220,19 +1207,6 @@ impl ChainSpecBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Enable Amsterdam at genesis.
|
||||
pub fn amsterdam_activated(mut self) -> Self {
|
||||
self = self.osaka_activated();
|
||||
self.hardforks.insert(EthereumHardfork::Amsterdam, ForkCondition::Timestamp(0));
|
||||
self
|
||||
}
|
||||
|
||||
/// Enable Amsterdam at the given timestamp.
|
||||
pub fn with_amsterdam_at(mut self, timestamp: u64) -> Self {
|
||||
self.hardforks.insert(EthereumHardfork::Amsterdam, ForkCondition::Timestamp(timestamp));
|
||||
self
|
||||
}
|
||||
|
||||
/// Build the resulting [`ChainSpec`].
|
||||
///
|
||||
/// # Panics
|
||||
|
||||
@@ -15,7 +15,7 @@ use reth_db_common::{
|
||||
use reth_node_api::{HeaderTy, ReceiptTy, TxTy};
|
||||
use reth_node_core::args::StageEnum;
|
||||
use reth_provider::{
|
||||
DBProvider, DatabaseProviderFactory, StaticFileProviderFactory, StaticFileWriter, TrieWriter,
|
||||
DBProvider, DatabaseProviderFactory, StaticFileProviderFactory, StaticFileWriter,
|
||||
};
|
||||
use reth_prune::PruneSegment;
|
||||
use reth_stages::StageId;
|
||||
@@ -113,7 +113,6 @@ impl<C: ChainSpecParser> Command<C> {
|
||||
tx.clear::<tables::TransactionBlocks>()?;
|
||||
tx.clear::<tables::BlockOmmers<HeaderTy<N>>>()?;
|
||||
tx.clear::<tables::BlockWithdrawals>()?;
|
||||
tx.clear::<tables::BlockAccessLists>()?;
|
||||
reset_stage_checkpoint(tx, StageId::Bodies)?;
|
||||
|
||||
insert_genesis_header(&provider_rw, &self.env.chain)?;
|
||||
@@ -168,10 +167,6 @@ impl<C: ChainSpecParser> Command<C> {
|
||||
None,
|
||||
)?;
|
||||
}
|
||||
StageEnum::MerkleChangeSets => {
|
||||
provider_rw.clear_trie_changesets()?;
|
||||
reset_stage_checkpoint(tx, StageId::MerkleChangeSets)?;
|
||||
}
|
||||
StageEnum::AccountHistory | StageEnum::StorageHistory => {
|
||||
tx.clear::<tables::AccountsHistory>()?;
|
||||
tx.clear::<tables::StoragesHistory>()?;
|
||||
|
||||
@@ -550,7 +550,6 @@ impl PruneConfig {
|
||||
/// - `Option<PruneMode>` fields: set from `other` only if `self` is `None`.
|
||||
/// - `block_interval`: set from `other` only if `self.block_interval ==
|
||||
/// DEFAULT_BLOCK_INTERVAL`.
|
||||
/// - `merkle_changesets`: always set from `other`.
|
||||
/// - `receipts_log_filter`: set from `other` only if `self` is empty and `other` is non-empty.
|
||||
pub fn merge(&mut self, other: Self) {
|
||||
let Self {
|
||||
@@ -563,7 +562,6 @@ impl PruneConfig {
|
||||
account_history,
|
||||
storage_history,
|
||||
bodies_history,
|
||||
merkle_changesets,
|
||||
receipts_log_filter,
|
||||
},
|
||||
} = other;
|
||||
@@ -580,8 +578,6 @@ impl PruneConfig {
|
||||
self.segments.account_history = self.segments.account_history.or(account_history);
|
||||
self.segments.storage_history = self.segments.storage_history.or(storage_history);
|
||||
self.segments.bodies_history = self.segments.bodies_history.or(bodies_history);
|
||||
// Merkle changesets is not optional; always take the value from `other`
|
||||
self.segments.merkle_changesets = merkle_changesets;
|
||||
|
||||
if self.segments.receipts_log_filter.0.is_empty() && !receipts_log_filter.0.is_empty() {
|
||||
self.segments.receipts_log_filter = receipts_log_filter;
|
||||
@@ -1091,7 +1087,6 @@ receipts = { distance = 16384 }
|
||||
account_history: None,
|
||||
storage_history: Some(PruneMode::Before(5000)),
|
||||
bodies_history: None,
|
||||
merkle_changesets: PruneMode::Before(0),
|
||||
receipts_log_filter: ReceiptsLogPruneConfig(BTreeMap::from([(
|
||||
Address::random(),
|
||||
PruneMode::Full,
|
||||
@@ -1108,7 +1103,6 @@ receipts = { distance = 16384 }
|
||||
account_history: Some(PruneMode::Distance(2000)),
|
||||
storage_history: Some(PruneMode::Distance(3000)),
|
||||
bodies_history: None,
|
||||
merkle_changesets: PruneMode::Distance(10000),
|
||||
receipts_log_filter: ReceiptsLogPruneConfig(BTreeMap::from([
|
||||
(Address::random(), PruneMode::Distance(1000)),
|
||||
(Address::random(), PruneMode::Before(2000)),
|
||||
@@ -1127,7 +1121,6 @@ receipts = { distance = 16384 }
|
||||
assert_eq!(config1.segments.receipts, Some(PruneMode::Distance(1000)));
|
||||
assert_eq!(config1.segments.account_history, Some(PruneMode::Distance(2000)));
|
||||
assert_eq!(config1.segments.storage_history, Some(PruneMode::Before(5000)));
|
||||
assert_eq!(config1.segments.merkle_changesets, PruneMode::Distance(10000));
|
||||
assert_eq!(config1.segments.receipts_log_filter, original_filter);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,11 @@ workspace = true
|
||||
# reth
|
||||
reth-chainspec.workspace = true
|
||||
reth-consensus.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
# ethereum
|
||||
reth-primitives-traits.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-eips.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-primitives = { workspace = true, features = ["rand"] }
|
||||
@@ -38,6 +35,4 @@ std = [
|
||||
"reth-primitives-traits/std",
|
||||
"reth-ethereum-primitives/std",
|
||||
"alloy-primitives/std",
|
||||
"alloy-rlp/std",
|
||||
"tracing/std",
|
||||
]
|
||||
|
||||
@@ -69,29 +69,6 @@ pub fn validate_shanghai_withdrawals<B: Block>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validate that block access lists are present in Amsterdam
|
||||
///
|
||||
/// [EIP-7928]: https://eips.ethereum.org/EIPS/eip-7928
|
||||
#[inline]
|
||||
pub fn validate_amsterdam_block_access_lists<B: Block>(
|
||||
block: &SealedBlock<B>,
|
||||
) -> Result<(), ConsensusError> {
|
||||
let bal = block.body().block_access_list().ok_or(ConsensusError::BlockAccessListMissing)?;
|
||||
let bal_hash = alloy_primitives::keccak256(alloy_rlp::encode(bal));
|
||||
let header_bal_hash =
|
||||
block.block_access_list_hash().ok_or(ConsensusError::BlockAccessListHashMissing)?;
|
||||
if bal_hash != header_bal_hash {
|
||||
tracing::error!(
|
||||
target: "consensus",
|
||||
?header_bal_hash,
|
||||
?bal,
|
||||
"Block access list hash mismatch in validation.rs in L81"
|
||||
);
|
||||
return Err(ConsensusError::InvalidBalHash);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validate that blob gas is present in the block if Cancun is active.
|
||||
///
|
||||
/// See [EIP-4844]: Shard Blob Transactions
|
||||
@@ -154,21 +131,6 @@ where
|
||||
}
|
||||
_ => return Err(ConsensusError::WithdrawalsRootUnexpected),
|
||||
}
|
||||
if let (Some(expected_hash), Some(body_bal)) =
|
||||
(header.block_access_list_hash(), body.block_access_list())
|
||||
{
|
||||
let got_hash = alloy_primitives::keccak256(alloy_rlp::encode(body_bal));
|
||||
|
||||
if got_hash != expected_hash {
|
||||
tracing::error!(
|
||||
target: "consensus",
|
||||
?expected_hash,
|
||||
?body_bal,
|
||||
"Block access list hash mismatch in validation.rs in L164"
|
||||
);
|
||||
return Err(ConsensusError::InvalidBalHash);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -255,10 +217,6 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
if chain_spec.is_amsterdam_active_at_timestamp(block.header().timestamp()) {
|
||||
validate_amsterdam_block_access_lists(block)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -534,7 +492,6 @@ mod tests {
|
||||
transactions: vec![transaction],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
let block = SealedBlock::seal_slow(alloy_consensus::Block { header, body });
|
||||
|
||||
@@ -402,41 +402,9 @@ pub enum ConsensusError {
|
||||
/// The maximum allowed RLP length.
|
||||
max_rlp_length: usize,
|
||||
},
|
||||
|
||||
/// Error when the hash of block access list is different from the expected hash.
|
||||
#[error("Block header's BAL hash does not match the computed BAL hash.")]
|
||||
InvalidBalHash,
|
||||
|
||||
/// Error when the block access list hash is missing.
|
||||
#[error("block access list hash missing")]
|
||||
BlockAccessListHashMissing,
|
||||
|
||||
/// Error when the block access list is different from the expected access list.
|
||||
#[error("Block's access list is invalid.")]
|
||||
InvalidBlockAccessList,
|
||||
|
||||
/// Error when the block access list is missing.
|
||||
#[error("block access list missing")]
|
||||
BlockAccessListMissing,
|
||||
|
||||
/// Error when the block access list hash is unexpected.
|
||||
#[error("block access list hash unexpected")]
|
||||
BlockAccessListHashUnexpected,
|
||||
|
||||
/// Error when the block access list contains an account change that is not present in the
|
||||
/// computed access list.
|
||||
#[error("Block BAL contains an account change that is not present in the computed BAL.")]
|
||||
InvalidBalExtraAccount,
|
||||
|
||||
/// Error when the block access list is missing an account change that is present in the
|
||||
/// computed access list.
|
||||
#[error("Block BAL is missing an account change that is present in the computed BAL.")]
|
||||
InvalidBalMissingAccount,
|
||||
|
||||
/// EIP-7825: Transaction gas limit exceeds maximum allowed
|
||||
#[error(transparent)]
|
||||
TransactionGasLimitTooHigh(Box<TxGasLimitTooHighErr>),
|
||||
|
||||
/// Other, likely an injected L2 error.
|
||||
#[error("{0}")]
|
||||
Other(String),
|
||||
|
||||
@@ -56,7 +56,6 @@ pub fn generate_test_blocks(chain_spec: &ChainSpec, count: u64) -> Vec<SealedBlo
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash: None,
|
||||
};
|
||||
|
||||
// Set required fields based on chain spec
|
||||
@@ -107,7 +106,6 @@ pub fn generate_test_blocks(chain_spec: &ChainSpec, count: u64) -> Vec<SealedBlo
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: header.withdrawals_root.is_some().then(Withdrawals::default),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
// Create the block
|
||||
|
||||
@@ -227,7 +227,6 @@ where
|
||||
suggested_fee_recipient: alloy_primitives::Address::random(),
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
env.active_node_state_mut()?
|
||||
@@ -300,7 +299,6 @@ where
|
||||
suggested_fee_recipient: alloy_primitives::Address::random(),
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
let fresh_fcu_result = EngineApiClient::<Engine>::fork_choice_updated_v3(
|
||||
|
||||
@@ -254,7 +254,6 @@ where
|
||||
suggested_fee_recipient: alloy_primitives::Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
EthPayloadBuilderAttributes::new(B256::ZERO, attributes)
|
||||
};
|
||||
@@ -285,7 +284,6 @@ where
|
||||
suggested_fee_recipient: alloy_primitives::Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
<<N as NodeTypes>::Payload as PayloadTypes>::PayloadBuilderAttributes::from(
|
||||
EthPayloadBuilderAttributes::new(B256::ZERO, attributes),
|
||||
|
||||
@@ -161,7 +161,6 @@ async fn test_testsuite_assert_mine_block() -> Result<()> {
|
||||
suggested_fee_recipient: Address::random(),
|
||||
withdrawals: None,
|
||||
parent_beacon_block_root: None,
|
||||
slot_number: None,
|
||||
},
|
||||
));
|
||||
|
||||
|
||||
@@ -448,14 +448,12 @@ mod tests {
|
||||
nonce: account.nonce,
|
||||
code_hash: account.bytecode_hash.unwrap_or_default(),
|
||||
code: None,
|
||||
account_id: None,
|
||||
}),
|
||||
original_info: (i == 0).then(|| AccountInfo {
|
||||
balance: account.balance.checked_div(U256::from(2)).unwrap_or(U256::ZERO),
|
||||
nonce: 0,
|
||||
code_hash: account.bytecode_hash.unwrap_or_default(),
|
||||
code: None,
|
||||
account_id: None,
|
||||
}),
|
||||
storage,
|
||||
status: AccountStatus::default(),
|
||||
@@ -839,7 +837,6 @@ mod tests {
|
||||
receipts: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used: 0,
|
||||
block_access_list: Default::default(),
|
||||
blob_gas_used: 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -204,7 +204,7 @@ where
|
||||
EngineApiMessageVersion::default(),
|
||||
)
|
||||
.await?;
|
||||
tracing::debug!(target: "engine::local", "FCU result: {res:?}");
|
||||
|
||||
if !res.is_valid() {
|
||||
eyre::bail!("Invalid payload status")
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ where
|
||||
.chain_spec
|
||||
.is_cancun_active_at_timestamp(timestamp)
|
||||
.then(B256::random),
|
||||
slot_number: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,7 @@ pub trait EngineTypes:
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV2>
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV3>
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV4>
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV5>
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV6>,
|
||||
+ TryInto<Self::ExecutionPayloadEnvelopeV5>,
|
||||
> + DeserializeOwned
|
||||
+ Serialize
|
||||
{
|
||||
@@ -107,14 +106,6 @@ pub trait EngineTypes:
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static;
|
||||
/// Execution Payload V6 envelope type.
|
||||
type ExecutionPayloadEnvelopeV6: DeserializeOwned
|
||||
+ Serialize
|
||||
+ Clone
|
||||
+ Unpin
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static;
|
||||
}
|
||||
|
||||
/// Type that validates the payloads processed by the engine API.
|
||||
|
||||
@@ -25,6 +25,7 @@ reth-tasks.workspace = true
|
||||
reth-node-types.workspace = true
|
||||
reth-chainspec.workspace = true
|
||||
reth-engine-primitives.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
|
||||
# async
|
||||
futures.workspace = true
|
||||
@@ -40,6 +41,8 @@ reth-evm-ethereum.workspace = true
|
||||
reth-exex-types.workspace = true
|
||||
reth-primitives-traits.workspace = true
|
||||
reth-node-ethereum.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
|
||||
alloy-eips.workspace = true
|
||||
tokio = { workspace = true, features = ["sync"] }
|
||||
tokio-stream.workspace = true
|
||||
|
||||
@@ -26,6 +26,7 @@ use reth_provider::{
|
||||
use reth_prune::PrunerWithFactory;
|
||||
use reth_stages_api::{MetricEventsSender, Pipeline};
|
||||
use reth_tasks::TaskSpawner;
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use std::{
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
@@ -84,6 +85,7 @@ where
|
||||
tree_config: TreeConfig,
|
||||
sync_metrics_tx: MetricEventsSender,
|
||||
evm_config: C,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> Self
|
||||
where
|
||||
V: EngineValidator<N::Payload>,
|
||||
@@ -109,6 +111,7 @@ where
|
||||
tree_config,
|
||||
engine_kind,
|
||||
evm_config,
|
||||
changeset_cache,
|
||||
);
|
||||
|
||||
let engine_handler = EngineApiRequestHandler::new(to_tree_tx, from_tree);
|
||||
@@ -156,6 +159,7 @@ mod tests {
|
||||
};
|
||||
use reth_prune::Pruner;
|
||||
use reth_tasks::TokioTaskExecutor;
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{mpsc::unbounded_channel, watch};
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
@@ -188,6 +192,8 @@ mod tests {
|
||||
let pruner = Pruner::new_with_factory(provider_factory.clone(), vec![], 0, 0, None, rx);
|
||||
let evm_config = EthEvmConfig::new(chain_spec.clone());
|
||||
|
||||
let changeset_cache = ChangesetCache::new();
|
||||
|
||||
let engine_validator = BasicEngineValidator::new(
|
||||
blockchain_db.clone(),
|
||||
consensus.clone(),
|
||||
@@ -195,6 +201,7 @@ mod tests {
|
||||
engine_payload_validator,
|
||||
TreeConfig::default(),
|
||||
Box::new(NoopInvalidBlockHook::default()),
|
||||
changeset_cache.clone(),
|
||||
);
|
||||
|
||||
let (sync_metrics_tx, _sync_metrics_rx) = unbounded_channel();
|
||||
@@ -214,6 +221,7 @@ mod tests {
|
||||
TreeConfig::default(),
|
||||
sync_metrics_tx,
|
||||
evm_config,
|
||||
changeset_cache,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ reth-trie-parallel.workspace = true
|
||||
reth-trie-sparse = { workspace = true, features = ["std", "metrics"] }
|
||||
reth-trie-sparse-parallel = { workspace = true, features = ["std"] }
|
||||
reth-trie.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
|
||||
# alloy
|
||||
alloy-evm.workspace = true
|
||||
@@ -133,6 +134,7 @@ test-utils = [
|
||||
"reth-static-file",
|
||||
"reth-tracing",
|
||||
"reth-trie/test-utils",
|
||||
"reth-trie-db/test-utils",
|
||||
"reth-trie-sparse/test-utils",
|
||||
"reth-prune-types?/test-utils",
|
||||
"reth-trie-parallel/test-utils",
|
||||
|
||||
@@ -26,12 +26,10 @@ fn create_bench_state(num_accounts: usize) -> EvmState {
|
||||
nonce: 10,
|
||||
code_hash: B256::from_slice(&rng.random::<[u8; 32]>()),
|
||||
code: Default::default(),
|
||||
account_id: None,
|
||||
},
|
||||
storage,
|
||||
status: AccountStatus::empty(),
|
||||
transaction_id: 0,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let address = Address::with_last_byte(i as u8);
|
||||
|
||||
@@ -62,7 +62,6 @@ fn create_bench_state_updates(params: &BenchParams) -> Vec<EvmState> {
|
||||
storage: HashMap::default(),
|
||||
status: AccountStatus::SelfDestructed,
|
||||
transaction_id: 0,
|
||||
..Default::default()
|
||||
}
|
||||
} else {
|
||||
RevmAccount {
|
||||
@@ -71,7 +70,6 @@ fn create_bench_state_updates(params: &BenchParams) -> Vec<EvmState> {
|
||||
nonce: rng.random::<u64>(),
|
||||
code_hash: KECCAK_EMPTY,
|
||||
code: Some(Default::default()),
|
||||
account_id: None,
|
||||
},
|
||||
storage: (0..rng.random_range(0..=params.storage_slots_per_account))
|
||||
.map(|_| {
|
||||
@@ -87,7 +85,6 @@ fn create_bench_state_updates(params: &BenchParams) -> Vec<EvmState> {
|
||||
.collect(),
|
||||
status: AccountStatus::Touched,
|
||||
transaction_id: 0,
|
||||
..Default::default()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -242,7 +239,10 @@ fn bench_state_root(c: &mut Criterion) {
|
||||
std::convert::identity,
|
||||
),
|
||||
StateProviderBuilder::new(provider.clone(), genesis_hash, None),
|
||||
OverlayStateProviderFactory::new(provider),
|
||||
OverlayStateProviderFactory::new(
|
||||
provider,
|
||||
reth_trie_db::ChangesetCache::new(),
|
||||
),
|
||||
&TreeConfig::default(),
|
||||
None,
|
||||
);
|
||||
|
||||
@@ -159,6 +159,7 @@ where
|
||||
|
||||
self.metrics.save_blocks_block_count.record(block_count as f64);
|
||||
self.metrics.save_blocks_duration_seconds.record(start_time.elapsed());
|
||||
|
||||
Ok(last_block)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,6 @@ mod tests {
|
||||
receipts: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used: 1000,
|
||||
block_access_list: None,
|
||||
blob_gas_used: 0,
|
||||
},
|
||||
))
|
||||
@@ -581,12 +580,10 @@ mod tests {
|
||||
nonce: 10,
|
||||
code_hash: B256::random(),
|
||||
code: Default::default(),
|
||||
account_id: None,
|
||||
},
|
||||
storage,
|
||||
status: AccountStatus::default(),
|
||||
transaction_id: 0,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
state
|
||||
|
||||
@@ -30,11 +30,13 @@ use reth_payload_primitives::{
|
||||
};
|
||||
use reth_primitives_traits::{NodePrimitives, RecoveredBlock, SealedBlock, SealedHeader};
|
||||
use reth_provider::{
|
||||
BlockReader, DatabaseProviderFactory, HashedPostStateProvider, ProviderError, StateProviderBox,
|
||||
StateProviderFactory, StateReader, TransactionVariant, TrieReader,
|
||||
BlockNumReader, BlockReader, ChangeSetReader, DatabaseProviderFactory, HashedPostStateProvider,
|
||||
ProviderError, StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
|
||||
TransactionVariant,
|
||||
};
|
||||
use reth_revm::database::StateProviderDatabase;
|
||||
use reth_stages_api::ControlFlow;
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use revm::state::EvmState;
|
||||
use state::TreeState;
|
||||
use std::{fmt::Debug, ops, sync::Arc, time::Instant};
|
||||
@@ -271,6 +273,8 @@ where
|
||||
engine_kind: EngineApiKind,
|
||||
/// The EVM configuration.
|
||||
evm_config: C,
|
||||
/// Changeset cache for in-memory trie changesets
|
||||
changeset_cache: ChangesetCache,
|
||||
}
|
||||
|
||||
impl<N, P: Debug, T: PayloadTypes + Debug, V: Debug, C> std::fmt::Debug
|
||||
@@ -295,6 +299,7 @@ where
|
||||
.field("metrics", &self.metrics)
|
||||
.field("engine_kind", &self.engine_kind)
|
||||
.field("evm_config", &self.evm_config)
|
||||
.field("changeset_cache", &self.changeset_cache)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
@@ -307,11 +312,12 @@ where
|
||||
+ StateProviderFactory
|
||||
+ StateReader<Receipt = N::Receipt>
|
||||
+ HashedPostStateProvider
|
||||
+ TrieReader
|
||||
+ Clone
|
||||
+ 'static,
|
||||
<P as DatabaseProviderFactory>::Provider:
|
||||
BlockReader<Block = N::Block, Header = N::BlockHeader>,
|
||||
<P as DatabaseProviderFactory>::Provider: BlockReader<Block = N::Block, Header = N::BlockHeader>
|
||||
+ StageCheckpointReader
|
||||
+ ChangeSetReader
|
||||
+ BlockNumReader,
|
||||
C: ConfigureEvm<Primitives = N> + 'static,
|
||||
T: PayloadTypes<BuiltPayload: BuiltPayload<Primitives = N>>,
|
||||
V: EngineValidator<T>,
|
||||
@@ -331,6 +337,7 @@ where
|
||||
config: TreeConfig,
|
||||
engine_kind: EngineApiKind,
|
||||
evm_config: C,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> Self {
|
||||
let (incoming_tx, incoming) = crossbeam_channel::unbounded();
|
||||
|
||||
@@ -351,6 +358,7 @@ where
|
||||
incoming_tx,
|
||||
engine_kind,
|
||||
evm_config,
|
||||
changeset_cache,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,6 +378,7 @@ where
|
||||
config: TreeConfig,
|
||||
kind: EngineApiKind,
|
||||
evm_config: C,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> (Sender<FromEngine<EngineApiRequest<T, N>, N::Block>>, UnboundedReceiver<EngineApiEvent<N>>)
|
||||
{
|
||||
let best_block_number = provider.best_block_number().unwrap_or(0);
|
||||
@@ -401,6 +410,7 @@ where
|
||||
config,
|
||||
kind,
|
||||
evm_config,
|
||||
changeset_cache,
|
||||
);
|
||||
let incoming = task.incoming_tx.clone();
|
||||
std::thread::Builder::new().name("Engine Task".to_string()).spawn(|| task.run()).unwrap();
|
||||
@@ -582,7 +592,7 @@ where
|
||||
// null}` if the expected and the actual arrays don't match.
|
||||
//
|
||||
// This validation **MUST** be instantly run in all cases even during active sync process.
|
||||
tracing::debug!("Payload received {:?}", payload);
|
||||
|
||||
let num_hash = payload.num_hash();
|
||||
let engine_event = ConsensusEngineEvent::BlockReceived(num_hash);
|
||||
self.emit_event(EngineApiEvent::BeaconConsensus(engine_event));
|
||||
@@ -591,7 +601,6 @@ where
|
||||
|
||||
// Check for invalid ancestors
|
||||
if let Some(invalid) = self.find_invalid_ancestor(&payload) {
|
||||
tracing::debug!(target: "engine::tree", ?invalid, "found invalid ancestor for payload");
|
||||
let status = self.handle_invalid_ancestor_payload(payload, invalid)?;
|
||||
return Ok(TreeOutcome::new(status));
|
||||
}
|
||||
@@ -600,7 +609,6 @@ where
|
||||
self.metrics.block_validation.record_payload_validation(start.elapsed().as_secs_f64());
|
||||
|
||||
let status = if self.backfill_sync_state.is_idle() {
|
||||
tracing::debug!(target: "engine::tree", "inserting payload directly");
|
||||
self.try_insert_payload(payload)?
|
||||
} else {
|
||||
self.try_buffer_payload(payload)?
|
||||
@@ -639,7 +647,7 @@ where
|
||||
let parent_hash = payload.parent_hash();
|
||||
let mut latest_valid_hash = None;
|
||||
|
||||
match self.insert_payload(payload.clone()) {
|
||||
match self.insert_payload(payload) {
|
||||
Ok(status) => {
|
||||
let status = match status {
|
||||
InsertPayloadOk::Inserted(BlockStatus::Valid) => {
|
||||
@@ -661,10 +669,7 @@ where
|
||||
Ok(PayloadStatus::new(status, latest_valid_hash))
|
||||
}
|
||||
Err(error) => match error {
|
||||
InsertPayloadError::Block(error) => {
|
||||
tracing::debug!("payload in new payload l 617 {:?}", payload);
|
||||
Ok(self.on_insert_block_error(error)?)
|
||||
}
|
||||
InsertPayloadError::Block(error) => Ok(self.on_insert_block_error(error)?),
|
||||
InsertPayloadError::Payload(error) => {
|
||||
Ok(self.on_new_payload_error(error, num_hash, parent_hash)?)
|
||||
}
|
||||
@@ -1370,6 +1375,21 @@ where
|
||||
|
||||
debug!(target: "engine::tree", ?last_persisted_block_hash, ?last_persisted_block_number, elapsed=?start_time.elapsed(), "Finished persisting, calling finish");
|
||||
self.persistence_state.finish(last_persisted_block_hash, last_persisted_block_number);
|
||||
|
||||
// Evict trie changesets for blocks below the finalized block, but keep at least 64 blocks
|
||||
if let Some(finalized) = self.canonical_in_memory_state.get_finalized_num_hash() {
|
||||
let min_threshold = last_persisted_block_number.saturating_sub(64);
|
||||
let eviction_threshold = finalized.number.min(min_threshold);
|
||||
debug!(
|
||||
target: "engine::tree",
|
||||
last_persisted = last_persisted_block_number,
|
||||
finalized_number = finalized.number,
|
||||
eviction_threshold,
|
||||
"Evicting changesets below threshold"
|
||||
);
|
||||
self.changeset_cache.evict(eviction_threshold);
|
||||
}
|
||||
|
||||
self.on_new_persisted_block()?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -1741,7 +1761,7 @@ where
|
||||
}
|
||||
|
||||
let min_block = self.persistence_state.last_persisted_block.number;
|
||||
self.state.tree_state.canonical_block_number().saturating_sub(min_block) >
|
||||
self.state.tree_state.canonical_block_number().saturating_sub(min_block) >=
|
||||
self.config.persistence_threshold()
|
||||
}
|
||||
|
||||
@@ -1823,6 +1843,7 @@ where
|
||||
/// or the database. If the required historical data (such as trie change sets) has been
|
||||
/// pruned for a given block, this operation will return an error. On archive nodes, it
|
||||
/// can retrieve any block.
|
||||
#[instrument(level = "debug", target = "engine::tree", skip(self))]
|
||||
fn canonical_block_by_hash(&self, hash: B256) -> ProviderResult<Option<ExecutedBlock<N>>> {
|
||||
trace!(target: "engine::tree", ?hash, "Fetching executed block by hash");
|
||||
// check memory first
|
||||
@@ -1840,7 +1861,18 @@ where
|
||||
.get_state(block.header().number())?
|
||||
.ok_or_else(|| ProviderError::StateForNumberNotFound(block.header().number()))?;
|
||||
let hashed_state = self.provider.hashed_post_state(execution_output.state());
|
||||
let trie_updates = self.provider.get_block_trie_updates(block.number())?;
|
||||
|
||||
debug!(
|
||||
target: "engine::tree",
|
||||
number = ?block.number(),
|
||||
"computing block trie updates",
|
||||
);
|
||||
let db_provider = self.provider.database_provider_ro()?;
|
||||
let trie_updates = reth_trie_db::compute_block_trie_updates(
|
||||
&self.changeset_cache,
|
||||
&db_provider,
|
||||
block.number(),
|
||||
)?;
|
||||
|
||||
let sorted_hashed_state = Arc::new(hashed_state.into_sorted());
|
||||
let sorted_trie_updates = Arc::new(trie_updates);
|
||||
|
||||
@@ -6,7 +6,6 @@ use alloy_primitives::{keccak256, Address, StorageKey, U256};
|
||||
use reth_primitives_traits::Account;
|
||||
use reth_provider::{AccountReader, ProviderError};
|
||||
use reth_trie::{HashedPostState, HashedStorage};
|
||||
use revm_primitives::B256;
|
||||
use std::ops::Range;
|
||||
|
||||
/// Returns the total number of storage slots (both changed and read-only) across all accounts in
|
||||
@@ -102,7 +101,7 @@ impl<'a> Iterator for BALSlotIter<'a> {
|
||||
return None;
|
||||
}
|
||||
|
||||
return Some((address, slot.into()));
|
||||
return Some((address, slot));
|
||||
}
|
||||
|
||||
// Move to next account
|
||||
@@ -178,11 +177,13 @@ where
|
||||
let mut storage_map = HashedStorage::new(false);
|
||||
|
||||
for slot_changes in &account_changes.storage_changes {
|
||||
let hashed_slot = keccak256(B256::from(slot_changes.slot));
|
||||
let hashed_slot = keccak256(slot_changes.slot);
|
||||
|
||||
// Get the last change for this slot
|
||||
if let Some(last_change) = slot_changes.changes.last() {
|
||||
storage_map.storage.insert(hashed_slot, last_change.new_value);
|
||||
storage_map
|
||||
.storage
|
||||
.insert(hashed_slot, U256::from_be_bytes(last_change.new_value.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +200,7 @@ mod tests {
|
||||
use alloy_eip7928::{
|
||||
AccountChanges, BalanceChange, CodeChange, NonceChange, SlotChanges, StorageChange,
|
||||
};
|
||||
use alloy_primitives::{Address, Bytes, B256};
|
||||
use alloy_primitives::{Address, Bytes, StorageKey, B256};
|
||||
use reth_revm::test_utils::StateProviderTest;
|
||||
|
||||
#[test]
|
||||
@@ -236,8 +237,8 @@ mod tests {
|
||||
let provider = StateProviderTest::default();
|
||||
|
||||
let address = Address::random();
|
||||
let slot = U256::random();
|
||||
let value = U256::random();
|
||||
let slot = StorageKey::random();
|
||||
let value = B256::random();
|
||||
|
||||
let slot_changes = SlotChanges { slot, changes: vec![StorageChange::new(0, value)] };
|
||||
|
||||
@@ -257,10 +258,10 @@ mod tests {
|
||||
assert!(result.storages.contains_key(&hashed_address));
|
||||
|
||||
let storage = result.storages.get(&hashed_address).unwrap();
|
||||
let hashed_slot = keccak256(B256::from(slot));
|
||||
let hashed_slot = keccak256(slot);
|
||||
|
||||
let stored_value = storage.storage.get(&hashed_slot).unwrap();
|
||||
assert_eq!(*stored_value, value);
|
||||
assert_eq!(*stored_value, U256::from_be_bytes(value.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -391,15 +392,15 @@ mod tests {
|
||||
let provider = StateProviderTest::default();
|
||||
|
||||
let address = Address::random();
|
||||
let slot = U256::random();
|
||||
let slot = StorageKey::random();
|
||||
|
||||
// Multiple changes to the same slot - should take the last one
|
||||
let slot_changes = SlotChanges {
|
||||
slot,
|
||||
changes: vec![
|
||||
StorageChange::new(0, U256::from(100)),
|
||||
StorageChange::new(1, U256::from(200)),
|
||||
StorageChange::new(2, U256::from(300)),
|
||||
StorageChange::new(0, B256::from(U256::from(100).to_be_bytes::<32>())),
|
||||
StorageChange::new(1, B256::from(U256::from(200).to_be_bytes::<32>())),
|
||||
StorageChange::new(2, B256::from(U256::from(300).to_be_bytes::<32>())),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -417,7 +418,7 @@ mod tests {
|
||||
|
||||
let hashed_address = keccak256(address);
|
||||
let storage = result.storages.get(&hashed_address).unwrap();
|
||||
let hashed_slot = keccak256(B256::from(slot));
|
||||
let hashed_slot = keccak256(slot);
|
||||
|
||||
let stored_value = storage.storage.get(&hashed_slot).unwrap();
|
||||
|
||||
@@ -437,15 +438,15 @@ mod tests {
|
||||
address: addr1,
|
||||
storage_changes: vec![
|
||||
SlotChanges {
|
||||
slot: U256::from(100),
|
||||
changes: vec![StorageChange::new(0, U256::ZERO)],
|
||||
slot: StorageKey::from(U256::from(100)),
|
||||
changes: vec![StorageChange::new(0, B256::ZERO)],
|
||||
},
|
||||
SlotChanges {
|
||||
slot: U256::from(101),
|
||||
changes: vec![StorageChange::new(0, U256::ZERO)],
|
||||
slot: StorageKey::from(U256::from(101)),
|
||||
changes: vec![StorageChange::new(0, B256::ZERO)],
|
||||
},
|
||||
],
|
||||
storage_reads: vec![U256::from(102)],
|
||||
storage_reads: vec![StorageKey::from(U256::from(102))],
|
||||
balance_changes: vec![],
|
||||
nonce_changes: vec![],
|
||||
code_changes: vec![],
|
||||
@@ -455,10 +456,10 @@ mod tests {
|
||||
let account2 = AccountChanges {
|
||||
address: addr2,
|
||||
storage_changes: vec![SlotChanges {
|
||||
slot: U256::from(200),
|
||||
changes: vec![StorageChange::new(0, U256::ZERO)],
|
||||
slot: StorageKey::from(U256::from(200)),
|
||||
changes: vec![StorageChange::new(0, B256::ZERO)],
|
||||
}],
|
||||
storage_reads: vec![U256::from(201)],
|
||||
storage_reads: vec![StorageKey::from(U256::from(201))],
|
||||
balance_changes: vec![],
|
||||
nonce_changes: vec![],
|
||||
code_changes: vec![],
|
||||
@@ -469,15 +470,15 @@ mod tests {
|
||||
address: addr3,
|
||||
storage_changes: vec![
|
||||
SlotChanges {
|
||||
slot: U256::from(300),
|
||||
changes: vec![StorageChange::new(0, U256::ZERO)],
|
||||
slot: StorageKey::from(U256::from(300)),
|
||||
changes: vec![StorageChange::new(0, B256::ZERO)],
|
||||
},
|
||||
SlotChanges {
|
||||
slot: U256::from(301),
|
||||
changes: vec![StorageChange::new(0, U256::ZERO)],
|
||||
slot: StorageKey::from(U256::from(301)),
|
||||
changes: vec![StorageChange::new(0, B256::ZERO)],
|
||||
},
|
||||
],
|
||||
storage_reads: vec![U256::from(302)],
|
||||
storage_reads: vec![StorageKey::from(U256::from(302))],
|
||||
balance_changes: vec![],
|
||||
nonce_changes: vec![],
|
||||
code_changes: vec![],
|
||||
|
||||
@@ -886,6 +886,7 @@ mod tests {
|
||||
use reth_revm::db::BundleState;
|
||||
use reth_testing_utils::generators;
|
||||
use reth_trie::{test_utils::state_root, HashedPostState};
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use revm_primitives::{Address, HashMap, B256, KECCAK_EMPTY, U256};
|
||||
use revm_state::{AccountInfo, AccountStatus, EvmState, EvmStorageSlot};
|
||||
use std::sync::Arc;
|
||||
@@ -1058,12 +1059,10 @@ mod tests {
|
||||
nonce: rng.random::<u64>(),
|
||||
code_hash: KECCAK_EMPTY,
|
||||
code: Some(Default::default()),
|
||||
account_id: None,
|
||||
},
|
||||
storage,
|
||||
status: AccountStatus::Touched,
|
||||
transaction_id: 0,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
state_update.insert(address, account);
|
||||
@@ -1143,7 +1142,7 @@ mod tests {
|
||||
std::convert::identity,
|
||||
),
|
||||
StateProviderBuilder::new(provider_factory.clone(), genesis_hash, None),
|
||||
OverlayStateProviderFactory::new(provider_factory),
|
||||
OverlayStateProviderFactory::new(provider_factory, ChangesetCache::new()),
|
||||
&TreeConfig::default(),
|
||||
None, // No BAL for test
|
||||
);
|
||||
|
||||
@@ -1318,79 +1318,15 @@ mod tests {
|
||||
use reth_provider::{
|
||||
providers::OverlayStateProviderFactory, test_utils::create_test_provider_factory,
|
||||
BlockNumReader, BlockReader, ChangeSetReader, DatabaseProviderFactory, LatestStateProvider,
|
||||
PruneCheckpointReader, StageCheckpointReader, StateProviderBox, TrieReader,
|
||||
PruneCheckpointReader, StageCheckpointReader, StateProviderBox,
|
||||
};
|
||||
use reth_trie::MultiProof;
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use reth_trie_parallel::proof_task::{ProofTaskCtx, ProofWorkerHandle};
|
||||
use revm_primitives::{B256, U256};
|
||||
use std::{
|
||||
mem,
|
||||
sync::{Arc, OnceLock},
|
||||
};
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use tokio::runtime::{Handle, Runtime};
|
||||
|
||||
/// Maximum number of targets to batch together for state update batching.
|
||||
const STATE_UPDATE_MAX_BATCH_TARGETS: usize = 64;
|
||||
|
||||
/// Checks whether two `Source` values refer to the same origin.
|
||||
fn same_source(lhs: Source, rhs: Source) -> bool {
|
||||
match (lhs, rhs) {
|
||||
(Source::Evm(a), Source::Evm(b)) => same_state_change_source(a, b),
|
||||
(Source::BlockAccessList, Source::BlockAccessList) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks whether two state change sources refer to the same origin.
|
||||
fn same_state_change_source(lhs: StateChangeSource, rhs: StateChangeSource) -> bool {
|
||||
match (lhs, rhs) {
|
||||
(StateChangeSource::Transaction(a), StateChangeSource::Transaction(b)) => a == b,
|
||||
(StateChangeSource::PreBlock(a), StateChangeSource::PreBlock(b)) => {
|
||||
mem::discriminant(&a) == mem::discriminant(&b)
|
||||
}
|
||||
(StateChangeSource::PostBlock(a), StateChangeSource::PostBlock(b)) => {
|
||||
mem::discriminant(&a) == mem::discriminant(&b)
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Determines if a state update can be batched with the current batch.
|
||||
fn can_batch_state_update(
|
||||
batch_source: Source,
|
||||
batch_update: &EvmState,
|
||||
next_source: Source,
|
||||
next_update: &EvmState,
|
||||
) -> bool {
|
||||
if !same_source(batch_source, next_source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
match (batch_source, next_source) {
|
||||
(
|
||||
Source::Evm(StateChangeSource::PreBlock(_)),
|
||||
Source::Evm(StateChangeSource::PreBlock(_)),
|
||||
) |
|
||||
(
|
||||
Source::Evm(StateChangeSource::PostBlock(_)),
|
||||
Source::Evm(StateChangeSource::PostBlock(_)),
|
||||
) => batch_update == next_update,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
/// Estimates target count from `EvmState` for batching decisions.
|
||||
fn estimate_evm_state_targets(state: &EvmState) -> usize {
|
||||
state
|
||||
.values()
|
||||
.filter(|account| account.is_touched())
|
||||
.map(|account| {
|
||||
let changed_slots = account.storage.iter().filter(|(_, v)| v.is_changed()).count();
|
||||
1 + changed_slots
|
||||
})
|
||||
.sum()
|
||||
}
|
||||
|
||||
/// Get a handle to the test runtime, creating it if necessary
|
||||
fn get_test_runtime_handle() -> Handle {
|
||||
static TEST_RT: OnceLock<Runtime> = OnceLock::new();
|
||||
@@ -1406,7 +1342,6 @@ mod tests {
|
||||
where
|
||||
F: DatabaseProviderFactory<
|
||||
Provider: BlockReader
|
||||
+ TrieReader
|
||||
+ StageCheckpointReader
|
||||
+ PruneCheckpointReader
|
||||
+ ChangeSetReader
|
||||
@@ -1416,7 +1351,8 @@ mod tests {
|
||||
+ 'static,
|
||||
{
|
||||
let rt_handle = get_test_runtime_handle();
|
||||
let overlay_factory = OverlayStateProviderFactory::new(factory);
|
||||
let changeset_cache = ChangesetCache::new();
|
||||
let overlay_factory = OverlayStateProviderFactory::new(factory, changeset_cache);
|
||||
let task_ctx = ProofTaskCtx::new(overlay_factory);
|
||||
let proof_handle = ProofWorkerHandle::new(rt_handle, task_ctx, 1, 1, false);
|
||||
let (to_sparse_trie, _receiver) = std::sync::mpsc::channel();
|
||||
@@ -1428,7 +1364,7 @@ mod tests {
|
||||
fn create_cached_provider<F>(factory: F) -> CachedStateProvider<StateProviderBox>
|
||||
where
|
||||
F: DatabaseProviderFactory<
|
||||
Provider: BlockReader + TrieReader + StageCheckpointReader + PruneCheckpointReader,
|
||||
Provider: BlockReader + StageCheckpointReader + PruneCheckpointReader,
|
||||
> + Clone
|
||||
+ Send
|
||||
+ 'static,
|
||||
@@ -1840,328 +1776,6 @@ mod tests {
|
||||
assert_eq!(proofs_requested, 1);
|
||||
}
|
||||
|
||||
/// Verifies that consecutive state update messages from the same source are batched together.
|
||||
#[test]
|
||||
fn test_state_update_batching() {
|
||||
use alloy_evm::block::StateChangeSource;
|
||||
use revm_state::Account;
|
||||
|
||||
let test_provider_factory = create_test_provider_factory();
|
||||
let mut task = create_test_state_root_task(test_provider_factory);
|
||||
|
||||
// create multiple state updates
|
||||
let addr1 = alloy_primitives::Address::random();
|
||||
let addr2 = alloy_primitives::Address::random();
|
||||
|
||||
let mut update1 = EvmState::default();
|
||||
update1.insert(
|
||||
addr1,
|
||||
Account {
|
||||
info: revm_state::AccountInfo {
|
||||
balance: U256::from(100),
|
||||
nonce: 1,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
},
|
||||
);
|
||||
|
||||
let mut update2 = EvmState::default();
|
||||
update2.insert(
|
||||
addr2,
|
||||
Account {
|
||||
info: revm_state::AccountInfo {
|
||||
balance: U256::from(200),
|
||||
nonce: 2,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
},
|
||||
);
|
||||
|
||||
let source = StateChangeSource::Transaction(0);
|
||||
|
||||
let tx = task.tx.clone();
|
||||
tx.send(MultiProofMessage::StateUpdate(source.into(), update1.clone())).unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(source.into(), update2.clone())).unwrap();
|
||||
|
||||
let proofs_requested =
|
||||
if let Ok(MultiProofMessage::StateUpdate(_src, update)) = task.rx.recv() {
|
||||
let mut merged_update = update;
|
||||
let mut num_batched = 1;
|
||||
|
||||
while let Ok(MultiProofMessage::StateUpdate(_next_source, next_update)) =
|
||||
task.rx.try_recv()
|
||||
{
|
||||
merged_update.extend(next_update);
|
||||
num_batched += 1;
|
||||
}
|
||||
|
||||
assert_eq!(num_batched, 2);
|
||||
assert_eq!(merged_update.len(), 2);
|
||||
assert!(merged_update.contains_key(&addr1));
|
||||
assert!(merged_update.contains_key(&addr2));
|
||||
|
||||
task.on_state_update(source.into(), merged_update)
|
||||
} else {
|
||||
panic!("Expected StateUpdate message");
|
||||
};
|
||||
assert_eq!(proofs_requested, 1);
|
||||
}
|
||||
|
||||
/// Verifies that state updates from different sources are not batched together.
|
||||
#[test]
|
||||
fn test_state_update_batching_separates_sources() {
|
||||
use alloy_evm::block::StateChangeSource;
|
||||
use revm_state::Account;
|
||||
|
||||
let test_provider_factory = create_test_provider_factory();
|
||||
let task = create_test_state_root_task(test_provider_factory);
|
||||
|
||||
let addr_a1 = alloy_primitives::Address::random();
|
||||
let addr_b1 = alloy_primitives::Address::random();
|
||||
let addr_a2 = alloy_primitives::Address::random();
|
||||
|
||||
let create_state_update = |addr: alloy_primitives::Address, balance: u64| {
|
||||
let mut state = EvmState::default();
|
||||
state.insert(
|
||||
addr,
|
||||
Account {
|
||||
info: revm_state::AccountInfo {
|
||||
balance: U256::from(balance),
|
||||
nonce: 1,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
},
|
||||
);
|
||||
state
|
||||
};
|
||||
|
||||
let source_a = StateChangeSource::Transaction(1);
|
||||
let source_b = StateChangeSource::Transaction(2);
|
||||
|
||||
// Queue: A1 (immediate dispatch), B1 (batched), A2 (should become pending)
|
||||
let tx = task.tx.clone();
|
||||
tx.send(MultiProofMessage::StateUpdate(source_a.into(), create_state_update(addr_a1, 100)))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(source_b.into(), create_state_update(addr_b1, 200)))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(source_a.into(), create_state_update(addr_a2, 300)))
|
||||
.unwrap();
|
||||
|
||||
let mut pending_msg: Option<MultiProofMessage> = None;
|
||||
|
||||
if let Ok(MultiProofMessage::StateUpdate(first_source, _)) = task.rx.recv() {
|
||||
assert!(same_source(first_source, source_a.into()));
|
||||
|
||||
// Simulate batching loop for remaining messages
|
||||
let mut accumulated_updates: Vec<(Source, EvmState)> = Vec::new();
|
||||
let mut accumulated_targets = 0usize;
|
||||
|
||||
loop {
|
||||
if accumulated_targets >= STATE_UPDATE_MAX_BATCH_TARGETS {
|
||||
break;
|
||||
}
|
||||
match task.rx.try_recv() {
|
||||
Ok(MultiProofMessage::StateUpdate(next_source, next_update)) => {
|
||||
if let Some((batch_source, batch_update)) = accumulated_updates.first() &&
|
||||
!can_batch_state_update(
|
||||
*batch_source,
|
||||
batch_update,
|
||||
next_source,
|
||||
&next_update,
|
||||
)
|
||||
{
|
||||
pending_msg =
|
||||
Some(MultiProofMessage::StateUpdate(next_source, next_update));
|
||||
break;
|
||||
}
|
||||
|
||||
let next_estimate = estimate_evm_state_targets(&next_update);
|
||||
if next_estimate > STATE_UPDATE_MAX_BATCH_TARGETS {
|
||||
pending_msg =
|
||||
Some(MultiProofMessage::StateUpdate(next_source, next_update));
|
||||
break;
|
||||
}
|
||||
if accumulated_targets + next_estimate > STATE_UPDATE_MAX_BATCH_TARGETS &&
|
||||
!accumulated_updates.is_empty()
|
||||
{
|
||||
pending_msg =
|
||||
Some(MultiProofMessage::StateUpdate(next_source, next_update));
|
||||
break;
|
||||
}
|
||||
accumulated_targets += next_estimate;
|
||||
accumulated_updates.push((next_source, next_update));
|
||||
}
|
||||
Ok(other_msg) => {
|
||||
pending_msg = Some(other_msg);
|
||||
break;
|
||||
}
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(accumulated_updates.len(), 1, "Should only batch matching sources");
|
||||
let batch_source = accumulated_updates[0].0;
|
||||
assert!(same_source(batch_source, source_b.into()));
|
||||
|
||||
let batch_source = accumulated_updates[0].0;
|
||||
let mut merged_update = accumulated_updates.remove(0).1;
|
||||
for (_, next_update) in accumulated_updates {
|
||||
merged_update.extend(next_update);
|
||||
}
|
||||
|
||||
assert!(same_source(batch_source, source_b.into()), "Batch should use matching source");
|
||||
assert!(merged_update.contains_key(&addr_b1));
|
||||
assert!(!merged_update.contains_key(&addr_a1));
|
||||
assert!(!merged_update.contains_key(&addr_a2));
|
||||
} else {
|
||||
panic!("Expected first StateUpdate");
|
||||
}
|
||||
|
||||
match pending_msg {
|
||||
Some(MultiProofMessage::StateUpdate(pending_source, pending_update)) => {
|
||||
assert!(same_source(pending_source, source_a.into()));
|
||||
assert!(pending_update.contains_key(&addr_a2));
|
||||
}
|
||||
other => panic!("Expected pending StateUpdate with source_a, got {:?}", other),
|
||||
}
|
||||
}
|
||||
|
||||
/// Verifies that pre-block updates only batch when their payloads are identical.
|
||||
#[test]
|
||||
fn test_pre_block_updates_require_payload_match_to_batch() {
|
||||
use alloy_evm::block::{StateChangePreBlockSource, StateChangeSource};
|
||||
use revm_state::Account;
|
||||
|
||||
let test_provider_factory = create_test_provider_factory();
|
||||
let task = create_test_state_root_task(test_provider_factory);
|
||||
|
||||
let addr1 = alloy_primitives::Address::random();
|
||||
let addr2 = alloy_primitives::Address::random();
|
||||
let addr3 = alloy_primitives::Address::random();
|
||||
|
||||
let create_state_update = |addr: alloy_primitives::Address, balance: u64| {
|
||||
let mut state = EvmState::default();
|
||||
state.insert(
|
||||
addr,
|
||||
Account {
|
||||
info: revm_state::AccountInfo {
|
||||
balance: U256::from(balance),
|
||||
nonce: 1,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
},
|
||||
);
|
||||
state
|
||||
};
|
||||
|
||||
let source = StateChangeSource::PreBlock(StateChangePreBlockSource::BeaconRootContract);
|
||||
|
||||
// Queue: first update dispatched immediately, next two should not merge
|
||||
let tx = task.tx.clone();
|
||||
tx.send(MultiProofMessage::StateUpdate(source.into(), create_state_update(addr1, 100)))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(source.into(), create_state_update(addr2, 200)))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(source.into(), create_state_update(addr3, 300)))
|
||||
.unwrap();
|
||||
|
||||
let mut pending_msg: Option<MultiProofMessage> = None;
|
||||
|
||||
if let Ok(MultiProofMessage::StateUpdate(first_source, first_update)) = task.rx.recv() {
|
||||
assert!(same_source(first_source, source.into()));
|
||||
assert!(first_update.contains_key(&addr1));
|
||||
|
||||
let mut accumulated_updates: Vec<(Source, EvmState)> = Vec::new();
|
||||
let mut accumulated_targets = 0usize;
|
||||
|
||||
loop {
|
||||
if accumulated_targets >= STATE_UPDATE_MAX_BATCH_TARGETS {
|
||||
break;
|
||||
}
|
||||
match task.rx.try_recv() {
|
||||
Ok(MultiProofMessage::StateUpdate(next_source, next_update)) => {
|
||||
if let Some((batch_source, batch_update)) = accumulated_updates.first() &&
|
||||
!can_batch_state_update(
|
||||
*batch_source,
|
||||
batch_update,
|
||||
next_source,
|
||||
&next_update,
|
||||
)
|
||||
{
|
||||
pending_msg =
|
||||
Some(MultiProofMessage::StateUpdate(next_source, next_update));
|
||||
break;
|
||||
}
|
||||
|
||||
let next_estimate = estimate_evm_state_targets(&next_update);
|
||||
if next_estimate > STATE_UPDATE_MAX_BATCH_TARGETS {
|
||||
pending_msg =
|
||||
Some(MultiProofMessage::StateUpdate(next_source, next_update));
|
||||
break;
|
||||
}
|
||||
if accumulated_targets + next_estimate > STATE_UPDATE_MAX_BATCH_TARGETS &&
|
||||
!accumulated_updates.is_empty()
|
||||
{
|
||||
pending_msg =
|
||||
Some(MultiProofMessage::StateUpdate(next_source, next_update));
|
||||
break;
|
||||
}
|
||||
accumulated_targets += next_estimate;
|
||||
accumulated_updates.push((next_source, next_update));
|
||||
}
|
||||
Ok(other_msg) => {
|
||||
pending_msg = Some(other_msg);
|
||||
break;
|
||||
}
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
accumulated_updates.len(),
|
||||
1,
|
||||
"Second pre-block update should not merge with a different payload"
|
||||
);
|
||||
let (batched_source, batched_update) = accumulated_updates.remove(0);
|
||||
assert!(same_source(batched_source, source.into()));
|
||||
assert!(batched_update.contains_key(&addr2));
|
||||
assert!(!batched_update.contains_key(&addr3));
|
||||
|
||||
match pending_msg {
|
||||
Some(MultiProofMessage::StateUpdate(_, pending_update)) => {
|
||||
assert!(pending_update.contains_key(&addr3));
|
||||
}
|
||||
other => panic!("Expected pending third pre-block update, got {:?}", other),
|
||||
}
|
||||
} else {
|
||||
panic!("Expected first StateUpdate");
|
||||
}
|
||||
}
|
||||
|
||||
/// Verifies that different message types arriving mid-batch are not lost and preserve order.
|
||||
#[test]
|
||||
fn test_batching_preserves_ordering_with_different_message_type() {
|
||||
@@ -2197,9 +1811,7 @@ mod tests {
|
||||
nonce: 1,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
@@ -2216,9 +1828,7 @@ mod tests {
|
||||
nonce: 2,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
@@ -2320,9 +1930,7 @@ mod tests {
|
||||
nonce: 1,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
@@ -2369,157 +1977,7 @@ mod tests {
|
||||
assert_eq!(targets.len(), 1);
|
||||
assert!(targets.contains_key(&prefetch_addr2));
|
||||
}
|
||||
other => panic!("Expected remaining PrefetchProofs2 in pending_msg, got {:?}", other),
|
||||
}
|
||||
}
|
||||
|
||||
/// Verifies that pending messages from a previous batch drain get full batching treatment.
|
||||
#[test]
|
||||
fn test_pending_messages_get_full_batching_treatment() {
|
||||
// Queue: [Prefetch1, State1, State2, State3, Prefetch2]
|
||||
//
|
||||
// Expected behavior:
|
||||
// 1. recv() → Prefetch1
|
||||
// 2. try_recv() → State1 is different type → pending = State1, break
|
||||
// 3. Process Prefetch1
|
||||
// 4. Next iteration: pending = State1 → process with batching
|
||||
// 5. try_recv() → State2 same type → merge
|
||||
// 6. try_recv() → State3 same type → merge
|
||||
// 7. try_recv() → Prefetch2 different type → pending = Prefetch2, break
|
||||
// 8. Process merged State (1+2+3)
|
||||
//
|
||||
// Without the state-machine fix, State1 would be processed alone (no batching).
|
||||
use alloy_evm::block::StateChangeSource;
|
||||
use revm_state::Account;
|
||||
|
||||
let test_provider_factory = create_test_provider_factory();
|
||||
let task = create_test_state_root_task(test_provider_factory);
|
||||
|
||||
let prefetch_addr1 = B256::random();
|
||||
let prefetch_addr2 = B256::random();
|
||||
let state_addr1 = alloy_primitives::Address::random();
|
||||
let state_addr2 = alloy_primitives::Address::random();
|
||||
let state_addr3 = alloy_primitives::Address::random();
|
||||
|
||||
// Create Prefetch targets
|
||||
let mut prefetch1 = MultiProofTargets::default();
|
||||
prefetch1.insert(prefetch_addr1, HashSet::default());
|
||||
|
||||
let mut prefetch2 = MultiProofTargets::default();
|
||||
prefetch2.insert(prefetch_addr2, HashSet::default());
|
||||
|
||||
// Create StateUpdates
|
||||
let create_state_update = |addr: alloy_primitives::Address, balance: u64| {
|
||||
let mut state = EvmState::default();
|
||||
state.insert(
|
||||
addr,
|
||||
Account {
|
||||
info: revm_state::AccountInfo {
|
||||
balance: U256::from(balance),
|
||||
nonce: 1,
|
||||
code_hash: Default::default(),
|
||||
code: Default::default(),
|
||||
account_id: Some(0),
|
||||
},
|
||||
original_info: Default::default(),
|
||||
transaction_id: Default::default(),
|
||||
storage: Default::default(),
|
||||
status: revm_state::AccountStatus::Touched,
|
||||
},
|
||||
);
|
||||
state
|
||||
};
|
||||
|
||||
let source = StateChangeSource::Transaction(42);
|
||||
|
||||
// Queue: [Prefetch1, State1, State2, State3, Prefetch2]
|
||||
let tx = task.tx.clone();
|
||||
tx.send(MultiProofMessage::PrefetchProofs(prefetch1.clone())).unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(
|
||||
source.into(),
|
||||
create_state_update(state_addr1, 100),
|
||||
))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(
|
||||
source.into(),
|
||||
create_state_update(state_addr2, 200),
|
||||
))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::StateUpdate(
|
||||
source.into(),
|
||||
create_state_update(state_addr3, 300),
|
||||
))
|
||||
.unwrap();
|
||||
tx.send(MultiProofMessage::PrefetchProofs(prefetch2.clone())).unwrap();
|
||||
|
||||
// Simulate the state-machine loop behavior
|
||||
let mut pending_msg: Option<MultiProofMessage> = None;
|
||||
|
||||
// First iteration: recv() gets Prefetch1, drains until State1
|
||||
if let Ok(MultiProofMessage::PrefetchProofs(targets)) = task.rx.recv() {
|
||||
let mut merged_targets = targets;
|
||||
loop {
|
||||
match task.rx.try_recv() {
|
||||
Ok(MultiProofMessage::PrefetchProofs(next_targets)) => {
|
||||
merged_targets.extend(next_targets);
|
||||
}
|
||||
Ok(other_msg) => {
|
||||
pending_msg = Some(other_msg);
|
||||
break;
|
||||
}
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
// Should have only Prefetch1 (State1 is different type)
|
||||
assert_eq!(merged_targets.len(), 1);
|
||||
assert!(merged_targets.contains_key(&prefetch_addr1));
|
||||
} else {
|
||||
panic!("Expected PrefetchProofs");
|
||||
}
|
||||
|
||||
// Pending should be State1
|
||||
assert!(matches!(pending_msg, Some(MultiProofMessage::StateUpdate(_, _))));
|
||||
|
||||
// Second iteration: process pending State1 WITH BATCHING
|
||||
// This is the key test - the pending message should drain State2 and State3
|
||||
if let Some(MultiProofMessage::StateUpdate(_src, first_update)) = pending_msg.take() {
|
||||
let mut merged_update = first_update;
|
||||
let mut num_batched = 1;
|
||||
|
||||
loop {
|
||||
match task.rx.try_recv() {
|
||||
Ok(MultiProofMessage::StateUpdate(_src, next_update)) => {
|
||||
merged_update.extend(next_update);
|
||||
num_batched += 1;
|
||||
}
|
||||
Ok(other_msg) => {
|
||||
pending_msg = Some(other_msg);
|
||||
break;
|
||||
}
|
||||
Err(_) => break,
|
||||
}
|
||||
}
|
||||
|
||||
// THE KEY ASSERTION: pending State1 should have batched with State2 and State3
|
||||
assert_eq!(
|
||||
num_batched, 3,
|
||||
"Pending message should get full batching treatment and merge all 3 StateUpdates"
|
||||
);
|
||||
assert_eq!(merged_update.len(), 3, "Should have all 3 addresses in merged update");
|
||||
assert!(merged_update.contains_key(&state_addr1));
|
||||
assert!(merged_update.contains_key(&state_addr2));
|
||||
assert!(merged_update.contains_key(&state_addr3));
|
||||
} else {
|
||||
panic!("Expected pending StateUpdate");
|
||||
}
|
||||
|
||||
// Pending should now be Prefetch2
|
||||
match pending_msg {
|
||||
Some(MultiProofMessage::PrefetchProofs(targets)) => {
|
||||
assert_eq!(targets.len(), 1);
|
||||
assert!(targets.contains_key(&prefetch_addr2));
|
||||
}
|
||||
_ => panic!("Prefetch2 was lost!"),
|
||||
other => panic!("Expected PrefetchProofs2 in channel, got {:?}", other),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,13 +43,14 @@ use reth_provider::{
|
||||
providers::OverlayStateProviderFactory, BlockExecutionOutput, BlockNumReader, BlockReader,
|
||||
ChangeSetReader, DatabaseProviderFactory, DatabaseProviderROFactory, ExecutionOutcome,
|
||||
HashedPostStateProvider, ProviderError, PruneCheckpointReader, StageCheckpointReader,
|
||||
StateProvider, StateProviderFactory, StateReader, TrieReader,
|
||||
StateProvider, StateProviderFactory, StateReader,
|
||||
};
|
||||
use reth_revm::db::State;
|
||||
use reth_trie::{
|
||||
updates::{TrieUpdates, TrieUpdatesSorted},
|
||||
HashedPostState, HashedPostStateSorted, StateRoot, TrieInputSorted,
|
||||
};
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use reth_trie_parallel::root::{ParallelStateRoot, ParallelStateRootError};
|
||||
use revm_primitives::Address;
|
||||
use std::{
|
||||
@@ -138,6 +139,8 @@ where
|
||||
metrics: EngineApiMetrics,
|
||||
/// Validator for the payload.
|
||||
validator: V,
|
||||
/// Changeset cache for in-memory trie changesets
|
||||
changeset_cache: ChangesetCache,
|
||||
}
|
||||
|
||||
impl<N, P, Evm, V> BasicEngineValidator<P, Evm, V>
|
||||
@@ -145,7 +148,6 @@ where
|
||||
N: NodePrimitives,
|
||||
P: DatabaseProviderFactory<
|
||||
Provider: BlockReader
|
||||
+ TrieReader
|
||||
+ StageCheckpointReader
|
||||
+ PruneCheckpointReader
|
||||
+ ChangeSetReader
|
||||
@@ -169,6 +171,7 @@ where
|
||||
validator: V,
|
||||
config: TreeConfig,
|
||||
invalid_block_hook: Box<dyn InvalidBlockHook<N>>,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> Self {
|
||||
let precompile_cache_map = PrecompileCacheMap::default();
|
||||
let payload_processor = PayloadProcessor::new(
|
||||
@@ -188,6 +191,7 @@ where
|
||||
invalid_block_hook,
|
||||
metrics: EngineApiMetrics::default(),
|
||||
validator,
|
||||
changeset_cache,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,13 +431,33 @@ where
|
||||
.map_err(Box::<dyn std::error::Error + Send + Sync>::from))
|
||||
.map(Arc::new);
|
||||
|
||||
// Compute trie input from ancestors once, before spawning payload processor.
|
||||
// This will be extended with the current block's hashed state after execution.
|
||||
let trie_input_start = Instant::now();
|
||||
let (trie_input, block_hash_for_overlay) =
|
||||
ensure_ok!(self.compute_trie_input(parent_hash, ctx.state()));
|
||||
|
||||
self.metrics
|
||||
.block_validation
|
||||
.trie_input_duration
|
||||
.record(trie_input_start.elapsed().as_secs_f64());
|
||||
|
||||
// Create overlay factory for payload processor (StateRootTask path needs it for
|
||||
// multiproofs)
|
||||
let overlay_factory = {
|
||||
let TrieInputSorted { nodes, state, .. } = &trie_input;
|
||||
OverlayStateProviderFactory::new(self.provider.clone(), self.changeset_cache.clone())
|
||||
.with_block_hash(Some(block_hash_for_overlay))
|
||||
.with_trie_overlay(Some(Arc::clone(nodes)))
|
||||
.with_hashed_state_overlay(Some(Arc::clone(state)))
|
||||
};
|
||||
|
||||
// Spawn the appropriate processor based on strategy
|
||||
let mut handle = ensure_ok!(self.spawn_payload_processor(
|
||||
env.clone(),
|
||||
txs,
|
||||
provider_builder,
|
||||
parent_hash,
|
||||
ctx.state(),
|
||||
overlay_factory.clone(),
|
||||
strategy,
|
||||
block_access_list,
|
||||
));
|
||||
@@ -494,11 +518,7 @@ where
|
||||
}
|
||||
StateRootStrategy::Parallel => {
|
||||
debug!(target: "engine::tree::payload_validator", "Using parallel state root algorithm");
|
||||
match self.compute_state_root_parallel(
|
||||
block.parent_hash(),
|
||||
&hashed_state,
|
||||
ctx.state(),
|
||||
) {
|
||||
match self.compute_state_root_parallel(overlay_factory.clone(), &hashed_state) {
|
||||
Ok(result) => {
|
||||
let elapsed = root_time.elapsed();
|
||||
info!(
|
||||
@@ -534,7 +554,7 @@ where
|
||||
}
|
||||
|
||||
let (root, updates) = ensure_ok_post_block!(
|
||||
self.compute_state_root_serial(block.parent_hash(), &hashed_state, ctx.state()),
|
||||
self.compute_state_root_serial(overlay_factory.clone(), &hashed_state),
|
||||
block
|
||||
);
|
||||
(root, updates, root_time.elapsed())
|
||||
@@ -571,7 +591,14 @@ where
|
||||
// Terminate prewarming task with the shared execution outcome
|
||||
handle.terminate_caching(Some(Arc::clone(&execution_outcome)));
|
||||
|
||||
Ok(self.spawn_deferred_trie_task(block, execution_outcome, &ctx, hashed_state, trie_output))
|
||||
Ok(self.spawn_deferred_trie_task(
|
||||
block,
|
||||
execution_outcome,
|
||||
&ctx,
|
||||
hashed_state,
|
||||
trie_output,
|
||||
overlay_factory,
|
||||
))
|
||||
}
|
||||
|
||||
/// Return sealed block header from database or in-memory state by hash.
|
||||
@@ -624,14 +651,12 @@ where
|
||||
Evm: ConfigureEngineEvm<T::ExecutionData, Primitives = N>,
|
||||
{
|
||||
debug!(target: "engine::tree::payload_validator", "Executing block");
|
||||
|
||||
let mut db = State::builder()
|
||||
.with_database(StateProviderDatabase::new(state_provider))
|
||||
.with_bundle_update()
|
||||
.with_bal_builder() //TODO
|
||||
.without_state_clear()
|
||||
.build();
|
||||
db.bal_state.bal_index = 0;
|
||||
db.bal_state.bal_builder = Some(revm::state::bal::Bal::new());
|
||||
|
||||
let spec_id = *env.evm_env.spec_id();
|
||||
let evm = self.evm_config.evm_with_env(&mut db, env.evm_env);
|
||||
@@ -672,6 +697,10 @@ where
|
||||
|
||||
/// Compute state root for the given hashed post state in parallel.
|
||||
///
|
||||
/// Uses an overlay factory which provides the state of the parent block, along with the
|
||||
/// [`HashedPostState`] containing the changes of this block, to compute the state root and
|
||||
/// trie updates for this block.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Returns `Ok(_)` if computed successfully.
|
||||
@@ -679,58 +708,39 @@ where
|
||||
#[instrument(level = "debug", target = "engine::tree::payload_validator", skip_all)]
|
||||
fn compute_state_root_parallel(
|
||||
&self,
|
||||
parent_hash: B256,
|
||||
overlay_factory: OverlayStateProviderFactory<P>,
|
||||
hashed_state: &HashedPostState,
|
||||
state: &EngineApiTreeState<N>,
|
||||
) -> Result<(B256, TrieUpdates), ParallelStateRootError> {
|
||||
let (mut input, block_hash) = self.compute_trie_input(parent_hash, state)?;
|
||||
|
||||
// Extend state overlay with current block's sorted state.
|
||||
input.prefix_sets.extend(hashed_state.construct_prefix_sets());
|
||||
let sorted_hashed_state = hashed_state.clone_into_sorted();
|
||||
Arc::make_mut(&mut input.state).extend_ref(&sorted_hashed_state);
|
||||
|
||||
let TrieInputSorted { nodes, state, prefix_sets: prefix_sets_mut } = input;
|
||||
|
||||
let factory = OverlayStateProviderFactory::new(self.provider.clone())
|
||||
.with_block_hash(Some(block_hash))
|
||||
.with_trie_overlay(Some(nodes))
|
||||
.with_hashed_state_overlay(Some(state));
|
||||
|
||||
// The `hashed_state` argument is already taken into account as part of the overlay, but we
|
||||
// The `hashed_state` argument will be taken into account as part of the overlay, but we
|
||||
// need to use the prefix sets which were generated from it to indicate to the
|
||||
// ParallelStateRoot which parts of the trie need to be recomputed.
|
||||
let prefix_sets = prefix_sets_mut.freeze();
|
||||
|
||||
ParallelStateRoot::new(factory, prefix_sets).incremental_root_with_updates()
|
||||
let prefix_sets = hashed_state.construct_prefix_sets().freeze();
|
||||
let overlay_factory =
|
||||
overlay_factory.with_extended_hashed_state_overlay(hashed_state.clone_into_sorted());
|
||||
ParallelStateRoot::new(overlay_factory, prefix_sets).incremental_root_with_updates()
|
||||
}
|
||||
|
||||
/// Compute state root for the given hashed post state in serial.
|
||||
///
|
||||
/// Uses an overlay factory which provides the state of the parent block, along with the
|
||||
/// [`HashedPostState`] containing the changes of this block, to compute the state root and
|
||||
/// trie updates for this block.
|
||||
fn compute_state_root_serial(
|
||||
&self,
|
||||
parent_hash: B256,
|
||||
overlay_factory: OverlayStateProviderFactory<P>,
|
||||
hashed_state: &HashedPostState,
|
||||
state: &EngineApiTreeState<N>,
|
||||
) -> ProviderResult<(B256, TrieUpdates)> {
|
||||
let (mut input, block_hash) = self.compute_trie_input(parent_hash, state)?;
|
||||
// The `hashed_state` argument will be taken into account as part of the overlay, but we
|
||||
// need to use the prefix sets which were generated from it to indicate to the
|
||||
// StateRoot which parts of the trie need to be recomputed.
|
||||
let prefix_sets = hashed_state.construct_prefix_sets().freeze();
|
||||
let overlay_factory =
|
||||
overlay_factory.with_extended_hashed_state_overlay(hashed_state.clone_into_sorted());
|
||||
|
||||
// Extend state overlay with current block's sorted state.
|
||||
input.prefix_sets.extend(hashed_state.construct_prefix_sets());
|
||||
let sorted_hashed_state = hashed_state.clone_into_sorted();
|
||||
Arc::make_mut(&mut input.state).extend_ref(&sorted_hashed_state);
|
||||
|
||||
let TrieInputSorted { nodes, state, .. } = input;
|
||||
let prefix_sets = hashed_state.construct_prefix_sets();
|
||||
|
||||
let factory = OverlayStateProviderFactory::new(self.provider.clone())
|
||||
.with_block_hash(Some(block_hash))
|
||||
.with_trie_overlay(Some(nodes))
|
||||
.with_hashed_state_overlay(Some(state));
|
||||
|
||||
let provider = factory.database_provider_ro()?;
|
||||
let provider = overlay_factory.database_provider_ro()?;
|
||||
|
||||
Ok(StateRoot::new(&provider, &provider)
|
||||
.with_prefix_sets(prefix_sets.freeze())
|
||||
.with_prefix_sets(prefix_sets)
|
||||
.root_with_updates()?)
|
||||
}
|
||||
|
||||
@@ -813,6 +823,11 @@ where
|
||||
///
|
||||
/// The method handles strategy fallbacks if the preferred approach fails, ensuring
|
||||
/// block execution always completes with a valid state root.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `overlay_factory` - Pre-computed overlay factory for multiproof generation
|
||||
/// (`StateRootTask`)
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[instrument(
|
||||
level = "debug",
|
||||
@@ -825,8 +840,7 @@ where
|
||||
env: ExecutionEnv<Evm>,
|
||||
txs: T,
|
||||
provider_builder: StateProviderBuilder<N, P>,
|
||||
parent_hash: B256,
|
||||
state: &EngineApiTreeState<N>,
|
||||
overlay_factory: OverlayStateProviderFactory<P>,
|
||||
strategy: StateRootStrategy,
|
||||
block_access_list: Option<Arc<BlockAccessList>>,
|
||||
) -> Result<
|
||||
@@ -839,32 +853,14 @@ where
|
||||
> {
|
||||
match strategy {
|
||||
StateRootStrategy::StateRootTask => {
|
||||
// Compute trie input
|
||||
let trie_input_start = Instant::now();
|
||||
let (trie_input, block_hash) = self.compute_trie_input(parent_hash, state)?;
|
||||
|
||||
// Create OverlayStateProviderFactory with sorted trie data for multiproofs
|
||||
let TrieInputSorted { nodes, state, .. } = trie_input;
|
||||
|
||||
let multiproof_provider_factory =
|
||||
OverlayStateProviderFactory::new(self.provider.clone())
|
||||
.with_block_hash(Some(block_hash))
|
||||
.with_trie_overlay(Some(nodes))
|
||||
.with_hashed_state_overlay(Some(state));
|
||||
|
||||
// Record trie input duration including OverlayStateProviderFactory setup
|
||||
self.metrics
|
||||
.block_validation
|
||||
.trie_input_duration
|
||||
.record(trie_input_start.elapsed().as_secs_f64());
|
||||
|
||||
let spawn_start = Instant::now();
|
||||
|
||||
// Use the pre-computed overlay factory for multiproofs
|
||||
let handle = self.payload_processor.spawn(
|
||||
env,
|
||||
txs,
|
||||
provider_builder,
|
||||
multiproof_provider_factory,
|
||||
overlay_factory,
|
||||
&self.config,
|
||||
block_access_list,
|
||||
);
|
||||
@@ -1105,6 +1101,7 @@ where
|
||||
ctx: &TreeCtx<'_, N>,
|
||||
hashed_state: HashedPostState,
|
||||
trie_output: TrieUpdates,
|
||||
overlay_factory: OverlayStateProviderFactory<P>,
|
||||
) -> ExecutedBlock<N> {
|
||||
// Capture parent hash and ancestor overlays for deferred trie input construction.
|
||||
let (anchor_hash, overlay_blocks) = ctx
|
||||
@@ -1128,9 +1125,21 @@ where
|
||||
let deferred_handle_task = deferred_trie_data.clone();
|
||||
let block_validation_metrics = self.metrics.block_validation.clone();
|
||||
|
||||
// Capture block info and cache handle for changeset computation
|
||||
let block_hash = block.hash();
|
||||
let block_number = block.number();
|
||||
let changeset_cache = self.changeset_cache.clone();
|
||||
|
||||
// Spawn background task to compute trie data. Calling `wait_cloned` will compute from
|
||||
// the stored inputs and cache the result, so subsequent calls return immediately.
|
||||
let compute_trie_input_task = move || {
|
||||
let _span = debug_span!(
|
||||
target: "engine::tree::payload_validator",
|
||||
"compute_trie_input_task",
|
||||
block_number
|
||||
)
|
||||
.entered();
|
||||
|
||||
let result = panic::catch_unwind(AssertUnwindSafe(|| {
|
||||
let compute_start = Instant::now();
|
||||
let computed = deferred_handle_task.wait_cloned();
|
||||
@@ -1153,6 +1162,40 @@ where
|
||||
.anchored_overlay_hashed_state_size
|
||||
.record(anchored.trie_input.state.total_len() as f64);
|
||||
}
|
||||
|
||||
// Compute and cache changesets using the computed trie_updates
|
||||
let changeset_start = Instant::now();
|
||||
|
||||
// Get a provider from the overlay factory for trie cursor access
|
||||
let changeset_result =
|
||||
overlay_factory.database_provider_ro().and_then(|provider| {
|
||||
reth_trie::changesets::compute_trie_changesets(
|
||||
&provider,
|
||||
&computed.trie_updates,
|
||||
)
|
||||
.map_err(ProviderError::Database)
|
||||
});
|
||||
|
||||
match changeset_result {
|
||||
Ok(changesets) => {
|
||||
debug!(
|
||||
target: "engine::tree::changeset",
|
||||
?block_number,
|
||||
elapsed = ?changeset_start.elapsed(),
|
||||
"Computed and caching changesets"
|
||||
);
|
||||
|
||||
changeset_cache.insert(block_hash, block_number, Arc::new(changesets));
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(
|
||||
target: "engine::tree::changeset",
|
||||
?block_number,
|
||||
?e,
|
||||
"Failed to compute changesets in deferred trie task"
|
||||
);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
if result.is_err() {
|
||||
@@ -1249,7 +1292,6 @@ impl<N, Types, P, Evm, V> EngineValidator<Types> for BasicEngineValidator<P, Evm
|
||||
where
|
||||
P: DatabaseProviderFactory<
|
||||
Provider: BlockReader
|
||||
+ TrieReader
|
||||
+ StageCheckpointReader
|
||||
+ PruneCheckpointReader
|
||||
+ ChangeSetReader
|
||||
|
||||
@@ -233,9 +233,9 @@ mod tests {
|
||||
let dyn_precompile: DynPrecompile = (|_input: PrecompileInput<'_>| -> PrecompileResult {
|
||||
Ok(PrecompileOutput {
|
||||
gas_used: 0,
|
||||
gas_refunded: 0,
|
||||
bytes: Bytes::default(),
|
||||
reverted: false,
|
||||
gas_refunded: 0,
|
||||
})
|
||||
})
|
||||
.into();
|
||||
@@ -245,9 +245,9 @@ mod tests {
|
||||
|
||||
let output = PrecompileOutput {
|
||||
gas_used: 50,
|
||||
gas_refunded: 0,
|
||||
bytes: alloy_primitives::Bytes::copy_from_slice(b"cached_result"),
|
||||
reverted: false,
|
||||
gas_refunded: 0,
|
||||
};
|
||||
|
||||
let input = b"test_input";
|
||||
@@ -277,9 +277,9 @@ mod tests {
|
||||
|
||||
Ok(PrecompileOutput {
|
||||
gas_used: 5000,
|
||||
gas_refunded: 0,
|
||||
bytes: alloy_primitives::Bytes::copy_from_slice(b"output_from_precompile_1"),
|
||||
reverted: false,
|
||||
gas_refunded: 0,
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -292,9 +292,9 @@ mod tests {
|
||||
|
||||
Ok(PrecompileOutput {
|
||||
gas_used: 7000,
|
||||
gas_refunded: 0,
|
||||
bytes: alloy_primitives::Bytes::copy_from_slice(b"output_from_precompile_2"),
|
||||
reverted: false,
|
||||
gas_refunded: 0,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::{
|
||||
PersistTarget, TreeConfig,
|
||||
},
|
||||
};
|
||||
use reth_trie_db::ChangesetCache;
|
||||
|
||||
use alloy_eips::eip1898::BlockWithParent;
|
||||
use alloy_primitives::{
|
||||
@@ -192,6 +193,7 @@ impl TestHarness {
|
||||
let payload_builder = PayloadBuilderHandle::new(to_payload_service);
|
||||
|
||||
let evm_config = MockEvmConfig::default();
|
||||
let changeset_cache = ChangesetCache::new();
|
||||
let engine_validator = BasicEngineValidator::new(
|
||||
provider.clone(),
|
||||
consensus.clone(),
|
||||
@@ -199,6 +201,7 @@ impl TestHarness {
|
||||
payload_validator,
|
||||
TreeConfig::default(),
|
||||
Box::new(NoopInvalidBlockHook::default()),
|
||||
changeset_cache.clone(),
|
||||
);
|
||||
|
||||
let tree = EngineApiTreeHandler::new(
|
||||
@@ -215,6 +218,7 @@ impl TestHarness {
|
||||
TreeConfig::default().with_legacy_state_root(false).with_has_enough_parallelism(true),
|
||||
EngineApiKind::Ethereum,
|
||||
evm_config,
|
||||
changeset_cache,
|
||||
);
|
||||
|
||||
let block_builder = TestBlockBuilder::default().with_chain_spec((*chain_spec).clone());
|
||||
@@ -388,6 +392,7 @@ impl ValidatorTestHarness {
|
||||
let provider = harness.provider.clone();
|
||||
let payload_validator = MockEngineValidator;
|
||||
let evm_config = MockEvmConfig::default();
|
||||
let changeset_cache = ChangesetCache::new();
|
||||
|
||||
let validator = BasicEngineValidator::new(
|
||||
provider,
|
||||
@@ -396,6 +401,7 @@ impl ValidatorTestHarness {
|
||||
payload_validator,
|
||||
TreeConfig::default(),
|
||||
Box::new(NoopInvalidBlockHook::default()),
|
||||
changeset_cache,
|
||||
);
|
||||
|
||||
Self { harness, validator, metrics: TestMetrics::default() }
|
||||
@@ -485,7 +491,7 @@ fn test_tree_persist_block_batch() {
|
||||
let chain_spec = MAINNET.clone();
|
||||
let mut test_block_builder = TestBlockBuilder::eth().with_chain_spec((*chain_spec).clone());
|
||||
|
||||
// we need more than tree_config.persistence_threshold() +1 blocks to
|
||||
// we need at least tree_config.persistence_threshold() + 1 blocks to
|
||||
// trigger the persistence task.
|
||||
let blocks: Vec<_> = test_block_builder
|
||||
.get_executed_blocks(1..tree_config.persistence_threshold() + 2)
|
||||
@@ -525,7 +531,7 @@ async fn test_tree_persist_blocks() {
|
||||
let chain_spec = MAINNET.clone();
|
||||
let mut test_block_builder = TestBlockBuilder::eth().with_chain_spec((*chain_spec).clone());
|
||||
|
||||
// we need more than tree_config.persistence_threshold() +1 blocks to
|
||||
// we need at least tree_config.persistence_threshold() + 1 blocks to
|
||||
// trigger the persistence task.
|
||||
let blocks: Vec<_> = test_block_builder
|
||||
.get_executed_blocks(1..tree_config.persistence_threshold() + 2)
|
||||
|
||||
@@ -27,9 +27,6 @@ reth-payload-primitives.workspace = true
|
||||
alloy-rpc-types-engine.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
# revm
|
||||
revm.workspace = true
|
||||
|
||||
# async
|
||||
tokio = { workspace = true, default-features = false }
|
||||
tokio-util.workspace = true
|
||||
|
||||
@@ -283,12 +283,8 @@ where
|
||||
let mut state = State::builder()
|
||||
.with_database_ref(StateProviderDatabase::new(&state_provider))
|
||||
.with_bundle_update()
|
||||
.with_bal_builder()
|
||||
.build();
|
||||
|
||||
state.bal_state.bal_index = 0;
|
||||
state.bal_state.bal_builder = Some(revm::state::bal::Bal::new());
|
||||
|
||||
let ctx = evm_config.context_for_block(&reorg_target).map_err(RethError::other)?;
|
||||
let evm = evm_config.evm_for_block(&mut state, &reorg_target).map_err(RethError::other)?;
|
||||
let mut builder = evm_config.create_block_builder(evm, &reorg_target_parent, ctx);
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
//! transactions: vec![Bytes::from(vec![1, 2, 3])],
|
||||
//! ommers: vec![],
|
||||
//! withdrawals: None,
|
||||
//! block_access_list: None,
|
||||
//! };
|
||||
//! // Compress the body: rlp encoding and snappy compression
|
||||
//! let compressed_body = CompressedBody::from_body(&body)?;
|
||||
@@ -582,12 +581,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_block_body_conversion() {
|
||||
let block_body: BlockBody<Bytes> = BlockBody {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
block_access_list: None,
|
||||
};
|
||||
let block_body: BlockBody<Bytes> =
|
||||
BlockBody { transactions: vec![], ommers: vec![], withdrawals: None };
|
||||
|
||||
let compressed_body = CompressedBody::from_body(&block_body).unwrap();
|
||||
|
||||
@@ -642,8 +637,7 @@ mod tests {
|
||||
|
||||
let withdrawals = Some(Withdrawals(vec![]));
|
||||
|
||||
let block_body =
|
||||
BlockBody { transactions, ommers: vec![], withdrawals, block_access_list: None };
|
||||
let block_body = BlockBody { transactions, ommers: vec![], withdrawals };
|
||||
|
||||
let block = Block::new(header, block_body);
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ pub(crate) fn create_header() -> Header {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +138,6 @@ pub(crate) fn create_test_block_with_compressed_data(number: BlockNumber) -> Blo
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash: None,
|
||||
};
|
||||
|
||||
// Create test body
|
||||
@@ -147,7 +145,6 @@ pub(crate) fn create_test_block_with_compressed_data(number: BlockNumber) -> Blo
|
||||
transactions: vec![Bytes::from(vec![(number % 256) as u8; 10])],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals(vec![])),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
// Create test receipt list with bloom
|
||||
|
||||
@@ -22,7 +22,6 @@ reth-consensus.workspace = true
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
|
||||
tracing.workspace = true
|
||||
|
||||
@@ -39,7 +38,6 @@ std = [
|
||||
"reth-execution-types/std",
|
||||
"reth-primitives-traits/std",
|
||||
"tracing/std",
|
||||
"alloy-rlp/std",
|
||||
]
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -75,13 +75,7 @@ where
|
||||
block: &RecoveredBlock<N::Block>,
|
||||
result: &BlockExecutionResult<N::Receipt>,
|
||||
) -> Result<(), ConsensusError> {
|
||||
validate_block_post_execution(
|
||||
block,
|
||||
&self.chain_spec,
|
||||
&result.receipts,
|
||||
&result.requests,
|
||||
&result.block_access_list,
|
||||
)
|
||||
validate_block_post_execution(block, &self.chain_spec, &result.receipts, &result.requests)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,15 +174,6 @@ where
|
||||
} else if header.requests_hash().is_some() {
|
||||
return Err(ConsensusError::RequestsHashUnexpected)
|
||||
}
|
||||
// if self.chain_spec.is_amsterdam_active_at_timestamp(header.timestamp()) &&
|
||||
// header.block_access_list_hash().is_none()
|
||||
// {
|
||||
// return Err(ConsensusError::BlockAccessListHashMissing)
|
||||
// } else if !self.chain_spec.is_amsterdam_active_at_timestamp(header.timestamp()) &&
|
||||
// header.block_access_list_hash().is_some()
|
||||
// {
|
||||
// return Err(ConsensusError::BlockAccessListHashUnexpected)
|
||||
// }
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use alloc::vec::Vec;
|
||||
use alloy_consensus::{proofs::calculate_receipt_root, BlockHeader, TxReceipt};
|
||||
use alloy_eips::{eip7685::Requests, eip7928::BlockAccessList, Encodable2718};
|
||||
use alloy_eips::{eip7685::Requests, Encodable2718};
|
||||
use alloy_primitives::{Bloom, Bytes, B256};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_primitives_traits::{
|
||||
receipt::gas_spent_by_transactions, Block, BlockBody, GotExpected, Receipt, RecoveredBlock,
|
||||
receipt::gas_spent_by_transactions, Block, GotExpected, Receipt, RecoveredBlock,
|
||||
};
|
||||
|
||||
/// Validate a block with regard to execution results:
|
||||
@@ -17,7 +17,6 @@ pub fn validate_block_post_execution<B, R, ChainSpec>(
|
||||
chain_spec: &ChainSpec,
|
||||
receipts: &[R],
|
||||
requests: &Requests,
|
||||
block_access_list: &Option<BlockAccessList>,
|
||||
) -> Result<(), ConsensusError>
|
||||
where
|
||||
B: Block,
|
||||
@@ -66,33 +65,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
// Validate bal hash matches the calculated hash
|
||||
if chain_spec.is_amsterdam_active_at_timestamp(block.header().timestamp()) {
|
||||
let Some(header_block_access_list_hash) = block.header().block_access_list_hash() else {
|
||||
return Err(ConsensusError::BlockAccessListHashMissing)
|
||||
};
|
||||
if let Some(bal) = block_access_list {
|
||||
let bal_hash = alloy_primitives::keccak256(alloy_rlp::encode(bal));
|
||||
let block_bal = block.body().block_access_list();
|
||||
tracing::debug!("Block Bal :{:?}", block_bal);
|
||||
if let Some(body_bal) = block_bal {
|
||||
if body_bal.is_empty() {
|
||||
tracing::debug!("Hit Empty BAL : Block is {:?}", block);
|
||||
}
|
||||
verify_bal(body_bal, bal)?;
|
||||
}
|
||||
|
||||
if bal_hash != header_block_access_list_hash {
|
||||
tracing::debug!(
|
||||
?bal_hash,
|
||||
?header_block_access_list_hash,
|
||||
"block access list hash mismatch"
|
||||
);
|
||||
return Err(ConsensusError::InvalidBalHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -141,47 +113,6 @@ fn compare_receipts_root_and_logs_bloom(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validates that the block access list in the body matches the expected block access list.
|
||||
fn verify_bal(
|
||||
body_bal: &BlockAccessList,
|
||||
expected_bal: &BlockAccessList,
|
||||
) -> Result<(), ConsensusError> {
|
||||
if body_bal == expected_bal {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Extract addresses
|
||||
let body_addrs: Vec<_> = body_bal.iter().map(|a| a.address).collect();
|
||||
let expected_addrs: Vec<_> = expected_bal.iter().map(|a| a.address).collect();
|
||||
|
||||
// Missing accounts (expected but not found in body)
|
||||
for addr in &expected_addrs {
|
||||
if !body_addrs.contains(addr) {
|
||||
tracing::debug!("Missing acc : computed bal {:?},body bal{:?}", expected_bal, body_bal);
|
||||
tracing::debug!("Missing Address: {:?}", addr);
|
||||
return Err(ConsensusError::InvalidBalMissingAccount);
|
||||
}
|
||||
}
|
||||
|
||||
// Extra accounts (body has accounts not in expected)
|
||||
for addr in &body_addrs {
|
||||
if !expected_addrs.contains(addr) {
|
||||
tracing::debug!("Extra acc : computed bal {:?},body bal{:?}", expected_bal, body_bal);
|
||||
tracing::debug!("Extra Address: {:?}", addr);
|
||||
return Err(ConsensusError::InvalidBalExtraAccount);
|
||||
}
|
||||
}
|
||||
|
||||
tracing::debug!(
|
||||
?expected_bal,
|
||||
?body_bal,
|
||||
"block access list in body does not match the provided block access list"
|
||||
);
|
||||
|
||||
// Fallback: mismatched access lists
|
||||
Err(ConsensusError::InvalidBlockAccessList)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -17,9 +17,7 @@ pub use payload::{payload_id, BlobSidecars, EthBuiltPayload, EthPayloadBuilderAt
|
||||
mod error;
|
||||
pub use error::*;
|
||||
|
||||
use alloy_rpc_types_engine::{
|
||||
ExecutionData, ExecutionPayload, ExecutionPayloadEnvelopeV5, ExecutionPayloadEnvelopeV6,
|
||||
};
|
||||
use alloy_rpc_types_engine::{ExecutionData, ExecutionPayload, ExecutionPayloadEnvelopeV5};
|
||||
pub use alloy_rpc_types_engine::{
|
||||
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
|
||||
ExecutionPayloadV1, PayloadAttributes as EthPayloadAttributes,
|
||||
@@ -68,15 +66,13 @@ where
|
||||
+ TryInto<ExecutionPayloadEnvelopeV2>
|
||||
+ TryInto<ExecutionPayloadEnvelopeV3>
|
||||
+ TryInto<ExecutionPayloadEnvelopeV4>
|
||||
+ TryInto<ExecutionPayloadEnvelopeV5>
|
||||
+ TryInto<ExecutionPayloadEnvelopeV6>,
|
||||
+ TryInto<ExecutionPayloadEnvelopeV5>,
|
||||
{
|
||||
type ExecutionPayloadEnvelopeV1 = ExecutionPayloadV1;
|
||||
type ExecutionPayloadEnvelopeV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadEnvelopeV3 = ExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadEnvelopeV4 = ExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadEnvelopeV5 = ExecutionPayloadEnvelopeV5;
|
||||
type ExecutionPayloadEnvelopeV6 = ExecutionPayloadEnvelopeV6;
|
||||
}
|
||||
|
||||
/// A default payload type for [`EthEngineTypes`]
|
||||
|
||||
@@ -11,9 +11,8 @@ use alloy_primitives::{Address, B256, U256};
|
||||
use alloy_rlp::Encodable;
|
||||
use alloy_rpc_types_engine::{
|
||||
BlobsBundleV1, BlobsBundleV2, ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3,
|
||||
ExecutionPayloadEnvelopeV4, ExecutionPayloadEnvelopeV5, ExecutionPayloadEnvelopeV6,
|
||||
ExecutionPayloadFieldV2, ExecutionPayloadV1, ExecutionPayloadV3, ExecutionPayloadV4,
|
||||
PayloadAttributes, PayloadId,
|
||||
ExecutionPayloadEnvelopeV4, ExecutionPayloadEnvelopeV5, ExecutionPayloadFieldV2,
|
||||
ExecutionPayloadV1, ExecutionPayloadV3, PayloadAttributes, PayloadId,
|
||||
};
|
||||
use core::convert::Infallible;
|
||||
use reth_ethereum_primitives::EthPrimitives;
|
||||
@@ -161,38 +160,6 @@ impl EthBuiltPayload {
|
||||
execution_requests: requests.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Try converting built payload into [`ExecutionPayloadEnvelopeV6`].
|
||||
pub fn try_into_v6(self) -> Result<ExecutionPayloadEnvelopeV6, BuiltPayloadConversionError> {
|
||||
let Self { block, fees, sidecars, requests, .. } = self;
|
||||
|
||||
let blobs_bundle = match sidecars {
|
||||
BlobSidecars::Empty => BlobsBundleV2::empty(),
|
||||
BlobSidecars::Eip7594(sidecars) => BlobsBundleV2::from(sidecars),
|
||||
BlobSidecars::Eip4844(_) => {
|
||||
return Err(BuiltPayloadConversionError::UnexpectedEip4844Sidecars)
|
||||
}
|
||||
};
|
||||
|
||||
Ok(ExecutionPayloadEnvelopeV6 {
|
||||
execution_payload: ExecutionPayloadV4::from_block_unchecked(
|
||||
block.hash(),
|
||||
&Arc::unwrap_or_clone(block).into_block(),
|
||||
),
|
||||
block_value: fees,
|
||||
// From the engine API spec:
|
||||
//
|
||||
// > Client software **MAY** use any heuristics to decide whether to set
|
||||
// `shouldOverrideBuilder` flag or not. If client software does not implement any
|
||||
// heuristic this flag **SHOULD** be set to `false`.
|
||||
//
|
||||
// Spec:
|
||||
// <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#specification-2>
|
||||
should_override_builder: false,
|
||||
blobs_bundle,
|
||||
execution_requests: requests.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: NodePrimitives> BuiltPayload for EthBuiltPayload<N> {
|
||||
@@ -260,14 +227,6 @@ impl TryFrom<EthBuiltPayload> for ExecutionPayloadEnvelopeV5 {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<EthBuiltPayload> for ExecutionPayloadEnvelopeV6 {
|
||||
type Error = BuiltPayloadConversionError;
|
||||
|
||||
fn try_from(value: EthBuiltPayload) -> Result<Self, Self::Error> {
|
||||
value.try_into_v6()
|
||||
}
|
||||
}
|
||||
|
||||
/// An enum representing blob transaction sidecars belonging to [`EthBuiltPayload`].
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub enum BlobSidecars {
|
||||
@@ -503,7 +462,6 @@ mod tests {
|
||||
.unwrap(),
|
||||
withdrawals: None,
|
||||
parent_beacon_block_root: None,
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
// Verify that the generated payload ID matches the expected value
|
||||
@@ -541,7 +499,6 @@ mod tests {
|
||||
},
|
||||
]),
|
||||
parent_beacon_block_root: None,
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
// Verify that the generated payload ID matches the expected value
|
||||
@@ -574,7 +531,6 @@ mod tests {
|
||||
)
|
||||
.unwrap(),
|
||||
),
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
// Verify that the generated payload ID matches the expected value
|
||||
|
||||
@@ -27,7 +27,6 @@ alloy-eips.workspace = true
|
||||
alloy-evm.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
alloy-rpc-types-engine.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
|
||||
# Misc
|
||||
parking_lot = { workspace = true, optional = true }
|
||||
@@ -58,7 +57,6 @@ std = [
|
||||
"derive_more?/std",
|
||||
"alloy-rpc-types-engine/std",
|
||||
"reth-storage-errors/std",
|
||||
"alloy-rlp/std",
|
||||
]
|
||||
test-utils = [
|
||||
"dep:parking_lot",
|
||||
|
||||
@@ -45,8 +45,7 @@ where
|
||||
execution_ctx: ctx,
|
||||
parent,
|
||||
transactions,
|
||||
output:
|
||||
BlockExecutionResult { receipts, requests, gas_used, blob_gas_used, block_access_list },
|
||||
output: BlockExecutionResult { receipts, requests, gas_used, blob_gas_used },
|
||||
state_root,
|
||||
..
|
||||
} = input;
|
||||
@@ -91,18 +90,6 @@ where
|
||||
};
|
||||
}
|
||||
|
||||
let (built_block_access_list, block_access_list_hash) =
|
||||
if self.chain_spec.is_amsterdam_active_at_timestamp(timestamp) {
|
||||
if let Some(bal) = block_access_list {
|
||||
let hash = alloy_primitives::keccak256(alloy_rlp::encode(bal));
|
||||
(Some(bal), Some(hash))
|
||||
} else {
|
||||
(None, None)
|
||||
}
|
||||
} else {
|
||||
(None, None)
|
||||
};
|
||||
|
||||
let header = Header {
|
||||
parent_hash: ctx.parent_hash,
|
||||
ommers_hash: EMPTY_OMMER_ROOT_HASH,
|
||||
@@ -125,17 +112,11 @@ where
|
||||
blob_gas_used: block_blob_gas_used,
|
||||
excess_blob_gas,
|
||||
requests_hash,
|
||||
block_access_list_hash,
|
||||
};
|
||||
|
||||
Ok(Block {
|
||||
header,
|
||||
body: BlockBody {
|
||||
transactions,
|
||||
ommers: Default::default(),
|
||||
withdrawals,
|
||||
block_access_list: built_block_access_list.cloned(),
|
||||
},
|
||||
body: BlockBody { transactions, ommers: Default::default(), withdrawals },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,9 +238,8 @@ where
|
||||
revm_spec_by_timestamp_and_block_number(self.chain_spec(), timestamp, block_number);
|
||||
|
||||
// configure evm env based on parent block
|
||||
let mut cfg_env = CfgEnv::new()
|
||||
.with_chain_id(self.chain_spec().chain().id())
|
||||
.with_spec_and_mainnet_gas_params(spec);
|
||||
let mut cfg_env =
|
||||
CfgEnv::new().with_chain_id(self.chain_spec().chain().id()).with_spec(spec);
|
||||
|
||||
if let Some(blob_params) = &blob_params {
|
||||
cfg_env.set_max_blobs_per_tx(blob_params.max_blobs_per_tx);
|
||||
@@ -408,7 +407,7 @@ mod tests {
|
||||
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
|
||||
|
||||
let evm_env = EvmEnv {
|
||||
cfg_env: CfgEnv::new().with_spec_and_mainnet_gas_params(SpecId::CONSTANTINOPLE),
|
||||
cfg_env: CfgEnv::new().with_spec(SpecId::CONSTANTINOPLE),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -475,7 +474,7 @@ mod tests {
|
||||
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
|
||||
|
||||
let evm_env = EvmEnv {
|
||||
cfg_env: CfgEnv::new().with_spec_and_mainnet_gas_params(SpecId::CONSTANTINOPLE),
|
||||
cfg_env: CfgEnv::new().with_spec(SpecId::CONSTANTINOPLE),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::EthEvmConfig;
|
||||
use alloc::{boxed::Box, sync::Arc, vec, vec::Vec};
|
||||
use alloy_consensus::Header;
|
||||
use alloy_eips::eip7685::Requests;
|
||||
use alloy_evm::{block::StateDB, precompiles::PrecompilesMap};
|
||||
use alloy_evm::precompiles::PrecompilesMap;
|
||||
use alloy_primitives::Bytes;
|
||||
use alloy_rpc_types_engine::ExecutionData;
|
||||
use parking_lot::Mutex;
|
||||
@@ -19,6 +19,7 @@ use reth_execution_types::{BlockExecutionResult, ExecutionOutcome};
|
||||
use reth_primitives_traits::{BlockTy, SealedBlock, SealedHeader};
|
||||
use revm::{
|
||||
context::result::{ExecutionResult, Output, ResultAndState, SuccessReason},
|
||||
database::State,
|
||||
Inspector,
|
||||
};
|
||||
|
||||
@@ -57,12 +58,12 @@ impl BlockExecutorFactory for MockEvmConfig {
|
||||
|
||||
fn create_executor<'a, DB, I>(
|
||||
&'a self,
|
||||
evm: EthEvm<DB, I, PrecompilesMap>,
|
||||
evm: EthEvm<&'a mut State<DB>, I, PrecompilesMap>,
|
||||
_ctx: Self::ExecutionCtx<'a>,
|
||||
) -> impl BlockExecutorFor<'a, Self, DB, I>
|
||||
where
|
||||
DB: StateDB + Database + 'a,
|
||||
I: Inspector<<Self::EvmFactory as EvmFactory>::Context<DB>> + 'a,
|
||||
DB: Database + 'a,
|
||||
I: Inspector<<Self::EvmFactory as EvmFactory>::Context<&'a mut State<DB>>> + 'a,
|
||||
{
|
||||
MockExecutor { result: self.exec_results.lock().pop().unwrap(), evm, hook: None }
|
||||
}
|
||||
@@ -70,17 +71,17 @@ impl BlockExecutorFactory for MockEvmConfig {
|
||||
|
||||
/// Mock executor that returns a fixed execution result.
|
||||
#[derive(derive_more::Debug)]
|
||||
pub struct MockExecutor<DB: Database, I> {
|
||||
pub struct MockExecutor<'a, DB: Database, I> {
|
||||
result: ExecutionOutcome,
|
||||
evm: EthEvm<DB, I, PrecompilesMap>,
|
||||
evm: EthEvm<&'a mut State<DB>, I, PrecompilesMap>,
|
||||
#[debug(skip)]
|
||||
hook: Option<Box<dyn reth_evm::OnStateHook>>,
|
||||
}
|
||||
|
||||
impl<DB: StateDB + Database, I: Inspector<EthEvmContext<DB>>> BlockExecutor
|
||||
for MockExecutor<DB, I>
|
||||
impl<'a, DB: Database, I: Inspector<EthEvmContext<&'a mut State<DB>>>> BlockExecutor
|
||||
for MockExecutor<'a, DB, I>
|
||||
{
|
||||
type Evm = EthEvm<DB, I, PrecompilesMap>;
|
||||
type Evm = EthEvm<&'a mut State<DB>, I, PrecompilesMap>;
|
||||
type Transaction = TransactionSigned;
|
||||
type Receipt = Receipt;
|
||||
|
||||
@@ -124,11 +125,10 @@ impl<DB: StateDB + Database, I: Inspector<EthEvmContext<DB>>> BlockExecutor
|
||||
reqs
|
||||
}),
|
||||
gas_used: 0,
|
||||
block_access_list: None,
|
||||
blob_gas_used: 0,
|
||||
};
|
||||
|
||||
*evm.db_mut().bundle_state_mut() = bundle;
|
||||
evm.db_mut().bundle_state = bundle;
|
||||
|
||||
Ok((evm, result))
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ fn create_database_with_beacon_root_contract() -> CacheDB<EmptyDB> {
|
||||
code_hash: keccak256(BEACON_ROOTS_CODE.clone()),
|
||||
nonce: 1,
|
||||
code: Some(Bytecode::new_raw(BEACON_ROOTS_CODE.clone())),
|
||||
account_id: None,
|
||||
};
|
||||
|
||||
db.insert_account_info(BEACON_ROOTS_ADDRESS, beacon_root_contract_account);
|
||||
@@ -54,7 +53,6 @@ fn create_database_with_withdrawal_requests_contract() -> CacheDB<EmptyDB> {
|
||||
balance: U256::ZERO,
|
||||
code_hash: keccak256(WITHDRAWAL_REQUEST_PREDEPLOY_CODE.clone()),
|
||||
code: Some(Bytecode::new_raw(WITHDRAWAL_REQUEST_PREDEPLOY_CODE.clone())),
|
||||
account_id: None,
|
||||
};
|
||||
|
||||
db.insert_account_info(
|
||||
@@ -88,12 +86,7 @@ fn eip_4788_non_genesis_call() {
|
||||
.execute_one(&RecoveredBlock::new_unhashed(
|
||||
Block {
|
||||
header: header.clone(),
|
||||
body: BlockBody {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
block_access_list: None,
|
||||
},
|
||||
body: BlockBody { transactions: vec![], ommers: vec![], withdrawals: None },
|
||||
},
|
||||
vec![],
|
||||
))
|
||||
@@ -112,12 +105,7 @@ fn eip_4788_non_genesis_call() {
|
||||
.execute_one(&RecoveredBlock::new_unhashed(
|
||||
Block {
|
||||
header: header.clone(),
|
||||
body: BlockBody {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
block_access_list: None,
|
||||
},
|
||||
body: BlockBody { transactions: vec![], ommers: vec![], withdrawals: None },
|
||||
},
|
||||
vec![],
|
||||
))
|
||||
@@ -177,12 +165,7 @@ fn eip_4788_no_code_cancun() {
|
||||
.execute_one(&RecoveredBlock::new_unhashed(
|
||||
Block {
|
||||
header,
|
||||
body: BlockBody {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
block_access_list: None,
|
||||
},
|
||||
body: BlockBody { transactions: vec![], ommers: vec![], withdrawals: None },
|
||||
},
|
||||
vec![],
|
||||
))
|
||||
@@ -224,12 +207,7 @@ fn eip_4788_empty_account_call() {
|
||||
.execute_one(&RecoveredBlock::new_unhashed(
|
||||
Block {
|
||||
header,
|
||||
body: BlockBody {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: None,
|
||||
block_access_list: None,
|
||||
},
|
||||
body: BlockBody { transactions: vec![], ommers: vec![], withdrawals: None },
|
||||
},
|
||||
vec![],
|
||||
))
|
||||
@@ -361,7 +339,6 @@ fn create_database_with_block_hashes(latest_block: u64) -> CacheDB<EmptyDB> {
|
||||
code_hash: keccak256(HISTORY_STORAGE_CODE.clone()),
|
||||
code: Some(Bytecode::new_raw(HISTORY_STORAGE_CODE.clone())),
|
||||
nonce: 1,
|
||||
account_id: None,
|
||||
};
|
||||
|
||||
db.insert_account_info(HISTORY_STORAGE_ADDRESS, blockhashes_contract_account);
|
||||
@@ -819,7 +796,6 @@ fn test_balance_increment_not_duplicated() {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(vec![withdrawal].into()),
|
||||
block_access_list: None,
|
||||
},
|
||||
},
|
||||
vec![],
|
||||
|
||||
@@ -223,7 +223,6 @@ async fn test_testing_build_block_v1_osaka() -> eyre::Result<()> {
|
||||
suggested_fee_recipient: Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
let request = TestingBuildBlockRequestV1 {
|
||||
|
||||
@@ -25,7 +25,6 @@ pub(crate) fn eth_payload_attributes(timestamp: u64) -> EthPayloadBuilderAttribu
|
||||
suggested_fee_recipient: Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
EthPayloadBuilderAttributes::new(B256::ZERO, attributes)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ async fn testing_rpc_build_block_works() -> eyre::Result<()> {
|
||||
suggested_fee_recipient: Address::ZERO,
|
||||
withdrawals: None,
|
||||
parent_beacon_block_root: None,
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
let request = TestingBuildBlockRequestV1 {
|
||||
|
||||
@@ -153,14 +153,10 @@ where
|
||||
let PayloadConfig { parent_header, attributes } = config;
|
||||
|
||||
let state_provider = client.state_by_block_hash(parent_header.hash())?;
|
||||
let state = StateProviderDatabase::new(&state_provider);
|
||||
let mut db = State::builder()
|
||||
.with_database(cached_reads.as_db_mut(state))
|
||||
.with_bundle_update()
|
||||
.with_bal_builder()
|
||||
.build();
|
||||
db.bal_state.bal_index = 0;
|
||||
db.bal_state.bal_builder = Some(revm::state::bal::Bal::new());
|
||||
let state = StateProviderDatabase::new(state_provider.as_ref());
|
||||
let mut db =
|
||||
State::builder().with_database_ref(cached_reads.as_db(state)).with_bundle_update().build();
|
||||
|
||||
let mut builder = evm_config
|
||||
.builder_for_next_block(
|
||||
&mut db,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use alloy_consensus::Block;
|
||||
use alloy_rpc_types_engine::{ExecutionData, PayloadError};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_payload_validator::{amsterdam, cancun, prague, shanghai};
|
||||
use reth_payload_validator::{cancun, prague, shanghai};
|
||||
use reth_primitives_traits::{Block as _, SealedBlock, SignedTransaction};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -103,10 +103,5 @@ where
|
||||
chain_spec.is_prague_active_at_timestamp(sealed_block.timestamp),
|
||||
)?;
|
||||
|
||||
amsterdam::ensure_well_formed_fields(
|
||||
sealed_block.body(),
|
||||
chain_spec.is_amsterdam_active_at_timestamp(sealed_block.timestamp),
|
||||
)?;
|
||||
|
||||
Ok(sealed_block)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//! Traits for execution.
|
||||
|
||||
use crate::{ConfigureEvm, Database, OnStateHook, TxEnvFor};
|
||||
use alloc::{borrow::Cow, boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::{BlockHeader, Header};
|
||||
use alloy_eips::eip2718::WithEncoded;
|
||||
pub use alloy_evm::block::{BlockExecutor, BlockExecutorFactory};
|
||||
use alloy_evm::{
|
||||
block::{CommitChanges, ExecutableTx, StateDB},
|
||||
block::{CommitChanges, ExecutableTx},
|
||||
Evm, EvmEnv, EvmFactory, RecoveredTx, ToTxEnv,
|
||||
};
|
||||
use alloy_primitives::{Address, B256};
|
||||
@@ -214,7 +214,7 @@ pub struct BlockAssemblerInput<'a, 'b, F: BlockExecutorFactory, H = Header> {
|
||||
/// Output of block execution.
|
||||
pub output: &'b BlockExecutionResult<F::Receipt>,
|
||||
/// [`BundleState`] after the block execution.
|
||||
pub bundle_state: Cow<'a, BundleState>,
|
||||
pub bundle_state: &'a BundleState,
|
||||
/// Provider with access to state.
|
||||
#[debug(skip)]
|
||||
pub state_provider: &'b dyn StateProvider,
|
||||
@@ -234,7 +234,7 @@ impl<'a, 'b, F: BlockExecutorFactory, H> BlockAssemblerInput<'a, 'b, F, H> {
|
||||
parent: &'a SealedHeader<H>,
|
||||
transactions: Vec<F::Transaction>,
|
||||
output: &'b BlockExecutionResult<F::Receipt>,
|
||||
bundle_state: impl Into<Cow<'a, BundleState>>,
|
||||
bundle_state: &'a BundleState,
|
||||
state_provider: &'b dyn StateProvider,
|
||||
state_root: B256,
|
||||
) -> Self {
|
||||
@@ -244,7 +244,7 @@ impl<'a, 'b, F: BlockExecutorFactory, H> BlockAssemblerInput<'a, 'b, F, H> {
|
||||
parent,
|
||||
transactions,
|
||||
output,
|
||||
bundle_state: bundle_state.into(),
|
||||
bundle_state,
|
||||
state_provider,
|
||||
state_root,
|
||||
}
|
||||
@@ -461,7 +461,8 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, F, Executor, Builder, N> BlockBuilder for BasicBlockBuilder<'a, F, Executor, Builder, N>
|
||||
impl<'a, F, DB, Executor, Builder, N> BlockBuilder
|
||||
for BasicBlockBuilder<'a, F, Executor, Builder, N>
|
||||
where
|
||||
F: BlockExecutorFactory<Transaction = N::SignedTx, Receipt = N::Receipt>,
|
||||
Executor: BlockExecutor<
|
||||
@@ -469,11 +470,12 @@ where
|
||||
Spec = <F::EvmFactory as EvmFactory>::Spec,
|
||||
HaltReason = <F::EvmFactory as EvmFactory>::HaltReason,
|
||||
BlockEnv = <F::EvmFactory as EvmFactory>::BlockEnv,
|
||||
DB: StateDB + 'a,
|
||||
DB = &'a mut State<DB>,
|
||||
>,
|
||||
Transaction = N::SignedTx,
|
||||
Receipt = N::Receipt,
|
||||
>,
|
||||
DB: Database + 'a,
|
||||
Builder: BlockAssembler<F, Block = N::Block>,
|
||||
N: NodePrimitives,
|
||||
{
|
||||
@@ -506,13 +508,13 @@ where
|
||||
state: impl StateProvider,
|
||||
) -> Result<BlockBuilderOutcome<N>, BlockExecutionError> {
|
||||
let (evm, result) = self.executor.finish()?;
|
||||
let (mut db, evm_env) = evm.finish();
|
||||
let (db, evm_env) = evm.finish();
|
||||
|
||||
// merge all transitions into bundle state
|
||||
db.merge_transitions(BundleRetention::Reverts);
|
||||
|
||||
// calculate the state root
|
||||
let hashed_state = state.hashed_post_state(db.bundle_state());
|
||||
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)?;
|
||||
@@ -526,7 +528,7 @@ where
|
||||
parent: self.parent,
|
||||
transactions,
|
||||
output: &result,
|
||||
bundle_state: Cow::Owned(db.take_bundle()),
|
||||
bundle_state: &db.bundle_state,
|
||||
state_provider: &state,
|
||||
state_root,
|
||||
})?;
|
||||
@@ -562,14 +564,8 @@ pub struct BasicBlockExecutor<F, DB> {
|
||||
impl<F, DB: Database> BasicBlockExecutor<F, DB> {
|
||||
/// Creates a new `BasicBlockExecutor` with the given strategy.
|
||||
pub fn new(strategy_factory: F, db: DB) -> Self {
|
||||
let mut db = State::builder()
|
||||
.with_database(db)
|
||||
.with_bundle_update()
|
||||
.with_bal_builder()
|
||||
.without_state_clear()
|
||||
.build();
|
||||
db.bal_state.bal_index = 0;
|
||||
db.bal_state.bal_builder = Some(revm::state::bal::Bal::new());
|
||||
let db =
|
||||
State::builder().with_database(db).with_bundle_update().without_state_clear().build();
|
||||
Self { strategy_factory, db }
|
||||
}
|
||||
}
|
||||
@@ -745,7 +741,6 @@ mod tests {
|
||||
nonce,
|
||||
code_hash: KECCAK_EMPTY,
|
||||
code: None,
|
||||
account_id: None,
|
||||
};
|
||||
state.insert_account(addr, account_info);
|
||||
state
|
||||
@@ -782,13 +777,8 @@ mod tests {
|
||||
|
||||
let mut state = setup_state_with_account(addr1, 100, 1);
|
||||
|
||||
let account2 = AccountInfo {
|
||||
balance: U256::from(200),
|
||||
nonce: 1,
|
||||
code_hash: KECCAK_EMPTY,
|
||||
code: None,
|
||||
account_id: None,
|
||||
};
|
||||
let account2 =
|
||||
AccountInfo { balance: U256::from(200), nonce: 1, code_hash: KECCAK_EMPTY, code: None };
|
||||
state.insert_account(addr2, account2);
|
||||
|
||||
let mut increments = HashMap::default();
|
||||
@@ -809,13 +799,8 @@ mod tests {
|
||||
|
||||
let mut state = setup_state_with_account(addr1, 100, 1);
|
||||
|
||||
let account2 = AccountInfo {
|
||||
balance: U256::from(200),
|
||||
nonce: 1,
|
||||
code_hash: KECCAK_EMPTY,
|
||||
code: None,
|
||||
account_id: None,
|
||||
};
|
||||
let account2 =
|
||||
AccountInfo { balance: U256::from(200), nonce: 1, code_hash: KECCAK_EMPTY, code: None };
|
||||
state.insert_account(addr2, account2);
|
||||
|
||||
let mut increments = HashMap::default();
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
extern crate alloc;
|
||||
|
||||
use crate::execute::{BasicBlockBuilder, Executor};
|
||||
use ::revm::context::TxEnv;
|
||||
use alloc::vec::Vec;
|
||||
use alloy_eips::{
|
||||
eip2718::{EIP2930_TX_TYPE_ID, LEGACY_TX_TYPE_ID},
|
||||
@@ -26,7 +25,7 @@ use alloy_eips::{
|
||||
eip4895::Withdrawals,
|
||||
};
|
||||
use alloy_evm::{
|
||||
block::{BlockExecutorFactory, BlockExecutorFor, StateDB},
|
||||
block::{BlockExecutorFactory, BlockExecutorFor},
|
||||
precompiles::PrecompilesMap,
|
||||
};
|
||||
use alloy_primitives::{Address, Bytes, B256};
|
||||
@@ -36,7 +35,7 @@ use reth_execution_errors::BlockExecutionError;
|
||||
use reth_primitives_traits::{
|
||||
BlockTy, HeaderTy, NodePrimitives, ReceiptTy, SealedBlock, SealedHeader, TxTy,
|
||||
};
|
||||
use revm::DatabaseCommit;
|
||||
use revm::{context::TxEnv, database::State};
|
||||
|
||||
pub mod either;
|
||||
/// EVM environment configuration.
|
||||
@@ -313,20 +312,20 @@ pub trait ConfigureEvm: Clone + Debug + Send + Sync + Unpin {
|
||||
/// Creates a strategy with given EVM and execution context.
|
||||
fn create_executor<'a, DB, I>(
|
||||
&'a self,
|
||||
evm: EvmFor<Self, DB, I>,
|
||||
evm: EvmFor<Self, &'a mut State<DB>, I>,
|
||||
ctx: <Self::BlockExecutorFactory as BlockExecutorFactory>::ExecutionCtx<'a>,
|
||||
) -> impl BlockExecutorFor<'a, Self::BlockExecutorFactory, DB, I>
|
||||
where
|
||||
DB: StateDB + DatabaseCommit + Database + 'a,
|
||||
I: InspectorFor<Self, DB> + 'a,
|
||||
DB: Database,
|
||||
I: InspectorFor<Self, &'a mut State<DB>> + 'a,
|
||||
{
|
||||
self.block_executor_factory().create_executor(evm, ctx)
|
||||
}
|
||||
|
||||
/// Creates a strategy for execution of a given block.
|
||||
fn executor_for_block<'a, DB: StateDB + DatabaseCommit + Database + 'a>(
|
||||
fn executor_for_block<'a, DB: Database>(
|
||||
&'a self,
|
||||
db: DB,
|
||||
db: &'a mut State<DB>,
|
||||
block: &'a SealedBlock<<Self::Primitives as NodePrimitives>::Block>,
|
||||
) -> Result<impl BlockExecutorFor<'a, Self::BlockExecutorFactory, DB>, Self::Error> {
|
||||
let evm = self.evm_for_block(db, block.header())?;
|
||||
@@ -351,7 +350,7 @@ pub trait ConfigureEvm: Clone + Debug + Send + Sync + Unpin {
|
||||
/// ```
|
||||
fn create_block_builder<'a, DB, I>(
|
||||
&'a self,
|
||||
evm: EvmFor<Self, DB, I>,
|
||||
evm: EvmFor<Self, &'a mut State<DB>, I>,
|
||||
parent: &'a SealedHeader<HeaderTy<Self::Primitives>>,
|
||||
ctx: <Self::BlockExecutorFactory as BlockExecutorFactory>::ExecutionCtx<'a>,
|
||||
) -> impl BlockBuilder<
|
||||
@@ -359,8 +358,8 @@ pub trait ConfigureEvm: Clone + Debug + Send + Sync + Unpin {
|
||||
Executor: BlockExecutorFor<'a, Self::BlockExecutorFactory, DB, I>,
|
||||
>
|
||||
where
|
||||
DB: StateDB + DatabaseCommit + Database + 'a,
|
||||
I: InspectorFor<Self, DB> + 'a,
|
||||
DB: Database,
|
||||
I: InspectorFor<Self, &'a mut State<DB>> + 'a,
|
||||
{
|
||||
BasicBlockBuilder {
|
||||
executor: self.create_executor(evm, ctx.clone()),
|
||||
@@ -400,9 +399,9 @@ pub trait ConfigureEvm: Clone + Debug + Send + Sync + Unpin {
|
||||
/// // Complete block building
|
||||
/// let outcome = builder.finish(state_provider)?;
|
||||
/// ```
|
||||
fn builder_for_next_block<'a, DB: StateDB + DatabaseCommit + Database + 'a>(
|
||||
fn builder_for_next_block<'a, DB: Database>(
|
||||
&'a self,
|
||||
db: DB,
|
||||
db: &'a mut State<DB>,
|
||||
parent: &'a SealedHeader<<Self::Primitives as NodePrimitives>::BlockHeader>,
|
||||
attributes: Self::NextBlockEnvCtx,
|
||||
) -> Result<
|
||||
|
||||
@@ -934,20 +934,10 @@ mod tests {
|
||||
let address3 = Address::random();
|
||||
|
||||
// Set up account info with some changes
|
||||
let account_info1 = AccountInfo {
|
||||
nonce: 1,
|
||||
balance: U256::from(100),
|
||||
code_hash: B256::ZERO,
|
||||
code: None,
|
||||
account_id: None,
|
||||
};
|
||||
let account_info2 = AccountInfo {
|
||||
nonce: 2,
|
||||
balance: U256::from(200),
|
||||
code_hash: B256::ZERO,
|
||||
code: None,
|
||||
account_id: None,
|
||||
};
|
||||
let account_info1 =
|
||||
AccountInfo { nonce: 1, balance: U256::from(100), code_hash: B256::ZERO, code: None };
|
||||
let account_info2 =
|
||||
AccountInfo { nonce: 2, balance: U256::from(200), code_hash: B256::ZERO, code: None };
|
||||
|
||||
// Set up the bundle state with these accounts
|
||||
let mut bundle_state = BundleState::default();
|
||||
|
||||
@@ -195,22 +195,22 @@ mod tests {
|
||||
|
||||
// wal with 1 block and tx (old 3-field format)
|
||||
// <https://github.com/paradigmxyz/reth/issues/15012>
|
||||
// #[test]
|
||||
// fn decode_notification_wal() {
|
||||
// let wal = include_bytes!("../../test-data/28.wal");
|
||||
// let notification: reth_exex_types::serde_bincode_compat::ExExNotification<
|
||||
// '_,
|
||||
// reth_ethereum_primitives::EthPrimitives,
|
||||
// > = rmp_serde::decode::from_slice(wal.as_slice()).unwrap();
|
||||
// let notification: ExExNotification = notification.into();
|
||||
// match notification {
|
||||
// ExExNotification::ChainCommitted { new } => {
|
||||
// assert_eq!(new.blocks().len(), 1);
|
||||
// assert_eq!(new.tip().transaction_count(), 1);
|
||||
// }
|
||||
// _ => panic!("unexpected notification"),
|
||||
// }
|
||||
// }
|
||||
#[test]
|
||||
fn decode_notification_wal() {
|
||||
let wal = include_bytes!("../../test-data/28.wal");
|
||||
let notification: reth_exex_types::serde_bincode_compat::ExExNotification<
|
||||
'_,
|
||||
reth_ethereum_primitives::EthPrimitives,
|
||||
> = rmp_serde::decode::from_slice(wal.as_slice()).unwrap();
|
||||
let notification: ExExNotification = notification.into();
|
||||
match notification {
|
||||
ExExNotification::ChainCommitted { new } => {
|
||||
assert_eq!(new.blocks().len(), 1);
|
||||
assert_eq!(new.tip().transaction_count(), 1);
|
||||
}
|
||||
_ => panic!("unexpected notification"),
|
||||
}
|
||||
}
|
||||
|
||||
// wal with 1 block and tx (new 4-field format with trie updates and hashed state)
|
||||
#[test]
|
||||
|
||||
Binary file not shown.
@@ -256,10 +256,6 @@ impl<B: FullBlock<Header: reth_primitives_traits::BlockHeader>> FromReader
|
||||
Err(err) => return Err(err),
|
||||
};
|
||||
|
||||
tracing::debug!(target: "downloaders::file",
|
||||
block=?block,
|
||||
"decoded block from file chunk"
|
||||
);
|
||||
let block = SealedBlock::seal_slow(block);
|
||||
|
||||
// Validate standalone header
|
||||
@@ -276,11 +272,6 @@ impl<B: FullBlock<Header: reth_primitives_traits::BlockHeader>> FromReader
|
||||
let block_hash = block.hash();
|
||||
let block_number = block.number();
|
||||
let (header, body) = block.split_sealed_header_body();
|
||||
tracing::debug!(target: "downloaders::file",
|
||||
header=?header,
|
||||
body=?body,
|
||||
"adding block to file client buffers"
|
||||
);
|
||||
headers.insert(block_number, header.unseal());
|
||||
hash_to_number.insert(block_hash, block_number);
|
||||
bodies.insert(block_hash, body);
|
||||
|
||||
@@ -265,7 +265,6 @@ mod tests {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash:None
|
||||
},
|
||||
]),
|
||||
}.encode(&mut data);
|
||||
@@ -303,7 +302,6 @@ mod tests {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash: None
|
||||
},
|
||||
]),
|
||||
};
|
||||
@@ -410,11 +408,9 @@ mod tests {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash:None
|
||||
},
|
||||
],
|
||||
withdrawals: None,
|
||||
block_access_list:None
|
||||
}
|
||||
]),
|
||||
};
|
||||
@@ -489,11 +485,9 @@ mod tests {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash:None
|
||||
},
|
||||
],
|
||||
withdrawals: None,
|
||||
block_access_list:None
|
||||
}
|
||||
]),
|
||||
};
|
||||
|
||||
@@ -152,7 +152,6 @@ mod tests {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash:None
|
||||
};
|
||||
assert_eq!(header.hash_slow(), expected_hash);
|
||||
}
|
||||
@@ -269,7 +268,6 @@ mod tests {
|
||||
excess_blob_gas: Some(0),
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash: None,
|
||||
};
|
||||
|
||||
let header = Header::decode(&mut data.as_slice()).unwrap();
|
||||
@@ -312,7 +310,6 @@ mod tests {
|
||||
blob_gas_used: Some(0),
|
||||
excess_blob_gas: Some(0x1600000),
|
||||
requests_hash: None,
|
||||
block_access_list_hash: None,
|
||||
};
|
||||
|
||||
let header = Header::decode(&mut data.as_slice()).unwrap();
|
||||
|
||||
@@ -824,7 +824,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Default::default()),
|
||||
block_access_list: None,
|
||||
}]
|
||||
.into(),
|
||||
}));
|
||||
|
||||
@@ -54,6 +54,7 @@ reth-tasks.workspace = true
|
||||
reth-tokio-util.workspace = true
|
||||
reth-tracing.workspace = true
|
||||
reth-transaction-pool.workspace = true
|
||||
reth-trie-db = { workspace = true, features = ["metrics"] }
|
||||
reth-basic-payload-builder.workspace = true
|
||||
reth-node-ethstats.workspace = true
|
||||
|
||||
@@ -115,6 +116,7 @@ test-utils = [
|
||||
"reth-db-api/test-utils",
|
||||
"reth-provider/test-utils",
|
||||
"reth-transaction-pool/test-utils",
|
||||
"reth-trie-db/test-utils",
|
||||
"reth-evm-ethereum/test-utils",
|
||||
"reth-node-ethereum/test-utils",
|
||||
"reth-primitives-traits/test-utils",
|
||||
|
||||
@@ -84,6 +84,7 @@ use reth_tracing::{
|
||||
tracing::{debug, error, info, warn},
|
||||
};
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use std::{sync::Arc, thread::available_parallelism, time::Duration};
|
||||
use tokio::sync::{
|
||||
mpsc::{unbounded_channel, UnboundedSender},
|
||||
@@ -470,7 +471,10 @@ where
|
||||
/// Returns the [`ProviderFactory`] for the attached storage after executing a consistent check
|
||||
/// between the database and static files. **It may execute a pipeline unwind if it fails this
|
||||
/// check.**
|
||||
pub async fn create_provider_factory<N, Evm>(&self) -> eyre::Result<ProviderFactory<N>>
|
||||
pub async fn create_provider_factory<N, Evm>(
|
||||
&self,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> eyre::Result<ProviderFactory<N>>
|
||||
where
|
||||
N: ProviderNodeTypes<DB = DB, ChainSpec = ChainSpec>,
|
||||
Evm: ConfigureEvm<Primitives = N::Primitives> + 'static,
|
||||
@@ -500,7 +504,8 @@ where
|
||||
static_file_provider,
|
||||
rocksdb_provider,
|
||||
)?
|
||||
.with_prune_modes(self.prune_modes());
|
||||
.with_prune_modes(self.prune_modes())
|
||||
.with_changeset_cache(changeset_cache);
|
||||
|
||||
// Keep MDBX, static files, and RocksDB aligned. If any check fails, unwind to the
|
||||
// earliest consistent block.
|
||||
@@ -593,12 +598,13 @@ where
|
||||
/// Creates a new [`ProviderFactory`] and attaches it to the launch context.
|
||||
pub async fn with_provider_factory<N, Evm>(
|
||||
self,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> eyre::Result<LaunchContextWith<Attached<WithConfigs<ChainSpec>, ProviderFactory<N>>>>
|
||||
where
|
||||
N: ProviderNodeTypes<DB = DB, ChainSpec = ChainSpec>,
|
||||
Evm: ConfigureEvm<Primitives = N::Primitives> + 'static,
|
||||
{
|
||||
let factory = self.create_provider_factory::<N, Evm>().await?;
|
||||
let factory = self.create_provider_factory::<N, Evm>(changeset_cache).await?;
|
||||
let ctx = LaunchContextWith {
|
||||
inner: self.inner,
|
||||
attachment: self.attachment.map_right(|_| factory),
|
||||
|
||||
@@ -37,6 +37,7 @@ use reth_provider::{
|
||||
use reth_tasks::TaskExecutor;
|
||||
use reth_tokio_util::EventSender;
|
||||
use reth_tracing::tracing::{debug, error, info};
|
||||
use reth_trie_db::ChangesetCache;
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
use tokio::sync::{mpsc::unbounded_channel, oneshot};
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
@@ -87,6 +88,9 @@ impl EngineNodeLauncher {
|
||||
} = target;
|
||||
let NodeHooks { on_component_initialized, on_node_started, .. } = hooks;
|
||||
|
||||
// Create changeset cache that will be shared across the engine
|
||||
let changeset_cache = ChangesetCache::new();
|
||||
|
||||
// setup the launch context
|
||||
let ctx = ctx
|
||||
.with_configured_globals(engine_tree_config.reserved_cpu_cores())
|
||||
@@ -98,8 +102,8 @@ impl EngineNodeLauncher {
|
||||
.attach(database.clone())
|
||||
// ensure certain settings take effect
|
||||
.with_adjusted_configs()
|
||||
// Create the provider factory
|
||||
.with_provider_factory::<_, <CB::Components as NodeComponents<T>>::Evm>().await?
|
||||
// Create the provider factory with changeset cache
|
||||
.with_provider_factory::<_, <CB::Components as NodeComponents<T>>::Evm>(changeset_cache.clone()).await?
|
||||
.inspect(|ctx| {
|
||||
info!(target: "reth::cli", "Database opened");
|
||||
match ctx.provider_factory().storage_settings() {
|
||||
@@ -204,7 +208,7 @@ impl EngineNodeLauncher {
|
||||
// Build the engine validator with all required components
|
||||
let engine_validator = validator_builder
|
||||
.clone()
|
||||
.build_tree_validator(&add_ons_ctx, engine_tree_config.clone())
|
||||
.build_tree_validator(&add_ons_ctx, engine_tree_config.clone(), changeset_cache.clone())
|
||||
.await?;
|
||||
|
||||
// Create the consensus engine stream with optional reorg
|
||||
@@ -214,7 +218,13 @@ impl EngineNodeLauncher {
|
||||
.maybe_reorg(
|
||||
ctx.blockchain_db().clone(),
|
||||
ctx.components().evm_config().clone(),
|
||||
|| validator_builder.build_tree_validator(&add_ons_ctx, engine_tree_config.clone()),
|
||||
|| async {
|
||||
// Create a separate cache for reorg validator (not shared with main engine)
|
||||
let reorg_cache = ChangesetCache::new();
|
||||
validator_builder
|
||||
.build_tree_validator(&add_ons_ctx, engine_tree_config.clone(), reorg_cache)
|
||||
.await
|
||||
},
|
||||
node_config.debug.reorg_frequency,
|
||||
node_config.debug.reorg_depth,
|
||||
)
|
||||
@@ -239,6 +249,7 @@ impl EngineNodeLauncher {
|
||||
engine_tree_config,
|
||||
ctx.sync_metrics_tx(),
|
||||
ctx.components().evm_config().clone(),
|
||||
changeset_cache,
|
||||
);
|
||||
|
||||
info!(target: "reth::cli", "Consensus engine initialized");
|
||||
@@ -290,7 +301,6 @@ impl EngineNodeLauncher {
|
||||
let startup_sync_state_idle = ctx.node_config().debug.startup_sync_state_idle;
|
||||
|
||||
info!(target: "reth::cli", "Starting consensus engine");
|
||||
info!(target: "reth::cli", "built payloads ready: {:#?}", built_payloads);
|
||||
let consensus_engine = async move {
|
||||
if let Some(initial_target) = initial_target {
|
||||
debug!(target: "reth::cli", %initial_target, "start backfill sync");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
pub use jsonrpsee::server::middleware::rpc::{RpcService, RpcServiceBuilder};
|
||||
pub use reth_engine_tree::tree::{BasicEngineValidator, EngineValidator};
|
||||
pub use reth_rpc_builder::{middleware::RethRpcMiddleware, Identity, Stack};
|
||||
pub use reth_trie_db::ChangesetCache;
|
||||
|
||||
use crate::{
|
||||
invalid_block_hook::InvalidBlockHookExt, ConfigureEngineEvm, ConsensusEngineEvent,
|
||||
@@ -1288,6 +1289,7 @@ pub trait EngineValidatorBuilder<Node: FullNodeComponents>: Send + Sync + Clone
|
||||
self,
|
||||
ctx: &AddOnsContext<'_, Node>,
|
||||
tree_config: TreeConfig,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> impl Future<Output = eyre::Result<Self::EngineValidator>> + Send;
|
||||
}
|
||||
|
||||
@@ -1335,10 +1337,12 @@ where
|
||||
self,
|
||||
ctx: &AddOnsContext<'_, Node>,
|
||||
tree_config: TreeConfig,
|
||||
changeset_cache: ChangesetCache,
|
||||
) -> eyre::Result<Self::EngineValidator> {
|
||||
let validator = self.payload_validator_builder.build(ctx).await?;
|
||||
let data_dir = ctx.config.datadir.clone().resolve_datadir(ctx.config.chain.chain());
|
||||
let invalid_block_hook = ctx.create_invalid_block_hook(&data_dir).await?;
|
||||
|
||||
Ok(BasicEngineValidator::new(
|
||||
ctx.node.provider().clone(),
|
||||
std::sync::Arc::new(ctx.node.consensus().clone()),
|
||||
@@ -1346,6 +1350,7 @@ where
|
||||
validator,
|
||||
tree_config,
|
||||
invalid_block_hook,
|
||||
changeset_cache,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ use alloy_primitives::{Address, BlockNumber};
|
||||
use clap::{builder::RangedU64ValueParser, Args};
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_config::config::PruneConfig;
|
||||
use reth_prune_types::{
|
||||
PruneMode, PruneModes, ReceiptsLogPruneConfig, MERKLE_CHANGESETS_RETENTION_BLOCKS,
|
||||
MINIMUM_PRUNING_DISTANCE,
|
||||
};
|
||||
use reth_prune_types::{PruneMode, PruneModes, ReceiptsLogPruneConfig, MINIMUM_PRUNING_DISTANCE};
|
||||
use std::{collections::BTreeMap, ops::Not};
|
||||
|
||||
/// Parameters for pruning and full node
|
||||
@@ -143,7 +140,6 @@ impl PruningArgs {
|
||||
.ethereum_fork_activation(EthereumHardfork::Paris)
|
||||
.block_number()
|
||||
.map(PruneMode::Before),
|
||||
merkle_changesets: PruneMode::Distance(MERKLE_CHANGESETS_RETENTION_BLOCKS),
|
||||
receipts_log_filter: Default::default(),
|
||||
},
|
||||
}
|
||||
@@ -160,7 +156,6 @@ impl PruningArgs {
|
||||
account_history: Some(PruneMode::Distance(10064)),
|
||||
storage_history: Some(PruneMode::Distance(10064)),
|
||||
bodies_history: Some(PruneMode::Distance(10064)),
|
||||
merkle_changesets: PruneMode::Distance(MERKLE_CHANGESETS_RETENTION_BLOCKS),
|
||||
receipts_log_filter: Default::default(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -38,11 +38,6 @@ pub enum StageEnum {
|
||||
///
|
||||
/// Handles Merkle tree-related computations and data processing.
|
||||
Merkle,
|
||||
/// The merkle changesets stage within the pipeline.
|
||||
///
|
||||
/// Handles Merkle trie changesets for storage and accounts.
|
||||
#[value(name = "merkle-changesets")]
|
||||
MerkleChangeSets,
|
||||
/// The transaction lookup stage within the pipeline.
|
||||
///
|
||||
/// Deals with the retrieval and processing of transactions.
|
||||
|
||||
@@ -298,7 +298,6 @@ mod tests {
|
||||
transactions: vec![transaction],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
let block = SealedBlock::seal_slow(alloy_consensus::Block { header, body });
|
||||
@@ -336,7 +335,6 @@ mod tests {
|
||||
transactions: vec![transaction],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
let block = SealedBlock::seal_slow(alloy_consensus::Block { header, body });
|
||||
@@ -391,7 +389,6 @@ mod tests {
|
||||
transactions: vec![transaction],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
let block = SealedBlock::seal_slow(alloy_consensus::Block { header, body });
|
||||
@@ -401,7 +398,6 @@ mod tests {
|
||||
receipts: vec![receipt],
|
||||
requests: Requests::default(),
|
||||
gas_used: GAS_USED,
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
// validate blob, it should pass blob gas used validation
|
||||
@@ -462,7 +458,6 @@ mod tests {
|
||||
transactions: vec![transaction],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Withdrawals::default()),
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
let block = SealedBlock::seal_slow(alloy_consensus::Block { header, body });
|
||||
@@ -472,7 +467,6 @@ mod tests {
|
||||
receipts: vec![receipt],
|
||||
requests: Requests::default(),
|
||||
gas_used: GAS_USED,
|
||||
block_access_list: None,
|
||||
};
|
||||
|
||||
// validate blob, it should pass blob gas used validation
|
||||
|
||||
@@ -518,7 +518,6 @@ mod tests {
|
||||
transactions: vec![],
|
||||
ommers: vec![],
|
||||
withdrawals: Some(Default::default()),
|
||||
..Default::default()
|
||||
};
|
||||
validate_body_against_header_op(&chainspec, &body, &header).unwrap();
|
||||
|
||||
@@ -543,7 +542,6 @@ mod tests {
|
||||
receipts: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used: GAS_USED,
|
||||
block_access_list: None,
|
||||
};
|
||||
validate_block_post_execution(&header, &chainspec, &result).unwrap();
|
||||
}
|
||||
@@ -565,7 +563,6 @@ mod tests {
|
||||
receipts: vec![],
|
||||
requests: Requests::default(),
|
||||
gas_used: GAS_USED,
|
||||
block_access_list: None,
|
||||
};
|
||||
assert!(matches!(
|
||||
validate_block_post_execution(&header, &chainspec, &result).unwrap_err(),
|
||||
|
||||
@@ -46,14 +46,7 @@ impl<ChainSpec: OpHardforks> OpBlockAssembler<ChainSpec> {
|
||||
evm_env,
|
||||
execution_ctx: ctx,
|
||||
transactions,
|
||||
output:
|
||||
BlockExecutionResult {
|
||||
receipts,
|
||||
gas_used,
|
||||
blob_gas_used,
|
||||
requests: _,
|
||||
block_access_list: _,
|
||||
},
|
||||
output: BlockExecutionResult { receipts, gas_used, blob_gas_used, requests: _ },
|
||||
bundle_state,
|
||||
state_root,
|
||||
state_provider,
|
||||
@@ -77,7 +70,7 @@ impl<ChainSpec: OpHardforks> OpBlockAssembler<ChainSpec> {
|
||||
// withdrawals root field in block header is used for storage root of L2 predeploy
|
||||
// `l2tol1-message-passer`
|
||||
Some(
|
||||
isthmus::withdrawals_root(&bundle_state, state_provider)
|
||||
isthmus::withdrawals_root(bundle_state, state_provider)
|
||||
.map_err(BlockExecutionError::other)?,
|
||||
)
|
||||
} else if self.chain_spec.is_canyon_active_at_timestamp(timestamp) {
|
||||
@@ -119,7 +112,6 @@ impl<ChainSpec: OpHardforks> OpBlockAssembler<ChainSpec> {
|
||||
blob_gas_used,
|
||||
excess_blob_gas,
|
||||
requests_hash,
|
||||
block_access_list_hash: None,
|
||||
};
|
||||
|
||||
Ok(Block::new(
|
||||
@@ -131,7 +123,6 @@ impl<ChainSpec: OpHardforks> OpBlockAssembler<ChainSpec> {
|
||||
.chain_spec
|
||||
.is_canyon_active_at_timestamp(timestamp)
|
||||
.then(Default::default),
|
||||
block_access_list: None,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ where
|
||||
|
||||
let spec = revm_spec_by_timestamp_after_bedrock(self.chain_spec(), timestamp);
|
||||
|
||||
let cfg_env = CfgEnv::new_with_spec(spec).with_chain_id(self.chain_spec().chain().id());
|
||||
let cfg_env = CfgEnv::new().with_chain_id(self.chain_spec().chain().id()).with_spec(spec);
|
||||
|
||||
let blob_excess_gas_and_price = spec
|
||||
.into_eth_spec()
|
||||
@@ -362,7 +362,7 @@ mod tests {
|
||||
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
|
||||
|
||||
// Create a custom configuration environment with a chain ID of 111
|
||||
let cfg = CfgEnv::new_with_spec(OpSpecId::default()).with_chain_id(111);
|
||||
let cfg = CfgEnv::new().with_chain_id(111).with_spec(OpSpecId::default());
|
||||
|
||||
let evm_env = EvmEnv { cfg_env: cfg.clone(), ..Default::default() };
|
||||
|
||||
@@ -401,7 +401,7 @@ mod tests {
|
||||
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
|
||||
|
||||
let evm_env =
|
||||
EvmEnv { cfg_env: CfgEnv::new_with_spec(OpSpecId::ECOTONE), ..Default::default() };
|
||||
EvmEnv { cfg_env: CfgEnv::new().with_spec(OpSpecId::ECOTONE), ..Default::default() };
|
||||
|
||||
let evm = evm_config.evm_with_env(db, evm_env.clone());
|
||||
|
||||
@@ -427,7 +427,7 @@ mod tests {
|
||||
let evm_config = test_evm_config();
|
||||
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
|
||||
|
||||
let cfg = CfgEnv::new_with_spec(OpSpecId::default()).with_chain_id(111);
|
||||
let cfg = CfgEnv::new().with_chain_id(111).with_spec(OpSpecId::default());
|
||||
let block = BlockEnv::default();
|
||||
let evm_env = EvmEnv { block_env: block, cfg_env: cfg.clone() };
|
||||
|
||||
@@ -464,7 +464,7 @@ mod tests {
|
||||
let db = CacheDB::<EmptyDBTyped<ProviderError>>::default();
|
||||
|
||||
let evm_env =
|
||||
EvmEnv { cfg_env: CfgEnv::new_with_spec(OpSpecId::ECOTONE), ..Default::default() };
|
||||
EvmEnv { cfg_env: CfgEnv::new().with_spec(OpSpecId::ECOTONE), ..Default::default() };
|
||||
|
||||
let evm = evm_config.evm_with_env_and_inspector(db, evm_env.clone(), NoOpInspector {});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use alloy_consensus::{Eip658Value, Receipt};
|
||||
use alloy_evm::eth::receipt_builder::ReceiptBuilderCtx;
|
||||
use alloy_op_evm::block::receipt_builder::OpReceiptBuilder;
|
||||
use op_alloy_consensus::OpTxType;
|
||||
use op_alloy_consensus::{OpDepositReceipt, OpTxType};
|
||||
use reth_evm::Evm;
|
||||
use reth_optimism_primitives::{OpReceipt, OpTransactionSigned};
|
||||
|
||||
@@ -41,7 +41,7 @@ impl OpReceiptBuilder for OpRethReceiptBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
fn build_deposit_receipt(&self, inner: op_alloy_consensus::OpDepositReceipt) -> Self::Receipt {
|
||||
fn build_deposit_receipt(&self, inner: OpDepositReceipt) -> Self::Receipt {
|
||||
OpReceipt::Deposit(inner)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ reth-revm = { workspace = true, features = ["std"] }
|
||||
reth-rpc.workspace = true
|
||||
reth-rpc-eth-types.workspace = true
|
||||
reth-stages-types.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
|
||||
alloy-network.workspace = true
|
||||
alloy-op-hardforks.workspace = true
|
||||
@@ -125,6 +126,7 @@ test-utils = [
|
||||
"reth-optimism-primitives/arbitrary",
|
||||
"reth-primitives-traits/test-utils",
|
||||
"reth-trie-common/test-utils",
|
||||
"reth-trie-db/test-utils",
|
||||
"reth-stages-types/test-utils",
|
||||
]
|
||||
reth-codec = ["reth-optimism-primitives/reth-codec"]
|
||||
|
||||
@@ -62,7 +62,6 @@ where
|
||||
type ExecutionPayloadEnvelopeV3 = OpExecutionPayloadEnvelopeV3;
|
||||
type ExecutionPayloadEnvelopeV4 = OpExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadEnvelopeV5 = OpExecutionPayloadEnvelopeV4;
|
||||
type ExecutionPayloadEnvelopeV6 = OpExecutionPayloadEnvelopeV4;
|
||||
}
|
||||
|
||||
/// Validator for Optimism engine API.
|
||||
@@ -284,8 +283,7 @@ pub fn validate_withdrawals_presence(
|
||||
EngineApiMessageVersion::V2 |
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
EngineApiMessageVersion::V5 => {
|
||||
if is_shanghai && !has_withdrawals {
|
||||
return Err(message_validation_kind
|
||||
.to_error(VersionSpecificValidationError::NoWithdrawalsPostShanghai));
|
||||
@@ -341,7 +339,6 @@ mod test {
|
||||
suggested_fee_recipient: Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
//! use reth_rpc::TraceApi;
|
||||
//! use reth_rpc_eth_types::{EthConfig, EthStateCache};
|
||||
//! use reth_tasks::{pool::BlockingTaskGuard, TaskManager};
|
||||
//! use reth_trie_db::ChangesetCache;
|
||||
//! use std::sync::Arc;
|
||||
//!
|
||||
//! #[tokio::main]
|
||||
@@ -37,7 +38,7 @@
|
||||
//! .with_loaded_toml_config(sepolia)
|
||||
//! .unwrap()
|
||||
//! .attach(Arc::new(db))
|
||||
//! .with_provider_factory::<_, OpEvmConfig>()
|
||||
//! .with_provider_factory::<_, OpEvmConfig>(ChangesetCache::new())
|
||||
//! .await
|
||||
//! .unwrap()
|
||||
//! .with_genesis()
|
||||
|
||||
@@ -61,7 +61,6 @@ pub fn optimism_payload_attributes<T>(timestamp: u64) -> OpPayloadBuilderAttribu
|
||||
suggested_fee_recipient: Address::ZERO,
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
};
|
||||
|
||||
OpPayloadBuilderAttributes {
|
||||
|
||||
@@ -40,7 +40,6 @@ async fn test_testsuite_op_assert_mine_block() -> Result<()> {
|
||||
suggested_fee_recipient: Address::random(),
|
||||
withdrawals: None,
|
||||
parent_beacon_block_root: None,
|
||||
slot_number: None,
|
||||
},
|
||||
transactions: None,
|
||||
no_tx_pool: None,
|
||||
@@ -86,7 +85,6 @@ async fn test_testsuite_op_assert_mine_block_isthmus_activated() -> Result<()> {
|
||||
suggested_fee_recipient: Address::random(),
|
||||
withdrawals: Some(vec![]),
|
||||
parent_beacon_block_root: Some(B256::ZERO),
|
||||
slot_number: None,
|
||||
},
|
||||
transactions: None,
|
||||
no_tx_pool: None,
|
||||
|
||||
@@ -19,7 +19,7 @@ use reth_optimism_node::{args::RollupArgs, OpEvmConfig, OpExecutorBuilder, OpNod
|
||||
use reth_optimism_primitives::OpPrimitives;
|
||||
use reth_provider::providers::BlockchainProvider;
|
||||
use revm::{
|
||||
context::{BlockEnv, ContextTr, TxEnv},
|
||||
context::{BlockEnv, Cfg, ContextTr, TxEnv},
|
||||
context_interface::result::EVMError,
|
||||
inspector::NoOpInspector,
|
||||
interpreter::interpreter::EthInterpreter,
|
||||
@@ -103,7 +103,7 @@ fn test_setup_custom_precompiles() {
|
||||
input: EvmEnv<OpSpecId>,
|
||||
) -> Self::Evm<DB, NoOpInspector> {
|
||||
let mut op_evm = OpEvmFactory::default().create_evm(db, input);
|
||||
*op_evm.components_mut().2 = UniPrecompiles::precompiles(*op_evm.ctx().cfg().spec());
|
||||
*op_evm.components_mut().2 = UniPrecompiles::precompiles(op_evm.ctx().cfg().spec());
|
||||
|
||||
op_evm
|
||||
}
|
||||
@@ -119,7 +119,7 @@ fn test_setup_custom_precompiles() {
|
||||
) -> Self::Evm<DB, I> {
|
||||
let mut op_evm =
|
||||
OpEvmFactory::default().create_evm_with_inspector(db, input, inspector);
|
||||
*op_evm.components_mut().2 = UniPrecompiles::precompiles(*op_evm.ctx().cfg().spec());
|
||||
*op_evm.components_mut().2 = UniPrecompiles::precompiles(op_evm.ctx().cfg().spec());
|
||||
|
||||
op_evm
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
OpPayloadBuilderAttributes, OpPayloadPrimitives,
|
||||
};
|
||||
use alloy_consensus::{BlockHeader, Transaction, Typed2718};
|
||||
use alloy_evm::{block::StateDB, Evm as AlloyEvm};
|
||||
use alloy_evm::Evm as AlloyEvm;
|
||||
use alloy_primitives::{B256, U256};
|
||||
use alloy_rpc_types_debug::ExecutionWitness;
|
||||
use alloy_rpc_types_engine::PayloadId;
|
||||
@@ -38,10 +38,7 @@ use reth_revm::{
|
||||
};
|
||||
use reth_storage_api::{errors::ProviderError, StateProvider, StateProviderFactory};
|
||||
use reth_transaction_pool::{BestTransactionsAttributes, PoolTransaction, TransactionPool};
|
||||
use revm::{
|
||||
context::{Block, BlockEnv},
|
||||
DatabaseCommit,
|
||||
};
|
||||
use revm::context::{Block, BlockEnv};
|
||||
use std::{marker::PhantomData, sync::Arc};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
@@ -601,9 +598,9 @@ where
|
||||
}
|
||||
|
||||
/// Prepares a [`BlockBuilder`] for the next block.
|
||||
pub fn block_builder<'a, DB: StateDB + DatabaseCommit + Database + 'a>(
|
||||
pub fn block_builder<'a, DB: Database>(
|
||||
&'a self,
|
||||
db: DB,
|
||||
db: &'a mut State<DB>,
|
||||
) -> Result<
|
||||
impl BlockBuilder<
|
||||
Primitives = Evm::Primitives,
|
||||
|
||||
@@ -464,7 +464,6 @@ mod tests {
|
||||
suggested_fee_recipient: address!("0x4200000000000000000000000000000000000011"),
|
||||
withdrawals: Some([].into()),
|
||||
parent_beacon_block_root: b256!("0x8fe0193b9bf83cb7e5a08538e494fecc23046aab9a497af3704f4afdae3250ff").into(),
|
||||
slot_number: None,
|
||||
},
|
||||
transactions: Some([bytes!("7ef8f8a0dc19cfa777d90980e4875d0a548a881baaa3f83f14d1bc0d3038bc329350e54194deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e20000f424000000000000000000000000300000000670d6d890000000000000125000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000014bf9181db6e381d4384bbf69c48b0ee0eed23c6ca26143c6d2544f9d39997a590000000000000000000000007f83d659683caf2767fd3c720981d51f5bc365bc")].into()),
|
||||
no_tx_pool: None,
|
||||
@@ -496,7 +495,6 @@ mod tests {
|
||||
suggested_fee_recipient: address!("0x4200000000000000000000000000000000000011"),
|
||||
withdrawals: Some([].into()),
|
||||
parent_beacon_block_root: b256!("0x8fe0193b9bf83cb7e5a08538e494fecc23046aab9a497af3704f4afdae3250ff").into(),
|
||||
slot_number: None,
|
||||
},
|
||||
transactions: Some([bytes!("7ef8f8a0dc19cfa777d90980e4875d0a548a881baaa3f83f14d1bc0d3038bc329350e54194deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e20000f424000000000000000000000000300000000670d6d890000000000000125000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000014bf9181db6e381d4384bbf69c48b0ee0eed23c6ca26143c6d2544f9d39997a590000000000000000000000007f83d659683caf2767fd3c720981d51f5bc365bc")].into()),
|
||||
no_tx_pool: None,
|
||||
|
||||
@@ -91,7 +91,6 @@ pub const BEDROCK_HEADER: Header = Header {
|
||||
excess_blob_gas: None,
|
||||
parent_beacon_block_root: None,
|
||||
requests_hash: None,
|
||||
block_access_list_hash:None
|
||||
};
|
||||
|
||||
/// Bedrock total difficulty on Optimism Mainnet.
|
||||
|
||||
@@ -116,17 +116,6 @@ pub enum VersionSpecificValidationError {
|
||||
/// Shanghai
|
||||
#[error("withdrawals pre-Shanghai")]
|
||||
HasWithdrawalsPreShanghai,
|
||||
/// Thrown if the pre-V6 `PayloadAttributes` or `ExecutionPayload` contains a block access list
|
||||
#[error("block access list not before V6")]
|
||||
BlockAccessListNotSupportedBeforeV6,
|
||||
/// Thrown if `engine_newPayload` contains no block access list
|
||||
/// after Amsterdam
|
||||
#[error("no block access list post-Amsterdam")]
|
||||
NoBlockAccessListPostAmsterdam,
|
||||
/// Thrown if `engine_newPayload` contains block access list
|
||||
/// before Amsterdam
|
||||
#[error("block access list pre-Amsterdam")]
|
||||
HasBlockAccessListPreAmsterdam,
|
||||
/// Thrown if the `PayloadAttributes` or `ExecutionPayload` contains no parent beacon block
|
||||
/// root after Cancun
|
||||
#[error("no parent beacon block root post-cancun")]
|
||||
|
||||
@@ -159,23 +159,12 @@ pub fn validate_payload_timestamp(
|
||||
// built payload does not fall within the time frame of the Osaka fork.
|
||||
return Err(EngineObjectValidationError::UnsupportedFork)
|
||||
}
|
||||
|
||||
// `engine_getPayloadV4` MUST reject payloads with a timestamp >= Osaka.
|
||||
if version.is_v4() && kind == MessageValidationKind::GetPayload && is_osaka {
|
||||
return Err(EngineObjectValidationError::UnsupportedFork)
|
||||
}
|
||||
|
||||
let is_amsterdam = chain_spec.is_amsterdam_active_at_timestamp(timestamp);
|
||||
if version.is_v6() && !is_amsterdam {
|
||||
// From the Engine API spec:
|
||||
// <https://github.com/ethereum/execution-apis/blob/15399c2e2f16a5f800bf3f285640357e2c245ad9/src/engine/osaka.md#specification>
|
||||
//
|
||||
// For `engine_getPayloadV6`
|
||||
//
|
||||
// 1. Client software MUST return -38005: Unsupported fork error if the timestamp of the
|
||||
// built payload does not fall within the time frame of the Amsterdam fork.
|
||||
|
||||
return Err(EngineObjectValidationError::UnsupportedFork)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -201,8 +190,7 @@ pub fn validate_withdrawals_presence<T: EthereumHardforks>(
|
||||
EngineApiMessageVersion::V2 |
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
EngineApiMessageVersion::V5 => {
|
||||
if is_shanghai_active && !has_withdrawals {
|
||||
return Err(message_validation_kind
|
||||
.to_error(VersionSpecificValidationError::NoWithdrawalsPostShanghai))
|
||||
@@ -217,45 +205,6 @@ pub fn validate_withdrawals_presence<T: EthereumHardforks>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validates the presence of the `block access lists` field according to the payload timestamp.
|
||||
/// After Amsterdam, block access list field must be [Some].
|
||||
/// Before Amsterdam, block access list field must be [None];
|
||||
pub fn validate_block_access_list_presence<T: EthereumHardforks>(
|
||||
chain_spec: &T,
|
||||
version: EngineApiMessageVersion,
|
||||
message_validation_kind: MessageValidationKind,
|
||||
timestamp: u64,
|
||||
has_block_access_list: bool,
|
||||
) -> Result<(), EngineObjectValidationError> {
|
||||
let is_amsterdam_active = chain_spec.is_amsterdam_active_at_timestamp(timestamp);
|
||||
|
||||
match version {
|
||||
EngineApiMessageVersion::V1 |
|
||||
EngineApiMessageVersion::V2 |
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 => {
|
||||
if has_block_access_list {
|
||||
return Err(message_validation_kind
|
||||
.to_error(VersionSpecificValidationError::BlockAccessListNotSupportedBeforeV6))
|
||||
}
|
||||
}
|
||||
|
||||
EngineApiMessageVersion::V6 => {
|
||||
if is_amsterdam_active && !has_block_access_list {
|
||||
return Err(message_validation_kind
|
||||
.to_error(VersionSpecificValidationError::NoBlockAccessListPostAmsterdam))
|
||||
}
|
||||
if !is_amsterdam_active && has_block_access_list {
|
||||
return Err(message_validation_kind
|
||||
.to_error(VersionSpecificValidationError::HasBlockAccessListPreAmsterdam))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Validate the presence of the `parentBeaconBlockRoot` field according to the given timestamp.
|
||||
/// This method is meant to be used with either a `payloadAttributes` field or a full payload, with
|
||||
/// the `engine_forkchoiceUpdated` and `engine_newPayload` methods respectively.
|
||||
@@ -342,10 +291,7 @@ pub fn validate_parent_beacon_block_root_presence<T: EthereumHardforks>(
|
||||
))
|
||||
}
|
||||
}
|
||||
EngineApiMessageVersion::V3 |
|
||||
EngineApiMessageVersion::V4 |
|
||||
EngineApiMessageVersion::V5 |
|
||||
EngineApiMessageVersion::V6 => {
|
||||
EngineApiMessageVersion::V3 | EngineApiMessageVersion::V4 | EngineApiMessageVersion::V5 => {
|
||||
if !has_parent_beacon_block_root {
|
||||
return Err(validation_kind
|
||||
.to_error(VersionSpecificValidationError::NoParentBeaconBlockRootPostCancun))
|
||||
@@ -418,14 +364,6 @@ where
|
||||
Type: PayloadAttributes,
|
||||
T: EthereumHardforks,
|
||||
{
|
||||
validate_block_access_list_presence(
|
||||
chain_spec,
|
||||
version,
|
||||
payload_or_attrs.message_validation_kind(),
|
||||
payload_or_attrs.timestamp(),
|
||||
payload_or_attrs.block_access_list().is_some(),
|
||||
)?;
|
||||
|
||||
validate_withdrawals_presence(
|
||||
chain_spec,
|
||||
version,
|
||||
@@ -464,10 +402,6 @@ pub enum EngineApiMessageVersion {
|
||||
///
|
||||
/// Added in the Osaka hardfork.
|
||||
V5 = 5,
|
||||
/// Version 6
|
||||
///
|
||||
/// Added in the Amsterdam hardfork
|
||||
V6 = 6,
|
||||
}
|
||||
|
||||
impl EngineApiMessageVersion {
|
||||
@@ -496,11 +430,6 @@ impl EngineApiMessageVersion {
|
||||
matches!(self, Self::V5)
|
||||
}
|
||||
|
||||
/// Returns true if version is V6
|
||||
pub const fn is_v6(&self) -> bool {
|
||||
matches!(self, Self::V6)
|
||||
}
|
||||
|
||||
/// Returns the method name for the given version.
|
||||
pub const fn method_name(&self) -> &'static str {
|
||||
match self {
|
||||
@@ -508,7 +437,7 @@ impl EngineApiMessageVersion {
|
||||
Self::V2 => "engine_newPayloadV2",
|
||||
Self::V3 => "engine_newPayloadV3",
|
||||
Self::V4 => "engine_newPayloadV4",
|
||||
Self::V5 | Self::V6 => "engine_newPayloadV5",
|
||||
Self::V5 => "engine_newPayloadV5",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ impl ExecutionPayload for ExecutionData {
|
||||
}
|
||||
|
||||
fn block_access_list(&self) -> Option<&Bytes> {
|
||||
self.payload.block_access_list()
|
||||
None
|
||||
}
|
||||
|
||||
fn parent_beacon_block_root(&self) -> Option<B256> {
|
||||
@@ -135,14 +135,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `block_access_list` from payload.
|
||||
pub fn block_access_list(&self) -> Option<&Bytes> {
|
||||
match self {
|
||||
Self::ExecutionPayload(payload) => payload.block_access_list(),
|
||||
Self::PayloadAttributes(_attributes) => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the timestamp from either the payload or attributes.
|
||||
pub fn timestamp(&self) -> u64 {
|
||||
match self {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
//! Amsterdam rules for new payloads.
|
||||
|
||||
use alloy_rpc_types_engine::PayloadError;
|
||||
use reth_primitives_traits::BlockBody;
|
||||
|
||||
/// Checks that block body contains withdrawals if Amsterdam is active and vv.
|
||||
#[inline]
|
||||
pub fn ensure_well_formed_fields<T: BlockBody>(
|
||||
block_body: &T,
|
||||
is_amsterdam_active: bool,
|
||||
) -> Result<(), PayloadError> {
|
||||
if is_amsterdam_active {
|
||||
if block_body.block_access_list().is_none() {
|
||||
// amsterdam active but no block access list present
|
||||
return Err(PayloadError::PostAmsterdamBlockWithoutBlockAccessList)
|
||||
}
|
||||
} else if block_body.block_access_list().is_some() {
|
||||
// amsterdam not active but block access list present
|
||||
return Err(PayloadError::PreAmsterdamBlockWithBlockAccessList)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub mod amsterdam;
|
||||
pub mod cancun;
|
||||
pub mod prague;
|
||||
pub mod shanghai;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user