Skip to content

refactor(xmss)!: retire the legacy leanXMSS security proof - #5456

Draft
alexanderlhicks wants to merge 18 commits into
prototype/xmss-fresh-repinfrom
prototype/xmss-retire-legacy
Draft

alexanderlhicks wants to merge 18 commits into
prototype/xmss-fresh-repinfrom
prototype/xmss-retire-legacy

Conversation

@alexanderlhicks

@alexanderlhicks alexanderlhicks commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex, an AI agent, prepared and published this draft.

This is the second leanXMSS proof draft. Its base is prototype/xmss-fresh-repin from the model proof, #5455. Merge order is #5377, #5455, then this PR.

Public security bounds

All 13 established security endpoints now use the fresh model theorem. This includes the all-calls theorem through realGame_security, the random-permutation and stateless corollaries, the multi-key bound, and the signing-error bounds. Existing security theorem statements keep their types. Three additional theorems expose the tighter estimates.

New theorem Budget and bound
stronglyUnforgeable_173 With at most qH direct adversarial hash queries and the existing signing lifetime, public forgery advantage is at most (qH + 173) / 2^127.
advantage_le_afterKeygen_piecewise For a total game budget q, let r = q − 13,434,881 be the calls remaining after key generation. The model term is zero for r < 172 and r / 2^127 otherwise. The real game adds the seed-guess terms r / 2^256 + (q − 1) / 2^256.
advantage_le_afterKeygen_add_one The same all-calls game satisfies the compact bound (r + 1) / 2^127.

An accepting verification spends exactly 172 hash calls. Reserving these calls gives 2(r − 172) + 344 = 2r for r ≥ 172. Downstream clients can continue to use the existing +318 own-query and +146 after-key-generation statements.

Retirement and follow-up

The change deletes 143 superseded proof files containing 45,660 lines. The import closure of the unforgeability umbrella, its multi-key module and the XMSS security umbrella falls from 346 EthLib files and 91,349 lines to 222 files and 56,165 lines, counting comments on both sides. Across the entire diff from the parent proof branch, 162 files change, with 924 insertions and 45,774 deletions.

Eleven retained modules under XmssSecurity/Proof/ still have importers. None owns a constant reached by the audited public theorems:

  • Wots, Execution, RandomOracle, UniformFiniteTable, Merkle, SecurityBudget
  • WotsExtraction, ForgeryCases, ConcreteForgery, CacheVerify, LazyScheme

Their removal is a follow-up after EthLib pins the merged VCVio #1431 APIs. Trim the imports and rebuild the downstream package first. In particular, RandomOracle re-exports HashSig names that a kernel dependency walk cannot detect.

Validation

  • A kernel dependency walk covered 256 public theorems, including the permutation results. All 17 required endpoints reached the fresh proof, and the walk found no forbidden legacy dependency. The axiom check on all 256 found only the three standard axioms or no axioms.
  • The XMSS proof, unforgeability, multi-key and security targets built with warnings as errors. So did the downstream package, including XmssSecurityContracts and the moved tests/downstream/XmssFreshRegression.lean.
  • The layer check passed with zero import cycles and zero orphan modules. A source scan found no remaining imports of the 143 deleted modules.
  • Local validation used cached dependencies. The baseline comparison passed against the actual parent. Repository-wide checks, including check-theorems and proof coverage, remain for CI. The closure counts measure source size. There is no comparable before-and-after build-time measurement.

BREAKING CHANGE: The deleted internal proof modules and their declarations are no longer importable. Consumers of the public security bounds can keep their existing theorem names and types.

alexanderlhicks and others added 18 commits December 4, 2026 00:58
Under fixed answers, a layer that yields a root makes 86 calls: the
message digest, 68 chain steps (a codeword's digits sum to 106 over 58
chains), the leaf hash and 16 path hashes. An accepting verification
therefore makes exactly 172 calls (length_queriesWith_verifyWith).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acle

XmssSecurity.Ghost.IsAdvHash and its decidability instance move, with the
same names and bodies, from Proof/Scan/Ghost.lean to the light module
XmssSecurity/HashOracle.lean. The fresh proof exports that predicate
instead of keeping its own copy, so the own-query bound and the public
own-query budget state the same predicate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VerifierReserve/Replay replays a supported counted run from its final
cache, so every accepting model verification counts exactly 172 calls.
VerifierReserve/Cut cuts the adversary at q - V own hash queries and keeps
every winning run. VerifierReserve/Model combines both with the fresh
own-query bound: with r calls after key generation, model forgery has
probability 0 below 172 and at most r / 2^127 from there on
(forgeAdvantage_le_afterKeygen). afterKeygenSecurity states the same as
HasAfterKeygenSecurity Concrete.scheme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
realGame_security takes its model term from
VerifierReserve.afterKeygenSecurity instead of the lane proof, so
unforgeable and its corollaries (adversary budget, lifetime, multi-key,
signing errors) follow the fresh route. stronglyUnforgeable (+318) now
follows from the new stronglyUnforgeable_173, which applies the
(2q + 344) / 2^128 own-query bound. advantage_le_afterKeygen (+146) and
advantage_le_afterKeygen_terms (+290) follow from the new
advantage_le_afterKeygen_fresh (model term 0 below 172 calls, else
r / 2^127) and advantage_le_afterKeygen_one ((q - K + 1) / 2^127).
Every existing statement is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The downstream package gains a Contracts library with three fixtures: the
all-calls, own-query, permutation, stateless and multi-key statements;
the signing-error statements; and the tighter own-query and paid-work
bounds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SOUNDNESS.md, the security README and the changelog state where each
public leanXMSS bound now gets its model term: the own-query bound
(2q + 344) / 2^128 and the verifier's reserve of 172 calls. They list the
tighter stronglyUnforgeable_173, advantage_le_afterKeygen_fresh and
advantage_le_afterKeygen_one next to the existing statements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lake warns when a file without a module header imports EthLib, and the
downstream package builds with --wfail. Each fixture now starts with
module; its statements are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No public theorem, test or other module imports them; the bounds use the fresh route.

BREAKING CHANGE: the deleted modules and their declarations are gone; the public statements are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No public theorem, test or other module imports them; the bounds use the fresh route.

BREAKING CHANGE: the deleted modules and their declarations are gone; the public statements are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No public theorem, test or other module imports them; the bounds use the fresh route.

BREAKING CHANGE: the deleted modules and their declarations are gone; the public statements are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No public theorem, test or other module imports them; the bounds use the fresh route.

BREAKING CHANGE: the deleted modules and their declarations are gone; the public statements are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onBound modules

No public theorem, test or other module imports them; the bounds use the fresh route.

BREAKING CHANGE: the deleted modules and their declarations are gone; the public statements are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The changelog lists the removed modules under the changes that break
callers, with the statements that replace the two named model theorems.
The security README no longer describes adaptations of removed files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eserve

evalWithAnswerFn_counted and the lifted-count lemma state facts about
HashSig.counted, not about XMSS. They move to HashSig/CountedCalls.lean;
the second is countHashQueries_liftM_hash there, since
HashSig.countHashQueries_liftM already names the coin case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bridge/Security.lean imported the reserve model, which imports Fresh/, so
check_layers.py found directory cycles between Fresh/, XmssSecurity/ and
XmssSecurity/Proof/. The reserve's model bound moves to
Fresh/VerifierReserve.lean. Bridge/Security.lean states the real-game
bound from any HasAfterKeygenSecurity Concrete.scheme
(realGame_le_q_of_afterKeygenSecurity), and realGame_security, with the
same name and statement, moves to Fresh/RealGame.lean, which Game.lean
and Proofs/Xmss/Security.lean import. The security umbrella also imports
Fresh/Regression.lean, so no module is left outside a library.

BREAKING CHANGE: realGame_security is declared in Fresh/RealGame.lean;
import it, or Proofs/Xmss/Security.lean, instead of Bridge/Security.lean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
advantage_le_afterKeygen_piecewise (was _fresh) states its model term
with the public keyGenQueries. advantage_le_afterKeygen_add_one (was
_one) gives (q - K + 1) / 2^127. The downstream fixtures become one
file, XmssSecurityContracts.lean, which pins the statements that
Consumer.lean does not: the two new bounds, stronglyUnforgeable_173,
realGame_security, the adversary-budget, lifetime and bounded
signing-error bounds, and the axioms of every security bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README credits leanerVM only for the bridge and the model, and says
that Fresh/ and the verifier reserve are written for EthLib.
SOUNDNESS.md says that the 290 of advantage_le_afterKeygen_terms is
slack and that 318 exceeds the 173 the proof needs. The changelog names
the renamed theorems and the moved realGame_security. The adversary's
hash instance keeps its doc comment, and a proof comment says why
173 = 172 + 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the regression module to the downstream test package and register it
as a Contracts root. Update the security umbrella and fixture comments
in the same commit, and clarify the verifier-reserve and bridge docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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