Skip to content

fix(blockchain): apply a VALID forkchoiceUpdated that names the payload the finalized block builds on - #992

Open
pablodeymo wants to merge 1 commit into
release/v2.0.1from
fix/991-valid-fcu-payload-below-finality
Open

pablodeymo wants to merge 1 commit into
release/v2.0.1from
fix/991-valid-fcu-payload-below-finality

Conversation

@pablodeymo

@pablodeymo pablodeymo commented Dec 5, 2026 •

Copy link
Copy Markdown
Collaborator

🗒️ 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_verdict looks for the block carrying that hash with payload_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 a VALID answer was dropped.

That payload's verdict is the one #989 keeps through finality's prune. Two flags are read from it:

  • the finalized block's execution_optimistic, and that of every block it descends from;
  • the head's, while no payload above the finalized block is FULL. An optimistic head is refused attestation data, aggregates and payload attestation data (require_validated, 503).

So with that verdict NOT_VALIDATED (the execution client was syncing when finality passed it, or a restart seeded it SYNCING), a node in a stretch of two or more epochs without a payload kept answering 503 for attestation data although the execution client had said VALID for that very payload. It recovered with the next FULL payload validated above finality.

What Changed

  • crates/blockchain/src/beacon_payloads.rs
    • apply_gloas_forkchoice_verdict: when payload_holder finds nothing and the answer is VALID, it calls validate_finalized_payload_base_named with the head hash.
    • validate_finalized_payload_base_named (new): moves the payload the finalized block builds on to VALID when the hash is that payload's own.
    • unvalidated_finalized_payload_base (new): the lookup and the NOT_VALIDATED check that validate_finalized_payload_base already did, shared by both.
  • docs/rpc.md: one sentence in "execution_optimistic under gloas".

Correctness / Behavior Guarantees

  • Only a VALID answer 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.
  • INVALID for a payload below finality is still ignored: nothing at or below finality leaves fork choice. SYNCING and ACCEPTED change nothing, as before.
  • A head whose parent payload is below the index (a checkpoint anchor) still ends in the same debug! line. The finalized block has no such payload then, so nothing is promoted.
  • No storage change. The verdicts are in memory only.

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 from forkchoice_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: INVALID and SYNCING for that hash, and VALID for a hash no block carries, promote nothing.

The first two fail with the new call removed.

Run on this branch:

Not run locally: make test-ethrex and the spec-fixture tests (make test-beacon). Not run against a live Gloas network.

Related Issues / PRs

✅ Verification Checklist

  • Ran make fmt — clean
  • Ran make lint (clippy with -D warnings) — clean
  • Ran make test (test-consensus, test-node and test-ethrex, at release-fast) — test-consensus and test-node passing; test-ethrex left to CI

…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.
@pablodeymo

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

AI security review: 0 finding(s) to check

Reviewed by GPT, Kimi, DeepSeek.
GLM (error, see the run log), Opus (error, see the run log) did not finish; GPT, Kimi, DeepSeek reviewed the whole PR. Comment /review continue to retry, with a new budget; reviewers that finished are reused.

No findings to check.

Housekeeping (not security): 1

Stale docs, missing tests, leftovers and inconsistencies, from a separate cheap model. Not checked by the judge.

Kind Item Where Fix
stale-docs seed_resumed_payload_statuses doc says payloads are 'never promoted' without the seed function — new code can now promot crates/blockchain/src/beacon_payloads.rs:404 Update the doc comment to say that without seeding the payload reads as Syncing and can be promoted by a VALID answer that names it directly, or remove the 'is never promoted' claim since new promotion paths exist.

Cost of this review: ~$0.53 of a $30 budget (estimated from token counts).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant