-
Notifications
You must be signed in to change notification settings - Fork 595
chore: SmallSubgroupIPA tests #11106
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 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bacf36e
added unit and integration tests
iakovenkos dd35c95
gcc build fixed
iakovenkos a05ee54
docs + issues
iakovenkos 77f8caa
Merge branch 'master' into si/chore-small-subgroup-ipa-tests
iakovenkos c2cf95d
comments resolved
iakovenkos 3192760
Merge branch 'si/chore-small-subgroup-ipa-tests' of github.com:AztecP…
iakovenkos 59cf075
Merge branch 'master' into si/chore-small-subgroup-ipa-tests
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
29 changes: 29 additions & 0 deletions
29
barretenberg/cpp/src/barretenberg/commitment_schemes/pcs_test_flavors.hpp
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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #pragma once | ||
|
|
||
| #include "barretenberg/ecc/curves/bn254/bn254.hpp" | ||
| #include "barretenberg/transcript/transcript.hpp" | ||
| #include "commitment_key.test.hpp" | ||
|
|
||
| namespace bb { | ||
| /** | ||
| * @brief Mock Flavors to use ZKSumcheckData and SmallSubgroupIPAProver in the PCS tests. | ||
| * | ||
| */ | ||
| class TestBn254Flavor { | ||
| public: | ||
| using Curve = curve::BN254; | ||
| using CommitmentKey = bb::CommitmentKey<curve::BN254>; | ||
| using Transcript = NativeTranscript; | ||
| using FF = typename Curve::ScalarField; | ||
| static constexpr size_t SUBGROUP_SIZE = Curve::SUBGROUP_SIZE; | ||
| }; | ||
|
|
||
| class TestGrumpkinFlavor { | ||
| public: | ||
| using Curve = curve::Grumpkin; | ||
| using CommitmentKey = bb::CommitmentKey<curve::Grumpkin>; | ||
| using Transcript = NativeTranscript; | ||
| using FF = typename Curve::ScalarField; | ||
| static constexpr size_t SUBGROUP_SIZE = Curve::SUBGROUP_SIZE; | ||
| }; | ||
| } // namespace bb | ||
70 changes: 70 additions & 0 deletions
70
barretenberg/cpp/src/barretenberg/commitment_schemes/pcs_test_instance_witness_generator.hpp
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 |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #pragma once | ||
|
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. Introduced this struct to remove redundant pattern in pcs tests where we manually generate polys, commit to them, and evaluate them |
||
|
|
||
| #include "barretenberg/ecc/curves/bn254/bn254.hpp" | ||
| #include "barretenberg/polynomials/polynomial.hpp" | ||
| #include "barretenberg/transcript/transcript.hpp" | ||
| #include "commitment_key.test.hpp" | ||
|
|
||
| namespace bb { | ||
| /** | ||
| * @brief Constructs random polynomials, computes commitments and corresponding evaluations. | ||
| * | ||
| * @tparam Curve | ||
| */ | ||
| template <typename Curve> struct PCSInstanceWitnessGenerator { | ||
|
iakovenkos marked this conversation as resolved.
Outdated
|
||
| public: | ||
| using CommitmentKey = bb::CommitmentKey<Curve>; | ||
| using Fr = typename Curve::ScalarField; | ||
| using Commitment = typename Curve::AffineElement; | ||
| using Polynomial = bb::Polynomial<Fr>; | ||
|
|
||
| std::shared_ptr<CommitmentKey> ck; | ||
| std::vector<Polynomial> polynomials; | ||
|
iakovenkos marked this conversation as resolved.
Outdated
|
||
| std::vector<Polynomial> shiftable_polynomials; | ||
| std::vector<Fr> const_size_mle_opening_point; | ||
| std::vector<Commitment> unshifted_commitments; | ||
| std::vector<Commitment> shifted_commitments; | ||
| std::vector<Fr> unshifted_evals; | ||
| std::vector<Fr> shifted_evals; | ||
|
|
||
| PCSInstanceWitnessGenerator(const size_t n, | ||
| const size_t num_polynomials, | ||
| const size_t num_shiftable, | ||
| const std::vector<Fr>& mle_opening_point, | ||
| std::shared_ptr<CommitmentKey>& commitment_key) | ||
| : ck(commitment_key) // Initialize the commitment key | ||
| , polynomials(num_polynomials) | ||
| , shiftable_polynomials(num_shiftable) | ||
|
|
||
| { | ||
| construct_instance_and_witnesses(n, mle_opening_point); | ||
| } | ||
|
|
||
| void construct_instance_and_witnesses(size_t n, const std::vector<Fr>& mle_opening_point) | ||
| { | ||
|
|
||
| const size_t num_unshifted = polynomials.size() - shiftable_polynomials.size(); | ||
|
|
||
| // Process polynomials that are not getting shifted | ||
|
iakovenkos marked this conversation as resolved.
Outdated
|
||
| for (size_t idx = 0; idx < num_unshifted; idx++) { | ||
| polynomials[idx] = Polynomial::random(n); | ||
| unshifted_commitments.push_back(ck->commit(polynomials[idx])); | ||
| unshifted_evals.push_back(polynomials[idx].evaluate_mle(mle_opening_point)); | ||
| } | ||
|
|
||
| // Process polynomials that are getting shifted | ||
|
iakovenkos marked this conversation as resolved.
Outdated
|
||
| size_t idx = num_unshifted; | ||
| for (auto& poly : shiftable_polynomials) { | ||
| poly = Polynomial::random(n, /*shiftable*/ 1); | ||
| polynomials[idx] = poly; | ||
| auto comm = this->ck->commit(poly); | ||
|
iakovenkos marked this conversation as resolved.
Outdated
|
||
| unshifted_commitments.push_back(comm); | ||
| shifted_commitments.push_back(comm); | ||
|
iakovenkos marked this conversation as resolved.
Outdated
|
||
| unshifted_evals.push_back(poly.evaluate_mle(mle_opening_point)); | ||
| shifted_evals.push_back(poly.evaluate_mle(mle_opening_point, true)); | ||
| idx++; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| } // namespace bb | ||
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.
Uh oh!
There was an error while loading. Please reload this page.