Commit 03e946a
refactor(lstar): trim state-transition docs and use itertools.batched (leanEthereum#1116)
* refactor(lstar): trim state-transition docs and use itertools.batched
Cut the comment volume in the lstar state transition and replace the
flat-vote-list index arithmetic with a stdlib idiom. No behavior change:
the 3SF-mini justification and finalization logic is untouched, and the
state-transition vectors are byte-identical (verified with fill, including
the determinism check across hash seeds).
- Unpack the flat justification vote list with itertools.batched zipped
against the tracked roots, replacing the i*N:(i+1)*N slicing. The zip is
strict so the length invariant is enforced, and each batch is listed
because the per-root tallies are mutated downstream.
- Hoist the validator count, which was recomputed four times.
- Trim over-explained comment blocks to the load-bearing reasoning and one
sentence per line: the vote-map round trip, the justifiable-slot filter
(now deferring to the documented rule rather than re-deriving it), the
finalization no-gap rule, and the finalized-relative flag encoding.
- Glue front-loaded comments to the line they justify, rather than stacking
them at the top of a block.
- Correct the genesis-anchor comment: genesis is justified and finalized by
definition as the anchor, not because it "cannot receive votes" (genesis
self-votes exist; they are dropped by the already-justified filter).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(anchor): inline the single-use head slot lookup
Drop the head_slot local and read store.blocks[store.head].slot directly
in the checkpoint, matching the inline-single-use convention.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(lstar): inline the single-use genesis-parent check
Fold the parent-slot-zero test directly into the if, dropping the
single-use intermediate boolean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 456e046 commit 03e946a
2 files changed
Lines changed: 68 additions & 235 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
138 | | - | |
| 137 | + | |
139 | 138 | | |
140 | 139 | | |
0 commit comments