Skip to content

refactor(sphincs)!: remove leanSPHINCS and the hash-based signature modules it leaves orphaned - #5460

Merged
tcoratger merged 1 commit into
masterfrom
chore/remove-sphincs
Dec 4, 2026
Merged

tcoratger merged 1 commit into
masterfrom
chore/remove-sphincs

Conversation

@tcoratger

@tcoratger tcoratger commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

This removes leanSPHINCS from EthLib, with its specification, proofs, C export, Python bindings and test vectors.
leanXMSS went in #5461, so it also removes the hash-based signature modules that only the two schemes used.
The leanVM formalization, which consumed these modules, now lives in leanEthereum/leanVM.

The problem

leanSPHINCS was the largest tree in EthLib/Cryptography, about 80,000 lines, and every proof build paid for it.
Its only consumer was the leanVM formalization, which has moved to its own repository.
Once both schemes are gone, their shared frame and the generic game they were stated in have no user left.

The idea

A module goes when nothing outside the deleted trees, except the aggregators Cryptography.lean, Proofs.lean and Base/Proofs.lean, imports it.
I computed that set to a fixpoint from the import graph, so a module whose only importers are themselves removed goes too.
Everything that leanVM work holds or imports stays: EthLib/Cryptography/LeanVm/** and Aggregation/**, with their proofs, are untouched.

What is removed

331 files and 88,837 lines are deleted; the whole diff is 369 files, +43 and -89,575.

  • leanSPHINCS, 303 files and 82,418 lines:
    • the specification, Sphincs/ and its root, 16 files;
    • the proofs, Proofs/Sphincs/ and its root, 240 files;
    • the C export Exports/Sphincs.lean;
    • in Python, sphincs.c, the ethlib.cryptography.sphincs package, the sphincs_* functions, the SPHINCS_* constants and SphincsError;
    • the tests bindings/python/tests/sphincs/ and the vectors tests/cryptography/sphincs/ (39 files), with their tests/sources.toml and tests/generators.toml entries and the leanVM pin that only they read.
  • Orphaned hash-based signature modules, 28 files and 6,419 lines:
    • Cryptography/HashSig.lean and Cryptography/Wots.lean;
    • Proofs/HashSig.lean and Proofs/HashSig/ (12 files), Proofs/Wots.lean and Proofs/Wots/ (2 files);
    • the strong-unforgeability game Proofs/SufCma.lean and Proofs/SufCma/ (3 files);
    • Proofs/AllPathsSatisfy.lean, Proofs/QueryAvoidance.lean, Proofs/RandomOracleDisjoint.lean and Proofs/SupportSim.lean;
    • in Base, Proofs/ByteOrder/Bits.lean and Proofs/Bytes/Equiv.lean.
  • The crypto-pq proof shard of ci.yml and proof_shards.py, which is left with no module.
  • The SPHINCS parts of SOUNDNESS.md (the budget section, the leanSPHINCS section, its A3, A4 and D1 entries), README.md, ARCHITECTURE.md, CONTRIBUTING.md, WRITING.md, the Merkle README, the labeler and labels, vectors-slow.yml, the comment-code allowlist and the accessor baseline.
  • tests/downstream/Consumer.lean loses its leanSPHINCS examples and the one about HashSig/Interchange.lean.

What stays

  • EthLib/Cryptography/LeanVm/README.md and Aggregation/ with Proofs/Aggregation/: leanVM work, kept as they are, even where they name leanSPHINCS.
  • RandomOracleWithCoins, EvalDistEq, the Keccak, sponge and permutation proofs: the VRF, the sponge proofs or other modules still import them.
  • Every Merkle proof module: SSZ, the VRF or the Merkle aggregator chain still use them.
  • The citation of the SPHINCS+ paper in Proofs/Merkle/RandomOracle/SecondPreimage.lean, which explains the tweaks of a Merkle tree.

For reviewers

  • git grep -i sphincs returns the CHANGELOG, the two leanVM files above, and that citation.
  • docstrings.h, contract.json and _native.pyi are written by lake exe gen-bindings; --check passes.
  • No required status check names proofs (crypto-pq), so dropping the shard blocks nothing.

Checks

  • lake build EthLib Exports gen-bindings EthLib.Base.Proofs EthLib.Cryptography.Proofs check-decls check-accessors --wfail: passed (11,301 jobs).
  • lake build --wfail in tests/downstream: passed.
  • lake exe gen-bindings --check: passed.
  • check-decls EthLib EthLib.Cryptography.Proofs EthLib.Base.Proofs EthLib.Exports: 72,851 declarations, 0 findings, baseline unchanged.
  • check-accessors: passed, 84 baseline entries.
  • soundness_facts.py --check, check_layers.py, check_lean_layout.py, check_comment_code.py, check_fixture_pins.py, release_manifest.py --check, check_vectors.py and its tests: passed.
  • test_proof_shards and test_check_layers: 132 tests passed.
  • ruff check, ruff format --check, ty check (also on Python 3.10), check_docstrings.py, check_python_comments.py, check_raises.py, codespell: passed.
  • pytest on contract, errors, engine errors, VRF and Keccak: 2,784 passed, 2 skipped; pytest --collect-only collects 79,127 tests without an error.

🤖 Generated with Claude Code

…odules it leaves orphaned

The leanVM formalization, which consumed these modules, now lives in
leanEthereum/leanVM, so nothing in EthLib needs them.

Remove the leanSPHINCS specification, proofs, C export, Python
bindings, test vectors and their pins, and the SPHINCS parts of the
documents, baselines, allowlists, labels and scripts.

With leanXMSS already removed, also remove the modules that only the
two schemes used: HashSig and Wots with their proofs, the SufCma game,
AllPathsSatisfy, QueryAvoidance, RandomOracleDisjoint, SupportSim and
HashSig/CachedReads, and in Base the ByteOrder/Bits and Bytes/Equiv
proofs. Drop the crypto-pq proof shard, which is left empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tcoratger
tcoratger force-pushed the chore/remove-sphincs branch from 3b14f9c to 2ab1907 Compare December 4, 2026 15:36
@tcoratger tcoratger changed the title refactor(sphincs)!: remove the leanSPHINCS specification and its proofs refactor(sphincs)!: remove leanSPHINCS and the hash-based signature modules it leaves orphaned Dec 4, 2026
@tcoratger
tcoratger merged commit 037d772 into master Dec 4, 2026
6 of 7 checks passed
@tcoratger
tcoratger deleted the chore/remove-sphincs branch December 4, 2026 15:36
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