Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ void create_dummy_vkey_and_proof(typename Flavor::CircuitBuilder& builder,
builder.assert_equal(builder.add_variable(fr::random_element()), proof_fields[offset].witness_index);
offset++;
}
// TODO(https://github.com/AztecProtocol/barretenberg/issues/1352): Using SMALL_DUMMY_VALUE might resolve this
// issue.
fr SMALL_DUMMY_VALUE(2); // arbtirary small value that shouldn't cause builder problems.
// The aggregation object
for (size_t i = 0; i < AggregationObject::PUBLIC_INPUTS_SIZE; i++) {
builder.assert_equal(builder.add_variable(fr::random_element()), proof_fields[offset].witness_index);
builder.assert_equal(builder.add_variable(SMALL_DUMMY_VALUE), proof_fields[offset].witness_index);
offset++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Contributor

Choose a reason for hiding this comment

The 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);

Expand All @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
Expand Down