From cf12dac8c78c413d59e2056b084b6b2f363b8fe7 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 30 Nov 2023 16:10:23 +0000 Subject: [PATCH] construct proofs in all rec v tests --- .../honk/verifier/goblin_verifier.test.cpp | 35 ++++++++-------- .../recursion/honk/verifier/verifier.test.cpp | 41 +++++++------------ 2 files changed, 32 insertions(+), 44 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp index 3e6857dac783..fdef0c393bfb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/goblin_verifier.test.cpp @@ -190,37 +190,36 @@ template class GoblinRecursiveVerifierTest : public testi RecursiveVerifier verifier(&outer_circuit, verification_key); auto pairing_points = verifier.verify_proof(inner_proof); - // Check the recursive verifier circuit + // Check for a failure flag in the recursive verifier circuit EXPECT_EQ(outer_circuit.failed(), false) << outer_circuit.err(); - EXPECT_TRUE(outer_circuit.check_circuit()); - - // { // Construct and verify a proof of the recursive verifier circuit - // auto composer = get_composer(); - // auto instance = composer.create_instance(outer_circuit); - // auto prover = composer.create_prover(instance); - // auto verifier = composer.create_verifier(instance); - // auto proof = prover.construct_proof(); - // bool verified = verifier.verify_proof(proof); - // ASSERT(verified); - // } - - // Additional check 1: Perform native verification then perform the pairing on - // the outputs of the recursive verifier and check that the result agrees. + + // Check 1: Perform native verification then perform the pairing on the outputs of the recursive + // verifier and check that the result agrees. auto native_verifier = inner_composer.create_verifier(instance); auto native_result = native_verifier.verify_proof(inner_proof); auto recursive_result = native_verifier.pcs_verification_key->pairing_check(pairing_points[0].get_value(), pairing_points[1].get_value()); EXPECT_EQ(recursive_result, native_result); - // Additional check 2: Ensure that the underlying native and recursive verification algorithms agree by ensuring + // Check 2: Ensure that the underlying native and recursive verification algorithms agree by ensuring // the manifests produced by each agree. auto recursive_manifest = verifier.transcript.get_manifest(); auto native_manifest = native_verifier.transcript.get_manifest(); - // recursive_manifest.print(); - // native_manifest.print(); for (size_t i = 0; i < recursive_manifest.size(); ++i) { EXPECT_EQ(recursive_manifest[i], native_manifest[i]); } + + // Check 3: Construct and verify a proof of the recursive verifier circuit + { + auto composer = get_composer(); + auto instance = composer.create_instance(outer_circuit); + auto prover = composer.create_prover(instance); + auto verifier = composer.create_verifier(instance); + auto proof = prover.construct_proof(); + bool verified = verifier.verify_proof(proof); + + ASSERT(verified); + } } /** diff --git a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp index 644dd13d9d7c..f2c0beed29a1 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/recursion/honk/verifier/verifier.test.cpp @@ -174,31 +174,10 @@ template class RecursiveVerifierTest : public testing::Te RecursiveVerifier verifier(&outer_circuit, verification_key); auto pairing_points = verifier.verify_proof(inner_proof); - // Check the recursive verifier circuit + // Check for a failure flag in the recursive verifier circuit EXPECT_EQ(outer_circuit.failed(), false) << outer_circuit.err(); - // EXPECT_TRUE(outer_circuit.check_circuit()); - { // Construct and verify a proof of the recursive verifier circuit - auto composer = get_composer(); - auto instance = composer.create_instance(outer_circuit); - auto prover = composer.create_prover(instance); - auto verifier = composer.create_verifier(instance); - auto proof = prover.construct_proof(); - bool verified = verifier.verify_proof(proof); - (void)verified; - - auto prover_manifest = prover.transcript.get_manifest(); - auto verifier_manifest = verifier.transcript.get_manifest(); - // prover_manifest.print(); - // verifier_manifest.print(); - for (size_t i = 0; i < prover_manifest.size(); ++i) { - EXPECT_EQ(prover_manifest[i], verifier_manifest[i]); - } - - ASSERT(verified); - } - - // Additional check 1: Perform native verification then perform the pairing on the outputs of the recursive + // Check 1: Perform native verification then perform the pairing on the outputs of the recursive // verifier and check that the result agrees. auto native_verifier = inner_composer.create_verifier(instance); auto native_result = native_verifier.verify_proof(inner_proof); @@ -206,15 +185,25 @@ template class RecursiveVerifierTest : public testing::Te pairing_points[1].get_value()); EXPECT_EQ(recursive_result, native_result); - // Additional check 2: Ensure that the underlying native and recursive verification algorithms agree by ensuring + // Check 2: Ensure that the underlying native and recursive verification algorithms agree by ensuring // the manifests produced by each agree. auto recursive_manifest = verifier.transcript.get_manifest(); auto native_manifest = native_verifier.transcript.get_manifest(); - // recursive_manifest.print(); - // native_manifest.print(); for (size_t i = 0; i < recursive_manifest.size(); ++i) { EXPECT_EQ(recursive_manifest[i], native_manifest[i]); } + + // Check 3: Construct and verify a proof of the recursive verifier circuit + { + auto composer = get_composer(); + auto instance = composer.create_instance(outer_circuit); + auto prover = composer.create_prover(instance); + auto verifier = composer.create_verifier(instance); + auto proof = prover.construct_proof(); + bool verified = verifier.verify_proof(proof); + + ASSERT(verified); + } } /**