Skip to content

refactor(xmss)!: remove the XMSS specification and its proofs - #5461

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

tcoratger merged 1 commit into
masterfrom
chore/remove-xmss

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

This removes leanXMSS from EthLib: its specification, its proofs, its C export, its Python bindings and its test vectors.
The leanVM formalization, which used these modules, now lives in leanEthereum/leanVM.

The problem

EthLib kept leanXMSS for one user, the leanVM formalization.
That work now lives in its own repository, so nothing in EthLib uses these modules any more.
They still cost CI time and review time on every change that touches the shared hash-based-signature code.

The idea

Delete every module whose path names XMSS, and every module that only those modules imported.
Keep each shared module that something outside XMSS still uses.

The import graph decides which modules go.
A module is removed only when every module that imports it is an XMSS module or an aggregator, a file that only gathers imports.
Four shared modules meet that condition, and no other module does.

Example

Proofs/SufCmaMultiKey.lean defines the many-key strong-unforgeability game.
On master, two modules import it: the aggregator Proofs.lean and Proofs/Xmss/Unforgeability/MultiKey.lean.
Once the XMSS file is gone, only the aggregator imports it, so it goes too.

Proofs/SufCma.lean is the single-key game.
The SPHINCS proofs import it as well, so it stays.

What is removed

345 files and 71,462 lines are deleted:

  • EthLib/Cryptography/Xmss.lean and Xmss/: 14 files, 1,611 lines.
  • EthLib/Cryptography/Proofs/Xmss.lean and Proofs/Xmss/: 253 files, 66,867 lines.
  • EthLib/Cryptography/Exports/Xmss.lean: 150 lines.
  • bindings/python/xmss.c, the package ethlib.cryptography.xmss and bindings/python/tests/xmss/: 11 files, 1,559 lines.
  • tests/cryptography/xmss/, the pinned vectors: 62 files, 445 lines.
  • Four shared modules that only the XMSS proofs imported: Proofs/SufCmaMultiKey.lean, Proofs/SupportBind.lean, Proofs/Wots/AcceptedScan.lean and Proofs/Hash/Keccak/LastBlock.lean: 830 lines.

The same change also edits these files:

  • the aggregators Cryptography.lean, Exports.lean, Proofs.lean and Proofs/Hash/Keccak.lean;
  • the binding table in Base/Exports/Bindings.lean, module.c, wrappers.h, XmssError and setup.py, and the regenerated docstrings.h, _native.pyi and contract.json;
  • the XMSS examples of tests/downstream/Consumer.lean;
  • the XMSS entries of tests/sources.toml, tests/generators.toml, the labeler, the proof shards and the comment allowlist;
  • SOUNDNESS.md, README.md, ARCHITECTURE.md, CONTRIBUTING.md, WRITING.md and tests/cryptography/README.md.

ARCHITECTURE.md had a rule that no Xmss module reaches a Sphincs module through its imports, nor the reverse.
With one scheme left, the rule cannot fail, so the rule and its check in scripts/check_layers.py are removed.

What stays shared

Something outside XMSS still uses each of these, so each one stays:

  • HashSig.lean, Wots.lean and Proofs/HashSig/: the SPHINCS specification and proofs use them.
  • Proofs/SufCma.lean and Proofs/SufCma/: the SPHINCS unforgeability proofs use them, directly or through Proofs/HashSig/.
  • Proofs/Wots/, Proofs/QueryAvoidance.lean, Proofs/RandomOracleWithCoins.lean, Proofs/EvalDistEq.lean, Proofs/Merkle/ and the Keccak proofs: SPHINCS, BLS, the VRF, SSZ or the consensus proofs use them.

Their doc comments named leanXMSS as a user, so they now say "the hash-based signatures".
The code example of CONTRIBUTING.md now shows the leanSPHINCS layer encoding, in place of the XMSS one.

For reviewers

  • The four removed shared modules hold generic lemmas, such as the Keccak last-block lemmas.
    Nothing else uses them, so they are removed rather than kept unused.
  • git grep -i xmss still finds a few mentions on purpose:
    • the CHANGELOG entry;
    • the source citation in Proofs/SufCma.lean;
    • XMSS as an example of a stateful key in Aggregation/Interface.lean;
    • the leanXMSS signatures that leanVM aggregates later, in LeanVm/README.md;
    • the FIPS 205 names xmss_node and xmss_pkFromSig in the SPHINCS files.
  • Three lines under Sphincs/ and Proofs/Sphincs/ still say that leanXMSS shares the search, the hash style or the oracle.
    This pull request leaves the SPHINCS paths alone, because a parallel pull request removes SPHINCS.
    If SPHINCS stays, those three lines need an edit.

Checks

  • lake build EthLib Exports EthLib.Cryptography.Proofs gen-bindings check-decls --wfail: passed, 12092 jobs.
  • lake build of the modules that tests/downstream/Consumer.lean imports, then lake lean tests/downstream/Consumer.lean: passed.
  • lake exe gen-bindings, then lake exe gen-bindings --check: passed.
  • check-decls EthLib EthLib.Exports EthLib.Cryptography.Proofs: 83345 declarations, 0 findings, 0 stale.
    The baseline is unchanged, since no entry named a removed declaration.
  • lake exe check-accessors: passed, baseline unchanged.
  • lake exe proof-coverage: not run, since it needs every proof built.
    No removed Lean line names a Consensus or Fork declaration, so no touched rule can change, and the baseline is unchanged.
  • uv sync --frozen --extra test, then pytest -n 8: 78504 passed, 664 skipped, 13 xfailed.
  • tests/cryptography/check_vectors.py: 2270 pinned vectors match their digests.
  • soundness_facts.py: regenerated; --check passed (586 operations and 38 constants, from 590 and 50).
  • check_layers, check_lean_layout --base upstream/master and --all --rule wrap, check_comment_code, release_manifest --check, check_fixture_pins: passed.
  • The unit tests of check_layers, proof_shards and check_vectors: passed.
  • ruff check, ruff format --check, check_python_comments, check_docstrings, ty check and ty check --python-version 3.10 bindings/python/ethlib: passed.
  • check_writing --base upstream/master: only S1 and D1 suggestions, on sentences and docs that this change did not write.

🤖 Generated with Claude Code

The leanVM formalization, which used these modules, now lives in
leanEthereum/leanVM, so nothing in EthLib uses leanXMSS any more.

Remove the specification, the proofs, the C export, the Python
bindings and the pinned vectors of leanXMSS. Remove the four shared
proof modules that only the XMSS proofs imported: SufCmaMultiKey,
SupportBind, Wots/AcceptedScan and Hash/Keccak/LastBlock. Remove the
import rule between XMSS and SPHINCS, which cannot fail with one
scheme left. Regenerate the binding contract and SOUNDNESS.md.

BREAKING CHANGE: ethlib.cryptography.xmss, XmssError, the native
xmss_* functions, the XMSS_* constants and the Lean modules under
EthLib/Cryptography/Xmss/ and EthLib/Cryptography/Proofs/Xmss/ are
removed, with no replacement in EthLib.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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