Repository navigation
Harden crypto, symbolic DSL, on-chain/JMT, CI, notices, and docs (ADR-0069) - #126
Conversation
|
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, cache round trips, or proof tests. |
|
[reviewer1] Changes requested on
Across two isolated Gradle runs, 132 selected tests passed with zero skips on this head. They covered BLS arithmetic, codecs, setup, BBS, circuit generation, PlonK verification, JMT and the on-chain Groth16 changes. The cache compatibility check above was separate. |
|
[reviewer3] Review of head Scope: engineering, cross-backend consistency, compatibility, CI/build, NOTICE and docs. What I verified
Blocking
Non-blocking (P2/P3)
Item 1 is the only thing blocking approval. |
…on, SRS compat, and tests
|
Addressed all review feedback in commit Security & Correctness Fixes
ADRs, Licence Notices, & Compatibility Notes
Regression Tests & Style Cleanup
Verification
Ready for final re-review. |
|
[reviewer1] Changes requested on
|
|
[reviewer3] Re-review of head Scope: engineering, cross-backend, CI/build wiring, compatibility, Java style and docs. What I verified
Non-blocking (agree with reviewer1)
P3
reviewer1 still has changes requested on items 1-3. If the next head changes only those, I'll re-check just that diff. |
…tes, note ADR-0050 baseline
|
Addressed all remaining items in commit
Verification
Ready for final approval. |
|
[reviewer1] Approved
All 21 selected setup-cache, JMT wire, Groth16 codec and state-transition tests passed on this head with zero skips. |
|
[reviewer3] Re-review of head What I verified
No remaining findings from me. |
|
[reviewer1] Approved All 65 selected tests passed on this commit with zero skips, covering BBS, annotation processing, SRS consistency and cache compatibility, and live snarkjs PlonK interoperability. I have no outstanding findings on this head. |
Summary
Comprehensive cryptographic hardening, symbolic DSL / annotation processor fixes, on-chain/JMT validation improvements, CI/NOTICE hygiene, documentation reconciliation, and a proposed PlonK v2 Cardano ADR (ADR-0069).
Key Changes
docs/adr/0069-plonk-v2-cardano-transcript-and-verifier.md): Documents the planned PlonK v2 Cardano profile (fully chained, domain-separated Fiat-Shamir transcript includingu, single decompression per point, parameter cleanup, and preserving thexi = omegaexclusion check while keeping legacy snarkjs compatibility).zeroj-bls12381,zeroj-blst):JacobianArith381.fromAffineandaddAffine: check(0, 0)affine infinity sentinel before settingZ = 1, restoring byte-for-byte parity withJacobianG1BLS381.G1Point.fromProjective: reducepzmodFp.Pbefore infinity/unit checks.Bls12381Codecs.scalarToLittleEndian32: delegate toscalarToBigEndian32so intermediate buffers are wiped andBigIntegersubclasses are safely copied.BlstG1Msm/BlstG2Msm: zeroizele,sbuf, nativesc,scal, and Pippenger scratch buffers infinallyblocks inside theArenatry-with-resources scope.zeroj-crypto,zeroj-verifier-plonk,zeroj-codec):PowersOfTauBLS381capped atpower <= 28;SetupCacheIO.validateBls12381Srsvalidates power bounds and minimum G1 length;SetupCacheIO.readScalarenforces minimal canonical two's-complement encoding.Groth16SetupBLS381&Groth16Pipeline: constraint count overflow guards, non-zero / non-root-of-unity scalar validation, andTrustedSetupPolicycheck beforeFiles.createDirectories.Groth16ProverBLS381: sharedwitness[0] == 1and proving-key point validity checks across all prove entry points (preserving the ADR-0046 public API surface).Groth16SetupCache&Groth16PkStore.load: reject infinityICentries (with ADR-0045 note);SrsCache.loadBls12381SrsenforcesTrustedSetupPolicywhen tau is stored and checkstau·G1 == tauG1[1].SparsePointFile.Index: validates segment size, stride (96/192),0 <= nnz <= count <= Integer.MAX_VALUE, and exact file length;Groth16PkMmap.shouldEngagewidens length sum tolong;FlatScalars.wrapvalidates backing length.PlonkBLS12381Verifier: checksnPublic <= (1 << power)andzh == 0before inverting;PlonKSetupBLS381: enforces sigma bijection across all3 * numGatespositions;KZGCommitmentBLS381.syntheticDivision: verifies zero remainder;PlonKProverBLS381: resamples/fails closed on zero denominators or infinity commitments.FiatShamirTranscript.squeezeNonZeroChallenge: fails closed if squeezed value is zero;GnarkFiatShamirTranscript: explicitStandardCharsets.UTF_8;Halo2Codec.detectCurve: fails closed whencurveis missing or unsupported.zeroj-circuit-dsl,zeroj-circuit-annotation-*,zeroj-circuit-lib):@CircuitParam@Targetrestricted toElementType.PARAMETER;CircuitAnnotationProcessorrejectsabstract@ZKCircuitclasses,@Provewiththrows,staticinput fields, and unannotated@Proveparams; removes dead@CircuitParambranch inproveCall; usesuniqueLocalNameincircuitParamSuffix, single-pass template substitution incircuitName, qualified source class names, boxedIntegernull guards before<= 0, parameterized-only overlap checks, and public/secret signal-list verification invalidateCircuit.Signal.hasSameBuilder;ZkBytes,ZkBits, andZkArrayverify single-builder ownership and reject null elements;ZkBytes.assertEqualandZkBits.assertEqualuse element-wise linear equality; addedZkContext.constantBoolandZkContext.constantUInt.InCircuitPedersen,InCircuitPedersenVector, andZkPedersenrejectvalueandblindingsharing the same wire ID;Merkle/SignalMerklevalidate array lengths and non-null arrays;CircuitAPIImpl.hintNvalidates args/shape;Gate.HintKind.MUL_MOD_REDUCEJavadoc corrected to 4 params;PlonKConstraintSystem.extendWitnessrejects missing/out-of-range wires; added per-circuitFe25519.HintConfig(configureHints).zeroj-bbs,zeroj-onchain-julc,zeroj-jmt-poseidon,zeroj-tools):BbsZkVerifier: explicit accepted-ciphersuite policy (never silently downgrading a caller-configuredBbsServiceprovider) and rejects non-emptyenvelope.publicInputs().BbsCodec.copyMessages: rejects null message entries;BbsService.verifyPresentation: checks null args, ciphersuite match, and proof framing.ScriptContextsecurity warnings in Javadoc on standaloneGroth16BLS12381Verifier,Groth16BLS12381TxOutRefBindingVerifier, andPlonkBLS12381*Verifier.Groth16AuthenticatedStateTransitionValidator: requires continuing outputreferenceScriptto be empty;Groth16AuthenticatedStateTransitionScriptFactory: drops unbackedDELETEfromTWO_ROOT_OPERATIONS.Groth16VerificationKeyCodec.decode: validates compressed G1/G2 non-infinity prime-order subgroup points;ProverToCardano.writeFp: validates[0, p).PoseidonJmtTree.verifyProofWire: independently verified viaPoseidonJmtReference.verifyWire(rejecting compressed/skipped levels on wire).CeremonyCli: closesURLClassLoadervia try-with-resources..github/workflows/heavy.yml: addedhash/**andit/sha2/**PR path filters.NOTICE&zeroj-tools/build.gradle: addedBouncyCastle,picocli, andrfc9380test-vector notices; bundledLICENSEandNOTICEinnativeDistZip.bundleJulcSourcesblock inzeroj-onchain-julc/build.gradle.README.md,www/src/content/docs/start/status.md,docs/adr/0031-groth16-mpc-trusted-setup-ceremony.md, andSealedBidPureJavaE2ETestJavadoc.Verification
All targeted new unit/negative tests and full module suites pass:
./gradlew verifyDefaultModuleSurface verifyNoBuiltinProfileDefine :zeroj-bls12381:test :zeroj-blst:test :zeroj-bbs:test :zeroj-codec:test :zeroj-circuit-dsl:test :zeroj-circuit-annotation-api:test :zeroj-circuit-annotation-processor:test :zeroj-circuit-lib:test :zeroj-jmt-poseidon:test :zeroj-crypto:test :zeroj-verifier-plonk:test :zeroj-verifier-groth16:test :zeroj-onchain-julc:test :zeroj-tools:test :zeroj-integration-tests:compileTestJava