Skip to content

Introduces the Pari Proof System - #4523

Draft
guruvamsi-policharla wants to merge 13 commits into
mainfrom
gv/pari-proof-system
Draft

Introduces the Pari Proof System#4523
guruvamsi-policharla wants to merge 13 commits into
mainfrom
gv/pari-proof-system

Conversation

@guruvamsi-policharla

Copy link
Copy Markdown
Collaborator

No description provided.

guruvamsi-policharla and others added 5 commits August 17, 2026 17:21
Replace the dense m*m constraint matrices with the compiler's sparse rows,
making compilation, the relation digest, setup column evaluation, and the
prover's assignment evaluation O(nnz) instead of O(m^2).

Drop the committed-input anchor rows: expressions never reference committed
columns, so each link row already gives its committed column a unique
nonzero entry, which is the linear independence commitment binding needs.
The full-rank regression test is retained against the sparse rows.

The prover no longer runs a separate satisfaction pass; the vanishing
divisibility check during proving rejects unsatisfied assignments.

Relation digests change; no encoded formats are affected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Embed the sparse public columns of the constraint matrices in the verifying
key, matching the paper's succinct index: verify and batch_verify no longer
take the compiled relation. Drop the redundant num_vars field (the relation
is square) and the stored G2 generator, cache the key digest instead of
rehashing the encoded key per proof, and validate canonicity of the sparse
columns on decode.

Batch verification samples 128-bit coefficients and uses the SmallScalar
MSMs for the point aggregations, and public-input evaluation shares one set
of Lagrange coefficients between both matrices. The Lagrange helper now
skips its domain-membership scan when the vanishing polynomial is nonzero.

The verifying-key wire format changes; fixtures regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add codecs for ProvingKey, so trusted-setup output can be distributed, and
for Opening, along with a public accessor for its randomness. Zero witness
columns produce identity basis points the point codec rejects, so the
witness basis encodes sparsely by index; every other length is derived from
the embedded verifying key and enforced exactly on decode.

Also fold in small cleanups: deduplicate assignment accessors, replace the
zero-polynomial masking idiom with mul_vanishing, sample nonzero setup
trapdoors with Scalar::random, and drop the test-only vanishing alias.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verification previously computed all m Lagrange coefficients at the
challenge, making single and batched verification grow linearly with the
constraint domain. Evaluate the basis only at the rows present in the
verifying key's public columns via the closed form
L_i(X) = Z_H(X) g^i / (m (X - g^i)) with one batched inversion, so verifier
field work depends on the public-column support instead of the domain.

Benchmarked against the reference garuda-pari implementation at domain
2^16, this takes single verification from 5.7ms to sub-millisecond and
batched verification from 5.1ms to ~0.1ms per proof.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3f71446
Status: ✅  Deploy successful!
Preview URL: https://64cc3bb3.monorepo-eu0.pages.dev
Branch Preview URL: https://gv-pari-proof-system.monorepo-eu0.pages.dev

View logs

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

Benchmark results

Regressions: 0.

✅ `qmdb::merkleize/v=any::unordered::fixed::mmr k=10000 ch=false s=true cc=true` (2/2 gates passed)
Field Value
Package commonware-storage
Benchmark target qmdb_gungraun
Variant qmdb::merkleize/v=any::unordered::fixed::mmr k=10000 ch=false s=true cc=true
Filter *::bench_merkleize::any_unordered_fixed_mmr
Baseline suite commonware-storage
Gates EstimatedCycles should decrease; tolerance 10.00%; blob_reads should decrease; tolerance 10.00%
Cargo flags --features test-traits
Metric Baseline Current Delta Gate
Ir 13,194,896 13,190,955 -0.03% -
L1hits 16,872,365 16,869,531 -0.02% -
LLhits 99,604 97,933 -1.68% -
RamHits 11,401 11,029 -3.26% -
TotalRW 16,983,370 16,978,493 -0.03% -
EstimatedCycles 17,769,420 17,745,211 -0.14% EstimatedCycles should decrease; tolerance 10.00%
blob_reads 158 158 +0.00% blob_reads should decrease; tolerance 10.00%
✅ `qmdb::merkleize/v=current::ordered::fixed::mmb chunk=256 k=10000 ch=false s=true cc=true` (2/2 gates passed)
Field Value
Package commonware-storage
Benchmark target qmdb_gungraun
Variant qmdb::merkleize/v=current::ordered::fixed::mmb chunk=256 k=10000 ch=false s=true cc=true
Filter *::bench_merkleize::current_ordered_fixed_mmb_chunk_256
Baseline suite commonware-storage
Gates EstimatedCycles should decrease; tolerance 10.00%; blob_reads should decrease; tolerance 10.00%
Cargo flags --features test-traits
Metric Baseline Current Delta Gate
Ir 15,453,484 15,485,822 +0.21% -
L1hits 20,196,835 20,365,661 +0.84% -
LLhits 144,154 142,555 -1.11% -
RamHits 18,434 17,511 -5.01% -
TotalRW 20,359,423 20,525,727 +0.82% -
EstimatedCycles 21,562,795 21,691,321 +0.60% EstimatedCycles should decrease; tolerance 10.00%
blob_reads 235 235 +0.00% blob_reads should decrease; tolerance 10.00%

Baseline commit(s): 3b768fe8b087

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
commonware-mcp 3f71446 Aug 18 2026, 09:54 PM

guruvamsi-policharla and others added 8 commits August 18, 2026 13:26
Generalize committed inputs from one vector to independently keyed blocks
(the commit-and-prove arity of the paper's Definition 9): layouts group
committed selections into blocks, setup samples one delta per block and
produces per-block commitment keys, claims carry one commitment per block,
witnesses carry per-block openings whose sum masks the B-side polynomial,
and verification pairs each block commitment with its own delta.

The identity is now a legal block commitment (homomorphic commitments to
zero reach it), so the point codec gains an identity-permitting read used
by claims, and the commit/verify identity gates on commitments are lifted
while the proof-point gates remain. Commitment keys expose their generators
so protocols can maintain commitments homomorphically outside the proof
system.

Claim, VerifyingKey, and ProvingKey wire formats change; fixtures
regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add lower-level prove/verify/batch entry points where the caller binds the
statement (public inputs and block commitments, or their preimages) into the
transcript. The standard entry points now bind the claim through a helper and
call the prebound core, which reorders the transcript so the claim precedes
the marker and key digest; all challenges change accordingly (ALPHA, no
migration). batch_verify_prebound takes each block commitment as weighted
point terms and folds the derivation into its multi-scalar multiplications,
partitioning weight-one terms onto the 128-bit coefficient path.

Add setup_with_trapdoor returning the zeroizing setup Trapdoor and a
simulate entry point that forges accepting proofs from the trapdoor alone,
for zero-knowledge testing and simulated load generation.

No encoded formats change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add the commonware-privacy crate as a workspace member with the
backend-agnostic payments contract (the Backend, Commitment, and Opening
traits) and the non-cryptographic mock backend, ported unchanged from the
prior arkworks-based line. The zkpari backend follows, built on
commonware-cryptography's native Pari rather than arkworks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two Pari-compiler optimizations that keep the compiled relation small
without touching the shared circuit DSL or its other consumers:

- Multiplication by a constant becomes a linear scaling of the other
  operand, emitting no rows or columns. This also removes the cost of the
  DSL lowering negation and subtraction to multiplication by -1.
- A squared value consumed only by a single equality assertion is fused
  into that assertion as one row (base^2 == other) instead of allocating an
  output column and a separate square row. Booleanity (b^2 == b) becomes one
  row and no column.

On bit-decomposition circuits this cuts the padded domain by roughly a
factor of four (an 8-bit reconstruction fits domain 16, not 64), which
brings the batched transfer relation to domain 256.

Relation digests change; no encoded formats are affected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add the BLS12-381 private-payments backend built on
commonware-cryptography's Pari, keeping the payments::Backend contract:

- range: the batched-transfer relation via the circuit DSL — two 64-bit
  range checks and the theta-aggregation v1 + theta*v2 — compiled to
  domain 256 (matching the prior arkworks design) thanks to constant
  folding and square-assertion fusion.
- payments: fund (proof-free deterministic commitment), transfer, and burn,
  each committing balances in the relation's payment basis (block 1) and
  proving through the prebound fold API so batch verification folds the
  aggregate com_theta = ledger[0] + theta*ledger[1] into its MSMs. Balances
  are homomorphic PaymentCommitments; overspend panics before proving.
- simulator: trapdoor-forged transfer proofs for load generation.
- codec: compressed commitments (48 B), openings (40 B), and range proofs
  (176 B), the identity permitted for zero-balance commitments.

Twelve tests cover the transfer/burn/mixed pipelines, boundary amounts,
overspend, fund-commitment binding, simulated proofs, and codec roundtrips.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Port the proof-size and verification-time harness to the native backend:
176-byte transfer proof, 48-byte commitment, ~11 ms proving, ~81 us per
transfer amortized across a batch of 100.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An integrating ledger keys transactions by their proof, so the Pari proof
and the payments RangeProof must be hashable. Add the derive and a
static-assertion test that the wire types satisfy the full integration
bound bundle (FixedSize + Read<Cfg=()> + Write + Clone + Eq + Debug + Hash
+ Send + Sync), plus Send + Sync + 'static on the params.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Batch verification re-derived the aggregation challenge per claim by
re-encoding the whole verifying key (603 bytes for the transfer relation)
and hashing it. Bind the key's cached digest instead, exposed via a new
public VerifyingKey::digest accessor. The digest covers every field of the
key, so this is strictly at least as binding as the full encoding.

Same-session A/B on the transfer benchmark: batch verification of 100
transfers drops from ~84 to ~73 microseconds per transfer (~14%).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.25735% with 265 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.46%. Comparing base (dfe4c5a) to head (3f71446).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
cryptography/src/zk/pari/types.rs 81.15% 68 Missing and 10 partials ⚠️
cryptography/src/zk/pari/circuit.rs 95.13% 24 Missing and 16 partials ⚠️
cryptography/src/zk/pari/prover.rs 86.20% 11 Missing and 17 partials ⚠️
cryptography/src/zk/pari/fuzz.rs 79.68% 24 Missing and 2 partials ⚠️
cryptography/src/zk/pari/verifier.rs 89.66% 12 Missing and 13 partials ⚠️
cryptography/src/zk/pari/poly.rs 96.44% 15 Missing and 6 partials ⚠️
cryptography/src/zk/pari/simulator.rs 70.00% 14 Missing and 7 partials ⚠️
privacy/src/payments/mod.rs 0.00% 11 Missing ⚠️
cryptography/src/zk/pari/setup.rs 94.79% 5 Missing and 5 partials ⚠️
cryptography/src/zk/pari/mod.rs 87.17% 4 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #4523      +/-   ##
==========================================
- Coverage   95.48%   95.46%   -0.02%     
==========================================
  Files         606      617      +11     
  Lines      273215   279458    +6243     
  Branches     6572     6772     +200     
==========================================
+ Hits       260890   266797    +5907     
- Misses      10144    10394     +250     
- Partials     2181     2267      +86     
Files with missing lines Coverage Δ
cryptography/src/bls12381/primitives/group.rs 96.14% <100.00%> (+0.01%) ⬆️
cryptography/src/zk/pari/mod.rs 87.17% <87.17%> (ø)
cryptography/src/zk/pari/setup.rs 94.79% <94.79%> (ø)
privacy/src/payments/mod.rs 0.00% <0.00%> (ø)
cryptography/src/zk/pari/poly.rs 96.44% <96.44%> (ø)
cryptography/src/zk/pari/simulator.rs 70.00% <70.00%> (ø)
cryptography/src/zk/pari/verifier.rs 89.66% <89.66%> (ø)
cryptography/src/zk/pari/fuzz.rs 79.68% <79.68%> (ø)
cryptography/src/zk/pari/prover.rs 86.20% <86.20%> (ø)
cryptography/src/zk/pari/circuit.rs 95.13% <95.13%> (ø)
... and 1 more

... and 61 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfe4c5a...3f71446. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant