Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
pg_recursion_constraint.test.cpp
Go to the documentation of this file.
2#include "acir_format.hpp"
11#include "proof_surgeon.hpp"
12
13#include <gtest/gtest.h>
14#include <vector>
15
16using namespace acir_format;
17using namespace bb;
18
19class IvcRecursionConstraintTest : public ::testing::Test {
20
21 public:
25 using FF = Flavor::FF;
31
32 static constexpr size_t NUM_TRAILING_KERNELS = 3; // reset, tail, hiding
33
46
47 static std::shared_ptr<VerificationKey> get_verification_key(Builder& builder_in,
48 const TraceSettings& trace_settings)
49 {
50 // This is a workaround to ensure that the circuit is finalized before we create the verification key
51 // In practice, this should not be needed as the circuit will be finalized when it is accumulated into the IVC
52 // but this is a workaround for the test setup.
53 // Create a copy of the input circuit
55
56 // Deepcopy the opqueue to avoid modifying the original one
60 std::shared_ptr<VerificationKey> vk = std::make_shared<VerificationKey>(prover_instance->get_precomputed());
61 return vk;
62 }
63
65 TraceSettings trace_settings)
66 {
67
68 // Reset kernel
69 EXPECT_EQ(ivc->verification_queue.size(), 1);
70 EXPECT_EQ(ivc->verification_queue[0].type, QUEUE_TYPE::PG);
71 construct_and_accumulate_mock_kernel(ivc, trace_settings);
72
73 // Tail kernel
74 EXPECT_EQ(ivc->verification_queue.size(), 1);
75 EXPECT_EQ(ivc->verification_queue[0].type, QUEUE_TYPE::PG_TAIL);
76 construct_and_accumulate_mock_kernel(ivc, trace_settings);
77
78 // Hiding kernel
79 EXPECT_EQ(ivc->verification_queue.size(), 1);
80 EXPECT_EQ(ivc->verification_queue[0].type, QUEUE_TYPE::PG_FINAL);
82 }
83
84 static UltraCircuitBuilder create_inner_circuit(size_t log_num_gates = 10)
85 {
87
89
90 // Create 2^log_n many add gates based on input log num gates
91 const size_t num_gates = (1 << log_num_gates);
92 for (size_t i = 0; i < num_gates; ++i) {
94 uint32_t a_idx = builder.add_variable(a);
95
98 fr d = a + b + c;
99 uint32_t b_idx = builder.add_variable(b);
100 uint32_t c_idx = builder.add_variable(c);
101 uint32_t d_idx = builder.add_variable(d);
102
103 builder.create_big_add_gate({ a_idx, b_idx, c_idx, d_idx, fr(1), fr(1), fr(1), fr(-1), fr(0) });
104 }
105
106 InnerPairingPoints::add_default_to_public_inputs(builder);
107 return builder;
108 }
109
115 {
116 AcirProgram program;
117 std::vector<RecursionConstraint> recursion_constraints;
118
119 Builder circuit{ ivc->goblin.op_queue };
122
123 {
124 using RecursiveFlavor = UltraRecursiveFlavor_<Builder>;
128
129 // Create an arbitrary inner circuit
130 auto inner_circuit = create_inner_circuit();
131
132 // Compute native verification key
133 auto prover_instance = std::make_shared<ProverInstance_<UltraFlavor>>(inner_circuit);
134 auto honk_vk = std::make_shared<UltraFlavor::VerificationKey>(prover_instance->get_precomputed());
135 UltraProver prover(prover_instance, honk_vk); // A prerequisite for computing VK
136 auto inner_proof = prover.construct_proof();
137
138 if (tamper_vk) {
139 honk_vk->q_l = g1::one;
140 UltraVerifier_<UltraFlavor> verifier(honk_vk);
141 EXPECT_FALSE(verifier.template verify_proof<DefaultIO>(inner_proof).result);
142 }
143 // Instantiate the recursive verifier using the native verification key
144 auto stdlib_vk_and_hash = std::make_shared<RecursiveFlavor::VKAndHash>(circuit, honk_vk);
145 stdlib::recursion::honk::UltraRecursiveVerifier_<RecursiveFlavor> verifier(&circuit, stdlib_vk_and_hash);
146
147 StdlibProof stdlib_inner_proof(circuit, inner_proof);
148 VerifierOutput output = verifier.template verify_proof<StdlibIO>(stdlib_inner_proof);
149
150 // IO
151 StdlibIO inputs;
152 inputs.pairing_inputs = output.points_accumulator;
153 inputs.set_public(); // propagate resulting pairing points on the public inputs
154 }
155
156 return circuit;
157 }
158
168 {
169 // Assemble simple vectors of witnesses for vkey and proof
170 std::vector<FF> key_witnesses = input.honk_vk->to_field_elements();
171 FF key_hash_witness = input.honk_vk->hash();
172 std::vector<FF> proof_witnesses = input.proof; // proof contains the public inputs at this stage
173
174 // Construct witness indices for each component in the constraint; populate the witness array
175 auto [key_indices, key_hash_index, proof_indices, public_inputs_indices] =
177 witness, proof_witnesses, key_witnesses, key_hash_witness, /*num_public_inputs_to_extract=*/0);
178
179 // The proof type can be either Oink or PG or PG_FINAL
180 PROOF_TYPE proof_type;
181 switch (input.type) {
182 case QUEUE_TYPE::OINK:
183 proof_type = OINK;
184 break;
185 case QUEUE_TYPE::PG:
186 proof_type = PG;
187 break;
188 case QUEUE_TYPE::PG_FINAL:
189 proof_type = PG_FINAL;
190 break;
191 case QUEUE_TYPE::PG_TAIL:
192 proof_type = PG_TAIL;
193 break;
194 default:
195 throw std::runtime_error("Invalid proof type");
196 }
197
198 return RecursionConstraint{
199 .key = key_indices,
200 .proof = {}, // the proof witness indices are not needed in an ivc recursion constraint
201 .public_inputs = public_inputs_indices,
202 .key_hash = key_hash_index,
203 .proof_type = proof_type,
204 };
205 }
206
221 {
222 AcirProgram program;
223
224 // Construct recursion constraints based on the ivc verification queue; populate the witness along the way
225 std::vector<RecursionConstraint> pg_recursion_constraints;
226 pg_recursion_constraints.reserve(verification_queue.size());
227 for (const auto& queue_entry : verification_queue) {
228 pg_recursion_constraints.push_back(create_recursion_constraint(queue_entry, program.witness));
229 }
230
231 // Construct a constraint system containing the business logic and ivc recursion constraints
232 program.constraints.varnum = static_cast<uint32_t>(program.witness.size());
233 program.constraints.num_acir_opcodes = static_cast<uint32_t>(pg_recursion_constraints.size());
234 program.constraints.pg_recursion_constraints = pg_recursion_constraints;
237
238 return program;
239 }
240
242 {
243 // construct a mock kernel program (acir) from the ivc verification queue
244 const ProgramMetadata metadata{ ivc };
245 AcirProgram mock_kernel_program = construct_mock_kernel_program(ivc->verification_queue);
246 auto kernel = acir_format::create_circuit<Builder>(mock_kernel_program, metadata);
247 auto kernel_vk = get_kernel_vk_from_circuit(kernel, trace_settings);
248 ivc->accumulate(kernel, kernel_vk);
249 }
250
252 {
253 // construct a mock kernel program (acir) from the ivc verification queue
254 auto app_circuit = construct_mock_app_circuit(ivc);
255 ivc->accumulate(app_circuit, get_verification_key(app_circuit, trace_settings));
256 }
257
266 AcirProgram& program, const TraceSettings& trace_settings)
267 {
268 // Create kernel circuit from the kernel program
269 Builder kernel = acir_format::create_circuit<Builder>(program);
270
271 // Manually construct the VK for the kernel circuit
272 auto prover_instance = std::make_shared<ClientIVC::ProverInstance>(kernel, trace_settings);
273 auto verification_key = std::make_shared<ClientIVC::MegaVerificationKey>(prover_instance->get_precomputed());
274 return verification_key;
275 }
276
278 TraceSettings trace_settings)
279 {
280 auto prover_instance = std::make_shared<ClientIVC::ProverInstance>(kernel, trace_settings);
281 auto verification_key = std::make_shared<ClientIVC::MegaVerificationKey>(prover_instance->get_precomputed());
282 return verification_key;
283 }
284
285 protected:
287};
288
293{
295 EXPECT_EQ(merge_proof.size(), MERGE_PROOF_SIZE);
296}
297
303{
304 TraceSettings trace_settings{ SMALL_TEST_STRUCTURE };
305 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5 /* app, kernel, reset, tail, hiding */, trace_settings);
306
307 // construct a mock app_circuit
308 construct_and_accumulate_mock_app(ivc, trace_settings);
309
310 // Construct kernel consisting only of the kernel completion logic
311 construct_and_accumulate_mock_kernel(ivc, trace_settings);
312
313 // add the trailing kernels
314 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
315
316 auto proof = ivc->prove();
317 EXPECT_TRUE(ClientIVC::verify(proof, ivc->get_vk()));
318}
319
325{
326 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
327 // 4 ciruits and the tail kernel
328 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/7, trace_settings);
329
330 // construct a mock app_circuit
331 construct_and_accumulate_mock_app(ivc, trace_settings);
332
333 const ProgramMetadata metadata{ ivc };
334
335 // Construct kernel_0; consists of a single oink recursive verification for app (plus databus/merge logic)
336 construct_and_accumulate_mock_kernel(ivc, trace_settings);
337
338 // construct a mock app_circuit
339 construct_and_accumulate_mock_app(ivc, trace_settings);
340
341 // Construct and accumulate another Kernel circuit
342 construct_and_accumulate_mock_kernel(ivc, trace_settings);
343
344 // Accumulate the trailing kernels
345 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
346
347 auto proof = ivc->prove();
348 EXPECT_TRUE(ClientIVC::verify(proof, ivc->get_vk()));
349}
350
351// Test generation of "init" kernel VK via dummy IVC data
352TEST_F(IvcRecursionConstraintTest, GenerateInitKernelVKFromConstraints)
353{
354 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
355
356 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
358 {
359 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
360
361 // Construct and accumulate mock app_circuit
362 construct_and_accumulate_mock_app(ivc, trace_settings);
363
364 // Construct and accumulate kernel consisting only of the kernel completion logic
365 construct_and_accumulate_mock_kernel(ivc, trace_settings);
366 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
367 }
368
369 // Now, construct the kernel VK by mocking the post app accumulation state of the IVC
371 {
372 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
373
374 // Construct kernel consisting only of the kernel completion logic
375 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::OINK, /*is_kernel=*/false);
376 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
377 program.witness = {}; // remove the witness to mimick VK construction context
378
379 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
380 }
381
382 // Compare the VK constructed via running the IVc with the one constructed via mocking
383 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
384}
385
386// Test generation of "reset" kernel VK via dummy IVC data
387TEST_F(IvcRecursionConstraintTest, GenerateResetKernelVKFromConstraints)
388{
389 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
390
391 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
393 {
394 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
395
396 const ProgramMetadata metadata{ ivc };
397
398 // Construct and accumulate mock app_circuit
399 construct_and_accumulate_mock_app(ivc, trace_settings);
400
401 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
402 construct_and_accumulate_mock_kernel(ivc, trace_settings);
403 EXPECT_TRUE(ivc->verification_queue.size() == 1);
404 EXPECT_TRUE(ivc->verification_queue[0].type == bb::ClientIVC::QUEUE_TYPE::PG);
405
406 // Construct and accumulate a mock RESET kernel (PG recursion for kernel accumulation)
407 construct_and_accumulate_mock_kernel(ivc, trace_settings);
408 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
409 }
410
411 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
413 {
414 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
415
416 // Construct kernel consisting only of the kernel completion logic
417 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG, /*is_kernel=*/true);
418 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
419 program.witness = {}; // remove the witness to mimick VK construction context
420 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
421 }
422
423 // Compare the VK constructed via running the IVc with the one constructed via mocking
424 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
425}
426
427// Test generation of "tail" kernel VK via dummy IVC data
428TEST_F(IvcRecursionConstraintTest, GenerateTailKernelVKFromConstraints)
429{
430 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
431
432 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
434 {
435 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
436
437 const ProgramMetadata metadata{ ivc };
438
439 // Construct and accumulate mock app_circuit
440 construct_and_accumulate_mock_app(ivc, trace_settings);
441
442 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
443 construct_and_accumulate_mock_kernel(ivc, trace_settings);
444
445 // Construct and accumulate a mock RESET kernel (PG recursion for kernel accumulation)
446 construct_and_accumulate_mock_kernel(ivc, trace_settings);
447
448 // Construct and accumulate a mock TAIL kernel (PG recursion for kernel accumulation)
449 EXPECT_TRUE(ivc->verification_queue.size() == 1);
450 EXPECT_TRUE(ivc->verification_queue[0].type == bb::ClientIVC::QUEUE_TYPE::PG_TAIL);
451 construct_and_accumulate_mock_kernel(ivc, trace_settings);
452
453 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
454 }
455
456 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
458 {
459 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
460
461 // Construct kernel consisting only of the kernel completion logic
462 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG_TAIL, /*is_kernel=*/true);
463 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
464 program.witness = {}; // remove the witness to mimick VK construction context
465
466 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
467 }
468
469 // Compare the VK constructed via running the IVc with the one constructed via mocking
470 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
471}
472
473// Test generation of "inner" kernel VK via dummy IVC data
474TEST_F(IvcRecursionConstraintTest, GenerateInnerKernelVKFromConstraints)
475{
476 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
477
478 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
480 {
481 // we have to set the number of circuits one more than the number of circuits we're accumulating as otherwise
482 // the last circuit will be seen as a tail
483 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/6, trace_settings);
484
485 const ProgramMetadata metadata{ ivc };
486
487 { // Construct and accumulate mock app_circuit
488 construct_and_accumulate_mock_app(ivc, trace_settings);
489 }
490
491 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
492 construct_and_accumulate_mock_kernel(ivc, trace_settings);
493
494 { // Construct and accumulate a second mock app_circuit
495 construct_and_accumulate_mock_app(ivc, trace_settings);
496 }
497
498 { // Construct and accumulate a mock INNER kernel (PG recursion for kernel accumulation)
499 EXPECT_TRUE(ivc->verification_queue.size() == 2);
500 EXPECT_TRUE(ivc->verification_queue[1].type == bb::ClientIVC::QUEUE_TYPE::PG);
501 construct_and_accumulate_mock_kernel(ivc, trace_settings);
502 }
503
504 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
505 }
506
507 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
509 {
510 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/4, trace_settings);
511
512 // Construct kernel consisting only of the kernel completion logic
513 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG, /*is_kernel=*/true);
514 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG, /*is_kernel=*/false);
515 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
516 program.witness = {}; // remove the witness to mimick VK construction context
517
518 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
519 }
520
521 // Compare the VK constructed via running the IVc with the one constructed via mocking
522 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
523}
524
525// Test generation of "hiding" kernel VK via dummy IVC data
526TEST_F(IvcRecursionConstraintTest, GenerateHidingKernelVKFromConstraints)
527{
528 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
529
530 // First, construct the kernel VK by running the full IVC
531 std::shared_ptr<MegaFlavor::VerificationKey> expected_hiding_kernel_vk;
532 {
533 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
534 const ProgramMetadata metadata{ ivc };
535
536 {
537 // Construct and accumulate mock app_circuit
538 construct_and_accumulate_mock_app(ivc, trace_settings);
539 }
540
541 {
542 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
543 construct_and_accumulate_mock_kernel(ivc, trace_settings);
544 }
545
546 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
547
548 // The single entry in the verification queue corresponds to the hiding kernel
549 expected_hiding_kernel_vk = ivc->verification_queue[0].honk_vk;
550 }
551
552 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
554 {
555 // mock IVC accumulation increases the num_circuits_accumualted, hence we need to assume the tail kernel has
556 // been accumulated
557 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, TraceSettings());
558 // construct a mock tail kernel
559 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG_FINAL, /*is_kernel=*/true);
560 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
561 program.witness = {}; // remove the witness to mimick VK construction context
562 kernel_vk = construct_kernel_vk_from_acir_program(program, TraceSettings());
563 }
564
565 // Compare the VK constructed via running the IVc with the one constructed via mocking
566 EXPECT_EQ(*kernel_vk.get(), *expected_hiding_kernel_vk.get());
567}
568
573TEST_F(IvcRecursionConstraintTest, RecursiveVerifierAppCircuitTest)
574{
575 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
576 auto ivc = std::make_shared<ClientIVC>(/*num_circuits*/ 5, trace_settings);
577
578 // construct a mock app_circuit with an UH recursion call
579 Builder app_circuit = construct_mock_UH_recursion_app_circuit(ivc, /*tamper_vk=*/false);
580
581 // Complete instance and generate an oink proof
582 ivc->accumulate(app_circuit, get_verification_key(app_circuit, trace_settings));
583
584 // Construct kernel consisting only of the kernel completion logic
585 construct_and_accumulate_mock_kernel(ivc, trace_settings);
586
587 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
588
589 auto proof = ivc->prove();
590 EXPECT_TRUE(ClientIVC::verify(proof, ivc->get_vk()));
591}
592
597TEST_F(IvcRecursionConstraintTest, BadRecursiveVerifierAppCircuitTest)
598{
599 BB_DISABLE_ASSERTS(); // Disable assert in PG prover
600
601 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
602 auto ivc = std::make_shared<ClientIVC>(/*num_circuits*/ 5, trace_settings);
603
604 // construct and accumulate mock app_circuit that has bad pairing point object
605 Builder app_circuit = construct_mock_UH_recursion_app_circuit(ivc, /*tamper_vk=*/true);
606 ivc->accumulate(app_circuit, get_verification_key(app_circuit, trace_settings));
607
608 // Construct kernel consisting only of the kernel completion logic
609 construct_and_accumulate_mock_kernel(ivc, trace_settings);
610
611 // add the trailing kernels
612 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
613
614 // We expect the CIVC proof to fail due to the app with a failed UH recursive verification
615 auto proof = ivc->prove();
616 EXPECT_FALSE(ClientIVC::verify(proof, ivc->get_vk()));
617}
acir_format::AcirFormatOriginalOpcodeIndices create_empty_original_opcode_indices()
void mock_opcode_indices(acir_format::AcirFormat &constraint_system)
#define BB_DISABLE_ASSERTS()
Definition assert.hpp:32
static std::shared_ptr< ClientIVC::MegaVerificationKey > get_kernel_vk_from_circuit(Builder &kernel, TraceSettings trace_settings)
static RecursionConstraint create_recursion_constraint(const VerifierInputs &input, SlabVector< FF > &witness)
Create an ACIR RecursionConstraint given the corresponding verifier inputs.
static Builder construct_mock_app_circuit(const std::shared_ptr< ClientIVC > &ivc)
Constuct a simple arbitrary circuit to represent a mock app circuit.
static std::shared_ptr< ClientIVC::MegaVerificationKey > construct_kernel_vk_from_acir_program(AcirProgram &program, const TraceSettings &trace_settings)
Construct a kernel circuit VK from an acir program with IVC recursion constraints.
static void construct_and_accumulate_trailing_kernels(const std::shared_ptr< ClientIVC > &ivc, TraceSettings trace_settings)
static UltraCircuitBuilder create_inner_circuit(size_t log_num_gates=10)
ClientIVC::VerificationQueue VerificationQueue
static AcirProgram construct_mock_kernel_program(const VerificationQueue &verification_queue)
Generate an acir program {constraints, witness} for a mock kernel.
static std::shared_ptr< VerificationKey > get_verification_key(Builder &builder_in, const TraceSettings &trace_settings)
static void construct_and_accumulate_mock_app(std::shared_ptr< ClientIVC > ivc, TraceSettings trace_settings)
static Builder construct_mock_UH_recursion_app_circuit(const std::shared_ptr< ClientIVC > &ivc, const bool tamper_vk)
Constuct a mock app circuit with a UH recursive verifier.
static void construct_and_accumulate_mock_kernel(std::shared_ptr< ClientIVC > ivc, TraceSettings trace_settings)
static RecursionWitnessData populate_recursion_witness_data(bb::SlabVector< FF > &witness, std::vector< FF > &proof_witnesses, const std::vector< FF > &key_witnesses, const FF &key_hash_witness, const size_t num_public_inputs_to_extract)
Populate a witness vector with key, proof, and public inputs; track witness indices for each componen...
std::deque< VerifierInputs > VerificationQueue
static bool verify(const Proof &proof, const VerificationKey &vk)
stdlib::recursion::PairingPoints< ClientCircuit > PairingPoints
MergeProver::MergeProof MergeProof
Definition goblin.hpp:36
static void add_some_ecc_op_gates(MegaBuilder &builder)
Generate a simple test circuit with some ECC op gates and conventional arithmetic gates.
std::shared_ptr< ECCOpQueue > op_queue
The verification key is responsible for storing the commitments to the precomputed (non-witness) poly...
Curve::ScalarField FF
static void add_arithmetic_gates(Builder &builder, const size_t num_gates=4)
Add a specified number of arithmetic gates to the provided circuit.
The recursive counterpart to the "native" Ultra flavor.
static constexpr element one
Definition group.hpp:46
A simple wrapper around a vector of stdlib field elements representing a proof.
Definition proof.hpp:19
Manages the data that is propagated on the public inputs of an application/function circuit.
AluTraceBuilder builder
Definition alu.test.cpp:123
FF a
FF b
void mock_ivc_accumulation(const std::shared_ptr< ClientIVC > &ivc, ClientIVC::QUEUE_TYPE type, const bool is_kernel)
Populate an IVC instance with data that mimics the state after a single IVC accumulation (Oink or PG)
Goblin::MergeProof create_mock_merge_proof()
Create a mock merge proof which has the correct structure but is not necessarily valid.
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
TEST_F(BoomerangGoblinRecursiveVerifierTests, graph_description_basic)
Construct and check a goblin recursive verification circuit.
Entry point for Barretenberg command-line interface.
field< Bn254FrParams > fr
Definition fr.hpp:174
std::vector< T, bb::ContainerSlabAllocator< T > > SlabVector
A vector that uses the slab allocator.
MegaCircuitBuilder_< field< Bn254FrParams > > MegaCircuitBuilder
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::vector< RecursionConstraint > pg_recursion_constraints
bb::poly_triple_< bb::curve::BN254::ScalarField > PolyTripleConstraint
AcirFormatOriginalOpcodeIndices original_opcode_indices
RecursionConstraint struct contains information required to recursively verify a proof!
std::shared_ptr< MegaVerificationKey > honk_vk
static field random_element(numeric::RNG *engine=nullptr) noexcept
An object storing two EC points that represent the inputs to a pairing check.
static void add_default_to_public_inputs(Builder &builder)
Adds default public inputs to the builder.