Skip to content

Retire raw.ak and test the common.ak helpers the verifiers use - #22

Merged
SamDelaney merged 2 commits into
sam/property-testsfrom
sam/unit-test-gaps
Nov 11, 2026
Merged

SamDelaney merged 2 commits into
sam/property-testsfrom
sam/unit-test-gaps

Conversation

@SamDelaney

@SamDelaney SamDelaney commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #21. This PR targets sam/property-tests, so its diff shows only the change below. Merge #21 first; this PR then retargets to main (automatically if #21's branch is deleted on merge, otherwise by editing the base).

Catalyst completion roadmap task 1.3: fill the unit-test gaps in common.ak and retire raw.ak.

What changes

raw.ak removed. Nothing in the package called it, and its projective test vectors in plonk_tests (test_plonk_proof, test_plonk_vkey) weren't used by any test, so they're removed too. The PLONK implementation report had recommended revalidating raw.ak or retiring it; it now describes the module without it, with raw_affine.ak (or compressed bytes) as the way in.

Test counts refreshed. The README and the three implementation reports now give the current counts (64 across the package, including the property-test files). The Bulletproofs report said 13 where the module has 10.

Tests for what the verifiers actually take from common.ak. Of its ~70 definitions, the verifiers use five:

Definition Used by
bls12_381_base_prime, bls12_381_half_prime blst_affine (compression sort bit)
concat_and_keccak_256 PLONK transcript (proofs, verifier)
scalar_sum, g1_sum PLONK verifier

The new tests/common_tests.ak has 8 unit and 3 property tests for them:

  • p equals the spec value, the half prime is (p − 1) / 2, and p ≡ 3 mod 4;
  • the standard G1 generator is on the curve, and its x matches the builtin's compressed bytes;
  • the hash is Keccak-256, not SHA3-256 (empty-input vector), pieces are joined in order, and where the input is split doesn't matter (property);
  • scalar_sum and g1_sum of an empty list are zero, and both agree with integer arithmetic mod r (properties).

Mutation check: reversing the join order in concat_and_keccak_256 makes two of these fail.

Not in this PR

The rest of common.ak (~950 lines: hand-rolled field arithmetic, compression, placeholder pairing) has no callers now that raw.ak is gone. The README and the implementation reports describe it as kept for reference, so deleting it is left as a separate decision.

Checks

aiken check -D: 64 tests pass (53 from #21 plus 11 new). aiken fmt --check and aiken build are clean, and plutus.json is unchanged.

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the helper-test additions and retirement of the unused projective conversion module.

No open issues 🎉

What changed in this PR

Builds on #21’s property tests by adding coverage for the common.ak helpers used by the verifiers and retiring the unused PLONK projective conversion module.

Changes:

  • Adds 8 unit tests and 3 property tests for BLS12-381 constants, Keccak concatenation, scalar sums, and G1 sums.
  • Removes raw.ak and its unused projective test vectors.
  • Documents the retirement and directs integrations to raw_affine.ak or compressed bytes.
File Description
zkp/​lib/​tests/​plonk_tests.ak Removes unused projective fixtures and their imports.
zkp/​lib/​tests/​common_tests.ak Adds unit and property coverage for shared verifier helpers.
zkp/​lib/​plonk/​raw.ak Deletes the legacy projective conversion module.
zkp/​docs/​plonk-implementation-report.md Records the retirement while preserving historical report context.

Review effort: Balanced

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>
@SamDelaney
SamDelaney merged commit c67d772 into sam/property-tests Nov 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants