Repository navigation
fix(groth16): validate and pin streaming proving-key imports (#48) - #61
Merged
Merged
Conversation
6 tasks
6 tasks
13 tasks
This was referenced Sep 27, 2026
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.
Streaming
.zkeyimport previously accepted on-curve points outside the prime-order subgroup and reduced some noncanonical field encodings. Validate every header, IC, G1-query and G2-query point before publishing a store; query infinity remains allowed and VK/IC infinity remains rejected.This bounded milestone for #48/#47 adds strict section/version/length/coefficient checks, a private source snapshot hashed before parsing, externally pinned source SHA-256 (or an explicit local/test unpinned API), deterministic payload manifests, and pinned store loading. Failed imports publish nothing and existing stores are never overwritten. Unknown section types outside snarkjs 1–10 are rejected. The deprecated two-argument implicit import fails closed.
An optional trusted exact circuit fingerprint is dimension-checked and written before the manifest is sealed. The returned manifest pin therefore supports both pinned loading and circuit-aware pipeline cache hits.
bindCircuitFingerprintrejects sealed stores without rewriting them; adding metadata requires a new import and explicit new pin. The CLI exposes--circuit-fingerprint, validates policy/hash arguments before import output, and returns exit 2 for malformed options. Guides use pinned loading; the rehearsal hashes the key only after successfulsnarkjs zkey verifyand finalizes with that hash.Security design: ADR-0025 applies the accepted import invariants; these operations process public key material, not private witnesses. The fingerprint is caller-asserted metadata, not proof of key/R1CS consistency. A malicious key made entirely of valid subgroup points can still expose low-entropy witness values through a modified L query. Independently verify the key against the exact R1CS and trusted
.ptau, or pin a hash from someone trusted who did. Hashes and subgroup tests do not verify a ceremony transcript. Keep the mapped store protected from concurrent local mutation throughout its lifetime. Internal key/R1CS consistency verification is tracked separately in #67; known-unfinalized-key rejection remains #66.Validation at
e29cc3d(after incorporating merged PR #60):./gradlew :zeroj-crypto:test :zeroj-tools:test :zeroj-crypto:javadoc :zeroj-tools:javadoc :zeroj-tools:fatJarpassed: 1,136 tests reported, 2 opt-in tests skipped, zero failures/errors. Includes live snarkjs contribution/import/prove interoperability.docs/ceremony/rehearsal.shcompleted the mixed-tool contribution → beacon → snarkjs verification → hash-pinned finalize flow.bash -nandgit diff --checkpassed.Performance evidence is recorded in the timing report, with a reproducible predicate harness. On the local 16-core Apple M4 Max / Java 25 host, median single-thread CPU cost was 0.5113 ms/G1 and 1.4840 ms/G2. Three tiny-fixture complete CLI imports took 0.16 s process wall time each. The 19M-constraint ownership finalize timing is still pending: its artifact/path and trusted hash were unavailable. The report's 64–74k core-second extrapolation uses the reviewer's assumed point counts; it is not a measured full-size import. Future optimization must preserve the subgroup predicate and have differential evidence.
#48 remains open for full-scale measurement, production circuit freeze, real ceremony/transcript and entropy verification, audited Filecoin conversion provenance, public deployment manifests and external security review. #47 remains open for its other assurance workstreams. No production-readiness claim or issue auto-closure.