docs: add spec deviations page - #499
Conversation
Documents two performance-driven deviations from leanSpec (asynchronous signature aggregation with early stop; attestation scoring on block building) and registers the page in the mdBook SUMMARY under a new Development section so it renders in the book. Source references verified against current code: line numbers and the tier-dependent attestation tie-break (leanSpec #1149).
🤖 Claude Code ReviewReview: PR #499 — docs: add spec deviations pageThis is a documentation-only change (new Verification performed:
All line numbers and code references are accurate as of the current Assessment: No issues found. The content is accurate, well-sourced, and appropriately scoped (split cleanly from PR #498 per the description). Good practice documenting why each deviation exists rather than just what differs from leanSpec — useful for onboarding and future spec-conformance audits. Automated review by Claude (Anthropic) · sonnet · custom prompt |
🤖 Codex Code Review
Aside from those doc issues, I did not find code correctness, security, or performance regressions in this PR because it only changes documentation. I did not run tests. Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Kimi Code ReviewReview of PR #499: Spec Deviations Documentation Overall, this is valuable documentation for consensus auditability. However, several clarifications are needed regarding determinism, safety bounds, and documentation maintenance. Critical Concerns1. Wall-clock dependence in consensus-critical code (aggregation.rs)
2. "Same XMSS proofs are produced" contradiction
3. Determinism of attestation scoring (block_builder.rs)
Security & Performance4. Timing attack surface
5. Cancellation safety
Documentation Quality6. Fragile line number references
7. Missing equivalence proof for attestation scoring
Minor Issues8. Inconsistent formatting
9. XMSS context SummaryThe deviations described appear sound from a consensus perspective (partial aggregation produces valid states; scoring preserves validity), but the documentation should explicitly address determinism and timing assumptions. Request changes for Items 1, 2, and 6 before merge. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
Greptile SummaryThis PR adds a
Confidence Score: 5/5Documentation-only change; no production code is modified. All three files are documentation or a developer guide. The new spec_deviations page is well-structured, references concrete code locations (functions, constants, file paths), and correctly distinguishes ethlambda behaviour from leanSpec. The SUMMARY.md and CLAUDE.md edits are minimal and correct. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| docs/spec_deviations.md | New documentation page describing two intentional spec deviations; content is detailed and accurate to the referenced code locations. |
| docs/SUMMARY.md | Adds a new Development section and links the new spec_deviations.md page; mdBook structure is correct. |
| CLAUDE.md | Minor path correction for leanSpec reference directory, adding fork-logic sub-path detail. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Aggregation["Async Aggregation (ethlambda)"]
A[Interval 2 tick] --> B[snapshot_current_slot_aggregation_inputs\ncurrent-slot raw gossip only]
B --> C[spawn_blocking worker]
C --> D{cancel.is_cancelled?}
D -- No --> E[Process group\nXMSS aggregation]
E --> F[Emit AggregateProduced]
F --> D
D -- Yes --> G[Drop remaining jobs]
H[send_after 750ms\nAGGREGATION_DEADLINE] --> I[Cancel token]
I --> G
end
subgraph LeanSpec_Agg["Aggregation (leanSpec)"]
J[tick_interval interval 2] --> K[aggregate\nsynchronous, no budget, no cancellation]
end
subgraph BlockBuild["Attestation Scoring on Block Build (ethlambda)"]
L[select_attestations] --> M{Tier}
M -- Finalize / Justify --> N[Sort: target slot, attest slot, new-voter count\ndata_root tiebreak]
M -- Build --> O[Sort: new-voter count, target slot, attest slot\ndata_root tiebreak]
N --> P[Pick best vs projected post-state]
O --> P
P --> Q[Repeat up to MAX_ATTESTATIONS_DATA = 8]
Q --> R[compact_attestations\nmerge proofs per AttestationData]
end
subgraph LeanSpec_Block["Block Build (leanSpec)"]
S[build_block] --> T[Sort by target.slot oldest-first\nGreedy inclusion up to 8]
end
Reviews (2): Last reviewed commit: "Merge branch 'main' into docs/spec-devia..." | Re-trigger Greptile
- Drop drift-prone line numbers; keep symbol + file references. - Correct the aggregation equivalence: the interval-2 worker snapshots only current-slot raw gossip signatures (skips proof reuse / stale groups) and may emit a partial result on cancellation, so it does not reproduce leanSpec's full aggregate set. Note the subset still yields a valid block. - Clarify the attestation cap is 8 distinct AttestationData entries, with per-entry proofs compacted back to one-per-data later. - Grammar (ran -> runs); trailing-newline cleanup.
## Summary Clarifies the Docker image-tag wording in `README.md` and `RELEASE.md`: - `unstable` is built from the latest `main` commit. - `latest` / `devnetX` are the latest **stable** devnet images. - Bumped the stale `devnet3` "at the time of writing" and `docker pull` examples to `devnet5` (the current devnet). ## Notes - Left untouched: `Cargo.toml` `leansig` `devnet4` branch (real dependency), the `devnet3/devnet4` test-ignore comment in `encoding.rs`, and the README "Older devnets" list (`devnet1-4` are correctly the *older* ones; `devnet5` is current). - The new `docs/spec_deviations.md` page (and its `SUMMARY.md` index entry) was split into #499.
leanSpec pins no commit and refactored its module layout, so file paths into it rot. Remove the two leanSpec paths from spec_deviations.md (behavioral descriptions and symbol names stay). Update the CLAUDE.md spec pointer: source now lives under src/lean_spec/spec/forks/<fork>/.
🤖 Kimi Code ReviewThis PR adds documentation describing ethlambda's deviations from the leanSpec reference implementation. While documentation-only, the described behaviors have consensus and security implications that warrant review. Security & Consensus ConsiderationsAsynchronous Aggregation with Early Stop ( The described 750ms deadline with 50ms buffer for propagation is aggressive. Consider:
Determinism of Partial Results ( The text states "any such subset still yields a valid block." While true, clarify whether this affects fork choice weight calculations. If Node A aggregates 100 signatures and Node B aggregates 60 due to timing, their fork choice views diverge until the block is published. Ensure this doesn't violate the "safety never depends on timing" property. Documentation AccuracyFile Path Verification
Missing Critical Details
Code Quality (Described Behavior)Attestation Ordering Tiebreakers ( The tiered scoring system (
MAX_ATTESTATIONS_DATA Limit Suggested AdditionsAdd a "Risk Assessment" subsection to each deviation: ### Risk Assessment
- **Liveness:** Low—cancelled signatures are retained for next slot (if true)
- **Consensus:** None—block building is local state
- **Worst Case:** Block contains fewer attestations, reducing rewards but not safetyNitpicks
Overall: The documentation is clear and technically sound. Address the signature persistence question and thread pool usage to ensure operators understand the liveness implications of the 750ms deadline. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code Review
No runtime code is changed in this PR, so I don’t see new fork-choice, STF, XMSS, SSZ, or memory-safety risk introduced by the patch itself. The main issue is that the new documentation currently misdescribes consensus-adjacent behavior in ways that could mislead later implementers. Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
Summary
Adds
docs/spec_deviations.mddocumenting where ethlambda intentionally diverges from the leanSpec reference, mainly for performance:spawn_blockingworker with a 750ms deadline, vs leanSpec's inline synchronousaggregate().Finalize > Justify > Build) and selected against a projected post-state when packing a block, vs leanSpec's greedy slot-ordered inclusion.Also registers the page in the mdBook
SUMMARY.mdunder a new Development section so it actually renders in the book.Source references were verified against current code (line numbers, and the tier-dependent attestation tie-break per leanSpec #1149).
Split out from #498, which now carries only the image-tag wording changes.