fix(groth16): remove the public unblinded prove API; deterministic prover becomes an unpublished test fixture (#50) - #57
Merged
Conversation
… becomes an unpublished test fixture (#50) Groth16ProverBLS381.proveUnblindedWithReaders (public, r = s = 0) produced deterministic, non-zero-knowledge proofs from the ordinary prover surface (consolidated triage C-01, issue #50). ADR-0046 moves that capability out of the product entirely: - Groth16ProverBLS381 keeps no fixed-blinder path: proveUnblindedWithReaders, the unused heap-only proveUnblinded, and the private proveInternal are removed. The only seam that can fix (r, s) is the package-private BlinderSource of proveBlinded (ADR-0045). The dead BN254 Groth16Prover.proveUnblinded goes too. - Groth16UnblindedTestProver, in a new zeroj-crypto test-fixtures source set, runs the public computeH and feeds (0, 0) exactly once through that seam, throwing on the second draw so the ADR-0045 P2 fail-closed behaviour holds. Both test-fixtures variants are skipped from the published component; a GenerateModuleMetadata guard (also run by `check`) and the ADR-0044 verifyDefaultModuleSurface task fail on any re-published variant or runtime test-fixtures edge. - Groth16ProverApiSurfaceTest pins the exact public method sets of the four Groth16 facade classes and every public proof-returning method in the groth16/plonk packages, scans for fixed-blinder names or BlinderSource parameters, asserts the fixture ships from a different code source, and checks behaviourally that all eleven public BLS12-381 prove paths (and the BN254 pair) are blinded while the fixture reproduces the independently computed unblinded A and B and still verifies. - The eight byte-equality differential tests (heap/mmap, dense/sparse store, pure-Java/blst, serial/parallel) now use the fixture; expected values are unchanged. - Docs: ADR-0046 (new), ADR-0036 and ADR-0045 cross-references, Groth16 dev guide, zeroj-crypto README, README ADR list. Verification: ./gradlew build verifyDefaultModuleSurface publishToMavenLocal (4076 tests, 0 failures); published zeroj-crypto carries no test-fixtures artifact or variant; both build guards verified to fail on a deliberate violation; zeroj-usecases Groth16 projects build and test against the snapshot (36 tests, 0 failures). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WRtUQPK45PkawH22huhT1K
…R-0046 arkworks/snarkjs references (#50 review) PR #57 review, f88b50d: - P2: the ADR-0044 module-surface task (which now also rejects runtime test-fixtures edges) was only invoked as a separate CI command, so a plain `./gradlew build` did not run the fixture-dependency guard ADR-0046 relies on. The root `check` now depends on it; `./gradlew build --dry-run` lists the task and `./gradlew check` executes both guards. - P3: ADR-0046 wrongly stated that arkworks exposes no unblinded prover. arkworks groth16 v0.5.0 exposes create_proof_with_reduction_no_zk (r = s = 0) and caller-supplied-blinder variants as public functions. The reference is pinned to v0.5.0 and ZeroJ's stricter boundary is described as this ADR's own decision. The snarkjs reference is pinned to v0.7.6 (`r`, `s` from `curve.Fr.random()`, no caller override). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WRtUQPK45PkawH22huhT1K
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #50 (consolidated triage C-01, Phase 1 of #54).
Groth16ProverBLS381.proveUnblindedWithReaders(...)was a public main-source API that fixed the Groth16 blinders tor = s = 0and therefore produced deterministic, non-zero-knowledge proofs from the ordinary prover surface. Both independent Groth16 review reports had wrongly stated that every unblinded path was package-private.This PR implements ADR-0046 (
docs/adr/0046-groth16-unblinded-proving-test-boundary.md, R3, status Proposed):proveUnblindedWithReaders, the unused heap-onlyproveUnblinded, and the privateproveInternalare removed fromGroth16ProverBLS381; the dead BN254Groth16Prover.proveUnblindedgoes too. The only seam through which a test can fix(r, s)is the package-privateBlinderSourceofproveBlinded, introduced by ADR-0045 for the forced-infinity tests.Groth16UnblindedTestProver(newzeroj-cryptojava-test-fixturessource set, same package) runs the publiccomputeHand feeds(0, 0)exactly once through that seam, throwing on the second draw so the ADR-0045 P2 fail-closed behaviour is preserved. Both test-fixtures variants are skipped from the published component; aGenerateModuleMetadataguard (also run bycheck) and the ADR-0044verifyDefaultModuleSurfacetask fail on a re-published variant or a runtime test-fixtures edge.Groth16ProverApiSurfaceTestpins the exact public method sets ofGroth16ProverBLS381,Groth16Keys,Groth16Pipeline,Groth16Proverand every public proof-returning method across thegroth16/plonkpackages (20), scans both packages for fixed-blinder names orBlinderSourceparameters, asserts the fixture loads from a different code source than the prover, and checks behaviourally, against an independently computed unblindedA/B, that all eleven public BLS12-381 prove paths (and the BN254 pair) are blinded and randomized while the fixture is deterministic and still pairing-verifies.zeroj-cryptoREADME; README ADR list.Acceptance criteria (#50)
Groth16ProverApiSurfaceTest, 8 tests).Verification
./gradlew build verifyDefaultModuleSurface publishToMavenLocal -PskipSigning=true:zeroj-crypto:test,:zeroj-crypto-blst:testzeroj-cryptomodule metadata / POM / jarapiElements,runtimeElements,javadocElements,sourcesElements; no-test-fixturesjar; no fixture class or fixed-blinder method in the jarskip()lines temporarily removedimplementation testFixtures(...)0.1.0-pre12-<sha>-SNAPSHOTaor.e2e/circuit.measuregated tests skipped; external snarkjsZkeyImportITpassedAn independent high-effort code review of the diff returned ten findings; they drove the seam consolidation (no
r = s = 0code in main), the proof-producer allowlist, the wider behavioural coverage, the module-surface extension, and the ADR wording corrections (Z2 now names the package-private PlonKproveUnblindedseams as out of scope under C-04; the ADR-0036 ingress list no longer creditsproveWithHCoeffswith relation validation).Remaining assumptions / for reviewer attention
SecureRandomis a CSPRNG on the deployment platform; blinder uniformity is argued (64 bytes reduced modr), not measured.module-info); adopting JPMS would need a redesign, recorded in the ADR.secureRandomBlinders/randomScalar/proveBlindeddirectly rather than relying on the tests alone, and agree the maintenance policy for the two allowlists (every new public prove method needs a deliberate update).proveUnblindedWithReaders; no consumer inzeroj-usecases,zeroj-tools, orzeroj-integration-tests.🤖 Generated with Claude Code