Skip to content

feat(lstar): sync model with upstream typed-rejection fixes (leanSpec #1177-#1181) - #42

Merged
adust09 merged 3 commits into
mainfrom
feat/sync-upstream-typed-rejections
Jul 5, 2026
Merged

feat(lstar): sync model with upstream typed-rejection fixes (leanSpec #1177-#1181)#42
adust09 merged 3 commits into
mainfrom
feat/sync-upstream-typed-rejections

Conversation

@adust09

@adust09 adust09 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The formalization in this repo surfaced six issues in leanEthereum/leanSpec (adust09's #1171-#1176). Five fixes are now merged upstream (#1177-#1181, current main @ 57d4339). This PR re-syncs the Lean model with the updated Python definitions.

Upstream changes mirrored

Upstream PR Python change Lean change
#1178 (issue #1174) Slot.is_justifiable_after totalized: a slot below the finalized boundary returns False instead of tripping an assert isJustifiableAfter gains the settled-slot guard; CONT-2 justifiable_iff now discharges it from finalized ≤ target; new lemma justifiable_before_finalized proves the guard behavior. noJustifiableBetween carries the same guard
#1178 (issue #1174) process_attestations vote-layout asserts became typed rejections processAttestations now rejects with emptyValidatorRegistry, the new justificationVotesLengthMismatch, and the new zeroHashJustificationRoot; finalization pruning that drops slot-map-missing roots (already the Lean behavior) is upstream behavior now, so the divergence note is retired
#1180 (issue #1173) SpecRejectionError split from AssertionError via a new SpecError base Doc-level: Except STError already modeled the type-level separation; Errors.lean records that upstream now matches
#1179 (issue #1176) Checkpoint.advance_to docstring: selection is by slot only, ancestry is a store invariant advanceTo docstring mirrors the note

ST-3 / ST-4 / ST-6 preservation proofs are extended over the new error paths; lake build passes with no sorry.

Not applicable to the current Lean tree

  • #1177 (SSZ list decoder rejects first_offset == 0, issue #1175): the variable-size list decoder is not yet formalized (SSZ-1..7 cover primitives only) — nothing to update.
  • #1179/#1181 fork-choice changes (store invariants, deterministic equivocation tie-break): the FC domain (FC-1..FC-5) has no Lean implementation yet; these land when the Store is formalized.
  • #1182 (open, fixes #1171): adds BLOCK_SLOT_GAP_TOO_LARGE / BLOCK_TOO_FAR_IN_FUTURE raised in fork_choice.on_block — outside the state-transition subset Errors.lean mirrors, so no Lean change is needed even once it merges.

adust09 added 3 commits July 5, 2026 21:52
Upstream leanEthereum/leanSpec#1178 (issue #1174) made
Slot.is_justifiable_after total: a slot before the finalized boundary
returns False instead of tripping an assert reachable from untrusted
state. Mirror the guard in isJustifiableAfter, discharge it in
justifiable_iff via the finalized <= target hypothesis, and prove the
settled-slot behavior as justifiable_before_finalized (CONT-2).
Upstream leanEthereum/leanSpec#1178 and #1180 (issues #1173/#1174)
turned the process_attestations vote-layout asserts into
SpecRejectionError raises with dedicated reasons, and split
SpecRejectionError from AssertionError via a new SpecError base.

Mirror that here: processAttestations now rejects an empty registry
(EMPTY_VALIDATOR_REGISTRY), a flat vote list whose length is not
roots x validators (JUSTIFICATION_VOTES_LENGTH_MISMATCH), and a
zero-hash tracked root (ZERO_HASH_JUSTIFICATION_ROOT), with the two
new STError variants added. noJustifiableBetween carries the same
settled-slot guard is_justifiable_after gained. The ST-3/ST-4/ST-6
preservation proofs are extended over the new error paths.
Upstream leanEthereum/leanSpec#1179 (issue #1176) documented that
Checkpoint.advance_to selects by slot only and that descent from the
finalized block is a separate store invariant. Mirror the note so the
Lean model and the Python spec read the same.
@adust09
adust09 merged commit a69032e into main Jul 5, 2026
1 check passed
@adust09
adust09 deleted the feat/sync-upstream-typed-rejections branch July 5, 2026 13:18
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