You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(stor): track upstream #1182 block-horizon guards in insertBlock (#57)
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.
Copy file name to clipboardExpand all lines: docs/lean4-proof-propositions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -494,7 +494,7 @@ The propositions here guarantee **chain-structure consistency and write atomicit
494
494
- [x] **STOR-1: Every non-genesis Block has its parent in the store**
495
495
- Source: `Database.add_block` (parent-existence precondition; no such database method exists in current leanSpec — the gate is `on_block`'s `UNKNOWN_PARENT_BLOCK` rejection in `src/lean_spec/spec/forks/lstar/fork_choice.py`, which runs before `SyncService._persist_block` writes anything)
496
496
- Note: Each block in the store has a parent block root (`parent_root`); for non-genesis blocks the parent must exist in `store.blocks` (the `block_root → Block` map). The exception generalizes beyond genesis: `create_store` seeds the map with a chain anchor whose parent is outside the tree (zero hash for genesis, an absent block for a checkpoint-sync anchor), so the invariant is stated relative to the anchor root.
497
-
- Proved at: `LeanSpec/Storage/Blocks.lean` (`Store.parentsPresent_anchor` establishes the invariant at anchoring, `Store.parentsPresent_insertBlock` shows the parent-gated insertion preserves it, and `Store.parent_exists_or_genesis` is the catalog form on a genesis-anchored store)
497
+
- Proved at: `LeanSpec/Storage/Blocks.lean` (`Store.parentsPresent_anchor` establishes the invariant at anchoring, `Store.parentsPresent_insertBlock` shows the parent-gated insertion preserves it — the gate reads the states map as upstream does, so the #1176 M-4 blocks-states alignment enters as a hypothesis — and `Store.parent_exists_or_genesis` is the catalog form on a genesis-anchored store). `insertBlock` also carries the horizon guards of the pending leanEthereum/leanSpec#1182 (fixing issue #1171): `insertBlock_slot_gap_bounded` and `insertBlock_within_horizon` bound an accepted block's slot against the parent and the store clock.
0 commit comments