From 1e1aa97d4c26f0f849e19e1156576a4d6fe04e6d Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Fri, 29 Aug 2025 19:20:17 +0000 Subject: [PATCH 01/25] Progress towards not using global honk_vk --- .../barretenberg/client_ivc/client_ivc.cpp | 24 +++++++++++-------- .../barretenberg/client_ivc/client_ivc.hpp | 4 +++- .../client_ivc/client_ivc.test.cpp | 4 ---- .../client_ivc/mock_circuit_producer.hpp | 5 ++++ .../client_ivc/mock_kernel_pinning.test.cpp | 10 +++++--- barretenberg/sol/lib/forge-std | 1 - barretenberg/sol/lib/openzeppelin-contracts | 1 - barretenberg/sol/lib/solidity-stringutils | 1 - bb-pilcom/powdr | 1 - l1-contracts/lib/circuits | 1 - l1-contracts/lib/forge-std | 1 - l1-contracts/lib/openzeppelin-contracts | 1 - 12 files changed, 29 insertions(+), 25 deletions(-) delete mode 160000 barretenberg/sol/lib/forge-std delete mode 160000 barretenberg/sol/lib/openzeppelin-contracts delete mode 160000 barretenberg/sol/lib/solidity-stringutils delete mode 160000 bb-pilcom/powdr delete mode 160000 l1-contracts/lib/circuits delete mode 160000 l1-contracts/lib/forge-std delete mode 160000 l1-contracts/lib/openzeppelin-contracts diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 0495ab8bf859..aa3fdcbccc04 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -191,7 +191,8 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( hide_op_queue_accumulation_result(circuit); // Propagate the public inputs of the tail kernel by converting them to public inputs of the hiding circuit. - auto num_public_inputs = static_cast(honk_vk->num_public_inputs); + auto num_public_inputs = + static_cast(verifier_inputs.honk_vk_and_hash->vk->num_public_inputs.get_value()); num_public_inputs -= KernelIO::PUBLIC_INPUTS_SIZE; // exclude fixed kernel_io public inputs for (size_t i = 0; i < num_public_inputs; i++) { verifier_inputs.proof[i].set_public(); @@ -488,22 +489,22 @@ void ClientIVC::accumulate(ClientCircuit& circuit, const std::shared_ptr& verification_key) { // Note: a structured trace is not used for the hiding kernel auto hiding_decider_pk = std::make_shared(circuit, TraceSettings(), bn254_commitment_key); - honk_vk = std::make_shared(hiding_decider_pk->get_precomputed()); - auto& hiding_circuit_vk = honk_vk; + honk_vk = verification_key; + + BB_ASSERT_EQ(*honk_vk, *verification_key, "Recomputed hiding VK disagrees!"); + // Hiding circuit is proven by a MegaZKProver - MegaZKProver prover(hiding_decider_pk, hiding_circuit_vk, transcript); + MegaZKProver prover(hiding_decider_pk, honk_vk, transcript); HonkProof proof = prover.construct_proof(); return proof; diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp index 7fbd2ad28dcf..daf4e2ac19fc 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp @@ -271,7 +271,6 @@ class ClientIVC { Proof prove(); static void hide_op_queue_accumulation_result(ClientCircuit& circuit); - HonkProof construct_mega_proof_for_hiding_kernel(ClientCircuit& circuit); static bool verify(const Proof& proof, const VerificationKey& vk); @@ -302,6 +301,9 @@ class ClientIVC { const std::shared_ptr& transcript, bool is_kernel); + HonkProof construct_honk_proof_for_hiding_kernel(ClientCircuit& circuit, + const std::shared_ptr& honk_vk); + QUEUE_TYPE get_queue_type() const; static std::shared_ptr perform_oink_recursive_verification( 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 eadf345d8aef..2c0107802fdf 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp @@ -67,10 +67,6 @@ class ClientIVCTests : public ::testing::Test { ClientIVC ivc{ num_circuits, trace_settings }; for (size_t j = 0; j < num_circuits; ++j) { - // Use default test settings for the mock hiding kernel since it's size must always be consistent - if (j == num_circuits - 1) { - settings = TestSettings{}; - } circuit_producer.construct_and_accumulate_next_circuit(ivc, settings); } return { ivc.prove(), ivc.get_vk() }; diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp index 1b5328e81d56..03d2d7524466 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/mock_circuit_producer.hpp @@ -202,6 +202,11 @@ class PrivateFunctionExecutionMockCircuitProducer { std::pair> create_next_circuit_and_vk(ClientIVC& ivc, TestSettings settings = {}) { + // If this is a mock hiding kernel, remove the settings and use a default (non-structured) trace + if (ivc.num_circuits_accumulated == ivc.get_num_circuits() - 1) { + settings = TestSettings{}; + ivc.trace_settings = TraceSettings{}; + } auto circuit = create_next_circuit(ivc, settings.log2_num_gates, settings.num_public_inputs); return { circuit, get_verification_key(circuit, ivc.trace_settings) }; } diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp index b4bacd16136e..78b3f50a3477 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp @@ -32,8 +32,12 @@ TEST_F(MockKernelTest, PinFoldingKernelSizes) auto [circuit, vk] = circuit_producer.create_next_circuit_and_vk(ivc); ivc.accumulate(circuit, vk); - EXPECT_TRUE(circuit.blocks.has_overflow); // trace overflow mechanism should be triggered + // Expect trace overflow for all but the hiding kernel (final circuit) + if (idx < NUM_CIRCUITS - 1) { + EXPECT_TRUE(circuit.blocks.has_overflow); + EXPECT_EQ(ivc.fold_output.accumulator->log_dyadic_size(), 19); + } else { + EXPECT_FALSE(circuit.blocks.has_overflow); + } } - - EXPECT_EQ(ivc.fold_output.accumulator->log_dyadic_size(), 19); } diff --git a/barretenberg/sol/lib/forge-std b/barretenberg/sol/lib/forge-std deleted file mode 160000 index 74cfb77e308d..000000000000 --- a/barretenberg/sol/lib/forge-std +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 74cfb77e308dd188d2f58864aaf44963ae6b88b1 diff --git a/barretenberg/sol/lib/openzeppelin-contracts b/barretenberg/sol/lib/openzeppelin-contracts deleted file mode 160000 index e50c24f5839d..000000000000 --- a/barretenberg/sol/lib/openzeppelin-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e50c24f5839db17f46991478384bfda14acfb830 diff --git a/barretenberg/sol/lib/solidity-stringutils b/barretenberg/sol/lib/solidity-stringutils deleted file mode 160000 index 46983c6d9462..000000000000 --- a/barretenberg/sol/lib/solidity-stringutils +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 46983c6d9462a80229cf0d5bab8ea3b3ee31066c diff --git a/bb-pilcom/powdr b/bb-pilcom/powdr deleted file mode 160000 index c3006c11819d..000000000000 --- a/bb-pilcom/powdr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c3006c11819d9b53fb183c9c12a10b83481bb631 diff --git a/l1-contracts/lib/circuits b/l1-contracts/lib/circuits deleted file mode 160000 index e47bcd526f5e..000000000000 --- a/l1-contracts/lib/circuits +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e47bcd526f5e38f9603d07d0791984ec53efd254 diff --git a/l1-contracts/lib/forge-std b/l1-contracts/lib/forge-std deleted file mode 160000 index 0e7097750918..000000000000 --- a/l1-contracts/lib/forge-std +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0e7097750918380d84dd3cfdef595bee74dabb70 diff --git a/l1-contracts/lib/openzeppelin-contracts b/l1-contracts/lib/openzeppelin-contracts deleted file mode 160000 index 448efeea6640..000000000000 --- a/l1-contracts/lib/openzeppelin-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 448efeea6640bbbc09373f03fbc9c88e280147ba From 007db1e6ba7c232f0ff68858d8ae749d4b57ea8d Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Fri, 29 Aug 2025 19:40:52 +0000 Subject: [PATCH 02/25] remove honk_vk altogether --- .../cpp/src/barretenberg/client_ivc/client_ivc.cpp | 12 +++++------- .../cpp/src/barretenberg/client_ivc/client_ivc.hpp | 3 +-- .../dsl/acir_format/pg_recursion_constraint.cpp | 2 -- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index aa3fdcbccc04..cb0670b043de 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -466,8 +466,6 @@ void ClientIVC::accumulate(ClientCircuit& circuit, const std::shared_ptrcommitment_key = bn254_commitment_key; trace_usage_tracker.update(circuit); - honk_vk = precomputed_vk; - // We're accumulating a kernel if the verification queue is empty (because the kernel circuit contains recursive // verifiers for all the entries previously present in the verification queue) and if it's not the first accumulate // call (which will always be for an app circuit). @@ -547,12 +545,9 @@ HonkProof ClientIVC::construct_honk_proof_for_hiding_kernel( { // Note: a structured trace is not used for the hiding kernel auto hiding_decider_pk = std::make_shared(circuit, TraceSettings(), bn254_commitment_key); - honk_vk = verification_key; - - BB_ASSERT_EQ(*honk_vk, *verification_key, "Recomputed hiding VK disagrees!"); // Hiding circuit is proven by a MegaZKProver - MegaZKProver prover(hiding_decider_pk, honk_vk, transcript); + MegaZKProver prover(hiding_decider_pk, verification_key, transcript); HonkProof proof = prover.construct_proof(); return proof; @@ -739,7 +734,10 @@ ClientIVC::Proof ClientIVC::Proof::from_file_msgpack(const std::string& filename // VerificationKey construction ClientIVC::VerificationKey ClientIVC::get_vk() const { - return { honk_vk, std::make_shared(), std::make_shared() }; + auto verification_key = verification_queue.front().honk_vk; + return { verification_key, + std::make_shared(), + std::make_shared() }; } void ClientIVC::update_native_verifier_accumulator(const VerifierInputs& queue_entry, diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp index daf4e2ac19fc..d878ac47fa85 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp @@ -221,8 +221,7 @@ class ClientIVC { std::shared_ptr recursive_verifier_native_accum; // native verifier accumulator used in recursive folding std::shared_ptr - native_verifier_accum; // native verifier accumulator used in prover folding - std::shared_ptr honk_vk; // honk vk to be completed and folded into the accumulator + native_verifier_accum; // native verifier accumulator used in prover folding // Set of tuples {proof, verification_key, type (Oink/PG)} to be recursively verified VerificationQueue verification_queue; diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.cpp index a9fce6c6e8e9..418414f4b8c8 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.cpp @@ -162,8 +162,6 @@ void mock_ivc_accumulation(const std::shared_ptr& ivc, ClientIVC::QUE ivc->goblin.merge_verification_queue.emplace_back(acir_format::create_mock_merge_proof()); // If the type is PG_FINAL, we also need to populate the ivc instance with a mock decider proof if (type == ClientIVC::QUEUE_TYPE::PG_FINAL) { - // we have to create a mock honk vk - ivc->honk_vk = entry.honk_vk; ivc->decider_proof = acir_format::create_mock_decider_proof(); } ivc->num_circuits_accumulated++; From c016a2594a4a7beab11c2b693e8be44af07ac3c4 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Fri, 29 Aug 2025 20:47:40 +0000 Subject: [PATCH 03/25] WiP replace fold_output with prover_accumulator --- .../src/barretenberg/client_ivc/client_ivc.cpp | 16 +++++++++------- .../src/barretenberg/client_ivc/client_ivc.hpp | 4 ++-- .../barretenberg/client_ivc/client_ivc.test.cpp | 2 +- .../client_ivc/mock_kernel_pinning.test.cpp | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index cb0670b043de..e6a7ca46e0a4 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -377,13 +377,14 @@ HonkProof ClientIVC::construct_oink_proof(const std::shared_ptrgate_challenges = prover_accumulation_transcript->template get_powers_of_challenge("gate_challenge", CONST_PG_LOG_N); - fold_output.accumulator = proving_key; // initialize the prover accum with the completed key + prover_accumulator = proving_key; // initialize the prover accum with the completed key HonkProof oink_proof = oink_prover.export_proof(); vinfo("oink proof constructed"); return oink_proof; } +// WORKTODO: could make these static by passing in and out the prover accumulator HonkProof ClientIVC::construct_pg_proof(const std::shared_ptr& proving_key, const std::shared_ptr& honk_vk, const std::shared_ptr& transcript, @@ -399,13 +400,14 @@ HonkProof ClientIVC::construct_pg_proof(const std::shared_ptr info("Accumulator hash in PG prover: ", accum_hash); } auto verifier_instance = std::make_shared>(honk_vk); - FoldingProver folding_prover({ fold_output.accumulator, proving_key }, + FoldingProver folding_prover({ prover_accumulator, proving_key }, { native_verifier_accum, verifier_instance }, transcript, trace_usage_tracker); - fold_output = folding_prover.prove(); + auto output = folding_prover.prove(); + prover_accumulator = output.accumulator; // update the prover accumulator vinfo("pg proof constructed"); - return fold_output.proof; + return output.proof; } /** @@ -561,7 +563,7 @@ HonkProof ClientIVC::construct_honk_proof_for_hiding_kernel( ClientIVC::Proof ClientIVC::prove() { // deallocate the protogalaxy accumulator - fold_output.accumulator = nullptr; + prover_accumulator = nullptr; auto mega_proof = verification_queue.front().proof; // A transcript is shared between the Hiding circuit prover and the Goblin prover @@ -616,8 +618,8 @@ bool ClientIVC::verify(const Proof& proof) const HonkProof ClientIVC::construct_decider_proof(const std::shared_ptr& transcript) { vinfo("prove decider..."); - fold_output.accumulator->commitment_key = bn254_commitment_key; - MegaDeciderProver decider_prover(fold_output.accumulator, transcript); + prover_accumulator->commitment_key = bn254_commitment_key; + MegaDeciderProver decider_prover(prover_accumulator, transcript); decider_prover.construct_proof(); return decider_prover.export_proof(); } diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp index d878ac47fa85..bffd22719739 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp @@ -215,8 +215,8 @@ class ClientIVC { public: size_t num_circuits_accumulated = 0; // number of circuits accumulated so far - ProverFoldOutput fold_output; // prover accumulator and fold proof - HonkProof decider_proof; // decider proof to be verified in the hiding circuit + std::shared_ptr prover_accumulator; // current PG prover accumulator instance + HonkProof decider_proof; // decider proof to be verified in the hiding circuit std::shared_ptr recursive_verifier_native_accum; // native verifier accumulator used in recursive folding 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 2c0107802fdf..14b634fa7159 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp @@ -344,7 +344,7 @@ TEST_F(ClientIVCTests, DynamicTraceOverflow) ivc, { .log2_num_gates = test.log2_num_arith_gates[idx] }); } - EXPECT_EQ(check_accumulator_target_sum_manual(ivc.fold_output.accumulator), true); + EXPECT_EQ(check_accumulator_target_sum_manual(ivc.prover_accumulator), true); EXPECT_TRUE(ivc.prove_and_verify()); } } diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp index 78b3f50a3477..cb6c7ecc3ae7 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/mock_kernel_pinning.test.cpp @@ -35,7 +35,7 @@ TEST_F(MockKernelTest, PinFoldingKernelSizes) // Expect trace overflow for all but the hiding kernel (final circuit) if (idx < NUM_CIRCUITS - 1) { EXPECT_TRUE(circuit.blocks.has_overflow); - EXPECT_EQ(ivc.fold_output.accumulator->log_dyadic_size(), 19); + EXPECT_EQ(ivc.prover_accumulator->log_dyadic_size(), 19); } else { EXPECT_FALSE(circuit.blocks.has_overflow); } From ae13c4ac2637ca277564aec6f4dc20fabfb06c80 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Sat, 30 Aug 2025 19:28:53 +0000 Subject: [PATCH 04/25] fix cast issue --- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index e6a7ca46e0a4..d1f886af1e3d 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -191,8 +191,8 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( hide_op_queue_accumulation_result(circuit); // Propagate the public inputs of the tail kernel by converting them to public inputs of the hiding circuit. - auto num_public_inputs = - static_cast(verifier_inputs.honk_vk_and_hash->vk->num_public_inputs.get_value()); + auto num_public_inputs = static_cast( + static_cast(verifier_inputs.honk_vk_and_hash->vk->num_public_inputs.get_value())); num_public_inputs -= KernelIO::PUBLIC_INPUTS_SIZE; // exclude fixed kernel_io public inputs for (size_t i = 0; i < num_public_inputs; i++) { verifier_inputs.proof[i].set_public(); From 674d53a407b8ea83560216231fe3fe4117ebd247 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Sat, 30 Aug 2025 19:34:46 +0000 Subject: [PATCH 05/25] add worktodo --- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index d1f886af1e3d..b7e8bf251353 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -194,6 +194,8 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( auto num_public_inputs = static_cast( static_cast(verifier_inputs.honk_vk_and_hash->vk->num_public_inputs.get_value())); num_public_inputs -= KernelIO::PUBLIC_INPUTS_SIZE; // exclude fixed kernel_io public inputs + // WORKTODO: We shouldn't need to do this pub inputs conversion at all anymore! + // BB_ASSERT_EQ(num_public_inputs, 0UL, "number of public inputs in tail should be 0!"); for (size_t i = 0; i < num_public_inputs; i++) { verifier_inputs.proof[i].set_public(); } From 07cac069df3768631f0ab75dfdca500b19cac5c5 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Sat, 30 Aug 2025 20:03:20 +0000 Subject: [PATCH 06/25] remove redundant verify methods --- .../src/barretenberg/api/api_client_ivc.cpp | 3 +- .../barretenberg/bbapi/bbapi_client_ivc.cpp | 2 +- .../barretenberg/client_ivc/client_ivc.cpp | 35 ------------------- .../barretenberg/client_ivc/client_ivc.hpp | 4 --- .../client_ivc/client_ivc.test.cpp | 18 ++++++---- .../client_ivc/test_bench_shared.hpp | 17 --------- .../dsl/acir_format/acir_integration.test.cpp | 2 +- .../pg_recursion_constraint.test.cpp | 12 ++++--- 8 files changed, 24 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 ba31d6709110..3b3a5c4761b2 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp @@ -154,7 +154,8 @@ bool ClientIVCAPI::prove_and_verify(const std::filesystem::path& input_path) std::shared_ptr ivc = steps.accumulate(); // Construct the hiding kernel as the final step of the IVC - const bool verified = ivc->prove_and_verify(); + auto proof = ivc->prove(); + const bool verified = ClientIVC::verify(proof, ivc->get_vk()); return verified; } diff --git a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp index 443eff026ea4..d8a70dca63f2 100644 --- a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp @@ -81,7 +81,7 @@ ClientIvcProve::Response ClientIvcProve::execute(BBApiRequest& request) && // We verify this proof. Another bb call to verify has some overhead of loading VK/proof/SRS, // and it is mysterious if this transaction fails later in the lifecycle. info("ClientIvcProve - verifying the generated proof as a sanity check"); - if (!request.ivc_in_progress->verify(proof)) { + if (!request.ivc_in_progress->verify(proof, request.ivc_in_progress->get_vk())) { throw_or_abort("Failed to verify the generated proof!"); } diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index b7e8bf251353..f21434eff3e3 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -601,17 +601,6 @@ bool ClientIVC::verify(const Proof& proof, const VerificationKey& vk) return goblin_verified && mega_verified; } -/** - * @brief Verify a full proof of the IVC - * - * @param proof - * @return bool - */ -bool ClientIVC::verify(const Proof& proof) const -{ - return verify(proof, get_vk()); -} - /** * @brief Internal method for constructing a decider proof * @@ -626,30 +615,6 @@ HonkProof ClientIVC::construct_decider_proof(const std::shared_ptr& return decider_prover.export_proof(); } -/** - * @brief Construct and verify a proof for the IVC - * @note Use of this method only makes sense when the prover and verifier are the same entity, e.g. in - * development/testing. - * - */ -bool ClientIVC::prove_and_verify() -{ - auto start = std::chrono::steady_clock::now(); - const auto proof = prove(); - auto end = std::chrono::steady_clock::now(); - auto diff = std::chrono::duration_cast(end - start); - vinfo("time to call ClientIVC::prove: ", diff.count(), " ms."); - - start = end; - const bool verified = verify(proof); - end = std::chrono::steady_clock::now(); - - diff = std::chrono::duration_cast(end - start); - vinfo("time to verify ClientIVC proof: ", diff.count(), " ms."); - - return verified; -} - // Proof methods size_t ClientIVC::Proof::size() const { diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp index bffd22719739..740c355bc533 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp @@ -273,10 +273,6 @@ class ClientIVC { static bool verify(const Proof& proof, const VerificationKey& vk); - bool verify(const Proof& proof) const; - - bool prove_and_verify(); - HonkProof construct_decider_proof(const std::shared_ptr& transcript); VerificationKey get_vk() const; 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 14b634fa7159..642b0f7d2412 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.test.cpp @@ -108,7 +108,8 @@ TEST_F(ClientIVCTests, BadProofFailure) for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) { circuit_producer.construct_and_accumulate_next_circuit(ivc, settings); } - EXPECT_TRUE(ivc.prove_and_verify()); + auto proof = ivc.prove(); + EXPECT_TRUE(ClientIVC::verify(proof, ivc.get_vk())); } // The IVC throws an exception if the FIRST fold proof is tampered with @@ -135,7 +136,8 @@ TEST_F(ClientIVCTests, BadProofFailure) num_public_inputs); // tamper with first proof } } - EXPECT_FALSE(ivc.prove_and_verify()); + auto proof = ivc.prove(); + EXPECT_FALSE(ClientIVC::verify(proof, ivc.get_vk())); } // The IVC fails if the SECOND fold proof is tampered with @@ -156,7 +158,8 @@ TEST_F(ClientIVCTests, BadProofFailure) circuit.num_public_inputs()); // tamper with second proof } } - EXPECT_FALSE(ivc.prove_and_verify()); + auto proof = ivc.prove(); + EXPECT_FALSE(ClientIVC::verify(proof, ivc.get_vk())); } EXPECT_TRUE(true); @@ -309,7 +312,8 @@ TEST_F(ClientIVCTests, StructuredTraceOverflow) log2_num_gates += 1; } - EXPECT_TRUE(ivc.prove_and_verify()); + auto proof = ivc.prove(); + EXPECT_TRUE(ClientIVC::verify(proof, ivc.get_vk())); }; /** @@ -345,7 +349,8 @@ TEST_F(ClientIVCTests, DynamicTraceOverflow) } EXPECT_EQ(check_accumulator_target_sum_manual(ivc.prover_accumulator), true); - EXPECT_TRUE(ivc.prove_and_verify()); + auto proof = ivc.prove(); + EXPECT_TRUE(ClientIVC::verify(proof, ivc.get_vk())); } } @@ -417,5 +422,6 @@ TEST_F(ClientIVCTests, DatabusFailure) ivc.accumulate(circuit, vk); } - EXPECT_FALSE(ivc.prove_and_verify()); + auto proof = ivc.prove(); + EXPECT_FALSE(ClientIVC::verify(proof, ivc.get_vk())); }; diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp index 960f26097ea5..fa3ffd091c95 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/test_bench_shared.hpp @@ -13,23 +13,6 @@ namespace bb { -/** - * @brief Verify an IVC proof - * - */ -bool verify_ivc(ClientIVC::Proof& proof, ClientIVC& ivc) -{ - bool verified = ivc.verify(proof); - - // This is a benchmark, not a test, so just print success or failure to the log - if (verified) { - info("IVC successfully verified!"); - } else { - info("IVC failed to verify."); - } - return verified; -} - /** * @brief Perform a specified number of circuit accumulation rounds * diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp index e117af832254..e630574ef248 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_integration.test.cpp @@ -511,7 +511,7 @@ TEST_F(AcirIntegrationTest, DISABLED_ClientIVCMsgpackInputs) std::shared_ptr ivc = steps.accumulate(); ClientIVC::Proof proof = ivc->prove(); - EXPECT_TRUE(ivc->verify(proof)); + EXPECT_TRUE(ivc->verify(proof, ivc->get_vk())); } /** diff --git a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.test.cpp b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.test.cpp index db0b6ddf5c25..51a4229b1f65 100644 --- a/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.test.cpp +++ b/barretenberg/cpp/src/barretenberg/dsl/acir_format/pg_recursion_constraint.test.cpp @@ -313,7 +313,8 @@ TEST_F(IvcRecursionConstraintTest, AccumulateSingleApp) // add the trailing kernels construct_and_accumulate_trailing_kernels(ivc, trace_settings); - EXPECT_TRUE(ivc->prove_and_verify()); + auto proof = ivc->prove(); + EXPECT_TRUE(ClientIVC::verify(proof, ivc->get_vk())); } /** @@ -343,7 +344,8 @@ TEST_F(IvcRecursionConstraintTest, AccumulateTwoApps) // Accumulate the trailing kernels construct_and_accumulate_trailing_kernels(ivc, trace_settings); - EXPECT_TRUE(ivc->prove_and_verify()); + auto proof = ivc->prove(); + EXPECT_TRUE(ClientIVC::verify(proof, ivc->get_vk())); } // Test generation of "init" kernel VK via dummy IVC data @@ -584,7 +586,8 @@ TEST_F(IvcRecursionConstraintTest, RecursiveVerifierAppCircuitTest) construct_and_accumulate_trailing_kernels(ivc, trace_settings); - EXPECT_TRUE(ivc->prove_and_verify()); + auto proof = ivc->prove(); + EXPECT_TRUE(ClientIVC::verify(proof, ivc->get_vk())); } /** @@ -607,5 +610,6 @@ TEST_F(IvcRecursionConstraintTest, BadRecursiveVerifierAppCircuitTest) construct_and_accumulate_trailing_kernels(ivc, trace_settings); // We expect the CIVC proof to fail due to the app with a failed UH recursive verification - EXPECT_FALSE(ivc->prove_and_verify()); + auto proof = ivc->prove(); + EXPECT_FALSE(ClientIVC::verify(proof, ivc->get_vk())); } From 3e562a5bff1bab4d8a09a39ad36acce8d734f78a Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Sat, 30 Aug 2025 20:23:37 +0000 Subject: [PATCH 07/25] tidy --- .../cpp/src/barretenberg/client_ivc/client_ivc.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index f21434eff3e3..faba5c27599e 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -173,8 +173,6 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( } case QUEUE_TYPE::PG: case QUEUE_TYPE::PG_TAIL: { - BB_ASSERT_NEQ(input_verifier_accumulator, nullptr); - output_verifier_accumulator = perform_pg_recursive_verification(circuit, input_verifier_accumulator, verifier_instance, @@ -185,7 +183,6 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( break; } case QUEUE_TYPE::PG_FINAL: { - BB_ASSERT_NEQ(input_verifier_accumulator, nullptr); BB_ASSERT_EQ(stdlib_verification_queue.size(), size_t(1)); hide_op_queue_accumulation_result(circuit); @@ -249,7 +246,7 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( kernel_input.output_pg_accum_hash.assert_equal(*prev_accum_hash); if (!is_hiding_kernel) { - // The hiding kernel has no return data but uses the traditional public-inputs mechanism + // The hiding kernel has no return data; it uses the traditional public-inputs mechanism bus_depot.set_kernel_return_data_commitment(witness_commitments.return_data); } } else { @@ -703,6 +700,8 @@ ClientIVC::Proof ClientIVC::Proof::from_file_msgpack(const std::string& filename // VerificationKey construction ClientIVC::VerificationKey ClientIVC::get_vk() const { + BB_ASSERT_EQ(verification_queue.size(), 1UL); + BB_ASSERT_EQ(verification_queue.front().type, QUEUE_TYPE::MEGA); auto verification_key = verification_queue.front().honk_vk; return { verification_key, std::make_shared(), From f9c87703032c0172eb15b930814f113ac8b819be Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Sat, 30 Aug 2025 20:36:05 +0000 Subject: [PATCH 08/25] fix assert --- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index ccc4c367334a..7add34a3e945 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -699,7 +699,7 @@ ClientIVC::Proof ClientIVC::Proof::from_file_msgpack(const std::string& filename ClientIVC::VerificationKey ClientIVC::get_vk() const { BB_ASSERT_EQ(verification_queue.size(), 1UL); - BB_ASSERT_EQ(verification_queue.front().type, QUEUE_TYPE::MEGA); + BB_ASSERT(verification_queue.front().type == QUEUE_TYPE::MEGA, true); auto verification_key = verification_queue.front().honk_vk; return { verification_key, std::make_shared(), From acc73bc83aeb3b894fe04b461119c4cbdc675d80 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Sat, 30 Aug 2025 21:40:28 +0000 Subject: [PATCH 09/25] fix build --- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 7add34a3e945..4c0e67da7789 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -699,7 +699,7 @@ ClientIVC::Proof ClientIVC::Proof::from_file_msgpack(const std::string& filename ClientIVC::VerificationKey ClientIVC::get_vk() const { BB_ASSERT_EQ(verification_queue.size(), 1UL); - BB_ASSERT(verification_queue.front().type == QUEUE_TYPE::MEGA, true); + BB_ASSERT_EQ(verification_queue.front().type == QUEUE_TYPE::MEGA, true); auto verification_key = verification_queue.front().honk_vk; return { verification_key, std::make_shared(), From 063b712e9b8976401ae3175e7392e657d0f95e2c Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 2 Sep 2025 18:34:51 +0000 Subject: [PATCH 10/25] restore randomly deleted components --- barretenberg/sol/lib/forge-std | 1 + barretenberg/sol/lib/openzeppelin-contracts | 1 + barretenberg/sol/lib/solidity-stringutils | 1 + bb-pilcom/powdr | 1 + l1-contracts/lib/circuits | 1 + l1-contracts/lib/forge-std | 1 + l1-contracts/lib/openzeppelin-contracts | 1 + 7 files changed, 7 insertions(+) create mode 160000 barretenberg/sol/lib/forge-std create mode 160000 barretenberg/sol/lib/openzeppelin-contracts create mode 160000 barretenberg/sol/lib/solidity-stringutils create mode 160000 bb-pilcom/powdr create mode 160000 l1-contracts/lib/circuits create mode 160000 l1-contracts/lib/forge-std create mode 160000 l1-contracts/lib/openzeppelin-contracts diff --git a/barretenberg/sol/lib/forge-std b/barretenberg/sol/lib/forge-std new file mode 160000 index 000000000000..74cfb77e308d --- /dev/null +++ b/barretenberg/sol/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 74cfb77e308dd188d2f58864aaf44963ae6b88b1 diff --git a/barretenberg/sol/lib/openzeppelin-contracts b/barretenberg/sol/lib/openzeppelin-contracts new file mode 160000 index 000000000000..e50c24f5839d --- /dev/null +++ b/barretenberg/sol/lib/openzeppelin-contracts @@ -0,0 +1 @@ +Subproject commit e50c24f5839db17f46991478384bfda14acfb830 diff --git a/barretenberg/sol/lib/solidity-stringutils b/barretenberg/sol/lib/solidity-stringutils new file mode 160000 index 000000000000..46983c6d9462 --- /dev/null +++ b/barretenberg/sol/lib/solidity-stringutils @@ -0,0 +1 @@ +Subproject commit 46983c6d9462a80229cf0d5bab8ea3b3ee31066c diff --git a/bb-pilcom/powdr b/bb-pilcom/powdr new file mode 160000 index 000000000000..c3006c11819d --- /dev/null +++ b/bb-pilcom/powdr @@ -0,0 +1 @@ +Subproject commit c3006c11819d9b53fb183c9c12a10b83481bb631 diff --git a/l1-contracts/lib/circuits b/l1-contracts/lib/circuits new file mode 160000 index 000000000000..e47bcd526f5e --- /dev/null +++ b/l1-contracts/lib/circuits @@ -0,0 +1 @@ +Subproject commit e47bcd526f5e38f9603d07d0791984ec53efd254 diff --git a/l1-contracts/lib/forge-std b/l1-contracts/lib/forge-std new file mode 160000 index 000000000000..0e7097750918 --- /dev/null +++ b/l1-contracts/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 0e7097750918380d84dd3cfdef595bee74dabb70 diff --git a/l1-contracts/lib/openzeppelin-contracts b/l1-contracts/lib/openzeppelin-contracts new file mode 160000 index 000000000000..448efeea6640 --- /dev/null +++ b/l1-contracts/lib/openzeppelin-contracts @@ -0,0 +1 @@ +Subproject commit 448efeea6640bbbc09373f03fbc9c88e280147ba From cb3f22b82a1c7fe8a51e0e03e87820d9126c51ea Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 2 Sep 2025 21:41:28 +0000 Subject: [PATCH 11/25] tidy --- barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp index d8a70dca63f2..685fbe22710d 100644 --- a/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/bbapi/bbapi_client_ivc.cpp @@ -81,7 +81,8 @@ ClientIvcProve::Response ClientIvcProve::execute(BBApiRequest& request) && // We verify this proof. Another bb call to verify has some overhead of loading VK/proof/SRS, // and it is mysterious if this transaction fails later in the lifecycle. info("ClientIvcProve - verifying the generated proof as a sanity check"); - if (!request.ivc_in_progress->verify(proof, request.ivc_in_progress->get_vk())) { + ClientIVC::VerificationKey vk = request.ivc_in_progress->get_vk(); + if (!ClientIVC::verify(proof, vk)) { throw_or_abort("Failed to verify the generated proof!"); } From cb6e82918555ce8eaea164e6017bf0fb33ef657b Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 2 Sep 2025 18:00:16 +0000 Subject: [PATCH 12/25] add option to not use structured trace when computing standalone vk --- barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp index 3b3a5c4761b2..388b8b78df02 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp @@ -27,15 +27,18 @@ namespace { // anonymous namespace * * @param bytecode_path * @param witness_path + * @param use_structured_trace Whether to utilize structured trace when computing VK for circuit */ void write_standalone_vk(const std::string& output_format, const std::filesystem::path& bytecode_path, - const std::filesystem::path& output_path) + const std::filesystem::path& output_path, + bool use_structured_trace = true) { auto bytecode = get_bytecode(bytecode_path); + auto trace_settings = use_structured_trace ? TraceSettings{ AZTEC_TRACE_STRUCTURE } : TraceSettings{}; auto response = bbapi::ClientIvcComputeStandaloneVk{ .circuit = { .name = "standalone_circuit", .bytecode = std::move(bytecode) } - }.execute(); + }.execute({ .trace_settings = trace_settings }); bool wrote_file = false; bool is_stdout = output_path == "-"; From 045a9092e5ae66aec61c7f55bd60df01d58e3afa Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 2 Sep 2025 22:11:02 +0000 Subject: [PATCH 13/25] update cli to allow nonstructured hiding circuit VK --- .../cpp/src/barretenberg/api/api_client_ivc.cpp | 4 +++- barretenberg/cpp/src/barretenberg/bb/cli.cpp | 2 +- noir-projects/noir-protocol-circuits/bootstrap.sh | 10 +++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp index 388b8b78df02..c67ff4a5fa32 100644 --- a/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/api/api_client_ivc.cpp @@ -213,7 +213,9 @@ void ClientIVCAPI::write_vk(const Flags& flags, auto bytecode = get_bytecode(bytecode_path); write_civc_vk(flags.output_format, bytecode, output_path); } else if (flags.verifier_type == "standalone") { - write_standalone_vk(flags.output_format, bytecode_path, output_path); + write_standalone_vk(flags.output_format, bytecode_path, output_path, /*use_structured_trace=*/true); + } else if (flags.verifier_type == "hiding") { + write_standalone_vk(flags.output_format, bytecode_path, output_path, /*use_structured_trace=*/false); } else { const std::string msg = std::string("Can't write vk for verifier type ") + flags.verifier_type; throw_or_abort(msg); diff --git a/barretenberg/cpp/src/barretenberg/bb/cli.cpp b/barretenberg/cpp/src/barretenberg/bb/cli.cpp index 090cc2a2391f..cad9674a95c4 100644 --- a/barretenberg/cpp/src/barretenberg/bb/cli.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/cli.cpp @@ -256,7 +256,7 @@ int parse_and_run_cli_command(int argc, char* argv[]) "use case where an IVC scheme is manually constructed via recursive UltraHonk proof " "verification). `ivc` produces a verification key for verifying the stack of run though a " "dedicated ivc verifier class (currently the only option is the ClientIVC class) ") - ->check(CLI::IsMember({ "standalone", "ivc" }).name("is_member")); + ->check(CLI::IsMember({ "standalone", "hiding", "ivc" }).name("is_member")); }; const auto add_verbose_flag = [&](CLI::App* subcommand) { diff --git a/noir-projects/noir-protocol-circuits/bootstrap.sh b/noir-projects/noir-protocol-circuits/bootstrap.sh index 6ee4c0968bd6..8c0eb8e49cd8 100755 --- a/noir-projects/noir-protocol-circuits/bootstrap.sh +++ b/noir-projects/noir-protocol-circuits/bootstrap.sh @@ -29,11 +29,11 @@ export circuits_hash=$(hash_str "$NOIR_HASH" $(cache_content_hash "^noir-project # Circuits matching these patterns we have client-ivc keys computed, rather than ultra-honk. readarray -t ivc_patterns < <(jq -r '.[]' "../client_ivc_circuits.json") -readarray -t ivc_tail_patterns < <(jq -r '.[]' "../client_ivc_tail_circuits.json") +ivc_hiding_pattern=("hiding") readarray -t rollup_honk_patterns < <(jq -r '.[]' "../rollup_honk_circuits.json") # Convert to regex string here and export for use in exported functions. export ivc_regex=$(IFS="|"; echo "${ivc_patterns[*]}") -export private_tail_regex=$(IFS="|"; echo "${ivc_tail_patterns[*]}") +export hiding_kernel_regex=$(IFS="|"; echo "${ivc_hiding_pattern[*]}") export rollup_honk_regex=$(IFS="|"; echo "${rollup_honk_patterns[*]}") function on_exit { @@ -74,10 +74,10 @@ function compile { cache_upload circuit-$hash.tar.gz $json_path &> /dev/null fi - if echo "$name" | grep -qE "${private_tail_regex}"; then + if echo "$name" | grep -qE "${hiding_kernel_regex}"; then local proto="client_ivc_tail" # We still need the standalone IVC vk. We also create the final IVC vk from the tail (specifically, the number of public inputs is used from it). - local write_vk_cmd="write_vk --scheme client_ivc --verifier_type standalone" + local write_vk_cmd="write_vk --scheme client_ivc --verifier_type hiding" elif echo "$name" | grep -qE "${ivc_regex}"; then local proto="client_ivc" local write_vk_cmd="write_vk --scheme client_ivc --verifier_type standalone" @@ -123,7 +123,7 @@ function compile { echo_stderr "Root rollup verifier at: $verifier_path (${SECONDS}s)" # Include the verifier path if we create it. cache_upload vk-$hash.tar.gz $key_path $verifier_path &> /dev/null - elif echo "$name" | grep -qE "${private_tail_regex}"; then + elif echo "$name" | grep -qE "${hiding_kernel_regex}"; then # If we are a tail kernel circuit, we also need to generate the ivc vk. SECONDS=0 local ivc_vk_path="$key_dir/${name}.ivc.vk" From 9dca508ce061c7c5f67f20eb1da3bf6dab65ab05 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 2 Sep 2025 23:48:56 +0000 Subject: [PATCH 14/25] nargo fmt From 6b792ed79eded6fd93077b340c796c08a81d25f2 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 2 Sep 2025 23:49:33 +0000 Subject: [PATCH 15/25] again From 824cf8c08fa293a7aea7b8e0ddb1af00507795b5 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Wed, 3 Sep 2025 03:29:09 +0000 Subject: [PATCH 16/25] fmt? From 2989802290d22d0798615b962c6c5dbdbd88d920 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Wed, 3 Sep 2025 03:33:18 +0000 Subject: [PATCH 17/25] unformat?? From c0f85e49f679756ecd15904cce609675512fe839 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Wed, 3 Sep 2025 03:59:56 +0000 Subject: [PATCH 18/25] again --- .../src/private_kernel_inner.nr | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr index f1792876c43e..5e315f3b6bdf 100644 --- a/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr +++ b/noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/private_kernel_inner.nr @@ -60,26 +60,28 @@ impl PrivateKernelInnerCircuitPrivateInputs { start_private_call_stack_length - 1]; - private_call_data_validator.verify_proof(false /* is_first_app */); - private_call_data_validator.validate_common( - self.previous_kernel.public_inputs.constants.protocol_contract_tree_root, - ); - private_call_data_validator.validate_against_call_request(call_request); - private_call_data_validator.validate_against_previous_kernel(self.previous_kernel.public_inputs); - - // Generate output. - // Safety: The output is validated below by PrivateKernelCircuitOutputValidator. - let output = unsafe { self.generate_output() }; - - // Validate output. - if dep::types::validate::should_validate_output() { - PrivateKernelCircuitOutputValidator::new(output).validate_as_inner_call( + private_call_data_validator.verify_proof(false /* is_first_app */); + private_call_data_validator.validate_common( + self.previous_kernel.public_inputs.constants.protocol_contract_tree_root, + ); + private_call_data_validator.validate_against_call_request(call_request); + private_call_data_validator.validate_against_previous_kernel( self.previous_kernel.public_inputs, - self.private_call, ); + + // Generate output. + // Safety: The output is validated below by PrivateKernelCircuitOutputValidator. + let output = unsafe { self.generate_output() }; + + // Validate output. + if dep::types::validate::should_validate_output() { + PrivateKernelCircuitOutputValidator::new(output).validate_as_inner_call( + self.previous_kernel.public_inputs, + self.private_call, + ); + } + output } - output -} } mod tests { From 17da7bbb2c7b5accdd8abf5ec70ee104c46f6208 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Wed, 3 Sep 2025 16:44:55 +0000 Subject: [PATCH 19/25] bump prover full timeout --- yarn-project/end-to-end/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index 451363ea22e4..2161ea62c933 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -14,13 +14,13 @@ function test_cmds { # Can't run full prover tests on ARM because AVM is disabled. if ../../barretenberg/cpp/bootstrap.sh hash | grep -qE no-avm; then if [ "$CI_FULL" -eq 1 ]; then - echo "$prefix:TIMEOUT=15m:CPUS=16:MEM=96g:NAME=e2e_prover_client_real $run_test_script simple e2e_prover/client" + echo "$prefix:TIMEOUT=20m:CPUS=16:MEM=96g:NAME=e2e_prover_client_real $run_test_script simple e2e_prover/client" else echo "$prefix:NAME=e2e_prover_client_fake FAKE_PROOFS=1 $run_test_script simple e2e_prover/client" fi else if [ "$CI_FULL" -eq 1 ]; then - echo "$prefix:TIMEOUT=15m:CPUS=16:MEM=96g:NAME=e2e_prover_full_real $run_test_script simple e2e_prover/full" + echo "$prefix:TIMEOUT=20m:CPUS=16:MEM=96g:NAME=e2e_prover_full_real $run_test_script simple e2e_prover/full" else echo "$prefix:NAME=e2e_prover_full_fake FAKE_PROOFS=1 $run_test_script simple e2e_prover/full" fi From 7e1d81413e467af40619ecbe631c8703a6263c9a Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Wed, 3 Sep 2025 21:52:53 +0000 Subject: [PATCH 20/25] test: bump timeout to 25 --- yarn-project/end-to-end/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index 2161ea62c933..46a4a4f071b6 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -14,13 +14,13 @@ function test_cmds { # Can't run full prover tests on ARM because AVM is disabled. if ../../barretenberg/cpp/bootstrap.sh hash | grep -qE no-avm; then if [ "$CI_FULL" -eq 1 ]; then - echo "$prefix:TIMEOUT=20m:CPUS=16:MEM=96g:NAME=e2e_prover_client_real $run_test_script simple e2e_prover/client" + echo "$prefix:TIMEOUT=25m:CPUS=16:MEM=96g:NAME=e2e_prover_client_real $run_test_script simple e2e_prover/client" else echo "$prefix:NAME=e2e_prover_client_fake FAKE_PROOFS=1 $run_test_script simple e2e_prover/client" fi else if [ "$CI_FULL" -eq 1 ]; then - echo "$prefix:TIMEOUT=20m:CPUS=16:MEM=96g:NAME=e2e_prover_full_real $run_test_script simple e2e_prover/full" + echo "$prefix:TIMEOUT=25m:CPUS=16:MEM=96g:NAME=e2e_prover_full_real $run_test_script simple e2e_prover/full" else echo "$prefix:NAME=e2e_prover_full_fake FAKE_PROOFS=1 $run_test_script simple e2e_prover/full" fi From 5c1ed1a8c7928b074a507ab9a9a03641ada28bc0 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 4 Sep 2025 00:10:51 +0000 Subject: [PATCH 21/25] wasm fix --- barretenberg/cpp/src/barretenberg/bb/cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barretenberg/cpp/src/barretenberg/bb/cli.cpp b/barretenberg/cpp/src/barretenberg/bb/cli.cpp index 297a5ecddb9c..fe1ce1b67296 100644 --- a/barretenberg/cpp/src/barretenberg/bb/cli.cpp +++ b/barretenberg/cpp/src/barretenberg/bb/cli.cpp @@ -558,10 +558,10 @@ int parse_and_run_cli_command(int argc, char* argv[]) debug_logging = flags.debug; verbose_logging = debug_logging || flags.verbose; slow_low_memory = flags.slow_low_memory; +#ifndef __wasm__ if (!flags.storage_budget.empty()) { storage_budget = parse_size_string(flags.storage_budget); } -#ifndef __wasm__ if (print_bench || !bench_out.empty()) { bb::detail::use_bb_bench = true; } From 8f089efc78d4aac4015f6b963f459821ee6a6584 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 4 Sep 2025 00:11:34 +0000 Subject: [PATCH 22/25] remove no longer needed tail pub input propagation --- .../cpp/src/barretenberg/client_ivc/client_ivc.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 4f774575928e..32e7d6ff3288 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -186,16 +186,6 @@ ClientIVC::perform_recursive_verification_and_databus_consistency_checks( hide_op_queue_accumulation_result(circuit); - // Propagate the public inputs of the tail kernel by converting them to public inputs of the hiding circuit. - auto num_public_inputs = static_cast( - static_cast(verifier_inputs.honk_vk_and_hash->vk->num_public_inputs.get_value())); - num_public_inputs -= KernelIO::PUBLIC_INPUTS_SIZE; // exclude fixed kernel_io public inputs - // WORKTODO: We shouldn't need to do this pub inputs conversion at all anymore! - // BB_ASSERT_EQ(num_public_inputs, 0UL, "number of public inputs in tail should be 0!"); - for (size_t i = 0; i < num_public_inputs; i++) { - verifier_inputs.proof[i].set_public(); - } - auto final_verifier_accumulator = perform_pg_recursive_verification(circuit, input_verifier_accumulator, verifier_instance, From 0351a1057874bf85ae284e231f1de9fd45e8136a Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Thu, 4 Sep 2025 16:01:20 +0000 Subject: [PATCH 23/25] touch more cleanup --- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp | 1 - barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp | 2 -- 2 files changed, 3 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 32e7d6ff3288..c9bcb959c19f 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -372,7 +372,6 @@ HonkProof ClientIVC::construct_oink_proof(const std::shared_ptr& proving_key, const std::shared_ptr& honk_vk, const std::shared_ptr& transcript, diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp index 13e3be94d9a9..5c949a9ac311 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp @@ -255,8 +255,6 @@ class ClientIVC { ExecutionTraceUsageTracker trace_usage_tracker; private: - using ProverFoldOutput = FoldingResult; - // Transcript for CIVC prover (shared between Hiding circuit, Merge, ECCVM, and Translator) std::shared_ptr transcript = std::make_shared(); From 4ebd6f1879c94c1475f4e674c221b40d1d3e0b28 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Mon, 8 Sep 2025 18:02:04 +0000 Subject: [PATCH 24/25] update noir protocol boot --- noir-projects/noir-protocol-circuits/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noir-projects/noir-protocol-circuits/bootstrap.sh b/noir-projects/noir-protocol-circuits/bootstrap.sh index a44b8037b7c0..5413d3764b20 100755 --- a/noir-projects/noir-protocol-circuits/bootstrap.sh +++ b/noir-projects/noir-protocol-circuits/bootstrap.sh @@ -109,9 +109,9 @@ function compile { local outdir=$(mktemp -d) trap "rm -rf $outdir" EXIT function write_vk { - if echo "$name" | grep -qE "${private_tail_regex}"; then + if echo "$name" | grep -qE "${hiding_kernel_regex}"; then # We still need the standalone IVC vk. We also create the final IVC vk from the tail (specifically, the number of public inputs is used from it). - denoise "$BB write_vk --scheme client_ivc --verifier_type standalone -b - -o $outdir" + denoise "$BB write_vk --scheme client_ivc --verifier_type hiding -b - -o $outdir" elif echo "$name" | grep -qE "${ivc_regex}"; then denoise "$BB write_vk --scheme client_ivc --verifier_type standalone -b - -o $outdir" elif echo "$name" | grep -qE "${rollup_honk_regex}"; then From 578e8fe0d735625c1eb7e4a2814ac6c53fc8a8b4 Mon Sep 17 00:00:00 2001 From: ledwards2225 Date: Tue, 9 Sep 2025 18:09:23 +0000 Subject: [PATCH 25/25] cleanup --- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp | 2 +- barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp | 2 +- yarn-project/end-to-end/bootstrap.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp index 5704db652c6c..324b8b705bb8 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.cpp @@ -602,7 +602,7 @@ void ClientIVC::hide_op_queue_content_in_hiding(ClientCircuit& circuit) * merge and decider proof. */ HonkProof ClientIVC::construct_honk_proof_for_hiding_kernel( - ClientCircuit& circuit, [[maybe_unused]] const std::shared_ptr& verification_key) + ClientCircuit& circuit, const std::shared_ptr& verification_key) { // Note: a structured trace is not used for the hiding kernel auto hiding_decider_pk = std::make_shared(circuit, TraceSettings(), bn254_commitment_key); diff --git a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp index 42e00b25028a..de5d3c202ea3 100644 --- a/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp +++ b/barretenberg/cpp/src/barretenberg/client_ivc/client_ivc.hpp @@ -351,7 +351,7 @@ class ClientIVC { bool is_kernel); HonkProof construct_honk_proof_for_hiding_kernel(ClientCircuit& circuit, - const std::shared_ptr& honk_vk); + const std::shared_ptr& verification_key); QUEUE_TYPE get_queue_type() const; diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index 46a4a4f071b6..2161ea62c933 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -14,13 +14,13 @@ function test_cmds { # Can't run full prover tests on ARM because AVM is disabled. if ../../barretenberg/cpp/bootstrap.sh hash | grep -qE no-avm; then if [ "$CI_FULL" -eq 1 ]; then - echo "$prefix:TIMEOUT=25m:CPUS=16:MEM=96g:NAME=e2e_prover_client_real $run_test_script simple e2e_prover/client" + echo "$prefix:TIMEOUT=20m:CPUS=16:MEM=96g:NAME=e2e_prover_client_real $run_test_script simple e2e_prover/client" else echo "$prefix:NAME=e2e_prover_client_fake FAKE_PROOFS=1 $run_test_script simple e2e_prover/client" fi else if [ "$CI_FULL" -eq 1 ]; then - echo "$prefix:TIMEOUT=25m:CPUS=16:MEM=96g:NAME=e2e_prover_full_real $run_test_script simple e2e_prover/full" + echo "$prefix:TIMEOUT=20m:CPUS=16:MEM=96g:NAME=e2e_prover_full_real $run_test_script simple e2e_prover/full" else echo "$prefix:NAME=e2e_prover_full_fake FAKE_PROOFS=1 $run_test_script simple e2e_prover/full" fi