Skip to content

SL-15: certified incremental SHA-256 for future replay-cache streaming #438

Open

Description

@afflom

Future replay-cache infrastructure prerequisite for #338; scoped extension of the already-landed #126/SL-06 contract. It is NOT a prerequisite for initial Mathlib delivery #362. No duplicate Mathlib PR or independent regeneration wave.

Scope correction after independent call-site review: the conflict exists in the unsplit draft source, but every DigestSet/streaming consumer belongs to currently unused replay-cache infrastructure. The actual CLI/glossary/loaded-import path already uses certified Sha256Digest::of. Preserve the cache prototype, claims and tests together in future #338 preparation; do not add this capability merely to compile unrelated code in the initial #335/#336/#341 delivery. The R3 proposal remains unexecuted, and implementation is paused pending the future cache source/interface decision.

The reviewed source union retains SL-06’s certified stdlib-only SHA-256 and omits shipped sha2, but #362’s DigestSetWriter still imports sha2. The actual new consumers stream an executable in 64 KiB reads and declaration-group frames. The current certified package exports only whole-message sha256/sha256Hex; FramedHasher buffers its message. Reintroducing sha2, buffering whole files/groups, or calling generated numbered internal functions does not faithfully resolve this integration.

Deliver the smallest certified incremental interface needed by DigestSetWriter, reusing authored Sha256 compression logic. Reserve SL-15 (SL-12 Host, SL-13 reader and SL-14 maps remain distinct).

Acceptance:

  • Follow R3 in v0.5’s authoritative spec sources: row/scenario/named falsifiable test before implementation. Keep every existing SL-02/SL-06 guarantee and strict comparison.
  • Stable exported initialization/update/finalization state retains only chaining words, cumulative length and a partial block; processing memory is bounded by state plus the supplied chunk. The Rust adapter must use declared certified exports, without another SHA implementation.
  • Digest bytes equal SHA-256 of the concatenated input for empty input/updates, arbitrary tested chunk partitions and FIPS padding/block boundaries. Preserve one-shot, framing, DigestSet JSON, BLAKE3 and caller I/O behavior. Use existing authority vectors and non-shipped differential oracle; retain a planted compression/length/padding defect refusal.
  • Handle the actual FIPS 64-bit bit-length domain explicitly, including cumulative overflow. Streaming cannot reuse the one-shot assumption that a host cannot allocate 2^61 bytes. Review the closed public error contract and boundary tests; no arbitrary practical size cap, silent wrap or public panic.
  • Replace only DigestSetWriter’s SHA component, exercise the actual executable and group-frame callers, and verify the bounded-state/chunk behavior. Do not claim cache replay, imported closure validation or broader Mathlib delivery through this slice.
  • When the future cache source/interface is admitted, coordinate this source/roots/linkage with its required v0.5 identity/product wave. Initial Add pinned Lean-library imports, glossary generation, wrappers and axiom auditing #362 must not wait for it. Official model/export/identity/artifact writers and complete final-head CI remain required for this capability; explicitly close through its reviewed merged issue-closing PR, not source preparation alone.

Independent source/design audit: /workspace/work/forward362-hash-policy-review/REVIEW.md, bound to source candidate b0a02df8 (later spec-entrypoint additions do not change inspected hashing paths). No runtime execution or implementation has been performed for this prerequisite.

Activity

  1. added this to the LexLean v0.5 milestone on Nov 4, 2026
  2. self-assigned this
    on Nov 4, 2026
  3. changed the title [-]SL-15: certified incremental SHA-256 for DigestSet streaming[/-] [+]SL-15: certified incremental SHA-256 for future replay-cache streaming[/+] on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions