Repository navigation
Add KZH-k multilinear polynomial commitments - #171
Merged
Merged
Conversation
h-hafezi
requested review from
WizardOfMenlo,
mmagician and
weikengchen
and removed request for
a team
August 26, 2026 01:16
Member
|
Thanks for the PR. I am currently reviewing :) |
Keep paper citations and implementation differences; leave asymptotics to the papers rather than restating them in the crate.
Replace the ~2500-line KZH test suite with multilinear_pc-style smoke coverage: dense/sparse and uneven-partition commit/open/check plus one wrong-evaluation rejection. The shared crate harness always sets hiding bounds, which KZH rejects, so it is not applicable. Cost sweeps, oracle reconstructions, malformed-input and serialization encyclopedias are removed; the two small unit tests in kzh/utils.rs stay.
Contributor
Author
|
Hi Weikeng, I was wondering if I could follow up on this thread. |
Member
|
(no worries I was just a bit busy lately, but I don't think there is any blocker in merging) |
For odd K the middle block's proof layer needs about N^(ceil(K/2)/K) group-scalar terms whether cached or recommitted, so generic openings do not meet the O(N^(1/2)) quoted by the papers; record that instead of claiming the papers' costs. Also stop asserting that large MSMs saturate the Rayon pool: ark-ec 0.5 parallelizes an MSM only across its bucket windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module has outer docs in lib.rs, so rustdoc resolves the combined docs from the crate root, where `MultilinearExtension` is not in scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
weikengchen
approved these changes
Sep 28, 2026
Keep the module docs about the implementation; protocol details and costs are left to the papers. 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.
Description
This PR adds KZH-
k, a non-hiding pairing-based multilinear polynomialcommitment family parameterized by the const generic
K.The implementation follows KZH-Fold and uses the generic-opening auxiliary
commitments described by IronDict. It uses arkworks' native little-endian MLE
layout throughout and calls
MultilinearExtension::fix_variablesfor partialevaluation.
Highlights
PolynomialCommitmentinterface for dense and sparsearkworks multilinear extensions.
variables is not divisible by
K.contraction needs fewer group-scalar terms than recommitting the partially
evaluated polynomial in a single-polynomial opening (at most the first
floor(K/2)layers, as in IronDict's generic opening). Tables that onlyserve free Boolean openings are not computed.
linear-combination APIs, and prepared verifier keys.
proofs, labels, and point dimensions at operation boundaries.
polynomials, a wrong-evaluation rejection test, unit tests for block
splitting and auxiliary-table selection, and a Criterion benchmark
(
benches/kzh_times.rs) forK = 2, 3, 4, 6at 12, 16, and 20 variablesthat also prints serialized parameter, key, state, and proof sizes.
Costs
The counts below are for
N = 2^nevaluations and one polynomial. They comefrom the implementation's own planner (
auxiliary_prefix_lengthsandopening_work_planinkzh/utils.rs), printed by a local, uncommitted probefor
K = 2, 3, 4, 6andn = 12, 13, 16, 17, 20. They count MSM scalar terms, pairings, and proofelements; they are not runtime measurements, and this PR makes no wall-clock
claims.
(1 + floor(K/2)) * NMSM scalar terms, i.e. oneN-termMSM for the commitment plus
Nterms per stored auxiliary table (2NforK = 2, 3,3NforK = 4,4NforK = 6in every case above).O(N)field operations plusO(N^(ceil(K/2)/K))group-scalar terms, which isO(sqrt(N))for evenKand zero for
K = 2. For oddKthis is above theO(sqrt(N))quoted inthe papers' cost summaries (
K = 3,n = 20: 8192 terms, i.e.8 * sqrt(N)). A same-point batch ofb > 1polynomials contractsbcached tables per cached layer, or recommits the layer when that is cheaper,
so it needs more group work than a single-polynomial opening.
K - 1layers of G1 elements plus the last block'sfield elements, i.e.
O(K * N^(1/K))elements; verification performsK - 1multi-pairings over those layers and
Kblock-sized MSMs.This PR intentionally does not add hiding commitments, strict degree bounds,
a Boolean-specialized opening API, or an R1CS verification gadget.
The most important files to review are:
poly-commit/src/kzh/mod.rspoly-commit/src/kzh/data_structures.rspoly-commit/src/kzh/utils.rspoly-commit/src/kzh/tests.rsNo existing GitHub issue currently tracks this addition; the construction,
scope, costs, setup assumptions, and compatibility choices are described here
and in the module documentation.
Validation
Local runs on
79c0620(macOS aarch64), mirroring.github/workflows/ci.ymlon stable and nightly with
RUSTFLAGS=-Dwarnings:cargo fmt --all -- --checkcargo check --examples --all,cargo check --examples --all-features --all(stable), and
cargo check --all-features --examples --all --benches(nightly)
cargo test --release: 118 library tests, including the 5 KZH tests, and4 doctests passed
cargo buildandcargo check --workspace --no-default-features --target aarch64-unknown-none --exclude ark-pcs-bench-templatesAdditional KZH checks:
cargo test --release -p ark-poly-commit --no-default-features --features std kzh::(serial auxiliary-table path) andRAYON_NUM_THREADS=2 cargo test --release -p ark-poly-commit kzh::(row-parallel path): 5 passed eachcargo bench -p ark-poly-commit --bench kzh_times -- --test: all 80benchmark functions of the
Kxnmatrix ran once (no timings recorded)RUSTDOCFLAGS=-Dwarnings cargo doc -p ark-poly-commit --no-deps --all-features: no KZH diagnostics; the 30 remaining broken-link errorsalso occur on
masterPendingsection inCHANGELOG.mdFiles changedin the Github PR explorerEdited during maintainer review (@weikengchen, with Claude Code): updated the test and validation sections for the trimmed test suite, and restated costs as operation counts from the implementation's planner.