Skip to content

Gloas fork choice redux#9025

Merged
mergify[bot] merged 110 commits intounstablefrom
gloas-walk-always
Apr 3, 2026
Merged

Gloas fork choice redux#9025
mergify[bot] merged 110 commits intounstablefrom
gloas-walk-always

Conversation

@michaelsproul
Copy link
Copy Markdown
Member

@michaelsproul michaelsproul commented Mar 24, 2026

Summary

Refined version of Gloas fork choice, removing some optimisations to yield a more readable implementation that more obviously aligns with the spec. The plan is to later introduce optimisations in a way that preserves spec similarity.

Differences from previous fork choice

  • best_child and best_descendant caching is removed.
  • ProtoNode.weight just includes attestation weight, to make calculating proposer boost simpler.

Schema migration

V29 schema migration encompasses several changes:

  • Drop deprecated justified_checkpoint and finalized_checkpoint from SszContainer
  • Drop previous_proposer_boost from SszContainer (proto array no longer needs it, it is only tracked on the fork choice store).
  • Subtract the proposer boost from all boosted nodes to ensure all proto nodes just have attestation weight (new paradigm).
  • Migrate VoteTrackerV28 (epoch-based) to VoteTracker (slot-based)
  • Migrate Vec<ProtoNodeV17> to Vec<ProtoNode> (add enum discriminant)
  • Drop queued_attestations: we do not need to persist these between restarts. New attestations will quickly replace any attestations that are one slot old.
  • V17 (pre-Gloas) and V29 (post-Gloas) nodes are allowed to coexist in the proto_nodes array. After the Gloas fork finalizes, we will be able to delete support for V17 nodes if we are happy with removing pre-Gloas fork choice.

hopinheimer and others added 30 commits February 19, 2026 23:07
Co-authored-by: Co-author hopinheimer <knmanas7@gmail.com>
Co-authored-by: Co-author brech1 <11075677+brech1@users.noreply.github.com>
@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Apr 2, 2026
Comment on lines +664 to +665
spec: &ChainSpec,
time_into_slot: Duration,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typical order is spec last

// direction). If this child is on the FULL path from the parent,
// all weight supports the parent's FULL virtual node, and vice versa.
if let Ok(child_v29) = node.as_v29() {
if child_v29.parent_payload_status == PayloadStatus::Full {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a match parent_payload_status, should we handle parent_payload_status == Pending?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be unreachable, right? Maybe we could consider using a more restrictive enum for the parent_payload_status (just Full or Empty).

@dapplion
Copy link
Copy Markdown
Collaborator

dapplion commented Apr 2, 2026

the attestation due deadline changes based on fork, fixed on dapplion@f45e420cf which also adds the exact fractions to the chainspec

Copy link
Copy Markdown
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside 2 minor details, good to go!

I checked the spec parity of all new functions in fork-choice and correctness of the new code. This PR regresses in performance introducing O(n^2) but we can fix easily later

…nSpec

Spec: `get_attestation_due_ms(epoch)` uses ATTESTATION_DUE_BPS_GLOAS
(2500) for Gloas epochs vs ATTESTATION_DUE_BPS (3333) pre-Gloas.
`get_payload_attestation_due_ms` uses PAYLOAD_ATTESTATION_DUE_BPS (7500).

- Add both BPS fields to ChainSpec with derived Duration values
- Add `get_attestation_due::<E>(slot)` that returns epoch-appropriate
  threshold matching the spec
- Add `get_payload_attestation_due()` matching the spec
- Use them in proto_array record_block_timeliness instead of hardcoded
  values
@mergify
Copy link
Copy Markdown

mergify Bot commented Apr 2, 2026

Some required checks have failed. Could you please take a look @michaelsproul? 🙏

@mergify mergify Bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Apr 2, 2026
@michaelsproul michaelsproul added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Apr 2, 2026
Copy link
Copy Markdown
Member

@hopinheimer hopinheimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sweet. 🚀

@hopinheimer hopinheimer mentioned this pull request Apr 3, 2026
Copy link
Copy Markdown
Member

@eserilev eserilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, going to press the big red button and merge this thing. This unlocks tons of ePBS stuff, thanks for all the hard work everyone <3

@eserilev eserilev added the ready-for-merge This PR is ready to merge. label Apr 3, 2026
@mergify mergify Bot added the queued label Apr 3, 2026
@mergify
Copy link
Copy Markdown

mergify Bot commented Apr 3, 2026

Merge Queue Status

This pull request spent 27 minutes 14 seconds in the queue, including 25 minutes 40 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request Apr 3, 2026
@mergify mergify Bot merged commit 65c2e01 into unstable Apr 3, 2026
38 checks passed
@mergify mergify Bot removed the queued label Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards-incompat Backwards-incompatible API change fork-choice gloas ready-for-merge This PR is ready to merge. ready-for-review The code is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants