Skip to content

verifier: evaluate the stacked claims' eq once per distinct point (-57% basis products) - #702

Open
tcoratger wants to merge 1 commit into
mainfrom
verifier-stack-claims-by-point
Open

tcoratger wants to merge 1 commit into
mainfrom
verifier-stack-claims-by-point

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

Summary

The stacked opening's basis evaluated a full eq over all 27 stack coordinates for each of its 141 column claims, but those claims have only 7 distinct low points. The basis now evaluates eq once per distinct point, and only the selector bits per claim: eq(point ++ sel, x) = eq(point, x_low) · eq_above(x).

one verify of a 900-leanXMSS leaf proof main this PR delta
field products in the basis 3,948 1,700 −56.9%, counted
basis evaluation (instrumented, fastest of 30, 7 pairs) ~295 µs ~180 µs ~−39%, faster in 7 of 7
whole verify (median of fastest-of-100, 11 pairs) 10.56 ms 10.42 ms per-pair median −1.1% (spread −21.7% to +0.3%), faster in 10 of 11; at the edge of the noise
allocations per verify 13,381 13,109 −2.0%
bytes allocated per verify 9.59 MB 9.53 MB −0.7%
heap peak per verify 1.96 MB 1.88 MB −4.0%

For reviewers

  • Placement::stack_point lost its only caller and goes. Its length check is now an assert_eq! in on_stack, which panics on the same inputs as before. The review checked that every claim's point length equals its placement's variables by construction, so replay_unchecked cannot reach the assert from an announced shape.
  • The Python verifier still builds each claim's full stack point. Nothing in the protocol changes, so the Python and guest verifiers need no edit.

Checks

  • Mutation: lows[at] → lows[0] turns test_portable_verifier red.
  • Independent soundness review: the verify and replay Summary is byte-identical to main.
  • cargo test --release -p verifier -p leanvm_core -p keccak_gkr and clippy: pass.

🤖 Generated with Claude Code

The stacked opening's basis evaluated every column claim as a boxed
eq_eval over the whole stack point: 141 claims on the 900-leanXMSS leaf,
each a product over 27 coordinates, though the claims sit at only 7
distinct low points (a table's columns share its point).

A column claim now reaches the stack as StackWeight::Placed (its point,
borrowed, and its placement); the ring switch and the Keccak batch's
weights stay closures (StackWeight::Other). verify_stacked_opening
groups the placed claims by point once, and at the terminal point
evaluates eq(point, x_low) per distinct point and only the selector
above the window per claim. The basis value is the same field element,
so proofs and transcripts are unchanged. Placement::stack_point lost its
one caller and is removed; the length check it implied (a claim's point
fills its window) is an assert in on_stack.

Workload: verifying a 900-leanXMSS leaf (rate 1/2). Products counted.
Times on a Ryzen 9 9900X shared at load 10-25, taskset -c 5, interleaved
pairs against origin/main; the basis time is instrumented, the fastest
of 30 verifies per process (7 pairs); the verify time is the fastest of
100 per process (11 pairs).

| metric                       | main  | branch | delta                                             |
| ---------------------------- | ----- | ------ | ------------------------------------------------- |
| products in the basis        | 3,948 | 1,700  | -56.9%, counted                                   |
| basis evaluation (us)        | ~295  | ~180   | about -39%, B faster in 7/7 (A 294..443, B 180..281) |
| whole verify (median ms)     | 10.56 | 10.42  | -1.1% per-pair median, -21.7..+0.3%, faster 10/11 |

The end-to-end effect is at the edge of the host's noise.

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