Repository navigation
Fix streaming PtauImporterBLS381, size PlonK t3 to n+6, and withdraw PlonKZkeyImporterBLS381 (ADR-0066) - #121
Conversation
…PlonKZkeyImporterBLS381 (ADR-0066)
|
[reviewer3] Review of head Scope: engineering, cross-backend, CI wiring, docs/links. What I verified
Non-blocking (P3)
|
|
[reviewer1] Changes requested on
|
|
Initial automated review · Aster Hi @satran004, thanks for the PR! 🙏 This is an automatic first check by an AI reviewer. It does not replace maintainer review and may be wrong. Reviewed commit: Issues found:
Not tested: Code and tests were read only; I did not run the build, proof generation, or snarkjs interop tests. |
… align 2^24+6 cap, and tighten negative tests
|
Addressed all Round 1 feedback from
Verification ( Ready for Round 2 re-review from |
|
[reviewer3] Re-review of head Both of my round-1 items are fixed. The unsatisfying-witness message now reads "Witness does not satisfy the PlonK constraints (… not divisible by Z_H …)", and ADR-0066 now has the witness-behaviour and forward-compatibility notes. Blocking: the round-2 change lets a tiny hostile
To reproduce, I built a 96-byte input: the magic, 3 sections, a valid section 1 with the correct prime and
The Suggested fix, keeping the hash-before-EC-work ordering:
No other new findings. |
|
[reviewer1] Changes requested on
|
…tient-degree wording
|
Addressed Round 2 feedback from
Verification ( Ready for Round 3 approval from |
|
[reviewer3] Re-review of head The round-2 regression is fixed.
No further findings from me. |
|
[reviewer1] Approved on On a clean snapshot I independently ran the PlonK crypto and cache tests, the PlonK verifier suite, and pinned snarkjs interoperability tests. All 89 passed with zero skips, including the truncated large-section regression and verification of a proof made from a same-power ceremony SRS. Ceremony provenance and external cryptographic review remain separate production gates. |
Summary
Fixes BLS12-381 PlonK
.ptauSRS import and quotient-split SRS sizing, explicitly withdraws the incompatible snarkjs PlonK.zkeyimporter, adds a live same-powersnarkjs@0.7.6.ptau -> setup -> prove -> snarkjs plonk verifyCI test, and aligns documentation under ADR-0066 (Proposed).Risk classification: R2 (untrusted
.ptauSRS import boundary, PlonK SRS sizing, withdrawal of broken.zkeyimporter).1. Streaming
PtauImporterBLS381(ADR-0066 I1–I2)qand checks exact equality withMontFp381.modulus(), instead of rejectingprime == FPas non-canonical).snarkjs@0.7.6Section 1 header (n8,q,power,ceremonyPower) and enforces exact Section 2 ((2^(power+1) - 1) * 96) and Section 3 (2^power * 192) sizes, rejecting duplicate sections, out-of-order sections, and trailing bytes.DigestInputStreamfor full-stream SHA-256 verification before pairing checks), so multi-GB ceremony.ptaufiles loadmaxPointspowers inO(maxPoints)RAM.< pMontFp381.fromMontLimbs(...), rejects infinity on SRS G1/G2 entries (and defensively handlesisInfinity()intoG1/toG2), verifies curve + prime-order subgroup membership, and checkse(tau^i·G1, G2) == e(tau^(i-1)·G1, tau·G2).2. Exact
t3 = n + 6Quotient-Split & SRS Sizing (ADR-0066 I3)t3inPlonKProverBLS381to exact lengthn + 6(indices2n .. 3n + 5) and asserts all trailing quotient coefficients at>= 3n + 6are zero (matchingsnarkjs@0.7.6plonk_prove.js:649-684).2nton + 6acrossPlonKSetupBLS381,PlonKProverBLS381, andPlonkSetupCache, enabling same-powersnarkjs.ptaufiles (2n - 1 >= n + 6forn >= 8) to work end to end.3. Explicit Withdrawal of
PlonKZkeyImporterBLS381(ADR-0066 I4)PlonKZkeyImporterBLS381.importZkey(...)overloads now throwUnsupportedOperationExceptionciting ADR-0066 and directing callers toPtauImporterBLS381+PlonKSetupBLS381, instead of failing with a misleading prime-canonicalityIOException.4. Documentation & CI Alignment (ADR-0066 I5)
PtauImporterBLS381Test(including live same-powersnarkjs@0.7.6.ptau -> setup -> prove -> snarkjs plonk verify) to.github/workflows/assurance.ymlunder-PrequireSnarkjs.README.md,www/src/content/docs/guides/proving/plonk.md,www/src/content/docs/start/status.md,docs/adr/0047-snarkjs-bidirectional-interop-export-and-ci.md, andzeroj-crypto/README.mdto remove inaccurate.zkeyimport / Beta / 9-blinder claims and document streaming.ptauimport.Breaking / Compatibility Notes
PlonKZkeyImporterBLS381.importZkey(...)now throwsUnsupportedOperationException(no in-repo production callers existed).PtauImporterBLS381now enforces the exact 60-bytesnarkjs@0.7.6Section 1 header and exact Section 2/3 sizes matchingpower.PlonKSetupBLS381,PlonKProverBLS381, andPlonkSetupCachenow accept SRS lengths in[domainSize + 6, 2 * domainSize)that were previously rejected.Verification
./gradlew -PrequireSnarkjs :zeroj-crypto:test --tests 'org.zeroj.crypto.plonk.*' --tests 'org.zeroj.crypto.setup.SetupCacheTest' :zeroj-verifier-plonk:test :zeroj-integration-tests:test --tests 'org.zeroj.it.snarkjs.SnarkjsPlonkInteropTest' --stacktrace— PASSED (including offline 70 MiB streaming test, negative SRS/point/hash tests, exactn + 6SRS test, and live same-powersnarkjs@0.7.6.ptau -> setup -> prove -> snarkjs plonk verify).