Skip to content

Skip repeated Sinsemilla input sort work - #478

Merged
ValarDragon merged 2 commits into
mainfrom
agent/sinsemilla-input-q0-sort-20260922
Sep 22, 2026
Merged

ValarDragon merged 2 commits into
mainfrom
agent/sinsemilla-input-q0-sort-20260922

Conversation

@ValarDragon

Copy link
Copy Markdown
Contributor

Summary

  • derive the first theta-compressed Sinsemilla table value directly from the
    proving key before lookup tasks are scheduled
  • remove that repeated value from each Sinsemilla input before generating and
    sorting Pasta keys, then reinsert its canonical sorted run
  • preserve independent input/table preparation, the generic fallback, proof
    bytes, sort scratch capacity, and retained proving-key memory

Motivation

#467 skips sorting the repeated first-row value in the shared fixed
Sinsemilla table. The two Sinsemilla inputs per Action have the same stronger
shape, but they were still sorting all 2,042 usable rows. In the benchmark
fixtures, 1,056--1,108 of those rows equal the table's first compressed value.

Waiting for shared table preparation would serialize independently scheduled
tasks. Instead, this change reconstructs the same value from the three
unrotated row-zero fixed values with two Horner steps, then reuses #467's
validated repeated-value sorter. Non-Pasta fields, zero or non-dominant
repetitions, and structurally unrelated tables retain the generic sort.

Benchmarks

Paired proofs used Rust 1.97.1. Every control/candidate pair produced identical
proof bytes. The focused metric is the sum of the two Sinsemilla input sorts
per Action; it excludes the already-optimized u10 lookup.

Host Workers Actions Pairs Control Candidate Delta (95% CI)
Apple M4 10 1 64 122.2 us 81.6 us -40.6 us [-48.8, -32.6]
Apple M4 10 4 32 497.4 us 305.2 us -192.3 us [-211.5, -173.4]
x86-64 Linux, x86_64-asm 6 1 64 175.0 us 119.0 us -56.0 us [-58.3, -53.9]
x86-64 Linux, x86_64-asm 6 4 32 639.7 us 431.8 us -207.9 us [-218.7, -197.8]

Uninstrumented full-proof measurements were noise-limited: M4/10 measured
43.231 -> 43.246 ms at one Action and 110.261 -> 110.055 ms at four Actions,
with both paired confidence intervals crossing zero. This PR therefore claims
the resolved focused saving, not a resolved full-proof delta.

Correctness and API

  • the direct q_0 derivation uses the same fixed columns, row, expression
    order, and theta-Horner order as table compression
  • the existing repeated-value sorter validates the nonzero dominant run and
    otherwise leaves both buffers untouched for the generic fallback
  • exact sorted-output equivalence remains covered for both Pasta fields, and a
    new test covers direct row-zero derivation and rotated-query rejection
  • 23 lookup-prover tests and the Orchard Post-NU6.3 proof/version test pass
  • no public or pub(crate) API, transcript, RNG consumption, cache, allocation
    capacity, or retained-memory shape changes; only a private helper signature
    gains the optional value

@ValarDragon
ValarDragon marked this pull request as ready for review September 22, 2026 19:40
@v12-auditor

v12-auditor Bot commented Sep 22, 2026

Copy link
Copy Markdown

Note

Complete: Audit complete. No review-worthy issues remain after automated review. One finding was auto-invalidated.

Open the full results here.

Analyzed one file, diff 3729c32...ce5cdf7.

@ValarDragon
ValarDragon merged commit a0b5054 into main Sep 22, 2026
55 checks passed
@ValarDragon
ValarDragon deleted the agent/sinsemilla-input-q0-sort-20260922 branch September 22, 2026 19:42
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