Skip to content

Commit

Permalink
7790: some other review comments are addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Aug 29, 2024
1 parent 53c3592 commit d1f935d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
if(NOT DISABLE_AZTEC_VM)
barretenberg_module(vm ultra_honk stdlib_honk_verifier)
barretenberg_module(vm sumcheck stdlib_honk_verifier)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ AvmRecursiveVerifier_<Flavor>::AvmRecursiveVerifier_(Builder* builder, const std
, builder(builder)
{}

// TODO(#991): (see https://github.com/AztecProtocol/barretenberg/issues/991)
template <typename Flavor>
std::array<typename Flavor::GroupElement, 2> AvmRecursiveVerifier_<Flavor>::verify_proof(const HonkProof& proof)
{
Expand Down Expand Up @@ -65,25 +66,23 @@ std::array<typename Flavor::GroupElement, 2> AvmRecursiveVerifier_<Flavor>::veri
gate_challenges[idx] = transcript->template get_challenge<FF>("Sumcheck:gate_challenge_" + std::to_string(idx));
}

// No need to constrain that sumcheck_verified is true as this is guaranteed by the implementation of
// when called over a "circuit field" types.
auto [multivariate_challenge, claimed_evaluations, sumcheck_verified] =
sumcheck.verify(relation_parameters, alpha, gate_challenges);

// TODO(md): call assert true on the builder type to lay down the positive boolean constraint?
// using bool_ct = stdlib::bool_t<Builder>;
// bool_ct is_true = bool_ct(1);
// sumcheck_verified.must_imply(is_true, "sumcheck verification failed");
vinfo("verified sumcheck: ", (sumcheck_verified.has_value() && sumcheck_verified.value()));

auto multivariate_to_univariate_opening_claim = Zeromorph::verify(circuit_size,
commitments.get_unshifted(),
commitments.get_to_be_shifted(),
claimed_evaluations.get_unshifted(),
claimed_evaluations.get_shifted(),
multivariate_challenge,
Commitment::one(builder),
transcript);
auto opening_claim = Zeromorph::verify(circuit_size,
commitments.get_unshifted(),
commitments.get_to_be_shifted(),
claimed_evaluations.get_unshifted(),
claimed_evaluations.get_shifted(),
multivariate_challenge,
Commitment::one(builder),
transcript);

auto pairing_points = PCS::reduce_verify(multivariate_to_univariate_opening_claim, transcript);
auto pairing_points = PCS::reduce_verify(opening_claim, transcript);

return pairing_points;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ TEST_F(AvmRecursiveTests, recursion)
bool outer_circuit_checked = CircuitChecker::check(outer_circuit);
ASSERT_TRUE(outer_circuit_checked) << "outer circuit check failed";

auto manifest = verifier.transcript->get_manifest();
auto recursive_manifest = recursive_verifier.transcript->get_manifest();

EXPECT_EQ(manifest.size(), recursive_manifest.size());
for (size_t i = 0; i < recursive_manifest.size(); ++i) {
EXPECT_EQ(recursive_manifest[i], manifest[i]);
}

for (auto const [key_el, rec_key_el] : zip_view(verifier.key->get_all(), recursive_verifier.key->get_all())) {
EXPECT_EQ(key_el, rec_key_el.get_value());
}

EXPECT_EQ(verifier.key->circuit_size, recursive_verifier.key->circuit_size);
EXPECT_EQ(verifier.key->num_public_inputs, recursive_verifier.key->num_public_inputs);

// Make a proof of the verification of an AVM proof
const size_t srs_size = 1 << 23;
auto ultra_instance = std::make_shared<OuterProverInstance>(
Expand All @@ -107,13 +122,5 @@ TEST_F(AvmRecursiveTests, recursion)
auto recursion_proof = ultra_prover.construct_proof();
bool recursion_verified = ultra_verifier.verify_proof(recursion_proof);
EXPECT_TRUE(recursion_verified) << "recursion proof verification failed";

auto manifest = verifier.transcript->get_manifest();
auto recursive_manifest = recursive_verifier.transcript->get_manifest();

EXPECT_EQ(manifest.size(), recursive_manifest.size());
for (size_t i = 0; i < recursive_manifest.size(); ++i) {
EXPECT_EQ(recursive_manifest[i], manifest[i]);
}
}
} // namespace tests_avm

0 comments on commit d1f935d

Please sign in to comment.