diff --git a/ACTIVATIONS.md b/ACTIVATIONS.md index 481d57989a..17578bcd87 100644 --- a/ACTIVATIONS.md +++ b/ACTIVATIONS.md @@ -7,14 +7,14 @@ and refresh the statuses when an activation is announced. Denim and Everest are contract-backed: an L1 upgrade signal (`crates/utilities/upgrade-signal`) can schedule them on a network with no new node release. Zenith can only be set in genesis. -Statuses checked 2026-11-13 against Base `v1.5.5` (`crates/common/chains/src/config.rs`). On both +Statuses checked 2026-11-18 against Base `v1.5.6` (`crates/common/chains/src/config.rs`). On both L1s, `getSchedule()` on the configured `protocol_versions_address` reverts, so no upgrade is scheduled through the signal; the schedules below are the ones in the code. | Upgrade | Base mainnet | Base Sepolia | Effect on the Firehose block | |---------|--------------|--------------|------------------------------| | Bedrock … Jovian | Active (Jovian 2025-12-02) | Active | Already in the stream. Canyon's `create2deployer` install is a direct DB write in `apply_pre_execution_changes`; it is emitted as a block-level code change when the block is traced with `v1.5.0-fh3.1` or later. | -| Azul | Active 2026-05-28 18:00 UTC | Active 2026-04-20 18:00 UTC | Already in the stream. | +| Azul | Active 2026-05-28 18:00 UTC | Active 2026-04-20 18:00 UTC | Already in the stream. Azul brings the EIP-7825 transaction gas limit cap (16,777,216). From `v1.5.6-fh3.1`, deposits are exempt from it during execution as well as validation: the root call of a deposit with a higher gas limit gets the whole limit minus the intrinsic gas, and only the gas it uses is reported. Covered by `crates/execution/firehose-tests/tests/deposit_gas.rs`. | | Beryl | Active 2026-06-25 18:00 UTC | Active 2026-06-18 18:00 UTC | Already in the stream. | | Cobalt | Active 2026-09-30 18:00 UTC | Active 2026-09-23 18:00 UTC | B-20 V2 precompiles. Covered by `etc/systems/tests/firehose_cobalt_b20.rs`. | | Denim | Active 2026-11-05 18:00 UTC (`1_793_901_600`); first Denim block is 53_556_127 at `1_793_901_601` | Active 2026-10-21 18:00 UTC (`1_792_605_600`) | See [Denim](#denim). Mainnet nodes need `v1.5.1-fh3.1` or later. | diff --git a/CHANGELOG.sf.md b/CHANGELOG.sf.md index af7458ecd2..7cf564ff7e 100644 --- a/CHANGELOG.sf.md +++ b/CHANGELOG.sf.md @@ -1,3 +1,14 @@ +## v1.5.6-fh3.1 + +### Changed + +* Rebased on upstream Base `v1.5.6`, recommended for Base mainnet and Base Sepolia with no + deadline. Uses `streamingfast/reth` `base-v2.5.2.11-fh3.1`; `firehose-tracer` stays on 5.7.0 and + the Firehose block model is unchanged. +* Upstream exempts deposit transactions from the EIP-7825 transaction gas limit cap during + execution. The root call of a deposit with a gas limit above 16,777,216 now gets the whole gas + limit minus the intrinsic gas, and its `gas_used` is only the gas it used. + ## v1.5.5-fh3.1 ### Changed diff --git a/Cargo.lock b/Cargo.lock index a3bd3b0a81..c28095cc4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2046,7 +2046,7 @@ dependencies = [ [[package]] name = "audit-archiver" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "audit-archiver-lib", @@ -2063,7 +2063,7 @@ dependencies = [ [[package]] name = "audit-archiver-lib" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "async-trait", @@ -2833,7 +2833,7 @@ dependencies = [ [[package]] name = "base" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "axum 0.8.9", @@ -2877,7 +2877,7 @@ dependencies = [ [[package]] name = "base-acceptance" -version = "1.5.5" +version = "1.5.6" dependencies = [ "chrono", "clap", @@ -2893,7 +2893,7 @@ dependencies = [ [[package]] name = "base-acceptance-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-acceptance", "clap", @@ -2902,7 +2902,7 @@ dependencies = [ [[package]] name = "base-action-harness" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -2969,7 +2969,7 @@ dependencies = [ [[package]] name = "base-balance-monitor" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-network 2.4.1", "alloy-node-bindings", @@ -2982,7 +2982,7 @@ dependencies = [ [[package]] name = "base-batcher-admin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-batcher-core", "base-runtime", @@ -2996,7 +2996,7 @@ dependencies = [ [[package]] name = "base-batcher-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-signer-local 2.4.1", @@ -3018,7 +3018,7 @@ dependencies = [ [[package]] name = "base-batcher-core" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -3043,7 +3043,7 @@ dependencies = [ [[package]] name = "base-batcher-encoder" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3069,7 +3069,7 @@ dependencies = [ [[package]] name = "base-batcher-service" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-node-bindings", "alloy-primitives", @@ -3111,7 +3111,7 @@ dependencies = [ [[package]] name = "base-batcher-source" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "base-blobs" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-primitives", @@ -3140,7 +3140,7 @@ dependencies = [ [[package]] name = "base-builder-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-builder-cli", "base-builder-core", @@ -3159,7 +3159,7 @@ dependencies = [ [[package]] name = "base-builder-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "base-builder-core", @@ -3179,7 +3179,7 @@ dependencies = [ [[package]] name = "base-builder-core" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-contract", @@ -3309,7 +3309,7 @@ dependencies = [ [[package]] name = "base-builder-metering" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "base-builder-core", @@ -3322,7 +3322,7 @@ dependencies = [ [[package]] name = "base-builder-multiplex" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3374,7 +3374,7 @@ dependencies = [ [[package]] name = "base-builder-publish" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-metrics", "base-ring-buffer", @@ -3394,7 +3394,7 @@ dependencies = [ [[package]] name = "base-bundles" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -3410,7 +3410,7 @@ dependencies = [ [[package]] name = "base-challenger" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3455,7 +3455,7 @@ dependencies = [ [[package]] name = "base-challenger-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-challenger", "base-cli-utils", @@ -3466,7 +3466,7 @@ dependencies = [ [[package]] name = "base-challenger-e2e" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-node-bindings", @@ -3494,7 +3494,7 @@ dependencies = [ [[package]] name = "base-challenger-e2e-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-challenger-e2e", "tokio", @@ -3504,7 +3504,7 @@ dependencies = [ [[package]] name = "base-cli-utils" -version = "1.5.5" +version = "1.5.6" dependencies = [ "backtrace", "base-metrics", @@ -3531,7 +3531,7 @@ dependencies = [ [[package]] name = "base-common-chains" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-eips 2.4.1", @@ -3546,7 +3546,7 @@ dependencies = [ [[package]] name = "base-common-consensus" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3583,7 +3583,7 @@ dependencies = [ [[package]] name = "base-common-eip8130" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -3593,7 +3593,7 @@ dependencies = [ [[package]] name = "base-common-evm" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3624,7 +3624,7 @@ dependencies = [ [[package]] name = "base-common-evm2" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3643,7 +3643,7 @@ dependencies = [ [[package]] name = "base-common-flashblocks" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-rpc-types-engine", @@ -3661,7 +3661,7 @@ dependencies = [ [[package]] name = "base-common-flz" -version = "1.5.5" +version = "1.5.6" dependencies = [ "criterion", "hex-literal 1.1.0", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "base-common-genesis" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-consensus 2.4.1", @@ -3693,7 +3693,7 @@ dependencies = [ [[package]] name = "base-common-l1-fees" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "base-common-flz", @@ -3702,7 +3702,7 @@ dependencies = [ [[package]] name = "base-common-network" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-network 2.4.1", @@ -3719,7 +3719,7 @@ dependencies = [ [[package]] name = "base-common-precompiles" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-evm", "alloy-primitives", @@ -3737,7 +3737,7 @@ dependencies = [ [[package]] name = "base-common-rpc-types" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3764,7 +3764,7 @@ dependencies = [ [[package]] name = "base-common-rpc-types-engine" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3787,7 +3787,7 @@ dependencies = [ [[package]] name = "base-common-signer" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3807,7 +3807,7 @@ dependencies = [ [[package]] name = "base-comp" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-common-genesis", "base-protocol", @@ -3818,7 +3818,7 @@ dependencies = [ [[package]] name = "base-consensus" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-consensus-cli", @@ -3827,7 +3827,7 @@ dependencies = [ [[package]] name = "base-consensus-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-genesis", @@ -3877,7 +3877,7 @@ dependencies = [ [[package]] name = "base-consensus-derive" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3908,7 +3908,7 @@ dependencies = [ [[package]] name = "base-consensus-disc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-rlp", "backon", @@ -3931,7 +3931,7 @@ dependencies = [ [[package]] name = "base-consensus-engine" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -3978,7 +3978,7 @@ dependencies = [ [[package]] name = "base-consensus-gossip" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-consensus 2.4.1", @@ -4018,7 +4018,7 @@ dependencies = [ [[package]] name = "base-consensus-node" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-consensus 2.4.1", @@ -4095,7 +4095,7 @@ dependencies = [ [[package]] name = "base-consensus-peers" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -4120,7 +4120,7 @@ dependencies = [ [[package]] name = "base-consensus-providers" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4158,7 +4158,7 @@ dependencies = [ [[package]] name = "base-consensus-rpc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-primitives", @@ -4187,7 +4187,7 @@ dependencies = [ [[package]] name = "base-consensus-safedb" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-primitives", @@ -4203,7 +4203,7 @@ dependencies = [ [[package]] name = "base-consensus-sources" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-rpc-client", @@ -4225,7 +4225,7 @@ dependencies = [ [[package]] name = "base-consensus-upgrades" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-primitives", @@ -4237,7 +4237,7 @@ dependencies = [ [[package]] name = "base-execution-chainspec" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-consensus 2.4.1", @@ -4262,7 +4262,7 @@ dependencies = [ [[package]] name = "base-execution-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4341,7 +4341,7 @@ dependencies = [ [[package]] name = "base-execution-consensus" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-consensus 2.4.1", @@ -4374,7 +4374,7 @@ dependencies = [ [[package]] name = "base-execution-eip8130" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -4393,7 +4393,7 @@ dependencies = [ [[package]] name = "base-execution-eip8130-rpc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4422,7 +4422,7 @@ dependencies = [ [[package]] name = "base-execution-eip8130-rpc-node" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-genesis", @@ -4447,7 +4447,7 @@ dependencies = [ [[package]] name = "base-execution-evm" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4479,7 +4479,7 @@ dependencies = [ [[package]] name = "base-execution-exex" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4505,7 +4505,7 @@ dependencies = [ [[package]] name = "base-execution-firehose" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-evm", @@ -4524,7 +4524,7 @@ dependencies = [ [[package]] name = "base-execution-payload-builder" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4582,7 +4582,7 @@ dependencies = [ [[package]] name = "base-execution-rpc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4659,7 +4659,7 @@ dependencies = [ [[package]] name = "base-execution-trie" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4713,7 +4713,7 @@ dependencies = [ [[package]] name = "base-execution-txpool" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4767,7 +4767,7 @@ dependencies = [ [[package]] name = "base-firehose-flashblocks" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4812,7 +4812,7 @@ dependencies = [ [[package]] name = "base-firehose-prestate" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-genesis", "base-common-chains", @@ -4830,7 +4830,7 @@ dependencies = [ [[package]] name = "base-firehose-tests" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4861,7 +4861,7 @@ dependencies = [ [[package]] name = "base-flashblocks" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -4919,7 +4919,7 @@ dependencies = [ [[package]] name = "base-flashblocks-node" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-contract", @@ -4976,7 +4976,7 @@ dependencies = [ [[package]] name = "base-health" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-transport-http", "async-trait", @@ -4998,7 +4998,7 @@ dependencies = [ [[package]] name = "base-jwt" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-provider", @@ -5014,7 +5014,7 @@ dependencies = [ [[package]] name = "base-l1-head" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-provider", @@ -5028,7 +5028,7 @@ dependencies = [ [[package]] name = "base-load-tester-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-network 2.4.1", "alloy-primitives", @@ -5049,7 +5049,7 @@ dependencies = [ [[package]] name = "base-load-tests" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5092,7 +5092,7 @@ dependencies = [ [[package]] name = "base-metering" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5138,7 +5138,7 @@ dependencies = [ [[package]] name = "base-metrics" -version = "1.5.5" +version = "1.5.6" dependencies = [ "ctor", "metrics", @@ -5148,7 +5148,7 @@ dependencies = [ [[package]] name = "base-node-core" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5225,7 +5225,7 @@ dependencies = [ [[package]] name = "base-node-runner" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-genesis", @@ -5255,6 +5255,7 @@ dependencies = [ "futures", "jsonrpsee", "reth-chainspec", + "reth-config", "reth-db", "reth-exex", "reth-ipc", @@ -5267,6 +5268,7 @@ dependencies = [ "reth-tasks", "reth-tracing", "serde_json", + "tempfile", "tokio", "tokio-tungstenite 0.28.0", "tower 0.5.3", @@ -5277,7 +5279,7 @@ dependencies = [ [[package]] name = "base-observability-events" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "base-metrics", @@ -5296,7 +5298,7 @@ dependencies = [ [[package]] name = "base-optimism-rpc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-network 2.4.1", @@ -5309,7 +5311,7 @@ dependencies = [ [[package]] name = "base-precompile-macros" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "proc-macro2", @@ -5319,7 +5321,7 @@ dependencies = [ [[package]] name = "base-precompile-storage" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-evm", "alloy-primitives", @@ -5335,7 +5337,7 @@ dependencies = [ [[package]] name = "base-proof" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5373,7 +5375,7 @@ dependencies = [ [[package]] name = "base-proof-client" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-evm", @@ -5396,7 +5398,7 @@ dependencies = [ [[package]] name = "base-proof-contracts" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-contract", "alloy-primitives", @@ -5414,7 +5416,7 @@ dependencies = [ [[package]] name = "base-proof-driver" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-evm", @@ -5434,7 +5436,7 @@ dependencies = [ [[package]] name = "base-proof-executor" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5468,7 +5470,7 @@ dependencies = [ [[package]] name = "base-proof-host" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5511,7 +5513,7 @@ dependencies = [ [[package]] name = "base-proof-mpt" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -5532,7 +5534,7 @@ dependencies = [ [[package]] name = "base-proof-preimage" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "async-channel", @@ -5546,7 +5548,7 @@ dependencies = [ [[package]] name = "base-proof-primitives" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-eips 2.4.1", @@ -5564,7 +5566,7 @@ dependencies = [ [[package]] name = "base-proof-rpc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-network 2.4.1", @@ -5593,7 +5595,7 @@ dependencies = [ [[package]] name = "base-proof-submission" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -5609,11 +5611,11 @@ dependencies = [ [[package]] name = "base-proof-succinct-elfs" -version = "1.5.5" +version = "1.5.6" [[package]] name = "base-proof-succinct-scripts" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "anyhow", @@ -5629,7 +5631,7 @@ dependencies = [ [[package]] name = "base-proof-tee-nitro-enclave" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-chains", "alloy-eips 2.4.1", @@ -5662,7 +5664,7 @@ dependencies = [ [[package]] name = "base-proof-tee-nitro-host" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -5694,7 +5696,7 @@ dependencies = [ [[package]] name = "base-proof-tee-nitro-verifier" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -5711,7 +5713,7 @@ dependencies = [ [[package]] name = "base-proof-tee-registrar" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -5753,7 +5755,7 @@ dependencies = [ [[package]] name = "base-proof-tee-registrar-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-signer-local 2.4.1", @@ -5771,7 +5773,7 @@ dependencies = [ [[package]] name = "base-proof-worker" -version = "1.5.5" +version = "1.5.6" dependencies = [ "async-trait", "backon", @@ -5787,7 +5789,7 @@ dependencies = [ [[package]] name = "base-proof-zk-backend" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -5822,7 +5824,7 @@ dependencies = [ [[package]] name = "base-proof-zk-host" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "async-trait", @@ -5839,7 +5841,7 @@ dependencies = [ [[package]] name = "base-proof-zk-utils" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5876,7 +5878,7 @@ dependencies = [ [[package]] name = "base-proof-zk-witness" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5911,7 +5913,7 @@ dependencies = [ [[package]] name = "base-proofs-extension" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-execution-exex", "base-execution-rpc", @@ -5928,7 +5930,7 @@ dependencies = [ [[package]] name = "base-proposer" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -5970,7 +5972,7 @@ dependencies = [ [[package]] name = "base-proposer-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-proposer", @@ -5982,7 +5984,7 @@ dependencies = [ [[package]] name = "base-protocol" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloc-no-stdlib", "alloy-consensus 2.4.1", @@ -6018,7 +6020,7 @@ dependencies = [ [[package]] name = "base-prover-nitro-enclave" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-proof-tee-nitro-enclave", "eyre", @@ -6027,7 +6029,7 @@ dependencies = [ [[package]] name = "base-prover-nitro-host" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "base-cli-utils", @@ -6049,7 +6051,7 @@ dependencies = [ [[package]] name = "base-prover-service" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "base-prover-service-db", @@ -6067,7 +6069,7 @@ dependencies = [ [[package]] name = "base-prover-service-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-prover-service", @@ -6084,7 +6086,7 @@ dependencies = [ [[package]] name = "base-prover-service-client" -version = "1.5.5" +version = "1.5.6" dependencies = [ "async-trait", "backon", @@ -6101,7 +6103,7 @@ dependencies = [ [[package]] name = "base-prover-service-db" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "anyhow", @@ -6120,7 +6122,7 @@ dependencies = [ [[package]] name = "base-prover-service-protocol" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "base-proof-primitives", @@ -6133,7 +6135,7 @@ dependencies = [ [[package]] name = "base-prover-zk-host" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-proof-worker", @@ -6153,7 +6155,7 @@ dependencies = [ [[package]] name = "base-reth-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "base-common-chains", @@ -6172,7 +6174,7 @@ dependencies = [ [[package]] name = "base-reth-node" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-common-genesis", @@ -6196,18 +6198,18 @@ dependencies = [ [[package]] name = "base-retry" -version = "1.5.5" +version = "1.5.6" dependencies = [ "backon", ] [[package]] name = "base-ring-buffer" -version = "1.5.5" +version = "1.5.6" [[package]] name = "base-roxy" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "axum 0.8.9", @@ -6221,7 +6223,7 @@ dependencies = [ [[package]] name = "base-roxy-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "base-cli-utils", @@ -6234,7 +6236,7 @@ dependencies = [ [[package]] name = "base-runtime" -version = "1.5.5" +version = "1.5.6" dependencies = [ "futures", "rand 0.9.5", @@ -6246,7 +6248,7 @@ dependencies = [ [[package]] name = "base-shadow-indexer" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -6280,7 +6282,7 @@ dependencies = [ [[package]] name = "base-shadow-indexer-db" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -6297,7 +6299,7 @@ dependencies = [ [[package]] name = "base-shadow-metrics" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-primitives", @@ -6316,7 +6318,7 @@ dependencies = [ [[package]] name = "base-shadow-metrics-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "axum 0.8.9", @@ -6331,7 +6333,7 @@ dependencies = [ [[package]] name = "base-sidecrush" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-provider", "alloy-rpc-types-eth 2.4.1", @@ -6344,7 +6346,7 @@ dependencies = [ [[package]] name = "base-sidecrush-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-sidecrush", "cadence", @@ -6356,7 +6358,7 @@ dependencies = [ [[package]] name = "base-snapshotter" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-provider", @@ -6383,7 +6385,7 @@ dependencies = [ [[package]] name = "base-snapshotter-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "aws-config", @@ -6400,7 +6402,7 @@ dependencies = [ [[package]] name = "base-snark-e2e" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-provider", @@ -6423,7 +6425,7 @@ dependencies = [ [[package]] name = "base-snark-e2e-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-snark-e2e", "tokio", @@ -6433,7 +6435,7 @@ dependencies = [ [[package]] name = "base-system-tests" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -6539,7 +6541,7 @@ dependencies = [ [[package]] name = "base-telemetry-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "base-cli-utils", @@ -6553,7 +6555,7 @@ dependencies = [ [[package]] name = "base-telemetry-service" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "anyhow", @@ -6583,7 +6585,7 @@ dependencies = [ [[package]] name = "base-test-utils" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-contract", @@ -6603,7 +6605,7 @@ dependencies = [ [[package]] name = "base-trusted-proxy" -version = "1.5.5" +version = "1.5.6" dependencies = [ "http 1.4.2", "ipnet", @@ -6613,7 +6615,7 @@ dependencies = [ [[package]] name = "base-tx-forwarding" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -6649,7 +6651,7 @@ dependencies = [ [[package]] name = "base-tx-manager" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -6685,7 +6687,7 @@ dependencies = [ [[package]] name = "base-txpool-rpc" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -6721,7 +6723,7 @@ dependencies = [ [[package]] name = "base-txpool-tracing" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-eips 2.4.1", @@ -6757,7 +6759,7 @@ dependencies = [ [[package]] name = "base-upgrade-signal" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-json-rpc 2.4.1", "alloy-primitives", @@ -6789,7 +6791,7 @@ dependencies = [ [[package]] name = "base-witness-diff" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-primitives", "alloy-provider", @@ -6815,7 +6817,7 @@ checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" [[package]] name = "base-zk-benchmarks" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-eips 2.4.1", "alloy-primitives", @@ -6833,7 +6835,7 @@ dependencies = [ [[package]] name = "base-zk-benchmarks-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-load-tests", @@ -6846,7 +6848,7 @@ dependencies = [ [[package]] name = "base-zk-fork-dispute" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-node-bindings", "alloy-primitives", @@ -6874,7 +6876,7 @@ dependencies = [ [[package]] name = "base-zk-fork-dispute-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "base-cli-utils", "base-zk-fork-dispute", @@ -6941,7 +6943,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basectl" -version = "1.5.5" +version = "1.5.6" dependencies = [ "anyhow", "basectl-cli", @@ -6953,7 +6955,7 @@ dependencies = [ [[package]] name = "basectl-cli" -version = "1.5.5" +version = "1.5.6" dependencies = [ "alloy-consensus 2.4.1", "alloy-contract", @@ -24181,7 +24183,7 @@ dependencies = [ [[package]] name = "websocket-proxy" -version = "1.5.5" +version = "1.5.6" dependencies = [ "axum 0.8.9", "backoff", @@ -24203,7 +24205,7 @@ dependencies = [ [[package]] name = "websocket-proxy-bin" -version = "1.5.5" +version = "1.5.6" dependencies = [ "axum 0.8.9", "base-cli-utils", diff --git a/Cargo.toml b/Cargo.toml index b59cde7eee..8350d4d702 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "1.5.5" +version = "1.5.6" edition = "2024" rust-version = "1.96" license = "MIT" @@ -356,6 +356,7 @@ reth-evm = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } reth-rpc = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } reth-revm = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } reth-errors = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } +reth-config = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } reth-trie = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } reth-exex = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } reth-tasks = { git = "https://github.com/base/reth", tag = "base-v2.5.2.11" } @@ -663,6 +664,7 @@ reth-cli = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77d reth-cli-commands = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 reth-cli-runner = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 reth-cli-util = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 +reth-config = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 reth-consensus = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 reth-consensus-common = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 reth-db = { git = "https://github.com/streamingfast/reth.git", rev = "24849d77dd91f190abdb6257366ef2d62dd63f55" } # base-v2.5.2.11-fh3.1 diff --git a/crates/common/evm/README.md b/crates/common/evm/README.md index e83040b83d..a2ed500622 100644 --- a/crates/common/evm/README.md +++ b/crates/common/evm/README.md @@ -27,6 +27,12 @@ let factory = BaseEvmFactory::default(); let precompiles = BasePrecompiles::new_with_spec(BaseSpecId::new(BaseUpgrade::Beryl)).install(); ``` +## Deposit execution gas + +Deposit transactions are exempt from the per-transaction gas limit cap. A deposit therefore +executes with its full declared gas limit, and only the gas it actually uses is reported as +used. Non-deposit transactions follow the standard transaction gas accounting unchanged. + ## License Licensed under the [MIT License](https://github.com/base/base/blob/main/LICENSE). diff --git a/crates/common/evm/src/handler.rs b/crates/common/evm/src/handler.rs index f5437195c9..960156c3e7 100644 --- a/crates/common/evm/src/handler.rs +++ b/crates/common/evm/src/handler.rs @@ -101,6 +101,19 @@ where self.mainnet.validate_env(evm) } + fn tx_gas(&self, evm: &mut Self::Evm, init_and_floor_gas: &InitialAndFloorGas) -> GasTracker { + let ctx = evm.ctx_ref(); + if ctx.tx().tx_type() != DEPOSIT_TRANSACTION_TYPE { + return self.mainnet.tx_gas(evm, init_and_floor_gas); + } + + // Deposits are exempt from the per-transaction gas limit cap. + let gas_limit = ctx.tx().gas_limit(); + let (remaining, reservoir) = + init_and_floor_gas.initial_gas_and_reservoir(gas_limit, u64::MAX); + GasTracker::new(gas_limit, remaining, reservoir) + } + fn validate_against_state_and_deduct_caller( &self, evm: &mut Self::Evm, @@ -398,9 +411,11 @@ where mod tests { use alloy_primitives::uint; + use alloy_sol_types::SolCall; use base_common_consensus::Predeploys; + use base_common_precompiles::{INonceManager, NonceManagerStorage}; use revm::{ - InspectEvm, + ExecuteEvm, InspectEvm, bytecode::Bytecode, context::{BlockEnv, CfgEnv, Context, TxEnv}, database::InMemoryDB, @@ -416,6 +431,88 @@ mod tests { use super::*; use crate::{BaseContext, BaseSpecId, BaseTransaction, Builder, DefaultBase, L1BlockInfo}; + /// A stateful precompile must not turn unused deposit gas into receipt gas used. + #[rstest] + #[case::cobalt(BaseUpgrade::Cobalt)] + #[case::denim(BaseUpgrade::Denim)] + #[case::everest(BaseUpgrade::Everest)] + fn deposit_precompile_gas_used_is_independent_of_limit(#[case] upgrade: BaseUpgrade) { + let run = |gas_limit| { + let tx = BaseTransaction::builder() + .base( + TxEnv::builder() + .caller(Address::repeat_byte(0x55)) + .kind(TxKind::Call(NonceManagerStorage::ADDRESS)) + .data(Bytes::from( + INonceManager::getNonceCall { + account: Address::repeat_byte(0x44), + nonceKey: U256::from(1), + } + .abi_encode(), + )) + .gas_limit(gas_limit) + .gas_price(0), + ) + .source_hash(B256::from([1u8; 32])) + .build_fill(); + let mut evm = Context::base() + .with_db(InMemoryDB::default()) + .with_cfg(CfgEnv::new_with_spec(BaseSpecId::new(upgrade))) + .build_base(); + let outcome = evm.transact(tx).expect("deposit must execute"); + assert!(outcome.result.is_success()); + assert_eq!( + INonceManager::getNonceCall::abi_decode_returns( + outcome.result.output().expect("precompile must return a nonce"), + ) + .unwrap(), + 0, + ); + outcome.result.tx_gas_used() + }; + assert_eq!(run(20_000_000), run(16_000_000)); + } + + /// Deposits are exempt from EIP-7825 during execution as well as validation. + #[rstest] + #[case::jovian(BaseUpgrade::Jovian)] + #[case::azul(BaseUpgrade::Azul)] + #[case::beryl(BaseUpgrade::Beryl)] + #[case::everest(BaseUpgrade::Everest)] + fn deposit_execution_uses_full_gas_limit( + #[case] upgrade: BaseUpgrade, + #[values(16_000_000, 16_777_216, 16_777_217, 20_000_000)] gas_limit: u64, + ) { + let target = Address::repeat_byte(0x44); + let mut db = InMemoryDB::default(); + // GAS PUSH1 0 MSTORE PUSH1 32 PUSH1 0 RETURN. + let code = Bytecode::new_raw(bytes!("5a60005260206000f3")); + db.insert_account_info( + target, + AccountInfo { code_hash: code.hash_slow(), code: Some(code), ..Default::default() }, + ); + let tx = BaseTransaction::builder() + .base( + TxEnv::builder() + .caller(Address::repeat_byte(0x55)) + .kind(TxKind::Call(target)) + .gas_limit(gas_limit) + .gas_price(0), + ) + .source_hash(B256::from([1u8; 32])) + .build_fill(); + let mut evm = Context::base() + .with_db(db) + .with_cfg(CfgEnv::new_with_spec(BaseSpecId::new(upgrade))) + .build_base(); + let outcome = evm.transact(tx).expect("deposit must execute"); + assert!(outcome.result.is_success()); + let output = outcome.result.output().expect("deposit must return GAS"); + // Empty calldata costs 21,000 intrinsic gas; GAS itself costs 2. + assert_eq!(U256::from_be_slice(output), U256::from(gas_limit - 21_000 - 2)); + assert_eq!(outcome.result.tx_gas_used(), 21_017); + } + /// Creates frame result. fn call_last_frame_return( ctx: BaseContext, diff --git a/crates/consensus/service/README.md b/crates/consensus/service/README.md index 516f44f92c..26c4880f06 100644 --- a/crates/consensus/service/README.md +++ b/crates/consensus/service/README.md @@ -119,7 +119,7 @@ The L1 watcher actor is the service's source of truth for L1 chain state. It run On each new head, the watcher computes the confirmation-delayed block number as `head.number - verifier_l1_confs`. If the delayed number is reachable it fetches that block by number via `AlloyL1BlockFetcher::get_block()` and sends it to the derivation actor as a `ProcessL1HeadUpdateRequest`. It also broadcasts the real head through the `watch::Sender>` and stores the real head number in the shared `Arc` so the `ConfDepthProvider` used by the derivation pipeline can gate its own L1 lookups. The derivation actor publishes the pipeline's L1 origin separately, and `optimism_syncStatus.current_l1` is served from that derivation-origin signal rather than from the raw L1 head. -Log fetching runs on the same head-update path. The watcher calls `AlloyL1BlockFetcher::get_logs()` with a filter for `SystemConfigLog` events from the rollup config's L1 system config address. If the logs contain a `SystemConfigUpdate::UnsafeBlockSigner` event it extracts the new signer address and sends it to the network actor via the `block_signer_sender` channel. The log fetch retries up to ten times with exponential backoff from 50 ms to 500 ms before the actor returns an error. +Log fetching runs on the same head-update path. The watcher calls `AlloyL1BlockFetcher::get_logs()` with a filter for `SystemConfigLog` events from the rollup config's L1 system config address. If the logs contain a `SystemConfigUpdate::UnsafeBlockSigner` event it extracts the new signer address and sends it to the network actor via the `block_signer_sender` channel. The log fetch retries with exponential backoff from 50 ms up to 5 s until it succeeds or the node shuts down, so an L1 RPC outage pauses the watcher instead of stopping the node, and the watcher resumes within a few seconds of L1 recovering. While it waits, the watcher keeps sending finalized L1 blocks to derivation and holds the next head it sees. It abandons the current head only after L1 reports a different block at that height, meaning the head was reorged out and the RPC may never serve its logs. A canonical head is never skipped, because its logs may carry a signer update. On each finalized block, the watcher sends the block directly to the derivation actor as a `ProcessFinalizedL1Block` without any confirmation delay. diff --git a/crates/consensus/service/src/actors/l1_watcher/actor.rs b/crates/consensus/service/src/actors/l1_watcher/actor.rs index 1ca41b4839..2e14e85b5d 100644 --- a/crates/consensus/service/src/actors/l1_watcher/actor.rs +++ b/crates/consensus/service/src/actors/l1_watcher/actor.rs @@ -41,14 +41,16 @@ use crate::{ pub struct LogRetrier; impl LogRetrier { - /// Fetch logs matching `filter` with capped exponential backoff, trying up to 10 times. + /// Fetch logs matching `filter`, retrying with capped exponential backoff until the fetch + /// succeeds or `cancel` fires. /// - /// Returns `Ok(Some(logs))` on success, `Ok(None)` if `cancel` fires during a backoff sleep, - /// or `Err(`[`L1WatcherActorError::RetriesExhausted`]`)` once all attempts fail. + /// Returns `Some(logs)` on success and `None` once `cancel` fires, whether during a request + /// or a backoff sleep. /// - /// Provider failures, including request timeouts, use the same bounded retry path. Exhausting - /// those attempts returns an actor error so the node service can shut down instead of waiting - /// indefinitely on an L1 request. + /// There is no attempt limit. Every L1 RPC failure is treated as transient, because exiting + /// cannot help: a restarted node needs the same L1 to start and to make progress. Retrying + /// keeps the node alive through an L1 outage, so it resumes as soon as L1 recovers. Each + /// request is still bounded by the provider's request timeout. /// /// `initial_backoff` and `max_backoff` are caller-supplied so tests can use tiny values. pub async fn fetch_logs_with_retry( @@ -58,16 +60,20 @@ impl LogRetrier { block_info: BlockInfo, initial_backoff: Duration, max_backoff: Duration, - ) -> Result>, L1WatcherActorError> + ) -> Option> where F: L1BlockFetcher, { - const MAX_RETRIES: u32 = 10; - let mut backoff = initial_backoff; - for attempt in 1..=MAX_RETRIES { - match provider.get_logs(filter.clone()).await { - Ok(logs) => return Ok(Some(logs)), + let mut attempt: u64 = 0; + loop { + attempt += 1; + let result = select! { + _ = cancel.cancelled() => return None, + result = provider.get_logs(filter.clone()) => result, + }; + match result { + Ok(logs) => return Some(logs), Err(e) => { warn!( target: "l1_watcher", @@ -75,26 +81,17 @@ impl LogRetrier { block_hash = %block_info.hash, block_number = block_info.number, attempt, + retry_in = ?backoff, "Failed to fetch logs for L1 head" ); - if attempt < MAX_RETRIES { - select! { - _ = cancel.cancelled() => return Ok(None), - _ = tokio::time::sleep(backoff) => {} - } - backoff = (backoff * 2).min(max_backoff); + select! { + _ = cancel.cancelled() => return None, + _ = tokio::time::sleep(backoff) => {} } + backoff = (backoff * 2).min(max_backoff); } } } - - error!( - target: "l1_watcher", - block_hash = %block_info.hash, - block_number = block_info.number, - "Exhausted retries fetching logs for L1 head" - ); - Err(L1WatcherActorError::RetriesExhausted) } } @@ -185,7 +182,15 @@ where /// Start the main processing loop. async fn start(mut self, _: Self::StartData) -> Result<(), Self::Error> { const INITIAL_BACKOFF: Duration = Duration::from_millis(50); - const MAX_BACKOFF: Duration = Duration::from_millis(500); + // Caps the retry interval during an L1 outage so the watcher resumes within a few + // seconds of L1 recovering without flooding the provider while it is down. + const MAX_BACKOFF: Duration = Duration::from_secs(5); + // How often to check whether a head whose logs keep failing has been reorged out, once + // a newer head is waiting. One L1 slot. + const REORG_CHECK_INTERVAL: Duration = Duration::from_secs(12); + // Bound on one reorg check, so a slow L1 cannot hold up the finalized stream or the + // log fetch for long. + const REORG_CHECK_TIMEOUT: Duration = Duration::from_secs(2); Metrics::l1_verifier_confs_depth().set(self.verifier_l1_confs as f64); if self.verifier_l1_confs > 0 { @@ -198,124 +203,188 @@ where let cancel = self.cancellation.clone(); - loop { - select! { - _ = cancel.cancelled() => { - // Exit the task on cancellation. - info!( - target: "l1_watcher", - "Received shutdown signal. Exiting L1 watcher task." - ); + // A head that arrived while logs for an older head were still being fetched. It is + // processed next, ahead of the streams. + let mut superseding_head: Option = None; - return Ok(()); + loop { + let head_block_info = match superseding_head.take() { + Some(head) => head, + None => select! { + _ = cancel.cancelled() => { + // Exit the task on cancellation. + info!( + target: "l1_watcher", + "Received shutdown signal. Exiting L1 watcher task." + ); + + return Ok(()); + }, + new_head = self.head_stream.next() => match new_head { + None => { + return Err(L1WatcherActorError::StreamEnded); + } + Some(head_block_info) => head_block_info, + }, + new_finalized = self.finalized_stream.next() => match new_finalized { + None => { + return Err(L1WatcherActorError::StreamEnded); + } + Some(finalized_block_info) => { + self.derivation_client.send_finalized_l1_block(finalized_block_info).await.map_err(|e| { + warn!(target: "l1_watcher", error = %e, "Error sending finalized l1 block update to derivation actor"); + L1WatcherActorError::DerivationClientError(e) + })?; + continue; + } + }, }, - new_head = self.head_stream.next() => match new_head { - None => { - return Err(L1WatcherActorError::StreamEnded); + }; + + // Always broadcast the real head so the sequencer's + // DelayedL1OriginSelectorProvider can compute its own offset. + self.latest_head.send_replace(Some(head_block_info)); + + // Update the shared atomic so the ConfDepthProvider in the + // derivation pipeline can enforce the confirmation depth cutoff. + self.l1_head_number.store(head_block_info.number, Ordering::Relaxed); + + // Apply verifier confirmation delay: derive from + // `head - verifier_l1_confs` when the chain is deep enough. + let derivation_block = + if self.verifier_l1_confs > 0 && head_block_info.number >= self.verifier_l1_confs { + let target = head_block_info.number - self.verifier_l1_confs; + // Delayed block reads are best effort. A request timeout is handled + // like any other fetch error: skip this head and try the next one. + match self.l1_provider.get_block(BlockId::Number(target.into())).await { + Ok(Some(block)) => block.into_consensus().into(), + Ok(None) => { + Metrics::l1_verifier_delayed_fetch_errors().increment(1); + warn!( + target: "l1_watcher", + head = head_block_info.number, + target, + "Delayed L1 block not found; skipping head update" + ); + continue; + } + Err(e) => { + Metrics::l1_verifier_delayed_fetch_errors().increment(1); + warn!( + target: "l1_watcher", + error = %e, + head = head_block_info.number, + target, + "Failed to fetch delayed L1 block; skipping head update" + ); + continue; + } } - Some(head_block_info) => { - // Always broadcast the real head so the sequencer's - // DelayedL1OriginSelectorProvider can compute its own offset. - self.latest_head.send_replace(Some(head_block_info)); - - // Update the shared atomic so the ConfDepthProvider in the - // derivation pipeline can enforce the confirmation depth cutoff. - self.l1_head_number.store(head_block_info.number, Ordering::Relaxed); - - // Apply verifier confirmation delay: derive from - // `head - verifier_l1_confs` when the chain is deep enough. - let derivation_block = if self.verifier_l1_confs > 0 - && head_block_info.number >= self.verifier_l1_confs - { - let target = head_block_info.number - self.verifier_l1_confs; - // Delayed block reads are best effort. A request timeout is handled - // like any other fetch error: skip this head and try the next one. - match self.l1_provider.get_block(BlockId::Number(target.into())).await { - Ok(Some(block)) => block.into_consensus().into(), - Ok(None) => { - Metrics::l1_verifier_delayed_fetch_errors().increment(1); - warn!( - target: "l1_watcher", - head = head_block_info.number, - target, - "Delayed L1 block not found; skipping head update" - ); - continue; - } - Err(e) => { - Metrics::l1_verifier_delayed_fetch_errors().increment(1); - warn!( - target: "l1_watcher", - error = %e, - head = head_block_info.number, - target, - "Failed to fetch delayed L1 block; skipping head update" - ); - continue; - } - } - } else { - head_block_info - }; - - Metrics::l1_verifier_derivation_head() - .absolute(derivation_block.number); - self.derivation_client.send_new_l1_head(derivation_block).await.map_err(|e| { - warn!(target: "l1_watcher", error = %e, "Error sending l1 head update to derivation actor"); - L1WatcherActorError::DerivationClientError(e) - })?; - - // For each log, attempt to construct a [`SystemConfigLog`]. - // Build the [`SystemConfigUpdate`] from the log. - // If the update is an Unsafe block signer update, send the address - // to the block signer sender. - let filter_address = self.rollup_config.l1_system_config_address; - let filter = Filter::new() - .address(filter_address) - .select(derivation_block.hash); - - // Log requests are retried with bounded backoff. If all attempts time out - // or otherwise fail, the actor returns an error instead of hanging. - let Some(logs) = LogRetrier::fetch_logs_with_retry( - &self.l1_provider, - filter, - &cancel, - derivation_block, - INITIAL_BACKOFF, - MAX_BACKOFF, - ) - .await? - else { - return Ok(()); - }; - let ecotone_active = - self.rollup_config.is_ecotone_active(derivation_block.timestamp); - for log in logs { - let sys_cfg_log = SystemConfigLog::new(log.into(), ecotone_active); - if let Ok(SystemConfigUpdate::UnsafeBlockSigner(UnsafeBlockSignerUpdate { unsafe_block_signer })) = sys_cfg_log.build() { - info!( - target: "l1_watcher", - "Unsafe block signer update: {unsafe_block_signer}" - ); - if let Some(ref block_signer_sender) = self.block_signer_sender && let Err(e) = block_signer_sender.send(unsafe_block_signer).await { - error!( - target: "l1_watcher", - "Error sending unsafe block signer update: {e}" - ); - } - } + } else { + head_block_info + }; + + Metrics::l1_verifier_derivation_head().absolute(derivation_block.number); + self.derivation_client.send_new_l1_head(derivation_block).await.map_err(|e| { + warn!(target: "l1_watcher", error = %e, "Error sending l1 head update to derivation actor"); + L1WatcherActorError::DerivationClientError(e) + })?; + + // For each log, attempt to construct a [`SystemConfigLog`]. + // Build the [`SystemConfigUpdate`] from the log. + // If the update is an Unsafe block signer update, send the address + // to the block signer sender. + let filter_address = self.rollup_config.l1_system_config_address; + let filter = Filter::new().address(filter_address).select(derivation_block.hash); + + // Log requests are retried until they succeed or the node shuts down, so an L1 + // outage pauses this watcher instead of exiting the node. While waiting, the finalized + // stream is still served. The first head that arrives meanwhile is kept + // and processed next, and the head stream is not polled again until then. + // + // This head is abandoned only once L1 reports a different block at its height, that + // is, once it has been reorged out and the RPC may never serve its logs. A canonical + // head is never abandoned, because its logs may carry an unsafe block signer update + // that later heads' filters would not include. + let fetch = LogRetrier::fetch_logs_with_retry( + &self.l1_provider, + filter, + &cancel, + derivation_block, + INITIAL_BACKOFF, + MAX_BACKOFF, + ); + tokio::pin!(fetch); + let mut next_reorg_check = tokio::time::Instant::now() + REORG_CHECK_INTERVAL; + let mut newer_head: Option = None; + let logs = loop { + select! { + logs = &mut fetch => match logs { + Some(logs) => break Some(logs), + None => return Ok(()), + }, + new_head = self.head_stream.next(), if newer_head.is_none() => match new_head { + None => return Err(L1WatcherActorError::StreamEnded), + Some(new_head) => newer_head = Some(new_head), + }, + new_finalized = self.finalized_stream.next() => match new_finalized { + None => return Err(L1WatcherActorError::StreamEnded), + Some(finalized_block_info) => { + self.derivation_client.send_finalized_l1_block(finalized_block_info).await.map_err(|e| { + warn!(target: "l1_watcher", error = %e, "Error sending finalized l1 block update to derivation actor"); + L1WatcherActorError::DerivationClientError(e) + })?; } }, - }, - new_finalized = self.finalized_stream.next() => match new_finalized { - None => { - return Err(L1WatcherActorError::StreamEnded); + _ = tokio::time::sleep_until(next_reorg_check), if newer_head.is_some() => { + let canonical = select! { + _ = cancel.cancelled() => return Ok(()), + block = tokio::time::timeout( + REORG_CHECK_TIMEOUT, + self.l1_provider + .get_block(BlockId::Number(derivation_block.number.into())), + ) => block, + }; + if let Ok(Ok(Some(block))) = canonical + && block.header.hash != derivation_block.hash + { + break None; + } + next_reorg_check = tokio::time::Instant::now() + REORG_CHECK_INTERVAL; } - Some(finalized_block_info) => { - self.derivation_client.send_finalized_l1_block(finalized_block_info).await.map_err(|e| { - warn!(target: "l1_watcher", error = %e, "Error sending finalized l1 block update to derivation actor"); - L1WatcherActorError::DerivationClientError(e) - })?; + } + }; + superseding_head = newer_head; + let Some(logs) = logs else { + warn!( + target: "l1_watcher", + block_hash = %derivation_block.hash, + block_number = derivation_block.number, + new_head = ?superseding_head.map(|head| head.number), + "L1 head was reorged out before its logs were fetched; moving to the newer head" + ); + continue; + }; + let ecotone_active = self.rollup_config.is_ecotone_active(derivation_block.timestamp); + for log in logs { + let sys_cfg_log = SystemConfigLog::new(log.into(), ecotone_active); + if let Ok(SystemConfigUpdate::UnsafeBlockSigner(UnsafeBlockSignerUpdate { + unsafe_block_signer, + })) = sys_cfg_log.build() + { + info!( + target: "l1_watcher", + signer = %unsafe_block_signer, + "Unsafe block signer update" + ); + if let Some(ref block_signer_sender) = self.block_signer_sender + && let Err(e) = block_signer_sender.send(unsafe_block_signer).await + { + error!( + target: "l1_watcher", + error = %e, + "Error sending unsafe block signer update" + ); } } } @@ -394,6 +463,86 @@ mod tests { } } + /// Fetcher whose log requests never complete, standing in for a hung L1 request. + /// + /// Hand-rolled like the other fetcher doubles in this module: `L1BlockFetcher` has no + /// automock, and a mockall expectation cannot return a future that never resolves. + struct PendingFetcher; + + #[async_trait] + impl L1BlockFetcher for PendingFetcher { + type Error = String; + + async fn get_logs(&self, _: Filter) -> Result, Self::Error> { + futures::future::pending().await + } + + async fn get_block(&self, _: BlockId) -> Result, Self::Error> { + Ok(None) + } + } + + /// Fetcher whose log requests fail a set number of times for one block hash, standing in + /// for an RPC that is briefly flaky for, or no longer serves, that block. Reports + /// `canonical` as the block hash at every height and records the hashes whose logs were + /// fetched. + /// + /// Hand-rolled like the other fetcher doubles in this module: `L1BlockFetcher` has no + /// automock, and the fake needs failure state shared across calls keyed on the filter. + struct HashFailingFetcher { + failing: B256, + failures_left: AtomicU32, + canonical: B256, + hang_block_lookup: bool, + fetched: Arc>>, + } + + impl HashFailingFetcher { + fn new(failing: B256, failures: u32, canonical: B256) -> Self { + Self { + failing, + failures_left: AtomicU32::new(failures), + canonical, + hang_block_lookup: false, + fetched: Arc::new(Mutex::new(Vec::new())), + } + } + + /// Makes block lookups never complete, standing in for a hung L1 request. + fn with_hanging_block_lookup(mut self) -> Self { + self.hang_block_lookup = true; + self + } + } + + #[async_trait] + impl L1BlockFetcher for HashFailingFetcher { + type Error = String; + + async fn get_logs(&self, filter: Filter) -> Result, Self::Error> { + let hash = filter.get_block_hash().expect("watcher filters logs by block hash"); + if hash == self.failing + && self + .failures_left + .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |n| n.checked_sub(1)) + .is_ok() + { + return Err("unknown block".to_string()); + } + self.fetched.lock().unwrap().push(hash); + Ok(vec![]) + } + + async fn get_block(&self, _: BlockId) -> Result, Self::Error> { + if self.hang_block_lookup { + std::future::pending::<()>().await; + } + let mut block: Block = Block::default(); + block.header.hash = self.canonical; + Ok(Some(block)) + } + } + fn dummy_block() -> BlockInfo { BlockInfo { hash: B256::ZERO, number: 0, parent_hash: B256::ZERO, timestamp: 0 } } @@ -505,6 +654,10 @@ mod tests { fn sent_heads(&self) -> Vec { self.heads.lock().unwrap().clone() } + + fn sent_finalized(&self) -> Vec { + self.finalized.lock().unwrap().clone() + } } // --------------------------------------------------------------------------- @@ -557,8 +710,40 @@ mod tests { (derivation_client, l1_head_rx, l1_head_number) } + /// Run an [`L1WatcherActor`] with the given head and finalized streams for at most + /// `run_for`, with verifier confirmations disabled. + /// + /// Returns whether the actor exited on its own within that time, and the derivation client. + async fn run_actor_for( + fetcher: F, + head_stream: BoxedBlockStream, + finalized_stream: BoxedBlockStream, + run_for: Duration, + ) -> (bool, RecordingDerivationClient) { + let derivation_client = RecordingDerivationClient::default(); + let actor = L1WatcherActor::new( + Arc::new(RollupConfig::default()), + fetcher, + watch::channel(None).0, + derivation_client.clone(), + None, + CancellationToken::new(), + head_stream, + finalized_stream, + 0, + Arc::new(AtomicU64::new(0)), + ); + let exited = tokio::time::timeout(run_for, actor.start(())).await.is_ok(); + (exited, derivation_client) + } + + /// A stream that yields `blocks` and then stays open without yielding. + fn open_stream(blocks: Vec) -> BoxedBlockStream { + Box::pin(futures::stream::iter(blocks).chain(futures::stream::pending())) + } + // --------------------------------------------------------------------------- - // LogRetrier tests (unchanged) + // LogRetrier tests // --------------------------------------------------------------------------- #[tokio::test] @@ -573,7 +758,7 @@ mod tests { Duration::from_nanos(1), ) .await; - assert!(matches!(result, Ok(Some(_)))); + assert!(result.is_some()); } #[tokio::test] @@ -588,13 +773,15 @@ mod tests { Duration::from_nanos(1), ) .await; - assert!(matches!(result, Ok(Some(_)))); + assert!(result.is_some()); } - #[tokio::test] - async fn fetch_logs_exhausted_retries_returns_error() { + #[tokio::test(start_paused = true)] + async fn fetch_logs_keeps_retrying_through_long_outage() { + // Fail far more often than any fixed attempt budget would allow; the retrier must + // keep going rather than give up and take the node down. let cancel = CancellationToken::new(); - let fetcher = MockFetcher::always_fail(); + let fetcher = MockFetcher::fail_times(1_000); let call_count = Arc::clone(&fetcher.call_count); let result = LogRetrier::fetch_logs_with_retry( &fetcher, @@ -605,25 +792,187 @@ mod tests { Duration::from_nanos(1), ) .await; - assert!(matches!(result, Err(L1WatcherActorError::RetriesExhausted))); - assert_eq!(call_count.load(Ordering::SeqCst), 10); + assert!(result.is_some()); + assert_eq!(call_count.load(Ordering::SeqCst), 1_001); } - #[tokio::test] + #[tokio::test(start_paused = true)] async fn fetch_logs_cancelled_during_backoff_returns_none() { let cancel = CancellationToken::new(); - // Pre-cancel so the very first backoff sleep resolves to the cancel arm. - cancel.cancel(); - let result = LogRetrier::fetch_logs_with_retry( - &MockFetcher::always_fail(), + let fetcher = MockFetcher::always_fail(); + let retry = LogRetrier::fetch_logs_with_retry( + &fetcher, Filter::new(), &cancel, dummy_block(), - Duration::from_secs(10), // long sleep ensures only the cancel arm fires + Duration::from_secs(10), // long sleep ensures only the cancel arm can end it Duration::from_secs(10), + ); + // The first request fails at once, so the retrier is in its backoff sleep by the time + // the cancellation fires. + let cancel_later = async { + tokio::time::sleep(Duration::from_secs(1)).await; + cancel.cancel(); + }; + let (result, ()) = tokio::join!(retry, cancel_later); + assert!(result.is_none()); + } + + #[tokio::test(start_paused = true)] + async fn fetch_logs_cancelled_during_request_returns_none() { + let cancel = CancellationToken::new(); + let retry = LogRetrier::fetch_logs_with_retry( + &PendingFetcher, + Filter::new(), + &cancel, + dummy_block(), + Duration::from_secs(10), + Duration::from_secs(10), + ); + // The request never completes, so the retrier is waiting on it when cancelled. + let cancel_later = async { + tokio::time::sleep(Duration::from_secs(1)).await; + cancel.cancel(); + }; + let (result, ()) = tokio::join!(retry, cancel_later); + assert!(result.is_none()); + } + + #[tokio::test(start_paused = true)] + async fn actor_survives_long_l1_log_outage() { + // With the production backoff, 30 consecutive failures span well over a minute of + // simulated outage. The actor must ride it out instead of exiting. + let fetcher = MockFetcher::fail_times(30); + let call_count = Arc::clone(&fetcher.call_count); + let (exited, client) = run_actor_for( + fetcher, + open_stream(vec![block_at(1)]), + open_stream(vec![]), + Duration::from_secs(10 * 60), + ) + .await; + + assert!(!exited, "actor exited during the L1 outage"); + assert_eq!(client.sent_heads().len(), 1); + assert_eq!(call_count.load(Ordering::SeqCst), 31); + } + + #[tokio::test(start_paused = true)] + async fn newer_head_replaces_head_whose_logs_cannot_be_fetched() { + // Logs for a reorged-out block may never be served again. Once L1 reports a different + // block at its height, a newer head must take over so the stale block cannot pin the + // watcher. + let stale = block_at(1); + // L1 now reports a different block at the stale head's height. + let fetcher = HashFailingFetcher::new(stale.hash, u32::MAX, B256::repeat_byte(0xff)); + let fetched = Arc::clone(&fetcher.fetched); + + let (exited, client) = run_actor_for( + fetcher, + open_stream(vec![stale, block_at(2)]), + open_stream(vec![]), + Duration::from_secs(5 * 60), + ) + .await; + + assert!(!exited); + let sent: Vec<_> = client.sent_heads().iter().map(|b| b.number).collect(); + assert_eq!(sent, vec![1, 2]); + assert_eq!(*fetched.lock().unwrap(), vec![block_at(2).hash]); + } + + #[tokio::test(start_paused = true)] + async fn briefly_failing_head_logs_are_fetched_before_newer_head() { + // A newer head arriving during a short L1 hiccup must not cost the current head its + // logs, which may carry an unsafe block signer update. + let first = block_at(1); + let fetcher = HashFailingFetcher::new(first.hash, 3, first.hash); + let fetched = Arc::clone(&fetcher.fetched); + + let (exited, client) = run_actor_for( + fetcher, + open_stream(vec![first, block_at(2)]), + open_stream(vec![]), + Duration::from_secs(5 * 60), ) .await; - assert!(matches!(result, Ok(None))); + + assert!(!exited); + let sent: Vec<_> = client.sent_heads().iter().map(|b| b.number).collect(); + assert_eq!(sent, vec![1, 2]); + assert_eq!(*fetched.lock().unwrap(), vec![first.hash, block_at(2).hash]); + } + + #[tokio::test(start_paused = true)] + async fn hung_reorg_check_does_not_stall_finalized_blocks() { + // A reorg check runs once a newer head waits. If it hangs during the outage, the + // finalized block arriving later must still reach derivation, and the head must not be + // abandoned. + let first = block_at(1); + let fetcher = + HashFailingFetcher::new(first.hash, u32::MAX, first.hash).with_hanging_block_lookup(); + let late_finalized: BoxedBlockStream = Box::pin( + futures::stream::once(Box::pin(async { + tokio::time::sleep(Duration::from_secs(60)).await; + block_at(7) + })) + .chain(futures::stream::pending()), + ); + + let (exited, client) = run_actor_for( + fetcher, + open_stream(vec![first, block_at(2)]), + late_finalized, + Duration::from_secs(5 * 60), + ) + .await; + + assert!(!exited); + let finalized: Vec<_> = client.sent_finalized().iter().map(|b| b.number).collect(); + assert_eq!(finalized, vec![7]); + let sent: Vec<_> = client.sent_heads().iter().map(|b| b.number).collect(); + assert_eq!(sent, vec![1]); + } + + #[tokio::test(start_paused = true)] + async fn canonical_head_is_not_abandoned_during_long_outage() { + // A canonical head's logs may carry a signer update that later heads' filters miss, so + // the watcher keeps retrying it however long the outage lasts, even with a newer head + // waiting. + let first = block_at(1); + let fetcher = HashFailingFetcher::new(first.hash, u32::MAX, first.hash); + let fetched = Arc::clone(&fetcher.fetched); + + let (exited, client) = run_actor_for( + fetcher, + open_stream(vec![first, block_at(2)]), + open_stream(vec![]), + Duration::from_secs(30 * 60), + ) + .await; + + assert!(!exited); + let sent: Vec<_> = client.sent_heads().iter().map(|b| b.number).collect(); + assert_eq!(sent, vec![1]); + assert!(fetched.lock().unwrap().is_empty()); + } + + #[tokio::test(start_paused = true)] + async fn finalized_blocks_reach_derivation_while_head_logs_are_failing() { + let head = block_at(1); + let fetcher = HashFailingFetcher::new(head.hash, u32::MAX, head.hash); + + let (exited, client) = run_actor_for( + fetcher, + open_stream(vec![head]), + open_stream(vec![block_at(7)]), + Duration::from_secs(5 * 60), + ) + .await; + + assert!(!exited); + let finalized: Vec<_> = client.sent_finalized().iter().map(|b| b.number).collect(); + assert_eq!(finalized, vec![7]); } // --------------------------------------------------------------------------- diff --git a/crates/consensus/service/src/actors/l1_watcher/error.rs b/crates/consensus/service/src/actors/l1_watcher/error.rs index def4e0516c..377b5043a7 100644 --- a/crates/consensus/service/src/actors/l1_watcher/error.rs +++ b/crates/consensus/service/src/actors/l1_watcher/error.rs @@ -20,9 +20,6 @@ pub enum L1WatcherActorError { /// Stream ended unexpectedly. #[error("Stream ended unexpectedly")] StreamEnded, - /// All retries were exhausted fetching logs for a block. - #[error("retries exhausted fetching logs")] - RetriesExhausted, /// Derivation client error. #[error("derivation client error: {0}")] DerivationClientError(#[from] DerivationClientError), diff --git a/crates/execution/cli/src/commands/download.rs b/crates/execution/cli/src/commands/download.rs index d8cfdf5970..c8c9596f57 100644 --- a/crates/execution/cli/src/commands/download.rs +++ b/crates/execution/cli/src/commands/download.rs @@ -4,16 +4,23 @@ //! Base-specific proofs database is downloaded separately by [`ProofsDownloader`] //! from the same snapshot source and manifest. -use std::{ffi::OsString, path::PathBuf, sync::Arc}; +use std::{ + ffi::OsString, + fs, + path::{Path, PathBuf}, + sync::Arc, + time::SystemTime, +}; use base_execution_chainspec::BaseChainSpec; +use base_node_runner::MerkleStageDefaults; use clap::Parser; use eyre::Result; use reth_chainspec::EthChainSpec; use reth_cli::chainspec::ChainSpecParser; use reth_cli_commands::download::DownloadCommand; use reth_node_core::args::DatadirArgs; -use tracing::info; +use tracing::{info, warn}; mod proofs; pub use proofs::{ @@ -48,32 +55,51 @@ impl> BaseDownloadCommand { pub async fn execute(self) -> Result<()> { let Self { inner, proofs } = self; - let (data_dir, chain_id) = if proofs { - let chain = inner - .chain_spec() - .ok_or_else(|| eyre::eyre!("--proofs flag is only on Base"))? - .chain(); - let chain_id = chain.id(); - let dir = resolve_datadir_args(std::env::args_os()).resolve_datadir(chain); - info!(target: "reth::cli", datadir = %dir.data_dir().display(), "Resolved datadir for proofs download"); - (Some(dir), Some(chain_id)) - } else { - (None, None) - }; - - inner.execute::().await?; - - if let (Some(data_dir), Some(chain_id)) = (data_dir, chain_id) { + let chain = inner + .chain_spec() + .ok_or_else(|| eyre::eyre!("download requires a Base chain spec"))? + .chain(); + let data_dir = resolve_datadir_args(std::env::args_os()).resolve_datadir(chain); + if proofs { + info!(target: "reth::cli", datadir = %data_dir.data_dir().display(), "Resolved datadir for proofs download"); + } + let config_path = data_dir.config(); + let config_modified_before = modified_at(&config_path); + + let manifest_download = inner.execute::().await?.is_some(); + + // Only manifest downloads generate reth.toml, and only for a new or cleared datadir; a + // `--url` archive may ship its own. + let config_modified_after = modified_at(&config_path); + if manifest_download + && config_modified_after.is_some() + && config_modified_after != config_modified_before + && let Err(error) = MerkleStageDefaults::apply(&config_path) + { + warn!( + target: "reth::cli", + %error, + path = %config_path.display(), + "failed to write merkle stage defaults to reth.toml" + ); + } + + if proofs { let target_dir = data_dir.data_dir().to_path_buf(); let concurrency = resolve_download_concurrency_arg(std::env::args_os()); let manifest_url = resolve_manifest_url_arg(std::env::args_os()); - ProofsDownloader::run(&target_dir, chain_id, concurrency, manifest_url).await?; + ProofsDownloader::run(&target_dir, chain.id(), concurrency, manifest_url).await?; } Ok(()) } } +/// Returns when `path` was last modified, or `None` if it does not exist. +fn modified_at(path: &Path) -> Option { + fs::metadata(path).and_then(|metadata| metadata.modified()).ok() +} + /// Extracts `--datadir` from the current process args without doing a second /// permissive clap parse of the whole command. fn resolve_datadir_args(args: impl IntoIterator) -> DatadirArgs { diff --git a/crates/execution/firehose-tests/Cargo.toml b/crates/execution/firehose-tests/Cargo.toml index cbb46220b8..fb23f80570 100644 --- a/crates/execution/firehose-tests/Cargo.toml +++ b/crates/execution/firehose-tests/Cargo.toml @@ -47,6 +47,10 @@ path = "tests/prestate.rs" name = "eip8130" path = "tests/eip8130.rs" +[[test]] +name = "deposit_gas" +path = "tests/deposit_gas.rs" + [dev-dependencies] k256.workspace = true sha2.workspace = true diff --git a/crates/execution/firehose-tests/tests/deposit_gas.rs b/crates/execution/firehose-tests/tests/deposit_gas.rs new file mode 100644 index 0000000000..906784b81e --- /dev/null +++ b/crates/execution/firehose-tests/tests/deposit_gas.rs @@ -0,0 +1,85 @@ +//! Firehose tracing of deposit transaction gas, run through the real Base executor and the +//! Firehose wrapper on an Everest genesis, where the EIP-7825 transaction gas limit cap applies. +//! +//! Deposits are exempt from the cap: a deposit executes with its whole declared gas limit, and +//! only the gas it uses is reported. The traced root call and receipt must show the same. + +use alloy_genesis::{Genesis, GenesisAccount}; +use alloy_primitives::{Address, B256, Sealed, TxKind, U256, address, bytes}; +use base_common_consensus::{BaseTxEnvelope, TxDeposit}; +use base_firehose_tests::{BlockInvariants, TraceContext, run_block}; +use base_test_utils::build_test_genesis_everest; +use firehose_tracer::pb::sf::ethereum::r#type::v2::{self as pbeth, TransactionTrace}; + +/// Contract whose code is `GAS PUSH1 0 MSTORE PUSH1 32 PUSH1 0 RETURN`: it returns the gas left +/// when it starts executing. +const GAS_ECHO: Address = address!("0x0000000000000000000000000000000000006a50"); +const DEPOSITOR: Address = address!("0x0000000000000000000000000000000000de9051"); +const BENEFICIARY: Address = address!("0x4200000000000000000000000000000000000011"); + +/// Intrinsic gas of a call with empty calldata. +const INTRINSIC_GAS: u64 = 21_000; +/// Gas the contract uses: `GAS` (2), three `PUSH1` (9), `MSTORE` with one memory word (6). +const EXECUTION_GAS: u64 = 17; + +#[test] +fn deposit_root_call_gets_its_full_gas_limit() { + for gas_limit in [16_000_000, 16_777_216, 16_777_217, 20_000_000] { + let trx = run_deposit(gas_limit); + + assert_eq!(pbeth::transaction_trace::Type::TrxTypeOptimismDeposit as i32, trx.r#type); + assert_eq!(pbeth::TransactionTraceStatus::Succeeded as i32, trx.status); + assert_eq!(gas_limit, trx.gas_limit, "gas limit {gas_limit}"); + + let root = &trx.calls[0]; + assert_eq!(GAS_ECHO.as_slice(), root.address.as_slice()); + assert_eq!(gas_limit - INTRINSIC_GAS, root.gas_limit, "gas limit {gas_limit}"); + assert_eq!(EXECUTION_GAS, root.gas_consumed, "gas limit {gas_limit}"); + // `GAS` itself costs 2 before it pushes the gas left. + let gas_left = U256::from(gas_limit - INTRINSIC_GAS - 2); + assert_eq!(gas_left.to_be_bytes::<32>().to_vec(), root.return_data); + + let gas_used = INTRINSIC_GAS + EXECUTION_GAS; + assert_eq!(gas_used, trx.gas_used, "gas limit {gas_limit}"); + let receipt = trx.receipt.as_ref().expect("receipt"); + assert_eq!(gas_used, receipt.cumulative_gas_used, "gas limit {gas_limit}"); + } +} + +fn run_deposit(gas_limit: u64) -> TransactionTrace { + let genesis = genesis(); + let deposit = TxDeposit { + source_hash: B256::repeat_byte(0x01), + from: DEPOSITOR, + to: TxKind::Call(GAS_ECHO), + mint: 0, + value: U256::ZERO, + gas_limit, + is_system_transaction: false, + input: Default::default(), + }; + let tx = BaseTxEnvelope::Deposit(Sealed::new(deposit)); + let outcome = run_block(&genesis, &context(&genesis), vec![tx]).expect("block runs"); + BlockInvariants::assert(&outcome.block).expect("block invariants hold"); + outcome.block.transaction_traces.into_iter().next().expect("one transaction") +} + +fn genesis() -> Genesis { + let mut genesis = build_test_genesis_everest(); + genesis.alloc.insert( + GAS_ECHO, + GenesisAccount { code: Some(bytes!("5a60005260206000f3")), ..Default::default() }, + ); + genesis +} + +const fn context(genesis: &Genesis) -> TraceContext { + TraceContext { + number: 1, + timestamp: genesis.timestamp + 2, + gas_limit: 30_000_000, + miner: BENEFICIARY, + base_fee_per_gas: Some(1), + difficulty: Some(U256::ZERO), + } +} diff --git a/crates/execution/runner/Cargo.toml b/crates/execution/runner/Cargo.toml index c90c6b91a1..4a68f434ba 100644 --- a/crates/execution/runner/Cargo.toml +++ b/crates/execution/runner/Cargo.toml @@ -18,6 +18,7 @@ base-test-utils = { workspace = true, optional = true } # reth reth-db.workspace = true reth-exex.workspace = true +reth-config.workspace = true reth-rpc-api.workspace = true reth-provider.workspace = true reth-node-builder.workspace = true @@ -71,6 +72,7 @@ tracing-subscriber = { workspace = true, optional = true } base-protocol.workspace = true base-common-evm.workspace = true base-node-runner = { path = ".", features = ["test-utils"] } +tempfile.workspace = true serde_json.workspace = true tokio-tungstenite.workspace = true criterion = { workspace = true, features = ["async_tokio", "html_reports"] } diff --git a/crates/execution/runner/README.md b/crates/execution/runner/README.md index 5fe03d4159..d409a04a11 100644 --- a/crates/execution/runner/README.md +++ b/crates/execution/runner/README.md @@ -11,6 +11,7 @@ aliases for building modular node extensions. - **`BaseNodeExtension`**: Trait for node extensions that can apply additional wiring to the builder. - **`FromExtensionConfig`**: Trait for extensions that can be constructed from a configuration type. - **`BaseNodeRunner`**: Orchestrates Base node wiring and launch. +- **`MerkleStageDefaults`**: Writes a merkle `rebuild_threshold` suited to 200ms blocks when a `reth.toml` is created, by `BaseNodeRunner` before launch or by `snapshot download`. - **`NodeHooks`**: Hook accumulator used by extensions to register RPC and node-start hooks. - **`BaseNodeBuilder`**: Type alias for the node builder with launch context. - **`BaseProvider`**: Type alias for the blockchain provider instance. diff --git a/crates/execution/runner/src/lib.rs b/crates/execution/runner/src/lib.rs index c938375cac..f4024309e8 100644 --- a/crates/execution/runner/src/lib.rs +++ b/crates/execution/runner/src/lib.rs @@ -13,6 +13,9 @@ pub use builder::{BaseNodeAdapter, BaseRpcContext, NodeHooks, RethNodeBuilder}; mod extension; pub use extension::{BaseNodeExtension, FromExtensionConfig}; +mod merkle; +pub use merkle::MerkleStageDefaults; + mod runner; pub use runner::{BaseNodeRunner, LaunchedBaseNode}; diff --git a/crates/execution/runner/src/merkle.rs b/crates/execution/runner/src/merkle.rs new file mode 100644 index 0000000000..618bbd5f6d --- /dev/null +++ b/crates/execution/runner/src/merkle.rs @@ -0,0 +1,96 @@ +//! Base defaults for the merkle stage section of `reth.toml`. + +use std::path::Path; + +use eyre::Result; +use reth_config::Config; +use tracing::info; + +/// Merkle stage settings tuned for Base's 200ms blocks, written when a `reth.toml` is created. +#[derive(Debug, Clone, Copy, Eq, PartialEq)] +pub struct MerkleStageDefaults; + +impl MerkleStageDefaults { + /// Pipeline ranges longer than this many blocks rebuild the whole trie instead of applying + /// the range's changes. + /// + /// A mainnet rebuild takes 7-8 hours whatever the range. Reth's default of 100,000 blocks is + /// about 5.5 hours of 200ms blocks, so each rebuild ends more than 100,000 blocks behind and + /// the next pipeline round rebuilds again: a node restored from a snapshot older than that + /// never reaches the tip. 450,000 blocks (25 hours) keeps day-old snapshots incremental and + /// stays below reth's default 500,000-block hashing clean threshold, past which pruned nodes + /// skip the changesets an incremental run reads. + pub const REBUILD_THRESHOLD: u64 = 450_000; + + /// Creates the `reth.toml` at `path` with reth's defaults and [`Self::REBUILD_THRESHOLD`]. + /// + /// An existing file is left as it is. + pub fn create(path: &Path) -> Result<()> { + if path.exists() { + return Ok(()); + } + Self::apply(path) + } + + /// Sets [`Self::REBUILD_THRESHOLD`] in the `reth.toml` at `path`, creating it with reth's + /// defaults when missing. Call only on a file that was just generated. + pub fn apply(path: &Path) -> Result<()> { + let mut config = Config::from_path(path)?; + config.stages.merkle.rebuild_threshold = Self::REBUILD_THRESHOLD; + config.save(path)?; + info!( + target: "base-runner", + path = %path.display(), + rebuild_threshold = Self::REBUILD_THRESHOLD, + "wrote merkle stage rebuild threshold" + ); + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use reth_config::config::MerkleConfig; + + use super::*; + + fn rebuild_threshold(path: &Path) -> u64 { + Config::from_path(path).unwrap().stages.merkle.rebuild_threshold + } + + #[test] + fn create_writes_base_threshold_to_missing_config() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("reth.toml"); + + MerkleStageDefaults::create(&path).unwrap(); + + assert_eq!(rebuild_threshold(&path), MerkleStageDefaults::REBUILD_THRESHOLD); + } + + #[test] + fn create_leaves_existing_config_untouched() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("reth.toml"); + Config::default().save(&path).unwrap(); + + MerkleStageDefaults::create(&path).unwrap(); + + assert_eq!(rebuild_threshold(&path), MerkleConfig::default().rebuild_threshold); + } + + #[test] + fn apply_sets_base_threshold_and_keeps_other_settings() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("reth.toml"); + let mut config = Config::default(); + config.stages.merkle.incremental_threshold = 1_000; + config.save(&path).unwrap(); + + MerkleStageDefaults::apply(&path).unwrap(); + + let loaded = Config::from_path(&path).unwrap(); + assert_eq!(loaded.stages.merkle.rebuild_threshold, MerkleStageDefaults::REBUILD_THRESHOLD); + assert_eq!(loaded.stages.merkle.incremental_threshold, 1_000); + } +} diff --git a/crates/execution/runner/src/runner.rs b/crates/execution/runner/src/runner.rs index 305b60b0db..7121354fce 100644 --- a/crates/execution/runner/src/runner.rs +++ b/crates/execution/runner/src/runner.rs @@ -12,10 +12,10 @@ use eyre::Result; use reth_node_builder::{Node, NodeHandle, NodeHandleFor}; use reth_provider::providers::BlockchainProvider; use tokio::sync::broadcast; -use tracing::info; +use tracing::{info, warn}; use crate::{ - BaseNodeBuilder, BaseNodeExtension, FromExtensionConfig, NodeHooks, + BaseNodeBuilder, BaseNodeExtension, FromExtensionConfig, MerkleStageDefaults, NodeHooks, node::BaseNode, service::{DefaultPayloadServiceBuilder, PayloadServiceBuilder}, }; @@ -162,6 +162,18 @@ impl BaseNodeRunner { /// handle without waiting for shutdown. pub async fn launch(self, builder: BaseNodeBuilder) -> Result { info!(target: "base-runner", "starting custom Base node"); + let node_config = builder.config(); + let config_path = + node_config.config.clone().unwrap_or_else(|| node_config.datadir().config()); + // A failed write must not block startup; reth then creates the file with its own defaults. + if let Err(error) = MerkleStageDefaults::create(&config_path) { + warn!( + target: "base-runner", + %error, + path = %config_path.display(), + "failed to create reth.toml with merkle stage defaults" + ); + } let Self { rollup_args, diff --git a/etc/docs-index.toml b/etc/docs-index.toml index 0991c9aca1..417dc8da84 100644 --- a/etc/docs-index.toml +++ b/etc/docs-index.toml @@ -212,7 +212,7 @@ digest = "e0d063f6c5" ["crates/common/evm/README.md"] summary = "Base revm-based EVM support: upgrade-to-SpecId mapping, BaseEvmFactory, block executors, receipt builders, and create2 deployer handling. Use when changing per-upgrade execution rules." -digest = "835735d39b" +digest = "0bfaf33862" ["crates/common/evm2/README.md"] summary = "Scaffold for Base's EVM2 integration (BaseEvmTypes, currently mirroring stock Ethereum), not wired into the node, for differential testing against revm. Use when working on EVM2 groundwork." @@ -308,7 +308,7 @@ digest = "030a8cd22a" ["crates/consensus/service/README.md"] summary = "Consensus node composition layer: actor model, RollupNode vs FollowNode, startup sequence, and each actor (engine, derivation, sequencer, network, L1 watcher, RPC). Read to understand node wiring." -digest = "07a60f6111" +digest = "9b6ffcbc45" ["crates/consensus/service/src/actors/network/README.md"] summary = "Overview and example of the network actor, which owns libp2p gossip and discv5 discovery, built via NetworkBuilder or with_transport for tests. Use when wiring or testing the P2P actor." @@ -388,7 +388,7 @@ digest = "2a3542b962" ["crates/execution/runner/README.md"] summary = "base-node-runner: BaseNodeExtension, FromExtensionConfig and NodeHooks for node extensions, plus the frozen-payload notification channel (PayloadReady) the unified sequencer uses to seal early." -digest = "029ce212e6" +digest = "20a419164e" ["crates/execution/shadow-indexer-db/README.md"] summary = "One-line stub: database access layer for shadow indexer block persistence. Little detail beyond that."