Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
protogalaxy.test.cpp
Go to the documentation of this file.
12
13#include <gtest/gtest.h>
14
15using namespace bb;
16
17namespace {
18
20
21template <typename Flavor> class ProtogalaxyTests : public testing::Test {
22 public:
25 using DeciderProvingKeys = DeciderProvingKeys_<Flavor, 2>;
26 using DeciderVerificationKey = DeciderVerificationKey_<Flavor>;
27 using DeciderVerificationKeys = DeciderVerificationKeys_<Flavor, 2>;
28 using ProtogalaxyProver = ProtogalaxyProver_<Flavor>;
29 using FF = typename Flavor::FF;
30 using Affine = typename Flavor::Commitment;
31 using Projective = typename Flavor::GroupElement;
32 using Builder = typename Flavor::CircuitBuilder;
33 using Polynomial = typename Flavor::Polynomial;
36 using WitnessCommitments = typename Flavor::WitnessCommitments;
37 using CommitmentKey = typename Flavor::CommitmentKey;
39 using DeciderProver = DeciderProver_<Flavor>;
40 using DeciderVerifier = DeciderVerifier_<Flavor>;
41 using FoldingProver = ProtogalaxyProver_<Flavor>;
44
47
48 static void SetUpTestSuite() { bb::srs::init_file_crs_factory(bb::srs::bb_crs_path()); }
49
50 static void construct_circuit(Builder& builder)
51 {
53 if constexpr (IsMegaFlavor<Flavor>) {
55 }
57 }
58
59 // Construct decider keys for a provided circuit and add to tuple
60 static void construct_keys(TupleOfKeys& keys, Builder& builder, TraceSettings trace_settings = TraceSettings{})
61 {
62
63 auto decider_proving_key = std::make_shared<DeciderProvingKey>(builder, trace_settings);
64 auto verification_key = std::make_shared<VerificationKey>(decider_proving_key->get_precomputed());
65 auto decider_verification_keys = std::make_shared<DeciderVerificationKey>(verification_key);
66 get<0>(keys).emplace_back(decider_proving_key);
67 get<1>(keys).emplace_back(decider_verification_keys);
68 }
69
70 // Construct a given numer of decider key pairs
71 static TupleOfKeys construct_keys(size_t num_keys, TraceSettings trace_settings = TraceSettings{})
72 {
73 TupleOfKeys keys;
74 // TODO(https://github.com/AztecProtocol/barretenberg/issues/938): Parallelize this loop
75 for (size_t idx = 0; idx < num_keys; idx++) {
76 auto builder = typename Flavor::CircuitBuilder();
77 construct_circuit(builder);
78
79 construct_keys(keys, builder, trace_settings);
80 }
81 return keys;
82 }
83
85 const std::vector<std::shared_ptr<DeciderProvingKey>>& proving_keys,
86 const std::vector<std::shared_ptr<DeciderVerificationKey>>& verification_keys,
88 {
89 FoldingProver folding_prover(proving_keys,
90 verification_keys,
92 trace_usage_tracker);
93 FoldingVerifier folding_verifier(verification_keys, std::make_shared<typename FoldingVerifier::Transcript>());
94
95 auto [prover_accumulator, folding_proof] = folding_prover.prove();
96 auto verifier_accumulator = folding_verifier.verify_folding_proof(folding_proof);
97 return { prover_accumulator, verifier_accumulator };
98 }
99
100 static void decide_and_verify(const std::shared_ptr<DeciderProvingKey>& prover_accumulator,
101 const std::shared_ptr<DeciderVerificationKey>& verifier_accumulator,
102 bool expected_result)
103 {
104 DeciderProver decider_prover(prover_accumulator);
105 DeciderVerifier decider_verifier(verifier_accumulator);
106 decider_prover.construct_proof();
107 HonkProof decider_proof = decider_prover.export_proof();
108 auto decider_output = decider_verifier.verify_proof(decider_proof);
109 bool result = decider_output.check();
110 EXPECT_EQ(result, expected_result);
111 }
112
119 static void test_full_honk_evaluations_valid_circuit()
120 {
121 auto builder = typename Flavor::CircuitBuilder();
122 construct_circuit(builder);
123
125
127
128 for (auto& alpha : decider_pk->alphas) {
129 alpha = FF::random_element();
130 }
131 PGInternal pg_internal;
132 auto full_honk_evals = pg_internal.compute_row_evaluations(
133 decider_pk->polynomials, decider_pk->alphas, decider_pk->relation_parameters);
134
135 // Evaluations should be 0 for valid circuit
136 for (const auto& eval : full_honk_evals.coeffs()) {
137 EXPECT_EQ(eval, FF(0));
138 }
139 }
140
146 static void test_pertubator_coefficients()
147 {
148 std::vector<FF> betas = { FF(5), FF(8), FF(11) };
149 std::vector<FF> deltas = { FF(2), FF(4), FF(8) };
150 std::vector<FF> full_honk_evaluations = { FF(1), FF(1), FF(1), FF(1), FF(1), FF(1), FF(1), FF(1) };
151 Polynomial honk_evaluations_poly(full_honk_evaluations.size());
152 for (auto [poly_val, val] : zip_view(honk_evaluations_poly.coeffs(), full_honk_evaluations)) {
153 poly_val = val;
154 }
155 auto perturbator = PGInternal::construct_perturbator_coefficients(betas, deltas, honk_evaluations_poly);
156 std::vector<FF> expected_values = { FF(648), FF(936), FF(432), FF(64) };
157 EXPECT_EQ(perturbator.size(), 4); // log(size) + 1
158 for (size_t i = 0; i < perturbator.size(); i++) {
159 EXPECT_EQ(perturbator[i], expected_values[i]);
160 }
161 }
162
168 static void test_pertubator_polynomial()
169 {
170 using SubrelationSeparators = typename Flavor::SubrelationSeparators;
171 const size_t log_size(3);
172 const size_t size(1 << log_size);
173 // Construct fully random prover polynomials
174 ProverPolynomials full_polynomials;
175 for (auto& poly : full_polynomials.get_all()) {
176 poly = bb::Polynomial<FF>::random(size);
177 }
178
179 auto relation_parameters = bb::RelationParameters<FF>::get_random();
180 SubrelationSeparators alphas;
181 for (auto& alpha : alphas) {
182 alpha = FF::random_element();
183 }
184
185 PGInternal pg_internal;
186 auto full_honk_evals = pg_internal.compute_row_evaluations(full_polynomials, alphas, relation_parameters);
187 std::vector<FF> betas(log_size);
188 for (size_t idx = 0; idx < log_size; idx++) {
189 betas[idx] = FF::random_element();
190 }
191
192 // Construct pow(\vec{betas}) as in the paper
193 bb::GateSeparatorPolynomial gate_separators(betas, log_size);
194
195 // Compute the corresponding target sum and create a dummy accumulator
196 auto target_sum = FF(0);
197 for (size_t i = 0; i < size; i++) {
198 target_sum += full_honk_evals[i] * gate_separators[i];
199 }
200
201 auto accumulator = std::make_shared<DeciderProvingKey>();
202 accumulator->polynomials = std::move(full_polynomials);
203 accumulator->set_dyadic_size(1 << log_size);
204 accumulator->gate_challenges = betas;
205 accumulator->target_sum = target_sum;
206 accumulator->relation_parameters = relation_parameters;
207 accumulator->alphas = alphas;
208
209 std::vector<FF> deltas(log_size);
210 for (size_t idx = 0; idx < log_size; idx++) {
211 deltas[idx] = FF::random_element();
212 }
213 auto perturbator = pg_internal.compute_perturbator(accumulator, deltas);
214
215 // Ensure the constant coefficient of the perturbator is equal to the target sum as indicated by the paper
216 EXPECT_EQ(perturbator[0], target_sum);
217 }
218
224 static void test_combiner_quotient()
225 {
226 auto perturbator_evaluation = FF(2); // F(\alpha) in the paper
227 auto combiner = bb::Univariate<FF, 12>(std::array<FF, 12>{ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 });
228 auto combiner_quotient = PGInternal::compute_combiner_quotient(perturbator_evaluation, combiner);
229
230 // K(i) = (G(i) - ( L_0(i) * F(\alpha)) / Z(i), i = {2,.., 13} for DeciderProvingKeys::NUM = 2
231 // K(i) = (G(i) - (1 - i) * F(\alpha)) / i * (i - 1)
232 auto expected_evals = bb::Univariate<FF, 12, 2>(std::array<FF, 10>{
233 (FF(22) - (FF(1) - FF(2)) * perturbator_evaluation) / (FF(2) * FF(2 - 1)),
234 (FF(23) - (FF(1) - FF(3)) * perturbator_evaluation) / (FF(3) * FF(3 - 1)),
235 (FF(24) - (FF(1) - FF(4)) * perturbator_evaluation) / (FF(4) * FF(4 - 1)),
236 (FF(25) - (FF(1) - FF(5)) * perturbator_evaluation) / (FF(5) * FF(5 - 1)),
237 (FF(26) - (FF(1) - FF(6)) * perturbator_evaluation) / (FF(6) * FF(6 - 1)),
238 (FF(27) - (FF(1) - FF(7)) * perturbator_evaluation) / (FF(7) * FF(7 - 1)),
239 (FF(28) - (FF(1) - FF(8)) * perturbator_evaluation) / (FF(8) * FF(8 - 1)),
240 (FF(29) - (FF(1) - FF(9)) * perturbator_evaluation) / (FF(9) * FF(9 - 1)),
241 (FF(30) - (FF(1) - FF(10)) * perturbator_evaluation) / (FF(10) * FF(10 - 1)),
242 (FF(31) - (FF(1) - FF(11)) * perturbator_evaluation) / (FF(11) * FF(11 - 1)),
243 });
244
245 for (size_t idx = 2; idx < 7; idx++) {
246 EXPECT_EQ(combiner_quotient.value_at(idx), expected_evals.value_at(idx));
247 }
248 }
249
255 static void test_compute_extended_relation_parameters()
256 {
257 Builder builder1;
259 auto pk_1 = std::make_shared<DeciderProvingKey>(builder1);
260 pk_1->relation_parameters.eta = 1;
261
262 Builder builder2;
263 builder2.add_variable(3);
265 auto pk_2 = std::make_shared<DeciderProvingKey>(builder2);
266 pk_2->relation_parameters.eta = 3;
267
268 DeciderProvingKeys pks{ { pk_1, pk_2 } };
269 auto relation_parameters_no_optimistic_skipping = PGInternal::template compute_extended_relation_parameters<
271 auto relation_parameters = PGInternal::template compute_extended_relation_parameters<
273
274 bb::Univariate<FF, 11> expected_eta{ { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21 } };
275 EXPECT_EQ(relation_parameters_no_optimistic_skipping.eta, expected_eta);
276 // Optimized relation parameters are the same, we just don't compute any values for non-used indices when
277 // deriving values from them
278 for (size_t i = 0; i < 11; i++) {
279 EXPECT_EQ(relation_parameters.eta.evaluations[i], expected_eta.evaluations[i]);
280 }
281 }
282
287 static void test_compute_and_extend_alphas()
288 {
289 Builder builder1;
291 auto pk_1 = std::make_shared<DeciderProvingKey>(builder1);
292 pk_1->alphas.fill(2);
293
294 Builder builder2;
295 builder2.add_variable(3);
297 auto pk_2 = std::make_shared<DeciderProvingKey>(builder2);
298 pk_2->alphas.fill(4);
299
300 DeciderProvingKeys pks{ { pk_1, pk_2 } };
301 auto alphas = PGInternal::compute_and_extend_alphas(pks);
302
303 bb::Univariate<FF, 12> expected_alphas{ { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24 } };
304 for (const auto& alpha : alphas) {
305 EXPECT_EQ(alpha, expected_alphas);
306 }
307 }
308
314 static void test_protogalaxy_inhomogeneous()
315 {
316 auto check_fold_and_decide = [](Builder& circuit_1, Builder& circuit_2) {
317 // Construct decider key pairs for each
318 TupleOfKeys keys;
319 construct_keys(keys, circuit_1);
320 construct_keys(keys, circuit_2);
321
322 // Perform prover and verifier folding
323 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(keys), get<1>(keys));
324 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
325
326 // Run decider
327 decide_and_verify(prover_accumulator, verifier_accumulator, true);
328 };
329
330 // One circuit has more arithmetic gates
331 {
332 // Construct two equivalent circuits
333 Builder builder1;
334 Builder builder2;
335 construct_circuit(builder1);
336 construct_circuit(builder2);
337
338 // Add some arithmetic gates
339 bb::MockCircuits::add_arithmetic_gates(builder1, /*num_gates=*/4);
340
341 check_fold_and_decide(builder1, builder2);
342 }
343
344 // One circuit has more arithmetic gates with public inputs
345 {
346 // Construct two equivalent circuits
347 Builder builder1;
348 Builder builder2;
349
350 // Add some arithmetic gates with public inputs to the first circuit
352
353 construct_circuit(builder1);
354 construct_circuit(builder2);
355
356 check_fold_and_decide(builder1, builder2);
357 }
358
359 // One circuit has more lookup gates
360 {
361 // Construct two equivalent circuits
362 Builder builder1;
363 Builder builder2;
364 construct_circuit(builder1);
365 construct_circuit(builder2);
366
367 // Add a different number of lookup gates to each circuit
368 bb::MockCircuits::add_lookup_gates(builder1, /*num_iterations=*/2); // 12 gates plus 4096 table
369 bb::MockCircuits::add_lookup_gates(builder2, /*num_iterations=*/1); // 6 gates plus 4096 table
370
371 check_fold_and_decide(builder1, builder2);
372 }
373 }
374
379 static void test_protogalaxy_bad_lookup_failure()
380 {
381 // Construct two equivalent circuits
382 Builder builder1;
383 Builder builder2;
384 construct_circuit(builder1);
385 construct_circuit(builder2);
386
387 // Add a different number of lookup gates to each circuit
388 bb::MockCircuits::add_lookup_gates(builder1, /*num_iterations=*/2); // 12 gates plus 4096 table
389 bb::MockCircuits::add_lookup_gates(builder2, /*num_iterations=*/1); // 6 gates plus 4096 table
390
391 // Erroneously set a non-zero wire value to zero in one of the lookup gates
392 for (auto& wire_3_witness_idx : builder1.blocks.lookup.w_o()) {
393 if (wire_3_witness_idx != builder1.zero_idx) {
394 wire_3_witness_idx = builder1.zero_idx;
395 break;
396 }
397 }
398
399 // Construct the key pairs for each
400 TupleOfKeys keys;
401 construct_keys(keys, builder1);
402 construct_keys(keys, builder2);
403
404 // Perform prover and verifier folding
405 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(keys), get<1>(keys));
406
407 // Expect failure in manual target sum check and decider
408 EXPECT_FALSE(check_accumulator_target_sum_manual(prover_accumulator));
409 decide_and_verify(prover_accumulator, verifier_accumulator, false);
410 }
411
416 static void test_full_protogalaxy()
417 {
418 TupleOfKeys insts = construct_keys(2);
419 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(insts), get<1>(insts));
420 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
421
422 TupleOfKeys insts_2 = construct_keys(1); // just one key pair
423 auto [prover_accumulator_2, verifier_accumulator_2] =
424 fold_and_verify({ prover_accumulator, get<0>(insts_2)[0] }, { verifier_accumulator, get<1>(insts_2)[0] });
425 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator_2));
426
427 decide_and_verify(prover_accumulator_2, verifier_accumulator_2, true);
428 }
429
434 static void test_full_protogalaxy_structured_trace()
435 {
436 TraceSettings trace_settings{ SMALL_TEST_STRUCTURE_FOR_OVERFLOWS };
437 TupleOfKeys keys_1 = construct_keys(2, trace_settings);
438
439 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(keys_1), get<1>(keys_1));
440 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
441
442 TupleOfKeys keys_2 = construct_keys(1, trace_settings); // just one key pair
443
444 auto [prover_accumulator_2, verifier_accumulator_2] =
445 fold_and_verify({ prover_accumulator, get<0>(keys_2)[0] }, { verifier_accumulator, get<1>(keys_2)[0] });
446 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator_2));
447 info(prover_accumulator_2->dyadic_size());
448 decide_and_verify(prover_accumulator_2, verifier_accumulator_2, true);
449 }
450
458 static void test_fold_with_virtual_size_expansion()
459 {
460 uint32_t overflow_capacity = 0; // consider the case where the overflow is not known until runtime
461 TraceSettings trace_settings{ SMALL_TEST_STRUCTURE_FOR_OVERFLOWS, overflow_capacity };
462 ExecutionTraceUsageTracker trace_usage_tracker = ExecutionTraceUsageTracker(trace_settings);
463
466
467 // define parameters for two circuits; the first fits within the structured trace, the second overflows
468 const std::vector<size_t> log2_num_gates = { 14, 18 };
469 for (size_t i = 0; i < 2; ++i) {
471
472 MockCircuits::add_arithmetic_gates(builder, 1 << log2_num_gates[i]);
474
475 auto decider_proving_key = std::make_shared<DeciderProvingKey>(builder, trace_settings);
476 trace_usage_tracker.update(builder);
477 auto verification_key = std::make_shared<VerificationKey>(decider_proving_key->get_precomputed());
478 auto decider_verification_key = std::make_shared<DeciderVerificationKey>(verification_key);
479 decider_pks.push_back(decider_proving_key);
480 decider_vks.push_back(decider_verification_key);
481 }
482
483 // Ensure the dyadic size of the first key is strictly less than that of the second
484 EXPECT_TRUE(decider_pks[0]->dyadic_size() < decider_pks[1]->dyadic_size());
485
486 // The size discrepency should be automatically handled by the PG prover via a virtual size increase
487 const auto [prover_accumulator, verifier_accumulator] =
488 fold_and_verify(decider_pks, decider_vks, trace_usage_tracker);
489 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
490 decide_and_verify(prover_accumulator, verifier_accumulator, true);
491 }
492
499 static void test_full_protogalaxy_structured_trace_inhomogeneous_circuits()
500 {
501 TraceSettings trace_settings{ SMALL_TEST_STRUCTURE };
502
503 // Construct three circuits to be folded, each with a different number of constraints
504 Builder builder1;
505 Builder builder2;
506 Builder builder3;
507 construct_circuit(builder1);
508 construct_circuit(builder2);
509 construct_circuit(builder3);
510
511 // Create inhomogenous circuits by adding a different number of add gates to each
515
516 // Construct the decider key pairs for the first two circuits
517 TupleOfKeys keys_1;
518 construct_keys(keys_1, builder1, trace_settings);
519 construct_keys(keys_1, builder2, trace_settings);
520
521 // Fold the first two pairs
522 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(keys_1), get<1>(keys_1));
523 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
524
525 // Construct the decider key pair for the third circuit
526 TupleOfKeys keys_2;
527 construct_keys(keys_2, builder3, trace_settings);
528
529 // Fold 3rd pair of keys into their respective accumulators
530 auto [prover_accumulator_2, verifier_accumulator_2] =
531 fold_and_verify({ prover_accumulator, get<0>(keys_2)[0] }, { verifier_accumulator, get<1>(keys_2)[0] });
532 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator_2));
533 info(prover_accumulator_2->dyadic_size());
534
535 // Decide on final accumulator
536 decide_and_verify(prover_accumulator_2, verifier_accumulator_2, true);
537 }
538
543 static void test_tampered_commitment()
544 {
545 TupleOfKeys insts = construct_keys(2);
546 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(insts), get<1>(insts));
547 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
548
549 // Tamper with a commitment
550 verifier_accumulator->witness_commitments.w_l = Projective(Affine::random_element());
551
552 TupleOfKeys insts_2 = construct_keys(1); // just one decider key pair
553 auto [prover_accumulator_2, verifier_accumulator_2] =
554 fold_and_verify({ prover_accumulator, get<0>(insts_2)[0] }, { verifier_accumulator, get<1>(insts_2)[0] });
555 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator_2));
556
557 decide_and_verify(prover_accumulator_2, verifier_accumulator_2, false);
558 }
559
565 static void test_tampered_accumulator_polynomial()
566 {
567 TupleOfKeys insts = construct_keys(2);
568 auto [prover_accumulator, verifier_accumulator] = fold_and_verify(get<0>(insts), get<1>(insts));
569 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
570
571 // Tamper with an accumulator polynomial
572 prover_accumulator->polynomials.w_l.at(1) = FF::random_element();
573 EXPECT_FALSE(check_accumulator_target_sum_manual(prover_accumulator));
574
575 TupleOfKeys insts_2 = construct_keys(1); // just one decider key pair
576 auto [prover_accumulator_2, verifier_accumulator_2] =
577 fold_and_verify({ prover_accumulator, get<0>(insts_2)[0] }, { verifier_accumulator, get<1>(insts_2)[0] });
578
579 EXPECT_EQ(prover_accumulator_2->target_sum == verifier_accumulator_2->target_sum, false);
580 decide_and_verify(prover_accumulator_2, verifier_accumulator_2, false);
581 }
582
583 template <size_t k> static void test_fold_k_key_pairs()
584 {
585 constexpr size_t total_insts = k + 1;
586 TupleOfKeys insts = construct_keys(total_insts);
587
589 get<0>(insts), get<1>(insts), std::make_shared<NativeTranscript>());
591 get<1>(insts), std::make_shared<NativeTranscript>());
592
593 auto [prover_accumulator, folding_proof] = folding_prover.prove();
594 auto verifier_accumulator = folding_verifier.verify_folding_proof(folding_proof);
595 EXPECT_TRUE(check_accumulator_target_sum_manual(prover_accumulator));
596 decide_and_verify(prover_accumulator, verifier_accumulator, true);
597 }
598};
599} // namespace
600
601using FlavorTypes = testing::Types<MegaFlavor>;
602TYPED_TEST_SUITE(ProtogalaxyTests, FlavorTypes);
603
604TYPED_TEST(ProtogalaxyTests, PerturbatorCoefficients)
605{
606 TestFixture::test_pertubator_coefficients();
607}
608
609TYPED_TEST(ProtogalaxyTests, FullHonkEvaluationsValidCircuit)
610{
611 TestFixture::test_full_honk_evaluations_valid_circuit();
612}
613
614TYPED_TEST(ProtogalaxyTests, PerturbatorPolynomial)
615{
616 TestFixture::test_pertubator_polynomial();
617}
618
619TYPED_TEST(ProtogalaxyTests, CombinerQuotient)
620{
621 TestFixture::test_combiner_quotient();
622}
623
624TYPED_TEST(ProtogalaxyTests, CombineRelationParameters)
625{
626 TestFixture::test_compute_extended_relation_parameters();
627}
628
629TYPED_TEST(ProtogalaxyTests, CombineAlphas)
630{
631 TestFixture::test_compute_and_extend_alphas();
632}
633
634TYPED_TEST(ProtogalaxyTests, ProtogalaxyInhomogeneous)
635{
636 TestFixture::test_protogalaxy_inhomogeneous();
637}
638
639TYPED_TEST(ProtogalaxyTests, FullProtogalaxyTest)
640{
641 TestFixture::test_full_protogalaxy();
642}
643
644TYPED_TEST(ProtogalaxyTests, FullProtogalaxyStructuredTrace)
645{
646 TestFixture::test_full_protogalaxy_structured_trace();
647}
648
649TYPED_TEST(ProtogalaxyTests, VirtualSizeExpansion)
650{
651 TestFixture::test_fold_with_virtual_size_expansion();
652}
653
654TYPED_TEST(ProtogalaxyTests, FullProtogalaxyStructuredTraceInhomogeneous)
655{
656 TestFixture::test_full_protogalaxy_structured_trace_inhomogeneous_circuits();
657}
658
659TYPED_TEST(ProtogalaxyTests, TamperedCommitment)
660{
661 TestFixture::test_tampered_commitment();
662}
663
664TYPED_TEST(ProtogalaxyTests, TamperedAccumulatorPolynomial)
665{
666 TestFixture::test_tampered_accumulator_polynomial();
667}
668
669TYPED_TEST(ProtogalaxyTests, BadLookupFailure)
670{
671 TestFixture::test_protogalaxy_bad_lookup_failure();
672}
673
674// We only fold one incoming decider key pair since this is all we plan to use, and compiling for higher values of k is
675// a significant compilation time cost.
676TYPED_TEST(ProtogalaxyTests, Fold1)
677{
678 TestFixture::template test_fold_k_key_pairs<1>();
679}
CommitmentKey object over a pairing group 𝔾₁.
A DeciderProvingKey is normally constructed from a finalized circuit and it contains all the informat...
The DeciderVerificationKey encapsulates all the necessary information for a Mega Honk Verifier to ver...
A container for the prover polynomials.
The verification key is responsible for storing the commitments to the precomputed (non-witnessk) pol...
static void add_some_ecc_op_gates(MegaBuilder &builder)
Generate a simple test circuit with some ECC op gates and conventional arithmetic gates.
WitnessEntities< Commitment > WitnessCommitments
A container for the witness commitments.
Curve::ScalarField FF
bb::CommitmentKey< Curve > CommitmentKey
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
Curve::Element GroupElement
MegaCircuitBuilder CircuitBuilder
bb::Polynomial< FF > Polynomial
Curve::AffineElement Commitment
static void add_arithmetic_gates_with_public_inputs(Builder &builder, const size_t num_gates=4)
Add a specified number of arithmetic gates (with public inputs) to the provided circuit.
static void add_lookup_gates(Builder &builder, size_t num_iterations=1)
Add lookup gates using the uint32 XOR lookup table (table size 4096)
static void add_arithmetic_gates(Builder &builder, const size_t num_gates=4)
Add a specified number of arithmetic gates to the provided circuit.
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
bb::RelationParameters< Univariate< FF, DeciderProvingKeys::EXTENDED_LENGTH, 0, NUM_KEYS - 1 > > UnivariateRelationParameters
A purely static class (never add state to this!) consisting of functions used by the Protogalaxy prov...
static Univariate< FF, DeciderPKs::BATCHED_EXTENDED_LENGTH, DeciderPKs::NUM > compute_combiner_quotient(FF perturbator_evaluation, ExtendedUnivariateWithRandomization combiner)
Compute the combiner quotient defined as $K$ polynomial in the paper.
bb::RelationParameters< Univariate< FF, DeciderProvingKeys_::EXTENDED_LENGTH > > UnivariateRelationParametersNoOptimisticSkipping
static UnivariateSubrelationSeparators compute_and_extend_alphas(const DeciderPKs &keys)
Combine the relation batching parameters (alphas) from each decider proving key into a univariate for...
static std::vector< FF > construct_perturbator_coefficients(std::span< const FF > betas, std::span< const FF > deltas, const Polynomial< FF > &full_honk_evaluations)
We construct the coefficients of the perturbator polynomial in O(n) time following the technique in C...
A univariate polynomial represented by its values on {domain_start, domain_start + 1,...
Fr & value_at(size_t i)
static void complete_proving_key_for_test(const std::shared_ptr< DeciderProvingKey_< Flavor > > &decider_pk)
TEST only method for completing computation of the prover polynomials using random challenges.
void info(Args... args)
Definition log.hpp:70
AluTraceBuilder builder
Definition alu.test.cpp:123
bool expected_result
typename ECCVMFlavor::ProverPolynomials ProverPolynomials
numeric::RNG & engine
std::vector< FF > betas
The challenges .
UltraKeccakFlavor::VerificationKey VerificationKey
testing::Types< MegaFlavor, UltraFlavor, UltraZKFlavor, UltraRollupFlavor > FlavorTypes
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
Definition engine.cpp:190
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
std::vector< fr > HonkProof
Definition proof.hpp:15
TYPED_TEST_SUITE(ShpleminiTest, TestSettings)
typename Flavor::FF FF
TYPED_TEST(ShpleminiTest, CorrectnessOfMultivariateClaimBatching)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Tracks the cumulative usage of the execution trace across a series of circuits.
Implementation of the methods for the -polynomials used in Protogalaxy and -polynomials used in Sumch...
Container for parameters used by the grand product (permutation, lookup) Honk relations.
static RelationParameters get_random()
static void add_default_to_public_inputs(Builder &builder)
Adds default public inputs to the builder.