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>(proving_key->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 proving_key = std::make_shared<DeciderProvingKey_<UltraFlavor>>(inner_circuit);
134 auto honk_vk = std::make_shared<UltraFlavor::VerificationKey>(proving_key->get_precomputed());
135 UltraProver prover(proving_key, 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 proving_key = std::make_shared<ClientIVC::DeciderProvingKey>(kernel, trace_settings);
273 auto verification_key = std::make_shared<ClientIVC::MegaVerificationKey>(proving_key->get_precomputed());
274 return verification_key;
275 }
276
278 TraceSettings trace_settings)
279 {
280 auto proving_key = std::make_shared<ClientIVC::DeciderProvingKey>(kernel, trace_settings);
281 auto verification_key = std::make_shared<ClientIVC::MegaVerificationKey>(proving_key->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 EXPECT_TRUE(ivc->prove_and_verify());
317}
318
324{
325 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
326 // 4 ciruits and the tail kernel
327 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/7, trace_settings);
328
329 // construct a mock app_circuit
330 construct_and_accumulate_mock_app(ivc, trace_settings);
331
332 const ProgramMetadata metadata{ ivc };
333
334 // Construct kernel_0; consists of a single oink recursive verification for app (plus databus/merge logic)
335 construct_and_accumulate_mock_kernel(ivc, trace_settings);
336
337 // construct a mock app_circuit
338 construct_and_accumulate_mock_app(ivc, trace_settings);
339
340 // Construct and accumulate another Kernel circuit
341 construct_and_accumulate_mock_kernel(ivc, trace_settings);
342
343 // Accumulate the trailing kernels
344 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
345
346 EXPECT_TRUE(ivc->prove_and_verify());
347}
348
349// Test generation of "init" kernel VK via dummy IVC data
350TEST_F(IvcRecursionConstraintTest, GenerateInitKernelVKFromConstraints)
351{
352 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
353
354 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
356 {
357 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
358
359 // Construct and accumulate mock app_circuit
360 construct_and_accumulate_mock_app(ivc, trace_settings);
361
362 // Construct and accumulate kernel consisting only of the kernel completion logic
363 construct_and_accumulate_mock_kernel(ivc, trace_settings);
364 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
365 }
366
367 // Now, construct the kernel VK by mocking the post app accumulation state of the IVC
369 {
370 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
371
372 // Construct kernel consisting only of the kernel completion logic
373 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::OINK, /*is_kernel=*/false);
374 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
375 program.witness = {}; // remove the witness to mimick VK construction context
376
377 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
378 }
379
380 // Compare the VK constructed via running the IVc with the one constructed via mocking
381 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
382}
383
384// Test generation of "reset" kernel VK via dummy IVC data
385TEST_F(IvcRecursionConstraintTest, GenerateResetKernelVKFromConstraints)
386{
387 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
388
389 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
391 {
392 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
393
394 const ProgramMetadata metadata{ ivc };
395
396 // Construct and accumulate mock app_circuit
397 construct_and_accumulate_mock_app(ivc, trace_settings);
398
399 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
400 construct_and_accumulate_mock_kernel(ivc, trace_settings);
401 EXPECT_TRUE(ivc->verification_queue.size() == 1);
402 EXPECT_TRUE(ivc->verification_queue[0].type == bb::ClientIVC::QUEUE_TYPE::PG);
403
404 // Construct and accumulate a mock RESET kernel (PG recursion for kernel accumulation)
405 construct_and_accumulate_mock_kernel(ivc, trace_settings);
406 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
407 }
408
409 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
411 {
412 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
413
414 // Construct kernel consisting only of the kernel completion logic
415 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG, /*is_kernel=*/true);
416 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
417 program.witness = {}; // remove the witness to mimick VK construction context
418 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
419 }
420
421 // Compare the VK constructed via running the IVc with the one constructed via mocking
422 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
423}
424
425// Test generation of "tail" kernel VK via dummy IVC data
426TEST_F(IvcRecursionConstraintTest, GenerateTailKernelVKFromConstraints)
427{
428 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
429
430 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
432 {
433 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
434
435 const ProgramMetadata metadata{ ivc };
436
437 // Construct and accumulate mock app_circuit
438 construct_and_accumulate_mock_app(ivc, trace_settings);
439
440 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
441 construct_and_accumulate_mock_kernel(ivc, trace_settings);
442
443 // Construct and accumulate a mock RESET kernel (PG recursion for kernel accumulation)
444 construct_and_accumulate_mock_kernel(ivc, trace_settings);
445
446 // Construct and accumulate a mock TAIL kernel (PG recursion for kernel accumulation)
447 EXPECT_TRUE(ivc->verification_queue.size() == 1);
448 EXPECT_TRUE(ivc->verification_queue[0].type == bb::ClientIVC::QUEUE_TYPE::PG_TAIL);
449 construct_and_accumulate_mock_kernel(ivc, trace_settings);
450
451 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
452 }
453
454 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
456 {
457 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
458
459 // Construct kernel consisting only of the kernel completion logic
460 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG_TAIL, /*is_kernel=*/true);
461 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
462 program.witness = {}; // remove the witness to mimick VK construction context
463
464 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
465 }
466
467 // Compare the VK constructed via running the IVc with the one constructed via mocking
468 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
469}
470
471// Test generation of "inner" kernel VK via dummy IVC data
472TEST_F(IvcRecursionConstraintTest, GenerateInnerKernelVKFromConstraints)
473{
474 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
475
476 // First, construct the kernel VK by running the full IVC (accumulate one app and one kernel)
478 {
479 // we have to set the number of circuits one more than the number of circuits we're accumulating as otherwise
480 // the last circuit will be seen as a tail
481 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/6, trace_settings);
482
483 const ProgramMetadata metadata{ ivc };
484
485 { // Construct and accumulate mock app_circuit
486 construct_and_accumulate_mock_app(ivc, trace_settings);
487 }
488
489 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
490 construct_and_accumulate_mock_kernel(ivc, trace_settings);
491
492 { // Construct and accumulate a second mock app_circuit
493 construct_and_accumulate_mock_app(ivc, trace_settings);
494 }
495
496 { // Construct and accumulate a mock INNER kernel (PG recursion for kernel accumulation)
497 EXPECT_TRUE(ivc->verification_queue.size() == 2);
498 EXPECT_TRUE(ivc->verification_queue[1].type == bb::ClientIVC::QUEUE_TYPE::PG);
499 construct_and_accumulate_mock_kernel(ivc, trace_settings);
500 }
501
502 expected_kernel_vk = ivc->verification_queue.back().honk_vk;
503 }
504
505 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
507 {
508 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/4, trace_settings);
509
510 // Construct kernel consisting only of the kernel completion logic
511 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG, /*is_kernel=*/true);
512 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG, /*is_kernel=*/false);
513 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
514 program.witness = {}; // remove the witness to mimick VK construction context
515
516 kernel_vk = construct_kernel_vk_from_acir_program(program, trace_settings);
517 }
518
519 // Compare the VK constructed via running the IVc with the one constructed via mocking
520 EXPECT_EQ(*kernel_vk.get(), *expected_kernel_vk.get());
521}
522
523// Test generation of "hiding" kernel VK via dummy IVC data
524TEST_F(IvcRecursionConstraintTest, GenerateHidingKernelVKFromConstraints)
525{
526 const TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
527
528 // First, construct the kernel VK by running the full IVC
529 std::shared_ptr<MegaFlavor::VerificationKey> expected_hiding_kernel_vk;
530 {
531 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, trace_settings);
532 const ProgramMetadata metadata{ ivc };
533
534 {
535 // Construct and accumulate mock app_circuit
536 construct_and_accumulate_mock_app(ivc, trace_settings);
537 }
538
539 {
540 // Construct and accumulate a mock INIT kernel (oink recursion for app accumulation)
541 construct_and_accumulate_mock_kernel(ivc, trace_settings);
542 }
543
544 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
545
546 // The single entry in the verification queue corresponds to the hiding kernel
547 expected_hiding_kernel_vk = ivc->verification_queue[0].honk_vk;
548 }
549
550 // Now, construct the kernel VK by mocking the IVC state prior to kernel construction
552 {
553 // mock IVC accumulation increases the num_circuits_accumualted, hence we need to assume the tail kernel has
554 // been accumulated
555 auto ivc = std::make_shared<ClientIVC>(/*num_circuits=*/5, TraceSettings());
556 // construct a mock tail kernel
557 acir_format::mock_ivc_accumulation(ivc, ClientIVC::QUEUE_TYPE::PG_FINAL, /*is_kernel=*/true);
558 AcirProgram program = construct_mock_kernel_program(ivc->verification_queue);
559 program.witness = {}; // remove the witness to mimick VK construction context
560 kernel_vk = construct_kernel_vk_from_acir_program(program, TraceSettings());
561 }
562
563 // Compare the VK constructed via running the IVc with the one constructed via mocking
564 EXPECT_EQ(*kernel_vk.get(), *expected_hiding_kernel_vk.get());
565}
566
571TEST_F(IvcRecursionConstraintTest, RecursiveVerifierAppCircuitTest)
572{
573 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
574 auto ivc = std::make_shared<ClientIVC>(/*num_circuits*/ 5, trace_settings);
575
576 // construct a mock app_circuit with an UH recursion call
577 Builder app_circuit = construct_mock_UH_recursion_app_circuit(ivc, /*tamper_vk=*/false);
578
579 // Complete instance and generate an oink proof
580 ivc->accumulate(app_circuit, get_verification_key(app_circuit, trace_settings));
581
582 // Construct kernel consisting only of the kernel completion logic
583 construct_and_accumulate_mock_kernel(ivc, trace_settings);
584
585 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
586
587 EXPECT_TRUE(ivc->prove_and_verify());
588}
589
594TEST_F(IvcRecursionConstraintTest, BadRecursiveVerifierAppCircuitTest)
595{
596 TraceSettings trace_settings{ AZTEC_TRACE_STRUCTURE };
597 auto ivc = std::make_shared<ClientIVC>(/*num_circuits*/ 5, trace_settings);
598
599 // construct and accumulate mock app_circuit that has bad pairing point object
600 Builder app_circuit = construct_mock_UH_recursion_app_circuit(ivc, /*tamper_vk=*/true);
601 ivc->accumulate(app_circuit, get_verification_key(app_circuit, trace_settings));
602
603 // Construct kernel consisting only of the kernel completion logic
604 construct_and_accumulate_mock_kernel(ivc, trace_settings);
605
606 // add the trailing kernels
607 construct_and_accumulate_trailing_kernels(ivc, trace_settings);
608
609 // We expect the CIVC proof to fail due to the app with a failed UH recursive verification
610 EXPECT_FALSE(ivc->prove_and_verify());
611}
acir_format::AcirFormatOriginalOpcodeIndices create_empty_original_opcode_indices()
void mock_opcode_indices(acir_format::AcirFormat &constraint_system)
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
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.