Repository navigation
Add property-based tests, test the common.ak helpers, retire raw.ak - #21
Merged
Merged
Conversation
Adds aiken-lang/fuzz v2.2.0 (v3 needs stdlib v4) and four test modules: - groth_props, plonk_props: changed public inputs, replaced or tampered proof elements are rejected. - point_props: g1_affine_compress matches blst's encoding for random points. - bullet_props: valid range proofs verify for any in-range value, blinding and seed; other values and tampered proofs are rejected. known_issue_* tests pin #11, #12, #14, #15 and #16: they pass because the bug exists, so each fix turns one red and it should then be replaced by the property named in its comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the added verifier and compression regression coverage.
No open issues 🎉
What changed in this PR
Adds property-based regression coverage for the Groth16, PLONK, and Bulletproofs verifiers and G1 affine compression, without changing production verifier code.
Changes:
- Adds 14 property tests and two unit tests covering valid proofs, input and proof tampering, and compression consistency.
- Captures current behavior for known issues #11, #12, #14, #15, and #16, with instructions for updating the tests when fixes land.
- Pins
aiken-lang/fuzzto v2.2.0 for compatibility with the current toolchain.
| File | Description |
|---|---|
zkp/lib/tests/point_props.ak |
Checks G1 affine compression against builtins and captures unchecked-y behavior. |
zkp/lib/tests/plonk_props.ak |
Tests input and evaluation tampering, input range handling, and inverse-list truncation. |
zkp/lib/tests/groth_props.ak |
Adds shared fuzzing helpers and tests proof tampering and public-input handling. |
zkp/lib/tests/bullet_props.ak |
Tests generated range proofs, commitment mismatches, proof tampering, and modular value aliases. |
zkp/aiken.toml |
Declares the fuzz dependency. |
zkp/aiken.lock |
Locks the fuzz dependency to v2.2.0. |
Review effort: Balanced
raw.ak had no callers, and its projective fixtures in plonk_tests were not used by any test, so both are removed. The PLONK implementation report recommended revalidating or retiring it; it now has a dated note. The verifiers use five definitions from common.ak: the two BLS12-381 constants, concat_and_keccak_256, scalar_sum and g1_sum. The new tests/common_tests.ak covers them with 8 unit and 3 property tests: p against the spec value, (p - 1) / 2, p = 3 mod 4, the G1 generator on the curve, Keccak (not SHA3) of the empty input, join order, split invariance, and both sums against integer arithmetic. 64 tests pass with aiken check -D; fmt and build are clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PLONK implementation report now describes the module as it is: raw_affine.ak is the one point-type front door, and the raw.ak passages and limitation are gone. The README and the three implementation reports give the current test counts (64 across the package, including the property-test files); the Bulletproofs report said 13 where the module has 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retire raw.ak and test the common.ak helpers the verifiers use
The README, zkp/README, specification and the three implementation reports now describe the property-based test files and the known_issue_* convention, and give the current layout of tests/. Each report's limitations section now lists the open issues that affect its module (#11 to #19). The Groth16 report described extra public inputs being truncated as safe, which #11 shows it isn't. The README links #20 for the unused part of common.ak. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Catalyst completion roadmap tasks 1.2 and 1.3: property-based tests for all three verifiers and the affine point compression, unit tests for the
common.akhelpers the verifiers use, and the removal ofraw.ak. Usesaiken-lang/fuzzv2.2.0 (v3.0.0 needs stdlib v4 and Aiken 1.1.24, so it can't be used here yet). Includes #22, which was stacked on this branch.Property tests
Four modules in
zkp/lib/tests/, with 14 property tests at 100 runs each plus 2 unit tests:groth_props[0, r)is rejected; replacinga,borcwith another valid point is rejected; too few inputs failsplonk_propspoint_propsg1_affine_compressgives byte-for-byte the builtin's encoding for random points (and the other square root encodes differently)bullet_props[0, 2^8)verifies with any blinding and seed; a commitment to another value is rejected; tamperingtau_x,mu,l_vecorr_vecis rejectedKnown-issue tests
known_issue_*tests pin #11, #12, #14, #15 and #16. They pass because the bug exists, which keeps CI green until the fix lands. Each fix then turns its test red, and the test should be replaced by the property named in its comment (the same call must fail). For #14, the test drops only the surplus generator's inverse (#19), the one inverse an honest proof can lose and still verify.common.akhelpers andraw.ak(from #22)raw.akhad no callers and its projective fixtures weren't used by any test, so both are removed. The verifiers use five definitions fromcommon.ak(the two BLS12-381 constants,concat_and_keccak_256,scalar_sum,g1_sum);tests/common_tests.akcovers them with 8 unit and 3 property tests.Documentation
The README,
zkp/README.md,specification.mdand the three implementation reports describe the new test files and the known-issue convention, give the current test count, and no longer mentionraw.ak. Each report's limitations section lists the open issues for its module (#11 to #19); the Groth16 report had called the extra-input truncation safe, which #11 shows it isn't.Checks
aiken check -D: 64 tests, all passaiken fmt --checkandaiken buildpass;plutus.jsonis unchangedpoint_props), dropping the second Bulletproofs check (bullet_props), or reversing the join order inconcat_and_keccak_256(common_tests)Not covered: G2 compression (it needs an Fp2 square root), #13 (it needs a modified prover), and #17 to #20, which aren't property-shaped.
🤖 Generated with Claude Code