Skip to content

fix: handle genesis block in gloas fork choice and genesis state init - #9149

Merged
nflaig merged 1 commit into
ChainSafe:epbs-devnet-1from
barnabasbusa:epbs-devnet-1
Apr 1, 2026
Merged

fix: handle genesis block in gloas fork choice and genesis state init#9149
nflaig merged 1 commit into
ChainSafe:epbs-devnet-1from
barnabasbusa:epbs-devnet-1

Conversation

@barnabasbusa

Copy link
Copy Markdown
Contributor

Summary

  • Fork choice fix: Handle genesis block's all-zeros parentRoot in getParentPayloadStatus() — returns PayloadStatus.FULL instead of throwing PROTO_ARRAY_ERROR_UNKNOWN_PARENT_BLOCK. This fixes the mainnet preset crash at block production time.
  • Genesis init fix: Guard latestExecutionPayloadHeader assignments in initializeBeaconStateFromEth1() with fork < ForkSeq.gloas since this field was removed in gloas (EIP-7732), replaced by latestExecutionPayloadBid.

Note on minimal preset SSZ crash

The minimal preset crash (First offset must equal to fixedEnd 109509 != 11589) is a genesis generator issue, not Lodestar. The difference of 97920 bytes exactly matches ptcWindow size with mainnet PTC_SIZE=512 vs minimal PTC_SIZE=2 — the genesis generator (ethpandaops/ethereum-genesis-generator:gloas-genesis) appears to use mainnet's PTC_SIZE when generating minimal preset states.

Test plan

  • All fork-choice unit tests pass (104/104)
  • Beacon-node fork choice tests pass
  • Type check passes
  • Lint passes
  • Test with Kurtosis devnet using mainnet preset

🤖 Generated with Claude Code

- Fix PROTO_ARRAY_ERROR_UNKNOWN_PARENT_BLOCK at block production by
  treating genesis block (parentRoot=0x00..00) as FULL in
  getParentPayloadStatus()
- Guard latestExecutionPayloadHeader assignments in genesis init to
  skip for gloas (field was removed in EIP-7732)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@barnabasbusa
barnabasbusa requested a review from a team as a code owner April 1, 2026 15:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a check in the fork-choice logic to treat the genesis block as a full payload when the parent root is a zero hash. Additionally, it updates the genesis state initialization to conditionally set the latest execution payload header only for forks prior to gloas. A review comment identifies a type safety improvement opportunity in the genesis utility, noting that the executionPayloadHeader parameter is missing the Fulu-specific header type in its union definition, which leads to unnecessary casting.

Comment thread packages/state-transition/src/util/genesis.ts

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

this looks good, still doing a quick sanity check, I don't think I ever tested gloas from genesis before

we also need to bring this to unstable branch, I can look into that more later

@nflaig

nflaig commented Apr 1, 2026

Copy link
Copy Markdown
Member

still seeing fork choice erros after genesis

Apr-01 17:50:52.013[chain]           error: Failed to run prepareForNextSlot nextEpoch=1, isEpochTransition=false, prepareSlot=22, code=FORKCHOICE_ERROR_MISSING_PROTO_ARRAY_BLOCK, root=0x8fd75b4c4ad764977c656e3466346e7a82b9601833f0e93ef6ec8bd69787b19a
Error: FORKCHOICE_ERROR_MISSING_PROTO_ARRAY_BLOCK
    at ForkChoice.getJustifiedBlock (file:///usr/app/packages/fork-choice/src/forkChoice/forkChoice.ts:1143:13)
    at getSafeExecutionBlockHash (file:///usr/app/packages/fork-choice/src/forkChoice/safeBlocks.ts:26:21)
    at Clock.prepareForNextSlot (file:///usr/app/packages/beacon-node/src/chain/prepareNextSlot.ts:165:33)

will merge this anyways, can fix that as part of the other wip

@nflaig
nflaig merged commit b139897 into ChainSafe:epbs-devnet-1 Apr 1, 2026
2 of 6 checks passed
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.

2 participants