Cache Groth16 public-input bases for single-proof verification - #482
Open
ValarDragon wants to merge 4 commits into
Open
ValarDragon wants to merge 4 commits into
ValarDragon wants to merge 4 commits into
Conversation
|
Note Complete: Audit complete. No review-worthy issues remain after automated review. One finding was auto-invalidated. Open the full results here. Analyzed two files, diff |
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.
Summary
Cache width-five window tables for the fixed public-input G1 bases when a
Groth16 verifying key is prepared. Single-proof verification uses those tables
with variable-time recoding of public inputs. The pairing equation and proof
acceptance rules are unchanged. This adds roughly 2.25 KiB of prepared-key
storage per public-input base and moves table construction to key preparation.
Measurement
Local Criterion, eight proof checks per iteration:
mainFor the seven-input diagnostic, width five measured 12.45 and 12.59 ms in
two runs; width four measured 13.09 and 12.88 ms. The one-input comparison
was 8.08 ms at width five versus 8.00 ms at width four, so the larger table
is a small regression for that case.
The seven-input diagnostic uses a MiMC proof and an expanded verifying key,
so the proof is invalid, but
verify_proofexecutes the complete input MSM,Miller loop, and final exponentiation before returning the result. The
diagnostic benchmark code was not included in this PR.
Checks
cargo test -p zakura-bellman --lib --locked(58 tests)cargo test -p zakura-bellman --lib verify_seven_public_inputs --lockedcargo test -p zakura-bellman --test mimc --lockedcargo test -p zakura-sapling-crypto --lib --locked(69 tests)cargo check -p zakura-bellman --no-default-features --features groth16 --lockedcargo fmt --all -- --checkgit diff --checkThe new test verifies a valid proof with seven public inputs and rejects a
change at each position. No public or crate-visible Rust API changes; the
public
PreparedVerifyingKeytype gains one private cached field.