Repository navigation
fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from - #989
Conversation
…n_optimistic flag is read from From gloas a block's flag is the verdict of the latest FULL payload it builds on. For the finalized block that payload is below it, and the finality prune dropped every verdict below the checkpoint's slot, so the finalized block and every block below it read as optimistic on a synced node. A skipped epoch boundary also dropped the finalized block's own verdict, which a child on its FULL branch reads. The prune now keeps both. A block below the finalized one answers with the finalized block's flag. A restart seeds the kept verdict, and a VALID answer for a head that builds on that payload validates it, since the execution-chain walk stops at the finalized block. Closes #981 (cherry picked from commit a4379c7)
|
/review |
AI security review: 1 finding(s) to checkReviewed by GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM3. Only finalized ancestors should inherit the finalized block’s verdict (medium, logic)
Duplicates folded into another finding: 2
Pre-existing (real, but already on the base branch): 2
Dismissed by the judge (likely not a problem): 1
Cost of this review: ~$1.09 of a $30 budget (estimated from token counts). |
…escends from A block below the finalized one answered with the finalized block's execution_optimistic flag on its slot alone. A block of a fork that lost stays stored after finality passes its slot and can be asked for by root, so it reported the finalized chain's verdict although nothing vouched for its own fork's payloads. The flag now goes only to a block the canonical index names at its slot, which below the finalized block are its ancestors. Any other block is read on its own, as before: with its verdict pruned a gloas one reads as optimistic.
|
/review |
AI security review: 1 finding(s) to checkReviewed by GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM4. Canonical ancestry check trusts the old head during a finality update (medium, consensus/state)
Duplicates folded into another finding: 1
Pre-existing (real, but already on the base branch): 2
Cost of this review: ~$1.27 of a $30 budget (estimated from token counts). |
…lized block The check that a block is an ancestor of the finalized one asks the canonical index, which follows the stored head. An import moves the finalized checkpoint first and recomputes the head after. In between the index still names the old head's branch, so when finality moved to another branch a block of the old one passed for an ancestor of the finalized block and took its execution_optimistic flag. The index now has to name the finalized block as well, asked first. Until the head has followed finality no block below the finalized one takes its flag, and each is read on its own.
|
/review |
AI security review: 0 finding(s) to checkReviewed by GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code. No findings to check. Duplicates folded into another finding: 2
Pre-existing (real, but already on the base branch): 2
Housekeeping (not security): 1Stale docs, missing tests, leftovers and inconsistencies, from a separate cheap model. Not checked by the judge.
Cost of this review: ~$1.16 of a $30 budget (estimated from token counts). |
🗒️ Description / Motivation
Backport of #983 to
release/v2.0.1, for v2.0.1. It fixes #981: on a network past Gloas, a synced node reportsexecution_optimistic: truefor the finalized block and every block below it. v2.0.0 lists this under known limitations, and Hoodi reaches Gloas on December 15.release/v2.0.1isv2.0.0(5340a088, the commit taggedv2.0.0-rc.3) plus the version bump, so v2.0.1 carries the ENR fork-digest fix of that commit and this one.#983 is not merged on
mainyet, and this does not wait for it. The two carry the same three commits: #983'sa4379c76and the two review fixes below, which are on #983 as28dc63deand99c92cc6. If review changes #983 further, the difference has to be ported here as well.What Changed
git cherry-pick a4379c76on top of5340a088, the commitrelease/v2.0.1branches from. It applied without conflicts, and the patch is identical to the one in #983 (samegit patch-id). Nothing was edited by hand. See #983 for the description of the change.4157d593fixes the finding of this PR's review (M3): a block below the finalized one took the finalized block's flag on its slot alone, so a stored block of a fork that lost reported the finalized chain's verdict. The flag now goes only to a block the canonical index names at its slot, which below the finalized block are its ancestors. Any other block is read on its own, as in v2.0.0.11cb3497fixes the finding of the second review (M4): the canonical index follows the head, and an import moves the finalized checkpoint before the head is recomputed, so a block of the old head's branch could pass for an ancestor of a finalized block on another branch. The index is now believed only once it names the finalized block too, asked first; until then no block below the finalized one takes its flag.7fe5531ais a merge ofrelease/v2.0.1(the version bump), so CI runs on the tree the release will have.Correctness / Behavior Guarantees
The same as #983. Two worth repeating for a patch release:
Tests Added / Run
Run on this branch (
5340a088plus the cherry-pick, before the version bump):cargo fmt --all -- --checkandmake lint: clean.make test-consensusandmake test-node: passing, including the tests fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #983 adds.Run again on
7fe5531aplus the review fix (the v2.0.1 tree): the same four, all passing, 4,582 tests. The new test,a_block_of_a_losing_fork_below_finality_does_not_take_the_finalized_flag, fails when the ancestry check is removed.Run once more on
11cb3497: the same four, all passing, 4,583 tests. Its test,a_block_of_the_old_heads_branch_does_not_take_the_finalized_flag, fails when the new condition is removed.The review's two pre-existing findings (M4, the pre-gloas payload under a gloas finalized block; M1, a
VALIDanswer for an EMPTY head that names the kept payload) are on the base already and are not changed here.Not run locally:
make test-ethrexand the spec-fixture tests (make test-beacon); CI covers them. Not yet run against a live Gloas network.Related Issues / PRs
execution_optimisticistruefor finalized blocks on a network past Gloas #981 (closed by fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #983 when it merges onmain).✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleanmake test(test-consensus,test-nodeandtest-ethrex, atrelease-fast) —test-consensusandtest-nodepassing;test-ethrexleft to CI