Repository navigation
common: keep only what the verifiers use - #27
Open
SamDelaney wants to merge 2 commits into
Open
SamDelaney wants to merge 2 commits into
SamDelaney wants to merge 2 commits into
Conversation
common.ak looked like a BLS12-381 library, but most of it was broken and nothing called it: pairing_check([], []) returned True, miller_loop and final_exponentiation were hash placeholders, point and field arithmetic reduced mod r instead of p, deserialize_field had its foldl arguments swapped, bls12_381_h was 1, and validate_g1_point skipped the subgroup check. Leaving it public invited someone to build on it. The module now holds only the five things the package uses: the two BLS12-381 constants (blst_affine and the point tests), concat_and_keccak_256 (the PLONK transcript), and scalar_sum and g1_sum (the PLONK verifier). They keep their names and module path, so no import changes, and common_tests already covers all five. Everything else, about 1,000 lines, is deleted. The READMEs and the three reports no longer describe common.ak as legacy scaffolding kept for reference. Fixes #20 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root README said 79 tests and the PLONK report 82; the package has 89, as the three reports' own headers already say. The PLONK report compared its 8.11B CPU against "Bulletproofs' range proof at ~5.2M mem / 14.2B cpu", the figure the Bulletproofs report dropped in 1aab9e6: it was the whole range_proof_valid test, and 14.2B is over the 10B limit, so PLONK couldn't have been both the most expensive verifier and the one with less headroom than Bulletproofs. It now compares against verify's own cost at n = 8 with setup called in the validator (3.16M memory, 7.81B CPU) and names the limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the unused cryptographic code removal and related documentation updates.
No open issues 🎉
What changed in this PR
Addresses #20 by reducing common/common.ak to the constants and helpers used by the verifiers, removing unused, defective cryptographic implementations while preserving existing imports and retained behavior.
Changes:
- Removes roughly 1,000 lines of unused curve, pairing, field, and serialization code, keeping two constants and three helpers.
- Updates documentation and test-header comments to reflect the smaller shared module.
- Refreshes documented test totals to 89 and corrects the PLONK report’s Bulletproofs cost comparison.
| File | Description |
|---|---|
zkp/README.md |
Describes the current shared modules instead of legacy scaffolding. |
zkp/lib/tests/common_tests.ak |
Updates header comments; test behavior is unchanged. |
zkp/lib/common/common.ak |
Removes unused implementations and documents the five retained definitions. |
zkp/docs/plonk-implementation-report.md |
Updates shared-module descriptions, test totals, and execution-cost comparisons. |
zkp/docs/groth16-implementation-report.md |
Removes references to deleted arithmetic and clarifies native builtin usage. |
zkp/docs/bulletproofs-implementation-report.md |
Updates the shared-module description. |
README.md |
Updates the test total and lists the retained common helpers. |
Review effort: Balanced
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 task 1.1: the last of the review issues.
common.akis cut down to what the package uses, plus a small docs correction.Fixes #20.
Changes
aee099ccommon/common.akkeeps only the two BLS12-381 constants,concat_and_keccak_256,scalar_sumandg1_sum. The rest, about 1,000 lines of broken curve, pairing and field code that no verifier called, is deleted. The READMEs and reports stop describing it as legacy code kept for reference.625e9491aab9e6(#25) found was the whole test and over the 10B CPU limit.What was removed
Everything in the issue:
pairing_check(true for empty lists), the placeholdermiller_loopandfinal_exponentiation, point and field arithmetic modrinstead ofp, the brokendeserialize_field,bls12_381_h = 1, andvalidate_g1_pointwithout a subgroup check. Also the types and helpers that only that code used (Field,G1Point,G2Point,VerificationKey,Proof, the compress, serialize and hash-to-curve routines,concat_and_blake2b_224,scalar_rt_*).The issue suggested moving the used helpers into a new small module. Keeping them in
common/common.akmakes that module the small one, so no import changes:blst_affine,plonk/proofs,plonk/verifierand the tests import the same names from the same path.plonk/raw.akwas already retired in #22.Nothing outside
common.akreferred to any removed name (checked withgit grepoverzkp/).Checks
aiken check -D: 89 tests, all pass, no warnings (the same 89 asmain;common_testsalready covered the five kept items)aiken buildpassesaiken fmtis clean on the committed files