Skip to content

refactor(forks/lstar): make the genesis anchor slot explicit#808

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor/explicit-genesis-checkpoint-slot
May 31, 2026
Merged

refactor(forks/lstar): make the genesis anchor slot explicit#808
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor/explicit-genesis-checkpoint-slot

Conversation

@tcoratger
Copy link
Copy Markdown
Collaborator

Summary

When the first post-genesis block is processed, the genesis block is forced to be justified and finalized. The code swapped in the parent root but kept the pre-state checkpoint slot:

state.latest_justified = Checkpoint(slot=state.latest_justified.slot, root=parent_root)
state.latest_finalized = Checkpoint(slot=state.latest_finalized.slot, root=parent_root)

This is correct only because both checkpoint slots are still 0 at that point (genesis initializes them to Slot(0), and slot processing never touches checkpoints). A reader had to reconstruct that invariant to convince themselves the slot was right.

This writes the slot as Slot(0) directly, at both the header-processing anchor and its mirror in the block builder, so the genesis anchor reads as a fixed slot-zero checkpoint with no hidden dependency on the pre-state.

No behavior change — state.latest_justified.slot and state.latest_finalized.slot are provably 0 on both paths (each builds on the genesis state).

Testing

  • just lint (ruff) — passed
  • just typecheck (ty) — passed
  • Impacted unit tests (tests/.../lstar/state/ + test_block_production_justification_gap) — 17 passed

🤖 Generated with Claude Code

Anchoring the genesis block as justified and finalized swapped in the
parent root but kept the pre-state checkpoint slot. That was correct only
because both checkpoint slots are still zero when the first post-genesis
block is processed, a hidden dependency a reader had to reconstruct.

Write the slot as zero directly at both the header-processing anchor and
its mirror in the block builder, so the genesis anchor reads as a fixed
slot-zero checkpoint. No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger merged commit 3545463 into leanEthereum:main May 31, 2026
13 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.

1 participant