Skip to content

feat(stor): track upstream #1182 block-horizon guards in insertBlock - #57

Merged
adust09 merged 1 commit into
mainfrom
feat/track-1182-block-horizon
Jul 20, 2026
Merged

feat(stor): track upstream #1182 block-horizon guards in insertBlock#57
adust09 merged 1 commit into
mainfrom
feat/track-1182-block-horizon

Conversation

@adust09

@adust09 adust09 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Hold until upstream merges

This PR mirrors the pending leanEthereum/leanSpec#1182 (head 5e1b7b51, fixing issue #1171 — adust09's future-slot-horizon finding). CI is green and the model is ready; merge after #1182 lands upstream, re-verifying the mirrored guards against the merged diff (they are unchanged since filing, but the upstream PR could still be revised).

What it mirrors

on_block bounds a block's slot right after the parent lookup, before the state transition's empty-slot loop can run:

  1. BLOCK_SLOT_GAP_TOO_LARGE — the slot may run at most HISTORICAL_ROOTS_LIMIT (2^18) beyond the parent state
  2. BLOCK_TOO_FAR_IN_FUTURE — at most one slot past the store clock (store.time // INTERVALS_PER_SLOT + 1)

Changes

  • STError gains both reasons (docstring notes they come from the pending #1182); Config.lean gains HISTORICAL_ROOTS_LIMIT
  • insertBlock now reads the parent state, exactly as on_block does — so parentsPresent_insertBlock takes the #1176 M-4 blocks-states alignment (WellFormed.blocksStatesAligned's shape) as a hypothesis to carry presence over to the block map
  • New theorems — the formal content of the #1171 fix: insertBlock_slot_gap_bounded (an accepted block names a stored parent state and sits within the gap bound — the empty-slot loop is bounded) and insertBlock_within_horizon (an accepted block sits within the clock horizon)

lake build passes with no sorry.

Mirror the pending leanEthereum/leanSpec#1182 (head 5e1b7b51, fixing
issue #1171): on_block bounds a block's slot right after the parent
lookup, before the state transition's empty-slot loop can run - at
most HISTORICAL_ROOTS_LIMIT beyond the parent state
(BLOCK_SLOT_GAP_TOO_LARGE) and at most one slot past the store clock
(BLOCK_TOO_FAR_IN_FUTURE). STError gains both reasons and Config gains
HISTORICAL_ROOTS_LIMIT.

insertBlock now reads the parent *state*, exactly as on_block does;
parentsPresent_insertBlock therefore takes the #1176 M-4 blocks-states
alignment as a hypothesis to carry presence over to the block map.

insertBlock_slot_gap_bounded and insertBlock_within_horizon extract
the two bounds from a successful insertion - the formal content of
issue #1171's fix.

Hold this PR until upstream #1182 merges; re-verify the mirrored
guards against the merged diff then.
@adust09
adust09 merged commit ef9f229 into main Jul 20, 2026
1 check passed
@adust09
adust09 deleted the feat/track-1182-block-horizon branch July 20, 2026 11:04
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