-
Notifications
You must be signed in to change notification settings - Fork 613
feat: VK generation test for HonkRecursionConstraint #13637
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
Changes from 1 commit
6bdc0c8
2225292
b30e242
c6ddd7f
fc1d775
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,7 +155,8 @@ template <typename RecursiveFlavor> class AcirHonkRecursionConstraint : public : | |
| * @param inner_circuits | ||
| * @return Composer | ||
| */ | ||
| template <typename BuilderType> BuilderType create_outer_circuit(std::vector<InnerBuilder>& inner_circuits) | ||
| template <typename BuilderType> | ||
| BuilderType create_outer_circuit(std::vector<InnerBuilder>& inner_circuits, bool dummy_witnesses = false) | ||
| { | ||
| std::vector<RecursionConstraint> honk_recursion_constraints; | ||
|
|
||
|
|
@@ -208,6 +209,9 @@ template <typename RecursiveFlavor> class AcirHonkRecursionConstraint : public : | |
| honk_recursion = 2; | ||
| } | ||
| ProgramMetadata metadata{ .honk_recursion = honk_recursion }; | ||
| if (dummy_witnesses) { | ||
| witness = {}; // set it all to 0 | ||
|
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. I think this is all we need to do to in order to trigger the dummy witness generation
Contributor
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. I think that's right |
||
| } | ||
| AcirProgram program{ constraint_system, witness }; | ||
| BuilderType outer_circuit = create_circuit<BuilderType>(program, metadata); | ||
|
|
||
|
|
@@ -228,6 +232,30 @@ using Flavors = testing::Types<UltraRecursiveFlavor_<UltraCircuitBuilder>, | |
|
|
||
| TYPED_TEST_SUITE(AcirHonkRecursionConstraint, Flavors); | ||
|
|
||
| TYPED_TEST(AcirHonkRecursionConstraint, TestHonkRecursionConstraintVKGeneration) | ||
| { | ||
| std::vector<typename TestFixture::InnerBuilder> layer_1_circuits; | ||
| layer_1_circuits.push_back(TestFixture::create_inner_circuit()); | ||
|
|
||
| auto layer_2_circuit = | ||
| TestFixture::template create_outer_circuit<typename TestFixture::OuterBuilder>(layer_1_circuits); | ||
|
|
||
| auto layer_2_circuit_with_dummy_witnesses = | ||
| TestFixture::template create_outer_circuit<typename TestFixture::OuterBuilder>(layer_1_circuits, | ||
| /*dummy_witnesses=*/true); | ||
|
|
||
| auto proving_key = std::make_shared<typename TestFixture::OuterDeciderProvingKey>(layer_2_circuit); | ||
| auto verification_key = std::make_shared<typename TestFixture::OuterVerificationKey>(proving_key->proving_key); | ||
|
|
||
| auto proving_key_dummy = | ||
| std::make_shared<typename TestFixture::OuterDeciderProvingKey>(layer_2_circuit_with_dummy_witnesses); | ||
| auto verification_key_dummy = | ||
| std::make_shared<typename TestFixture::OuterVerificationKey>(proving_key_dummy->proving_key); | ||
|
|
||
| // Compare the two vks | ||
| EXPECT_EQ(*verification_key_dummy, *verification_key); | ||
| } | ||
|
|
||
| TYPED_TEST(AcirHonkRecursionConstraint, TestBasicSingleHonkRecursionConstraint) | ||
| { | ||
| std::vector<typename TestFixture::InnerBuilder> layer_1_circuits; | ||
|
|
@@ -243,7 +271,7 @@ TYPED_TEST(AcirHonkRecursionConstraint, TestBasicSingleHonkRecursionConstraint) | |
| info("prover gates = ", proving_key->proving_key.circuit_size); | ||
| auto proof = prover.construct_proof(); | ||
| auto verification_key = std::make_shared<typename TestFixture::OuterVerificationKey>(proving_key->proving_key); | ||
| info(HasIPAAccumulator<TypeParam>); | ||
|
|
||
| if constexpr (HasIPAAccumulator<TypeParam>) { | ||
| auto ipa_verification_key = std::make_shared<VerifierCommitmentKey<curve::Grumpkin>>(1 << CONST_ECCVM_LOG_N); | ||
| typename TestFixture::OuterVerifier verifier(verification_key, ipa_verification_key); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,7 @@ UltraRecursiveVerifier_<Flavor>::Output UltraRecursiveVerifier_<Flavor>::verify_ | |
|
|
||
| auto pairing_points = PCS::reduce_verify_batch_opening_claim(opening_claim, transcript); | ||
|
|
||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/1352): Investigate if normalize() calls are needed. | ||
|
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. my guess is that these are not needed |
||
| pairing_points[0] = pairing_points[0].normalize(); | ||
| pairing_points[1] = pairing_points[1].normalize(); | ||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/995): generate recursion separator challenge properly. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.