From 0261e69315ed0ca93b44b264f833cead67863e42 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 17 Apr 2025 00:33:30 +0000 Subject: [PATCH 1/3] use default local pcsvk for pairing check everywhere --- .../honk_verifier/ultra_recursive_verifier.test.cpp | 12 +++++------- .../protogalaxy_recursive_verifier.test.cpp | 5 ++--- .../translator_recursive_verifier.test.cpp | 4 ++-- .../translator_vm/translator_verifier.cpp | 3 ++- .../src/barretenberg/ultra_honk/decider_verifier.cpp | 5 ++--- .../src/barretenberg/ultra_honk/decider_verifier.hpp | 1 - .../src/barretenberg/ultra_honk/merge_verifier.cpp | 6 +++--- .../src/barretenberg/ultra_honk/merge_verifier.hpp | 1 - .../recursion/recursive_verifier.test.cpp | 9 +++++---- .../src/barretenberg/vm2/constraining/verifier.cpp | 3 ++- 10 files changed, 23 insertions(+), 26 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp index 6fd060590ddd..027b1def747a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp @@ -223,11 +223,10 @@ template class RecursiveVerifierTest : public testing } else { native_result = native_verifier.verify_proof(inner_proof); } - auto pcs_verification_key = std::make_shared(); - bool result = pcs_verification_key->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + auto pcs_vkey = std::make_shared(); + bool result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); info("input pairing points result: ", result); - auto recursive_result = native_verifier.verification_key->verification_key->pcs_verification_key->pairing_check( - pairing_points.P0.get_value(), pairing_points.P1.get_value()); + auto recursive_result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_EQ(recursive_result, native_result); // Check 2: Ensure that the underlying native and recursive verification algorithms agree by ensuring @@ -292,10 +291,9 @@ template class RecursiveVerifierTest : public testing EXPECT_FALSE(CircuitChecker::check(outer_circuit)); } else { EXPECT_TRUE(CircuitChecker::check(outer_circuit)); - auto pcs_verification_key = std::make_shared(); + auto pcs_vkey = std::make_shared(); AggState pairing_points = output.agg_obj; - bool result = - pcs_verification_key->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + bool result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_FALSE(result); } } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp index be36c02fa494..78fdee4757bb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp @@ -335,9 +335,8 @@ template class ProtogalaxyRecursiveTests : public tes // check that the result agrees. InnerDeciderVerifier native_decider_verifier(verifier_accumulator); auto native_result = native_decider_verifier.verify_proof(decider_proof); - auto recursive_result = - native_decider_verifier.accumulator->verification_key->pcs_verification_key->pairing_check( - pairing_points.P0.get_value(), pairing_points.P1.get_value()); + auto pcs_vkey = std::make_shared(); + auto recursive_result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_EQ(native_result, recursive_result); if constexpr (!IsSimulator) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp index b90a24539d95..318ccc6968bb 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp @@ -97,8 +97,8 @@ template class TranslatorRecursiveTests : public ::te native_verifier_transcript->template receive_from_prover("init"); InnerVerifier native_verifier(verification_key, native_verifier_transcript); bool native_result = native_verifier.verify_proof(proof, evaluation_challenge_x, batching_challenge_v); - auto recursive_result = native_verifier.key->pcs_verification_key->pairing_check(pairing_points.P0.get_value(), - pairing_points.P1.get_value()); + auto pcs_vkey = std::make_shared(); + auto recursive_result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_EQ(recursive_result, native_result); auto recursive_manifest = verifier.transcript->get_manifest(); diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp index 390d4e2bd4f2..92ed57d95b76 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp @@ -133,7 +133,8 @@ bool TranslatorVerifier::verify_proof(const HonkProof& proof, sumcheck_output.claimed_libra_evaluation); const auto pairing_points = PCS::reduce_verify_batch_opening_claim(opening_claim, transcript); - auto verified = key->pcs_verification_key->pairing_check(pairing_points[0], pairing_points[1]); + auto pcs_vkey = std::make_shared(); + auto verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); return verified && consistency_checked; } diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp index f875923e3a4c..8fabb0b0f4fa 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp @@ -11,14 +11,12 @@ template DeciderVerifier_::DeciderVerifier_(const std::shared_ptr& accumulator, const std::shared_ptr& transcript) : accumulator(accumulator) - , pcs_verification_key(accumulator->verification_key->pcs_verification_key) , transcript(transcript) {} template DeciderVerifier_::DeciderVerifier_(const std::shared_ptr& accumulator) : accumulator(accumulator) - , pcs_verification_key(accumulator->verification_key->pcs_verification_key) {} /** @@ -83,7 +81,8 @@ template bool DeciderVerifier_::verify() libra_commitments, sumcheck_output.claimed_libra_evaluation); const auto pairing_points = PCS::reduce_verify_batch_opening_claim(opening_claim, transcript); - bool verified = pcs_verification_key->pairing_check(pairing_points[0], pairing_points[1]); + auto pcs_vkey = std::make_shared(); + bool verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); return sumcheck_output.verified && verified && consistency_checked; } diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.hpp index 9cad09edd5ff..1b3ca6bca7e9 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.hpp @@ -33,7 +33,6 @@ template class DeciderVerifier_ { bool verify(); // used when transcript that has been initialized with a proof std::shared_ptr key; std::shared_ptr accumulator; - std::shared_ptr pcs_verification_key; std::shared_ptr transcript; }; diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp index 8d49131aa301..59f371ebbdda 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp @@ -5,8 +5,7 @@ namespace bb { MergeVerifier::MergeVerifier() - : transcript(std::make_shared()) - , pcs_verification_key(std::make_unique()){}; + : transcript(std::make_shared()){}; /** * @brief Verify proper construction of the aggregate Goblin ECC op queue polynomials T_j, j = 1,2,3,4. @@ -87,7 +86,8 @@ bool MergeVerifier::verify_proof(const HonkProof& proof) OpeningClaim batched_claim = { { kappa, batched_eval }, batched_commitment }; auto pairing_points = PCS::reduce_verify(batched_claim, transcript); - auto verified = pcs_verification_key->pairing_check(pairing_points[0], pairing_points[1]); + auto pcs_vkey = std::make_shared(); + auto verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); return identity_checked && verified; } } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp index 35cb37ac7c56..1a5506e3a0b9 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.hpp @@ -29,7 +29,6 @@ class MergeVerifier { bool verify_proof(const HonkProof& proof); private: - std::shared_ptr pcs_verification_key; // Number of columns that jointly constitute the op_queue, should be the same as the number of wires in the // MegaCircuitBuilder static constexpr size_t NUM_WIRES = MegaExecutionTraceBlocks::NUM_WIRES; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp index e367229cd00a..3b09c016a681 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp @@ -96,8 +96,8 @@ TEST_F(AvmRecursiveTests, StandardRecursion) auto agg_object = AggregationObject::construct_default(outer_circuit); auto agg_output = recursive_verifier.verify_proof(proof, public_inputs_cols, agg_object); - bool agg_output_valid = - verification_key->pcs_verification_key->pairing_check(agg_output.P0.get_value(), agg_output.P1.get_value()); + auto pcs_vkey = std::make_shared(); + bool agg_output_valid = pcs_vkey->pairing_check(agg_output.P0.get_value(), agg_output.P1.get_value()); // Check that the output of the recursive verifier is well-formed for aggregation as this pair of points will // be aggregated with others. @@ -205,8 +205,9 @@ TEST_F(AvmRecursiveTests, GoblinRecursion) outer_circuit.ipa_proof = convert_stdlib_proof_to_native(verifier_output.ipa_proof); // Ensure that the pairing check is satisfied on the outputs of the recursive verifier - bool agg_output_valid = verification_key->pcs_verification_key->pairing_check( - verifier_output.agg_obj.P0.get_value(), verifier_output.agg_obj.P1.get_value()); + auto pcs_vkey = std::make_shared(); + bool agg_output_valid = + pcs_vkey->pairing_check(verifier_output.agg_obj.P0.get_value(), verifier_output.agg_obj.P1.get_value()); ASSERT_TRUE(agg_output_valid) << "Pairing points (aggregation state) are not valid."; ASSERT_FALSE(outer_circuit.failed()) << "Outer circuit has failed."; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp index 00e146b813e1..1f04644d2d9c 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp @@ -111,7 +111,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vectorpcs_verification_key->pairing_check(pairing_points[0], pairing_points[1]); + auto pcs_vkey = std::make_shared(); + const auto shplemini_verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); if (!shplemini_verified) { vinfo("Shplemini verification failed"); From 1f366bf87a6d9c8e9bcd671787b2685b9ec90d29 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 17 Apr 2025 01:18:23 +0000 Subject: [PATCH 2/3] remove pcs vk from vk for all but eccvm --- .../src/barretenberg/api/api_client_ivc.cpp | 3 --- .../src/barretenberg/api/api_ultra_honk.cpp | 1 - .../client_ivc/client_ivc.test.cpp | 2 -- .../avm2_recursion_constraint.test.cpp | 4 ---- .../ivc_recursion_constraint.test.cpp | 18 +----------------- .../barretenberg/dsl/acir_proofs/c_bind.cpp | 9 --------- .../src/barretenberg/eccvm/eccvm_flavor.hpp | 12 ++++-------- .../cpp/src/barretenberg/flavor/flavor.hpp | 1 - .../eccvm_verifier/eccvm_recursive_flavor.hpp | 6 ++++-- .../recursive_decider_verification_key.hpp | 5 +---- .../translator_recursive_flavor.hpp | 1 - .../flavor_serialization.test.cpp | 3 --- .../stdlib_circuit_builders/mega_flavor.hpp | 1 - .../mega_recursive_flavor.hpp | 1 - .../stdlib_circuit_builders/ultra_flavor.hpp | 1 - .../ultra_keccak_flavor.hpp | 1 - .../ultra_recursive_flavor.hpp | 1 - .../ultra_rollup_flavor.hpp | 1 - .../ultra_rollup_recursive_flavor.hpp | 1 - .../translator_vm/translator.test.cpp | 2 -- .../translator_vm/translator_flavor.hpp | 2 -- .../barretenberg/vm2/constraining/flavor.hpp | 2 -- .../recursion/recursive_flavor.hpp | 1 - 23 files changed, 10 insertions(+), 69 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp index 1c131ba77f88..8f4e4b376e24 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp @@ -301,9 +301,6 @@ bool ClientIVCAPI::verify([[maybe_unused]] const Flags& flags, const auto proof = ClientIVC::Proof::from_file_msgpack(proof_path); const auto vk = from_buffer(read_file(vk_path)); - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1335): Should be able to remove this. - vk.mega->pcs_verification_key = std::make_shared>(); - const bool verified = ClientIVC::verify(proof, vk); return verified; } diff --git a/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp b/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp index 7342dd189bb5..53e564006ceb 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_ultra_honk.cpp @@ -110,7 +110,6 @@ bool _verify(const bool ipa_accumulation, srs::init_crs_factory({}, g2_data); auto vk = std::make_shared(from_buffer(read_file(vk_path))); - vk->pcs_verification_key = std::make_shared>(); auto public_inputs = many_from_buffer(read_file(public_inputs_path)); auto proof = many_from_buffer(read_file(proof_path)); // concatenate public inputs and proof diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp index 0e5d0dbac8da..c6e886eec332 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp @@ -314,9 +314,7 @@ TEST_F(ClientIVCTests, VKIndependenceTest) auto ivc_vk = ivc.get_vk(); // PCS verification keys will not match so set to null before comparing - ivc_vk.mega->pcs_verification_key = nullptr; ivc_vk.eccvm->pcs_verification_key = nullptr; - ivc_vk.translator->pcs_verification_key = nullptr; return ivc_vk; }; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm2_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm2_recursion_constraint.test.cpp index 59ca2026dbcc..300e623bb904 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm2_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/avm2_recursion_constraint.test.cpp @@ -193,10 +193,6 @@ TEST_F(AcirAvm2RecursionConstraint, TestGenerateVKFromConstraintsWithoutWitness) actual_vk = std::make_shared(prover.proving_key->proving_key); } - // PCS verification key adresses will in general not match so set to null before comparing - expected_vk->pcs_verification_key = nullptr; - actual_vk->pcs_verification_key = nullptr; - // Compare the VK constructed via running the IVC with the one constructed via mocking EXPECT_EQ(*actual_vk.get(), *expected_vk.get()); } diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.test.cpp index 05c2cf946ee7..6dc4cb4a218d 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/ivc_recursion_constraint.test.cpp @@ -316,10 +316,6 @@ TEST_F(IvcRecursionConstraintTest, GenerateVK) kernel_vk = std::make_shared(prover.proving_key->proving_key); } - // PCS verification keys will not match so set to null before comparing - kernel_vk->pcs_verification_key = nullptr; - expected_kernel_vk->pcs_verification_key = nullptr; - EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get()); } @@ -358,10 +354,6 @@ TEST_F(IvcRecursionConstraintTest, GenerateInitKernelVKFromConstraints) kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings); } - // PCS verification keys will not match so set to null before comparing - kernel_vk->pcs_verification_key = nullptr; - expected_kernel_vk->pcs_verification_key = nullptr; - // Compare the VK constructed via running the IVc with the one constructed via mocking EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get()); } @@ -411,10 +403,6 @@ TEST_F(IvcRecursionConstraintTest, GenerateResetKernelVKFromConstraints) kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings); } - // PCS verification keys will not match so set to null before comparing - kernel_vk->pcs_verification_key = nullptr; - expected_kernel_vk->pcs_verification_key = nullptr; - // Compare the VK constructed via running the IVc with the one constructed via mocking EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get()); } @@ -472,10 +460,6 @@ TEST_F(IvcRecursionConstraintTest, GenerateInnerKernelVKFromConstraints) kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings); } - // PCS verification keys will not match so set to null before comparing - kernel_vk->pcs_verification_key = nullptr; - expected_kernel_vk->pcs_verification_key = nullptr; - // Compare the VK constructed via running the IVc with the one constructed via mocking EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get()); } @@ -534,4 +518,4 @@ TEST_F(IvcRecursionConstraintTest, BadRecursiveVerifierAppCircuitTest) // Still expect this to be true since we don't aggregate pairing point objects correctly. // If we fix aggregation, we should expect this test to fail. EXPECT_TRUE(ivc->prove_and_verify()); -} \ No newline at end of file +} diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp index e2ac38475cc6..e48c3436a9cb 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_proofs/c_bind.cpp @@ -293,9 +293,6 @@ WASM_EXPORT void acir_verify_aztec_client(uint8_t const* proof_buf, uint8_t cons const auto proof = ClientIVC::Proof::from_msgpack_buffer(proof_buf); const auto vk = from_buffer(from_buffer>(vk_buf)); - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1335): Should be able to remove this. - vk.mega->pcs_verification_key = std::make_shared>(); - *result = ClientIVC::verify(proof, vk); } @@ -337,12 +334,10 @@ WASM_EXPORT void acir_prove_ultra_keccak_honk(uint8_t const* acir_vec, uint8_t c WASM_EXPORT void acir_verify_ultra_honk(uint8_t const* proof_buf, uint8_t const* vk_buf, bool* result) { using VerificationKey = UltraFlavor::VerificationKey; - using VerifierCommitmentKey = bb::VerifierCommitmentKey; using Verifier = UltraVerifier_; auto proof = many_from_buffer(from_buffer>(proof_buf)); auto verification_key = std::make_shared(from_buffer(vk_buf)); - verification_key->pcs_verification_key = std::make_shared(); Verifier verifier{ verification_key }; @@ -352,12 +347,10 @@ WASM_EXPORT void acir_verify_ultra_honk(uint8_t const* proof_buf, uint8_t const* WASM_EXPORT void acir_verify_ultra_keccak_honk(uint8_t const* proof_buf, uint8_t const* vk_buf, bool* result) { using VerificationKey = UltraKeccakFlavor::VerificationKey; - using VerifierCommitmentKey = bb::VerifierCommitmentKey; using Verifier = UltraVerifier_; auto proof = many_from_buffer(from_buffer>(proof_buf)); auto verification_key = std::make_shared(from_buffer(vk_buf)); - verification_key->pcs_verification_key = std::make_shared(); Verifier verifier{ verification_key }; @@ -402,11 +395,9 @@ WASM_EXPORT void acir_write_vk_ultra_keccak_honk(uint8_t const* acir_vec, uint8_ WASM_EXPORT void acir_honk_solidity_verifier(uint8_t const* proof_buf, uint8_t const* vk_buf, uint8_t** out) { using VerificationKey = UltraKeccakFlavor::VerificationKey; - using VerifierCommitmentKey = bb::VerifierCommitmentKey; auto proof = many_from_buffer(from_buffer>(proof_buf)); auto verification_key = from_buffer(vk_buf); - verification_key.pcs_verification_key = std::make_shared(); auto str = get_honk_solidity_verifier(&verification_key); *out = to_heap_buffer(str); diff --git a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp index 75fbc636a5cd..ed89ef164c5d 100644 --- a/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/eccvm/eccvm_flavor.hpp @@ -750,15 +750,15 @@ class ECCVMFlavor { public: bool operator==(const VerificationKey&) const = default; + // IPA verification key requires one more point. + std::shared_ptr pcs_verification_key = + std::make_shared(ECCVM_FIXED_SIZE + 1); + // Default construct the fixed VK that results from ECCVM_FIXED_SIZE VerificationKey() : VerificationKey_(ECCVM_FIXED_SIZE, /*num_public_inputs=*/0) { this->pub_inputs_offset = 0; - // IPA verification key requires one more point. - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1025): make it so that PCSs inform the crs of - // how many points they need - this->pcs_verification_key = std::make_shared(ECCVM_FIXED_SIZE + 1); // Populate the commitments of the precomputed polynomials using the fixed VK data for (auto [vk_commitment, fixed_commitment] : @@ -773,10 +773,6 @@ class ECCVMFlavor { VerificationKey(const std::shared_ptr& proving_key) { - // IPA verification key requires one more point. - // TODO(https://github.com/AztecProtocol/barretenberg/issues/1025): make it so that PCSs inform the crs of - // how many points they need - this->pcs_verification_key = std::make_shared(ECCVM_FIXED_SIZE + 1); this->circuit_size = 1UL << CONST_ECCVM_LOG_N; this->log_circuit_size = CONST_ECCVM_LOG_N; this->num_public_inputs = proving_key->num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp index 835ea934221a..c530eeebd92d 100644 --- a/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/flavor/flavor.hpp @@ -163,7 +163,6 @@ class VerificationKey_ : public PrecomputedCommitments { public: using FF = typename VerifierCommitmentKey::Curve::ScalarField; using Commitment = typename VerifierCommitmentKey::Commitment; - std::shared_ptr pcs_verification_key; FF_ circuit_size; FF_ log_circuit_size; FF_ num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp index 3c25d778971b..6c125e03291e 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp @@ -92,6 +92,9 @@ template class ECCVMRecursiveFlavor_ { class VerificationKey : public VerificationKey_, VerifierCommitmentKey> { public: + // IPA verification key requires one more point. + std::shared_ptr pcs_verification_key; + /** * @brief Construct a new Verification Key with stdlib types from a provided native verification * key @@ -99,10 +102,9 @@ template class ECCVMRecursiveFlavor_ { * @param builder * @param native_key Native verification key from which to extract the precomputed commitments */ - VerificationKey(CircuitBuilder* builder, const std::shared_ptr& native_key) { - this->pcs_verification_key = std::make_shared( + pcs_verification_key = std::make_shared( builder, 1UL << CONST_ECCVM_LOG_N, native_key->pcs_verification_key); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1324): Remove `circuit_size` and // `log_circuit_size` from MSGPACK and the verification key. diff --git a/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/recursive_decider_verification_key.hpp b/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/recursive_decider_verification_key.hpp index edaab8b4bd36..51fbbc9fd709 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/recursive_decider_verification_key.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/recursive_decider_verification_key.hpp @@ -103,9 +103,6 @@ template class RecursiveDeciderVerificationKey_ { auto native_honk_vk = std::make_shared( static_cast(verification_key->circuit_size.get_value()), static_cast(verification_key->num_public_inputs.get_value())); - native_honk_vk->pcs_verification_key = verification_key->pcs_verification_key == nullptr - ? std::make_shared() - : verification_key->pcs_verification_key; native_honk_vk->pub_inputs_offset = static_cast(verification_key->pub_inputs_offset.get_value()); native_honk_vk->contains_pairing_point_accumulator = verification_key->contains_pairing_point_accumulator; native_honk_vk->pairing_point_accumulator_public_input_indices = @@ -153,4 +150,4 @@ template class RecursiveDeciderVerificationKey_ { return decider_vk; } }; -} // namespace bb::stdlib::recursion::honk \ No newline at end of file +} // namespace bb::stdlib::recursion::honk diff --git a/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_flavor.hpp index 05ee8edcc7d5..33e00adf6fec 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_flavor.hpp @@ -99,7 +99,6 @@ template class TranslatorRecursiveFlavor_ { public: VerificationKey(CircuitBuilder* builder, const std::shared_ptr& native_key) { - this->pcs_verification_key = std::make_shared(); // ? // TODO(https://github.com/AztecProtocol/barretenberg/issues/1324): Remove `circuit_size` and // `log_circuit_size` from MSGPACK and the verification key. this->circuit_size = FF{ 1UL << TranslatorFlavor::CONST_TRANSLATOR_LOG_N }; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp index cceb4feb4046..9a911411e88b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/flavor_serialization.test.cpp @@ -44,9 +44,6 @@ TYPED_TEST(FlavorSerializationTests, VerificationKeySerialization) auto proving_key = std::make_shared(builder); VerificationKey original_vkey{ proving_key->proving_key }; - // Set the pcs ptr to null since this will not be reconstructed correctly from buffer - original_vkey.pcs_verification_key = nullptr; - // Populate some non-zero values in the databus_propagation_data to ensure its being handled if constexpr (IsMegaBuilder) { original_vkey.databus_propagation_data.app_return_data_commitment_pub_input_key = diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp index 5cd8a2c33881..64e127806d53 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_flavor.hpp @@ -439,7 +439,6 @@ class MegaFlavor { void set_metadata(const ProvingKey& proving_key) { - this->pcs_verification_key = std::make_shared(); this->circuit_size = proving_key.circuit_size; this->log_circuit_size = numeric::get_msb(this->circuit_size); this->num_public_inputs = proving_key.num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp index 1d477417c0cf..9463a6eec606 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/mega_recursive_flavor.hpp @@ -120,7 +120,6 @@ template class MegaRecursiveFlavor_ { */ VerificationKey(CircuitBuilder* builder, const std::shared_ptr& native_key) { - this->pcs_verification_key = native_key->pcs_verification_key; this->circuit_size = FF::from_witness(builder, native_key->circuit_size); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1283): Use stdlib get_msb. this->log_circuit_size = FF::from_witness(builder, numeric::get_msb(native_key->circuit_size)); diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp index 0348685ff2e2..bd2d74fc0b8d 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_flavor.hpp @@ -360,7 +360,6 @@ class UltraFlavor { {} VerificationKey(ProvingKey& proving_key) { - this->pcs_verification_key = std::make_shared(); this->circuit_size = proving_key.circuit_size; this->log_circuit_size = numeric::get_msb(this->circuit_size); this->num_public_inputs = proving_key.num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_flavor.hpp index 5ff26a6adedc..9a8857e249ec 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_keccak_flavor.hpp @@ -44,7 +44,6 @@ class UltraKeccakFlavor : public bb::UltraFlavor { {} VerificationKey(ProvingKey& proving_key) { - this->pcs_verification_key = std::make_shared(); this->circuit_size = proving_key.circuit_size; this->log_circuit_size = numeric::get_msb(this->circuit_size); this->num_public_inputs = proving_key.num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp index 1425b2905244..ae3e9fb54447 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_recursive_flavor.hpp @@ -119,7 +119,6 @@ template class UltraRecursiveFlavor_ { */ VerificationKey(CircuitBuilder* builder, const std::shared_ptr& native_key) { - this->pcs_verification_key = native_key->pcs_verification_key; this->circuit_size = FF::from_witness(builder, native_key->circuit_size); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1283): Use stdlib get_msb. this->log_circuit_size = FF::from_witness(builder, numeric::get_msb(native_key->circuit_size)); diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_flavor.hpp index 8b633dd87e12..20f8fee63ea0 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_flavor.hpp @@ -84,7 +84,6 @@ class UltraRollupFlavor : public bb::UltraFlavor { : contains_ipa_claim(proving_key.contains_ipa_claim) , ipa_claim_public_input_indices(proving_key.ipa_claim_public_input_indices) { - this->pcs_verification_key = std::make_shared(); this->circuit_size = proving_key.circuit_size; this->log_circuit_size = numeric::get_msb(this->circuit_size); this->num_public_inputs = proving_key.num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_recursive_flavor.hpp index d35cfba12ac1..59abc28f4e6f 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib_circuit_builders/ultra_rollup_recursive_flavor.hpp @@ -66,7 +66,6 @@ template class UltraRollupRecursiveFlavor_ : public Ultra : contains_ipa_claim(native_key->contains_ipa_claim) , ipa_claim_public_input_indices(native_key->ipa_claim_public_input_indices) { - this->pcs_verification_key = native_key->pcs_verification_key; this->circuit_size = FF::from_witness(builder, native_key->circuit_size); // TODO(https://github.com/AztecProtocol/barretenberg/issues/1283): Use stdlib get_msb. this->log_circuit_size = FF::from_witness(builder, numeric::get_msb(native_key->circuit_size)); diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/translator.test.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/translator.test.cpp index 282eefc5814a..36e163a47e7a 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/translator.test.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/translator.test.cpp @@ -96,7 +96,6 @@ TEST_F(TranslatorTests, FixedVK) // Generate the default fixed VK TranslatorFlavor::VerificationKey fixed_vk{}; - fixed_vk.pcs_verification_key = nullptr; // Lambda for manually computing a verification key for a given circuit and comparing it to the fixed VK auto compare_computed_vk_against_fixed = [&](size_t circuit_size_parameter) { @@ -105,7 +104,6 @@ TEST_F(TranslatorTests, FixedVK) auto proving_key = std::make_shared(circuit_builder); TranslatorProver prover{ proving_key, prover_transcript }; TranslatorFlavor::VerificationKey computed_vk(proving_key->proving_key); - computed_vk.pcs_verification_key = nullptr; EXPECT_EQ(computed_vk, fixed_vk); }; diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp b/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp index 45f42d2e5c0d..6bdb1bedb96b 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/translator_flavor.hpp @@ -724,7 +724,6 @@ class TranslatorFlavor { : VerificationKey_(1UL << CONST_TRANSLATOR_LOG_N, /*num_public_inputs=*/0) { this->pub_inputs_offset = 0; - this->pcs_verification_key = std::make_shared(); // Populate the commitments of the precomputed polynomials for (auto [vk_commitment, fixed_commitment] : @@ -738,7 +737,6 @@ class TranslatorFlavor { {} VerificationKey(const std::shared_ptr& proving_key) { - this->pcs_verification_key = std::make_shared(); this->circuit_size = 1UL << TranslatorFlavor::CONST_TRANSLATOR_LOG_N; this->log_circuit_size = CONST_TRANSLATOR_LOG_N; this->num_public_inputs = proving_key->num_public_inputs; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/flavor.hpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/flavor.hpp index f2910d5cf530..9ddb3f2ed24d 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/flavor.hpp @@ -243,7 +243,6 @@ class AvmFlavor { zip_view(proving_key->get_precomputed_polynomials(), this->get_all())) { commitment = proving_key->commitment_key->commit(polynomial); } - pcs_verification_key = std::make_shared(); } VerificationKey(const size_t circuit_size, @@ -254,7 +253,6 @@ class AvmFlavor { for (auto [vk_cmt, cmt] : zip_view(this->get_all(), precomputed_cmts)) { vk_cmt = cmt; } - pcs_verification_key = std::make_shared(); } std::vector to_field_elements() const; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_flavor.hpp index 5dd879597c1a..ec7237fedfbd 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_flavor.hpp @@ -65,7 +65,6 @@ template class AvmRecursiveFlavor_ { public: VerificationKey(CircuitBuilder* builder, const std::shared_ptr& native_key) { - this->pcs_verification_key = native_key->pcs_verification_key; this->circuit_size = FF::from_witness(builder, native_key->circuit_size); this->log_circuit_size = FF::from_witness(builder, numeric::get_msb(native_key->circuit_size)); this->num_public_inputs = FF::from_witness(builder, native_key->num_public_inputs); From 8216ceb687e8b490814d11eba037fb8b17742b45 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 17 Apr 2025 03:46:20 +0000 Subject: [PATCH 3/3] dont use ptr --- .../stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp | 1 - .../honk_verifier/ultra_recursive_verifier.test.cpp | 11 ++++++----- .../protogalaxy_recursive_verifier.test.cpp | 5 +++-- .../translator_recursive_verifier.test.cpp | 5 +++-- .../translator_vm/translator_verifier.cpp | 5 +++-- .../src/barretenberg/ultra_honk/decider_verifier.cpp | 5 +++-- .../src/barretenberg/ultra_honk/merge_verifier.cpp | 4 ++-- .../recursion/recursive_verifier.test.cpp | 10 ++++++---- .../src/barretenberg/vm2/constraining/verifier.cpp | 5 +++-- 9 files changed, 29 insertions(+), 22 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp b/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp index 6c125e03291e..a76ad7b33eca 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/eccvm_verifier/eccvm_recursive_flavor.hpp @@ -92,7 +92,6 @@ template class ECCVMRecursiveFlavor_ { class VerificationKey : public VerificationKey_, VerifierCommitmentKey> { public: - // IPA verification key requires one more point. std::shared_ptr pcs_verification_key; /** diff --git a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp index 027b1def747a..ddbb367bcf6a 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/honk_verifier/ultra_recursive_verifier.test.cpp @@ -45,6 +45,7 @@ template class RecursiveVerifierTest : public testing using AggState = aggregation_state; using VerifierOutput = bb::stdlib::recursion::honk::UltraRecursiveVerifierOutput; + using NativeVerifierCommitmentKey = typename InnerFlavor::VerifierCommitmentKey; /** * @brief Create a non-trivial arbitrary inner circuit, the proof of which will be recursively verified * @@ -223,10 +224,10 @@ template class RecursiveVerifierTest : public testing } else { native_result = native_verifier.verify_proof(inner_proof); } - auto pcs_vkey = std::make_shared(); - bool result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + NativeVerifierCommitmentKey pcs_vkey{}; + bool result = pcs_vkey.pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); info("input pairing points result: ", result); - auto recursive_result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + auto recursive_result = pcs_vkey.pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_EQ(recursive_result, native_result); // Check 2: Ensure that the underlying native and recursive verification algorithms agree by ensuring @@ -291,9 +292,9 @@ template class RecursiveVerifierTest : public testing EXPECT_FALSE(CircuitChecker::check(outer_circuit)); } else { EXPECT_TRUE(CircuitChecker::check(outer_circuit)); - auto pcs_vkey = std::make_shared(); + NativeVerifierCommitmentKey pcs_vkey{}; AggState pairing_points = output.agg_obj; - bool result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + bool result = pcs_vkey.pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_FALSE(result); } } diff --git a/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp index 78fdee4757bb..e2756a3de92c 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/protogalaxy_verifier/protogalaxy_recursive_verifier.test.cpp @@ -269,6 +269,7 @@ template class ProtogalaxyRecursiveTests : public tes */ static void test_full_protogalaxy_recursive() { + using NativeVerifierCommitmentKey = typename InnerFlavor::VerifierCommitmentKey; // Create two arbitrary circuits for the first round of folding InnerBuilder builder1; create_function_circuit(builder1); @@ -335,8 +336,8 @@ template class ProtogalaxyRecursiveTests : public tes // check that the result agrees. InnerDeciderVerifier native_decider_verifier(verifier_accumulator); auto native_result = native_decider_verifier.verify_proof(decider_proof); - auto pcs_vkey = std::make_shared(); - auto recursive_result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + NativeVerifierCommitmentKey pcs_vkey{}; + auto recursive_result = pcs_vkey.pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_EQ(native_result, recursive_result); if constexpr (!IsSimulator) { diff --git a/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp index 318ccc6968bb..f4b5bced856b 100644 --- a/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/stdlib/translator_vm_verifier/translator_recursive_verifier.test.cpp @@ -61,6 +61,7 @@ template class TranslatorRecursiveTests : public ::te static void test_recursive_verification() { + using NativeVerifierCommitmentKey = typename InnerFlavor::VerifierCommitmentKey; // Add the same operations to the ECC op queue; the native computation is performed under the hood. auto op_queue = create_op_queue(500); @@ -97,8 +98,8 @@ template class TranslatorRecursiveTests : public ::te native_verifier_transcript->template receive_from_prover("init"); InnerVerifier native_verifier(verification_key, native_verifier_transcript); bool native_result = native_verifier.verify_proof(proof, evaluation_challenge_x, batching_challenge_v); - auto pcs_vkey = std::make_shared(); - auto recursive_result = pcs_vkey->pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); + NativeVerifierCommitmentKey pcs_vkey{}; + auto recursive_result = pcs_vkey.pairing_check(pairing_points.P0.get_value(), pairing_points.P1.get_value()); EXPECT_EQ(recursive_result, native_result); auto recursive_manifest = verifier.transcript->get_manifest(); diff --git a/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp b/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp index 92ed57d95b76..49ae849e98a8 100644 --- a/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/translator_vm/translator_verifier.cpp @@ -62,6 +62,7 @@ bool TranslatorVerifier::verify_proof(const HonkProof& proof, using ClaimBatch = ClaimBatcher::Batch; using InterleavedBatch = ClaimBatcher::InterleavedBatch; using Sumcheck = SumcheckVerifier; + using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey; // Load the proof produced by the translator prover transcript->load_proof(proof); @@ -133,8 +134,8 @@ bool TranslatorVerifier::verify_proof(const HonkProof& proof, sumcheck_output.claimed_libra_evaluation); const auto pairing_points = PCS::reduce_verify_batch_opening_claim(opening_claim, transcript); - auto pcs_vkey = std::make_shared(); - auto verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); + VerifierCommitmentKey pcs_vkey{}; + auto verified = pcs_vkey.pairing_check(pairing_points[0], pairing_points[1]); return verified && consistency_checked; } diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp index 8fabb0b0f4fa..c475181c7c3d 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/decider_verifier.cpp @@ -40,6 +40,7 @@ template bool DeciderVerifier_::verify() using VerifierCommitments = typename Flavor::VerifierCommitments; using ClaimBatcher = ClaimBatcher_; using ClaimBatch = ClaimBatcher::Batch; + using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey; VerifierCommitments commitments{ accumulator->verification_key, accumulator->witness_commitments }; @@ -81,8 +82,8 @@ template bool DeciderVerifier_::verify() libra_commitments, sumcheck_output.claimed_libra_evaluation); const auto pairing_points = PCS::reduce_verify_batch_opening_claim(opening_claim, transcript); - auto pcs_vkey = std::make_shared(); - bool verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); + VerifierCommitmentKey pcs_vkey{}; + bool verified = pcs_vkey.pairing_check(pairing_points[0], pairing_points[1]); return sumcheck_output.verified && verified && consistency_checked; } diff --git a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp index 59f371ebbdda..b74c4221ea6c 100644 --- a/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/ultra_honk/merge_verifier.cpp @@ -86,8 +86,8 @@ bool MergeVerifier::verify_proof(const HonkProof& proof) OpeningClaim batched_claim = { { kappa, batched_eval }, batched_commitment }; auto pairing_points = PCS::reduce_verify(batched_claim, transcript); - auto pcs_vkey = std::make_shared(); - auto verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); + VerifierCommitmentKey pcs_vkey{}; + auto verified = pcs_vkey.pairing_check(pairing_points[0], pairing_points[1]); return identity_checked && verified; } } // namespace bb diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp index 3b09c016a681..e963fa39e692 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/recursion/recursive_verifier.test.cpp @@ -76,6 +76,7 @@ TEST_F(AvmRecursiveTests, StandardRecursion) using OuterVerifier = UltraVerifier; using OuterDeciderProvingKey = DeciderProvingKey_; using AggregationObject = stdlib::recursion::aggregation_state; + using NativeVerifierCommitmentKey = typename AvmFlavor::VerifierCommitmentKey; if (testing::skip_slow_tests()) { GTEST_SKIP(); @@ -96,8 +97,8 @@ TEST_F(AvmRecursiveTests, StandardRecursion) auto agg_object = AggregationObject::construct_default(outer_circuit); auto agg_output = recursive_verifier.verify_proof(proof, public_inputs_cols, agg_object); - auto pcs_vkey = std::make_shared(); - bool agg_output_valid = pcs_vkey->pairing_check(agg_output.P0.get_value(), agg_output.P1.get_value()); + NativeVerifierCommitmentKey pcs_vkey{}; + bool agg_output_valid = pcs_vkey.pairing_check(agg_output.P0.get_value(), agg_output.P1.get_value()); // Check that the output of the recursive verifier is well-formed for aggregation as this pair of points will // be aggregated with others. @@ -165,6 +166,7 @@ TEST_F(AvmRecursiveTests, GoblinRecursion) using UltraFF = UltraRollupRecursiveFlavor::FF; using UltraRollupProver = UltraProver_; using AggregationObject = stdlib::recursion::aggregation_state; + using NativeVerifierCommitmentKey = typename AvmFlavor::VerifierCommitmentKey; NativeProofResult proof_result; ASSERT_NO_FATAL_FAILURE({ create_and_verify_native_proof(proof_result); }); @@ -205,9 +207,9 @@ TEST_F(AvmRecursiveTests, GoblinRecursion) outer_circuit.ipa_proof = convert_stdlib_proof_to_native(verifier_output.ipa_proof); // Ensure that the pairing check is satisfied on the outputs of the recursive verifier - auto pcs_vkey = std::make_shared(); + NativeVerifierCommitmentKey pcs_vkey{}; bool agg_output_valid = - pcs_vkey->pairing_check(verifier_output.agg_obj.P0.get_value(), verifier_output.agg_obj.P1.get_value()); + pcs_vkey.pairing_check(verifier_output.agg_obj.P0.get_value(), verifier_output.agg_obj.P1.get_value()); ASSERT_TRUE(agg_output_valid) << "Pairing points (aggregation state) are not valid."; ASSERT_FALSE(outer_circuit.failed()) << "Outer circuit has failed."; diff --git a/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp b/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp index 1f04644d2d9c..36aeb1335a59 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/constraining/verifier.cpp @@ -47,6 +47,7 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vector; using ClaimBatcher = ClaimBatcher_; using ClaimBatch = ClaimBatcher::Batch; + using VerifierCommitmentKey = typename Flavor::VerifierCommitmentKey; RelationParameters relation_parameters; @@ -111,8 +112,8 @@ bool AvmVerifier::verify_proof(const HonkProof& proof, const std::vector(); - const auto shplemini_verified = pcs_vkey->pairing_check(pairing_points[0], pairing_points[1]); + VerifierCommitmentKey pcs_vkey{}; + const auto shplemini_verified = pcs_vkey.pairing_check(pairing_points[0], pairing_points[1]); if (!shplemini_verified) { vinfo("Shplemini verification failed");