Skip to content

Initialize anchor PTC vote arrays in get_forkchoice_store - #5545

Merged
jihoonsong merged 13 commits into
ethereum:masterfrom
0xsamalt:fix-gloas-anchor-payload-vote-arrays
Aug 24, 2026
Merged

Initialize anchor PTC vote arrays in get_forkchoice_store#5545
jihoonsong merged 13 commits into
ethereum:masterfrom
0xsamalt:fix-gloas-anchor-payload-vote-arrays

Conversation

@0xsamalt

@0xsamalt 0xsamalt commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

get_forkchoice_store initializes the store's PTC vote arrays (payload_timeliness_vote and payload_data_availability_vote) for every block added via on_block, but leaves the anchor root out. Since payload_timeliness, payload_data_availability, and on_payload_attestation_message require every known block root to be present in these arrays, the anchor breaks the invariant: get_head fails with an AssertionError once the anchor is a previous-slot payload decision with its payload delivered, because should_extend_payload consults payload_timeliness on the anchor root.

Initialize both arrays for the anchor root with no votes cast ([None] * PTC_SIZE), matching on_block. test_genesis previously codified the missing arrays as expected behavior; it now asserts that the anchor's vote arrays are initialized with no votes recorded, and a regression test covers get_head with the anchor's payload delivered.

Checklist

  • Update documentation: not applicable, the fix is in the spec itself
  • Add tests for new functionality: added test_get_head_with_anchor_payload_delivered and updated test_genesis
  • Run make lint to check formatting
  • Run make test to check tests

Relations

None

@github-actions github-actions Bot added testing CI, actions, tests, testing infra gloas labels Aug 14, 2026
@github-actions github-actions Bot added the heze label Aug 16, 2026

@jtraglia jtraglia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for this @0xsamalt!

@jtraglia
jtraglia enabled auto-merge (squash) August 19, 2026 03:33
@jtraglia
jtraglia disabled auto-merge August 19, 2026 13:07
@0xsamalt
0xsamalt requested a review from jtraglia August 19, 2026 14:26
Comment on lines 344 to 348
if block.slot > slot:
# [Modified in Gloas:EIP7732]
if block.parent_root not in store.blocks:
return node
parent = ForkChoiceNode(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, I don't think I like this fix. Seems like a hack. Also the annotation (modified in gloas) is over the wrong thing now. I believe @jihoonsong is looking at this. Let's see what he thinks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The issue is related to Heze genesis, not here. I'll make a commit, which will exclude this change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After looking into this, it was not about Heze genesis either. See the other comment.

@jihoonsong

jihoonsong commented Aug 20, 2026

Copy link
Copy Markdown
Member

After reviewing this PR, I've concluded that the proposed spec change is correct. #5135 removed wrongly seeding the PTC arrays with True. Later, #5180 introduced None votes and it seems this spec change should've included there.

However, the new test case is unreachable. I think there are two cases relevant to this change: genesis block and checkpoint sync. The genesis block is always EMPTY post-Gloas (see #5172 for more context) and during checkpoint syncing, the anchor block cannot be from the previous slot. Hence, the test is removed in 745433f.

While I think it's unreachable that the PTC arrays being accessed by anchor root, I believe having this code makes the invariant hold without an exception as the author described.

@nflaig nflaig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, this matches what lodestar does, but this code should not be reachable as @jihoonsong pointed out as we only evaluate ptc votes near the tip, ie. for payload status of a block from current_slot - 1 but the finalized anchor during checkpoint sync is at least 2 epochs behind the current epoch

@jihoonsong
jihoonsong enabled auto-merge (squash) August 21, 2026 10:10
@jihoonsong
jihoonsong merged commit 93a0f8b into ethereum:master Aug 24, 2026
18 checks passed
@0xsamalt
0xsamalt deleted the fix-gloas-anchor-payload-vote-arrays branch August 24, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gloas heze testing CI, actions, tests, testing infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants