Repository navigation
fix(blockchain): apply a VALID forkchoiceUpdated that names the payload the finalized block builds on - #992
Open
pablodeymo wants to merge 1 commit into
Open
pablodeymo wants to merge 1 commit into
pablodeymo wants to merge 1 commit into
Conversation
…ad the finalized block builds on A gloas head with no FULL payload from the finalized block up sends, as its head hash, the payload the finalized block builds on. The verdict's walk (`payload_holder`) goes from the head down to the finalized block and finds no block carrying that hash, so a `VALID` answer for it was dropped. That payload's verdict is the one the finalized block's `execution_optimistic` flag is read from, and the head's too while no payload above it is FULL. Left `NOT_VALIDATED` (the execution client was syncing when finality passed it, or a restart seeded it `SYNCING`), the node kept reporting the finalized block and the head as optimistic, and refused attestation data for that head, until a FULL payload was validated above finality. `apply_gloas_forkchoice_verdict` now compares the head hash with that payload's own when no holder is found and the answer is `VALID`, and moves its verdict to `VALID` on a match. `INVALID` for a payload below finality is still ignored: nothing at or below finality leaves fork choice. Part of #991.
Collaborator
Author
|
/review |
2 of 3 tasks
AI security review: 0 finding(s) to checkReviewed by GPT, Kimi, DeepSeek. No findings to check. Housekeeping (not security): 1Stale docs, missing tests, leftovers and inconsistencies, from a separate cheap model. Not checked by the judge.
Cost of this review: ~$0.53 of a $30 budget (estimated from token counts). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description / Motivation
The fix for #991 on
release/v2.0.1, for v2.0.1, on top of #989.A gloas head with no FULL payload from the finalized block up sends, as its head hash, the payload the finalized block builds on.
apply_gloas_forkchoice_verdictlooks for the block carrying that hash withpayload_holder, which walks from the head down to the finalized block. The payload belongs to a block below it, so the walk finds nothing and aVALIDanswer was dropped.That payload's verdict is the one #989 keeps through finality's prune. Two flags are read from it:
execution_optimistic, and that of every block it descends from;require_validated,503).So with that verdict
NOT_VALIDATED(the execution client was syncing when finality passed it, or a restart seeded itSYNCING), a node in a stretch of two or more epochs without a payload kept answering503for attestation data although the execution client had saidVALIDfor that very payload. It recovered with the next FULL payload validated above finality.What Changed
crates/blockchain/src/beacon_payloads.rsapply_gloas_forkchoice_verdict: whenpayload_holderfinds nothing and the answer isVALID, it callsvalidate_finalized_payload_base_namedwith the head hash.validate_finalized_payload_base_named(new): moves the payload the finalized block builds on toVALIDwhen the hash is that payload's own.unvalidated_finalized_payload_base(new): the lookup and theNOT_VALIDATEDcheck thatvalidate_finalized_payload_basealready did, shared by both.docs/rpc.md: one sentence in "execution_optimisticunder gloas".Correctness / Behavior Guarantees
VALIDanswer whose head hash equals the hash in that block's bid promotes it. The hashes are compared, as in fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #989.INVALIDfor a payload below finality is still ignored: nothing at or below finality leaves fork choice.SYNCINGandACCEPTEDchange nothing, as before.debug!line. The finalized block has no such payload then, so nothing is promoted.Tests Added / Run
New, in
beacon_payloads::tests:a_valid_answer_naming_the_payload_below_finality_validates_it: the finalized block and the head both read optimistic before the answer and neither does after. The head hash comes fromforkchoice_plan, so the test also pins that this is the hash sent.a_valid_answer_validates_the_payload_below_a_finalized_block_built_on_empty: the case the issue describes, with the finalized block itself built on an EMPTY parent.no_other_answer_validates_the_payload_below_finality:INVALIDandSYNCINGfor that hash, andVALIDfor a hash no block carries, promote nothing.The first two fail with the new call removed.
Run on this branch:
cargo fmt --all -- --checkandmake lint: clean.make test-consensusandmake test-node: passing, 4,586 tests, which is the 4,583 of fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #989 plus these three.Not run locally:
make test-ethrexand the spec-fixture tests (make test-beacon). Not run against a live Gloas network.Related Issues / PRs
VALIDforkchoiceUpdatedfor a head that builds on a payload below finality is dropped #991. It stays open untilmainhas the fix.main: the same patch is on fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #983 as986c78f8, which closes AVALIDforkchoiceUpdatedfor a head that builds on a payload below finality is dropped #991 when it merges.v2.0.1-rc.1is tagged at the commit this branch starts from, so the fix needs a new release candidate.execution_optimisticistruefor finalized blocks on a network past Gloas #981, fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #983, fix(storage): keep the payload verdict the finalized block's execution_optimistic flag is read from #989.✅ 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