Skip to content

docs(lstar): clarify verify_signatures and ban "# Why:" labels - #917

Merged
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor-verify-signatures-docs
Jun 10, 2026
Merged

docs(lstar): clarify verify_signatures and ban "# Why:" labels#917
tcoratger merged 1 commit into
leanEthereum:mainfrom
tcoratger:refactor-verify-signatures-docs

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

Summary

Documentation-only cleanup of the lstar block signature verifier (verify_signatures), plus a small readability refactor of its body and one new documentation rule.

  • Docstring rewrite — spell out the proof contract (the proof carries neither public keys nor messages, so the caller reconstructs both and the verifier checks against them) and show the two parallel lists as a layout diagram.
  • Correct Raises: — the function raises SpecRejectionError with one of three concrete reasons (VALIDATOR_INDEX_OUT_OF_RANGE, PROPOSER_INDEX_OUT_OF_RANGE, INVALID_BLOCK_PROOF), not a bare AssertionError. Clients assert on .reason, so the docstring now names the real contract.
  • Lean inline comments — each body step (key resolution, message binding, proposer entry, proof check) gets a glued one-line comment, one sentence per line.
  • Small refactor — drop a redundant to_validator_indices() recomputation and rename the loop variables to voter_index / voter_indices to disambiguate from the proposer index. No behavior change.
  • New doc rule — ban the # Why: inline-comment label. A comment only exists when the reason is non-obvious, so the label is redundant noise; state the reason directly as plain prose.

Testing

just check passes (ruff lint, ruff format, ty, codespell, mdformat). No behavior change, so no fixtures regenerated.

🤖 Generated with Claude Code

Tighten the documentation in the lstar block signature verifier:

- Rewrite the docstring to spell out the proof contract (the proof holds
  neither keys nor messages, so the caller rebuilds both) and show the two
  parallel lists as a layout diagram.
- Correct the `Raises:` section: the function raises SpecRejectionError with
  one of three concrete reasons, not a bare AssertionError.
- Add lean, glued one-line comments to each body step (key resolution,
  message binding, proposer entry, proof check), one sentence per line.
- Drop a redundant to_validator_indices() recomputation and rename the loop
  variables to voter_index/voter_indices to disambiguate from the proposer.

Also ban the "# Why:" inline-comment label in the documentation rules: a
comment only exists when the reason is non-obvious, so the label is redundant
noise. State the reason directly as plain prose.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tcoratger
tcoratger merged commit 769e1a9 into leanEthereum:main Jun 10, 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