-
Notifications
You must be signed in to change notification settings - Fork 598
feat: fix commitments and openings of masking polynomials used in zk sumcheck #10773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
cee04ed
first steps
iakovenkos b859440
wip: computing the batched big sum claim poly
iakovenkos ff70d41
wip wip assessing approaches
iakovenkos 109ac5f
enhanced zk sumcheck data struct with prover's methods, fixed subgrou…
iakovenkos e986228
verifies, important pieces missing
iakovenkos 77c386a
consistency check added
iakovenkos 0e9a384
reduced the number of gates
iakovenkos d0f2dde
big sum masked
iakovenkos 31505cf
masked constant term + clean-up
iakovenkos 2986222
eccvm working
iakovenkos 4577e05
cleaning up and simplifying
iakovenkos d35feb5
clean up + adding scalar field subgroup generators to curves
iakovenkos c9d43c6
separated zk sumcheck data from small subgroup ipa
iakovenkos 559626c
isolated small subgroup ipa verifier methods
iakovenkos 48ca947
more clean-up
iakovenkos 29f6de7
mega with zk transcript test fixed
iakovenkos c37a3fc
eccvm and translator transcript tests + template on curve instead of …
iakovenkos 000347e
Merge branch 'master' into si/fixing-libra-commitments-and-openings
iakovenkos 537f268
bb native tests fix
iakovenkos ad60e4a
gcc build fix + clean-up + bn254 flavors subgroup size increase
iakovenkos e11702b
come back to 87
iakovenkos cfd31c1
Merge branch 'master' into si/fixing-libra-commitments-and-openings
iakovenkos 63a855b
adding tests
iakovenkos be153e6
added ifft for bn254 - no need to commit to sumcheck univariates
iakovenkos 20e8b53
docs + gcc
iakovenkos 59d485f
Merge branch 'si/fixing-libra-commitments-and-openings' of github.com…
iakovenkos ee6f31d
Merge branch 'master' into si/fixing-libra-commitments-and-openings
iakovenkos 2208253
minor clean-up
iakovenkos 398f7de
small fix
iakovenkos 6ab449b
resolved comments
iakovenkos c7ea181
sumcheck clean-up
iakovenkos 6e03b63
Merge branch 'master' into si/fixing-libra-commitments-and-openings
iakovenkos 90b7cde
removed noise in docs
iakovenkos ce8e47d
fix tests
iakovenkos b13eb0b
Merge branch 'master' into si/fixing-libra-commitments-and-openings
iakovenkos 3c84180
review addressed
iakovenkos 7231860
Merge branch 'master' into si/fixing-libra-commitments-and-openings
iakovenkos 40792a0
Merge branch 'si/fixing-libra-commitments-and-openings' of github.com…
iakovenkos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,118 +223,4 @@ TYPED_TEST(ShpleminiTest, CorrectnessOfGeminiClaimBatching) | |
| EXPECT_EQ(shplemini_result, expected_result); | ||
| } | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test got stale |
||
| /** | ||
| * @brief Libra masking univariates are used in sumcheck to prevent the leakage of witness data through the evaluations | ||
| * of round univariates. Here we test the opening of log_n Libra masking univariates batched with the opening of several | ||
| * prover polynomials and their shifts. | ||
| * | ||
| */ | ||
| TYPED_TEST(ShpleminiTest, ShpleminiWithMaskingLibraUnivariates) | ||
| { | ||
| using ShpleminiProver = ShpleminiProver_<TypeParam>; | ||
| using ShpleminiVerifier = ShpleminiVerifier_<TypeParam>; | ||
| using KZG = KZG<TypeParam>; | ||
| using IPA = IPA<TypeParam>; | ||
| using Fr = typename TypeParam::ScalarField; | ||
| using Commitment = typename TypeParam::AffineElement; | ||
| using Polynomial = typename bb::Polynomial<Fr>; | ||
|
|
||
| const size_t n = 16; | ||
| const size_t log_n = 4; | ||
| // In practice, the length of Libra univariates is equal to FLAVOR::BATCHED_RELATION_PARTIAL_LENGTH | ||
| const size_t LIBRA_UNIVARIATE_LENGTH = 12; | ||
|
|
||
| std::array<Fr, LIBRA_UNIVARIATE_LENGTH> interpolation_domain; | ||
| for (size_t idx = 0; idx < LIBRA_UNIVARIATE_LENGTH; idx++) { | ||
| interpolation_domain[idx] = Fr(idx); | ||
| } | ||
| // Generate multilinear polynomials, their commitments (genuine and mocked) and evaluations (genuine) at a | ||
| // random point. | ||
| auto mle_opening_point = this->random_evaluation_point(log_n); // sometimes denoted 'u' | ||
| auto poly1 = Polynomial::random(n); | ||
| auto poly2 = Polynomial::random(n, 1); | ||
| auto poly3 = Polynomial::random(n, 1); | ||
| auto poly4 = Polynomial::random(n); | ||
|
|
||
| std::vector<bb::Univariate<Fr, LIBRA_UNIVARIATE_LENGTH>> libra_univariates; | ||
| std::vector<Commitment> libra_commitments; | ||
| std::vector<Fr> libra_evaluations; | ||
| for (size_t idx = 0; idx < log_n; idx++) { | ||
| // generate random polynomial | ||
| Polynomial libra_polynomial = Polynomial::random(LIBRA_UNIVARIATE_LENGTH); | ||
| // create a univariate with the same coefficients (to store an array instead of a vector) | ||
| bb::Univariate<Fr, LIBRA_UNIVARIATE_LENGTH> libra_univariate; | ||
| for (size_t i = 0; i < LIBRA_UNIVARIATE_LENGTH; i++) { | ||
| libra_univariate.value_at(i) = libra_polynomial[i]; | ||
| } | ||
| libra_univariates.push_back(libra_univariate); | ||
|
|
||
| // commit to libra polynomial and populate the vector of libra commitments | ||
| Commitment libra_commitment = this->commit(libra_polynomial); | ||
| libra_commitments.push_back(libra_commitment); | ||
|
|
||
| // evaluate current libra univariate at the corresponding challenge and store the value in libra evaluations | ||
| libra_evaluations.push_back(libra_polynomial.evaluate(mle_opening_point[idx])); | ||
| } | ||
|
|
||
| Commitment commitment1 = this->commit(poly1); | ||
| Commitment commitment2 = this->commit(poly2); | ||
| Commitment commitment3 = this->commit(poly3); | ||
| Commitment commitment4 = this->commit(poly4); | ||
| std::vector<Commitment> unshifted_commitments = { commitment1, commitment2, commitment3, commitment4 }; | ||
| std::vector<Commitment> shifted_commitments = { commitment2, commitment3 }; | ||
| auto eval1 = poly1.evaluate_mle(mle_opening_point); | ||
| auto eval2 = poly2.evaluate_mle(mle_opening_point); | ||
| auto eval3 = poly3.evaluate_mle(mle_opening_point); | ||
| auto eval4 = poly4.evaluate_mle(mle_opening_point); | ||
| auto eval2_shift = poly2.evaluate_mle(mle_opening_point, true); | ||
| auto eval3_shift = poly3.evaluate_mle(mle_opening_point, true); | ||
|
|
||
| // Collect multilinear evaluations for input to prover | ||
| // std::vector<Fr> multilinear_evaluations = { eval1, eval2, eval3, eval4, eval2_shift, eval3_shift }; | ||
|
|
||
| auto prover_transcript = NativeTranscript::prover_init_empty(); | ||
|
|
||
| // Run the full prover PCS protocol: | ||
| auto opening_claim = ShpleminiProver::prove(Fr{ n }, | ||
| RefArray{ poly1, poly2, poly3, poly4 }, | ||
| RefArray{ poly2, poly3 }, | ||
| mle_opening_point, | ||
| this->ck(), | ||
| prover_transcript, | ||
| libra_univariates, | ||
| libra_evaluations); | ||
| if constexpr (std::is_same_v<TypeParam, curve::Grumpkin>) { | ||
| IPA::compute_opening_proof(this->ck(), opening_claim, prover_transcript); | ||
| } else { | ||
| KZG::compute_opening_proof(this->ck(), opening_claim, prover_transcript); | ||
| } | ||
|
|
||
| // Run the full verifier PCS protocol with genuine opening claims (genuine commitment, genuine evaluation) | ||
|
|
||
| auto verifier_transcript = NativeTranscript::verifier_init_empty(prover_transcript); | ||
|
|
||
| // Gemini verifier output: | ||
| // - claim: d+1 commitments to Fold_{r}^(0), Fold_{-r}^(0), Fold^(l), d+1 evaluations a_0_pos, a_l, l = 0:d-1 | ||
| auto batch_opening_claim = ShpleminiVerifier::compute_batch_opening_claim(n, | ||
| RefVector(unshifted_commitments), | ||
| RefVector(shifted_commitments), | ||
| RefArray{ eval1, eval2, eval3, eval4 }, | ||
| RefArray{ eval2_shift, eval3_shift }, | ||
| mle_opening_point, | ||
| this->vk()->get_g1_identity(), | ||
| verifier_transcript, | ||
| {}, | ||
| RefVector(libra_commitments), | ||
| libra_evaluations); | ||
|
|
||
| if constexpr (std::is_same_v<TypeParam, curve::Grumpkin>) { | ||
| auto result = IPA::reduce_verify_batch_opening_claim(batch_opening_claim, this->vk(), verifier_transcript); | ||
| EXPECT_EQ(result, true); | ||
| } else { | ||
| const auto pairing_points = KZG::reduce_verify_batch_opening_claim(batch_opening_claim, verifier_transcript); | ||
| // Final pairing check: e([Q] - [Q_z] + z[W], [1]_2) = e([W], [x]_2) | ||
| EXPECT_EQ(this->vk()->pairing_check(pairing_points[0], pairing_points[1]), true); | ||
| } | ||
| } | ||
| } // namespace bb | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we batch the prover's opening claims from SmallSubgroupIPA