Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
translator.test.cpp
Go to the documentation of this file.
10
11#include <gtest/gtest.h>
12using namespace bb;
13
17static auto& engine = numeric::get_debug_randomness();
18
19// Test helper: Create a VK by committing to proving key polynomials (for comparing with fixed VK)
22{
24 // Only ordered_extra_range_constraints_numerator needs a VK commitment (the only non-computable precomputed)
25 vk.ordered_extra_range_constraints_numerator =
26 proving_key->commitment_key.commit(proving_key->polynomials.ordered_extra_range_constraints_numerator);
27 return vk;
28}
29
30// Compute VK hash from fixed commitments (for test verification that vk_hash() is correct)
32{
34 // Serialize commitments using the Codec
35 for (const auto& commitment : TranslatorHardcodedVKAndHash::get_all()) {
37 for (const auto& fr : frs) {
38 elements.push_back(fr);
39 }
40 }
42}
43
44class TranslatorTests : public ::testing::Test {
46 using Fr = fr;
47 using Fq = fq;
49 using FF = Flavor::FF;
51
52 protected:
54
71 {
72 TranscriptManifest manifest;
73 constexpr size_t frs_per_G = FrCodec::calc_num_fields<Flavor::Commitment>();
74 constexpr size_t NUM_SUMCHECK_ROUNDS = Flavor::CONST_TRANSLATOR_LOG_N;
75
76 // Round 0: vk_hash, Gemini masking, wire commitments
77 manifest.add_entry(0, "vk_hash", 1);
78 manifest.add_entry(0, "Gemini:masking_poly_comm", frs_per_G);
79
80 // Wire commitments (10 total: 5 concatenated + 5 ordered)
81 // clang-format off
82 std::vector<std::string> wire_labels = {
83 "CONCATENATED_RANGE_CONSTRAINTS_0", "CONCATENATED_RANGE_CONSTRAINTS_1",
84 "CONCATENATED_RANGE_CONSTRAINTS_2", "CONCATENATED_RANGE_CONSTRAINTS_3",
85 "CONCATENATED_NON_RANGE",
86 "ORDERED_RANGE_CONSTRAINTS_0", "ORDERED_RANGE_CONSTRAINTS_1",
87 "ORDERED_RANGE_CONSTRAINTS_2", "ORDERED_RANGE_CONSTRAINTS_3",
88 "ORDERED_RANGE_CONSTRAINTS_4",
89 };
90 // clang-format on
91 for (const auto& label : wire_labels) {
92 manifest.add_entry(0, label, frs_per_G);
93 }
94 // beta and gamma are consecutive challenges (no data between), so both in round 0
95 manifest.add_challenge(0, "beta");
96 manifest.add_challenge(0, "gamma");
97
98 // Round 1: Z_PERM -> Sumcheck:alpha + all gate challenges (same round, no data between them)
99 manifest.add_entry(1, "Z_PERM", frs_per_G);
100 manifest.add_challenge(1, "Sumcheck:alpha");
101 manifest.add_challenge(1, "Sumcheck:gate_challenge");
102
103 // Round 2: Libra concatenation commitment + Sum -> Libra:Challenge
104 manifest.add_entry(2, "Libra:concatenation_commitment", frs_per_G);
105 manifest.add_entry(2, "Libra:Sum", 1);
106 manifest.add_challenge(2, "Libra:Challenge");
107
108 // Rounds 3-15: Sumcheck univariates for mini-circuit rounds 0..12
109 constexpr size_t LOG_MINI = Flavor::LOG_MINI_CIRCUIT_SIZE;
110 for (size_t i = 0; i < LOG_MINI; ++i) {
111 manifest.add_entry(3 + i, "Sumcheck:univariate_" + std::to_string(i), 9);
112 manifest.add_challenge(3 + i, "Sumcheck:u_" + std::to_string(i));
113 }
114
115 // Round 16: 154 minicircuit wire evaluations sent mid-sumcheck, then univariate_13
116 manifest.add_entry(3 + LOG_MINI, "Sumcheck:minicircuit_evaluations", Flavor::NUM_MINICIRCUIT_EVALUATIONS);
117 manifest.add_entry(3 + LOG_MINI, "Sumcheck:univariate_" + std::to_string(LOG_MINI), 9);
118 manifest.add_challenge(3 + LOG_MINI, "Sumcheck:u_" + std::to_string(LOG_MINI));
119
120 // Rounds 17-19: remaining sumcheck rounds 14..16
121 for (size_t i = LOG_MINI + 1; i < NUM_SUMCHECK_ROUNDS; ++i) {
122 manifest.add_entry(3 + i, "Sumcheck:univariate_" + std::to_string(i), 9);
123 manifest.add_challenge(3 + i, "Sumcheck:u_" + std::to_string(i));
124 }
125
126 // Sumcheck full-circuit evaluations (computable precomputed + minicircuit wires excluded) + Libra commitments
127 // -> rho
128 const size_t eval_round = 3 + NUM_SUMCHECK_ROUNDS;
129 manifest.add_entry(eval_round, "Sumcheck:evaluations", Flavor::NUM_FULL_CIRCUIT_EVALUATIONS);
130 manifest.add_entry(eval_round, "Libra:claimed_evaluation", 1);
131 manifest.add_entry(eval_round, "Libra:grand_sum_commitment", frs_per_G);
132 manifest.add_entry(eval_round, "Libra:quotient_commitment", frs_per_G);
133 manifest.add_challenge(eval_round, "rho");
134
135 // Gemini fold commitments -> Gemini:r
136 const size_t gemini_fold_round = eval_round + 1;
137 for (size_t i = 1; i < NUM_SUMCHECK_ROUNDS; ++i) {
138 manifest.add_entry(gemini_fold_round, "Gemini:FOLD_" + std::to_string(i), frs_per_G);
139 }
140 manifest.add_challenge(gemini_fold_round, "Gemini:r");
141
142 // Gemini evaluations + Libra evals -> Shplonk:nu
143 const size_t gemini_eval_round = gemini_fold_round + 1;
144 for (size_t i = 1; i <= NUM_SUMCHECK_ROUNDS; ++i) {
145 manifest.add_entry(gemini_eval_round, "Gemini:a_" + std::to_string(i), 1);
146 }
147 // No more Gemini:P_pos / Gemini:P_neg (interleaving replaced by concatenation)
148 manifest.add_entry(gemini_eval_round, "Libra:concatenation_eval", 1);
149 manifest.add_entry(gemini_eval_round, "Libra:shifted_grand_sum_eval", 1);
150 manifest.add_entry(gemini_eval_round, "Libra:grand_sum_eval", 1);
151 manifest.add_entry(gemini_eval_round, "Libra:quotient_eval", 1);
152 manifest.add_challenge(gemini_eval_round, "Shplonk:nu");
153
154 // Shplonk:Q -> Shplonk:z
155 const size_t shplonk_round = gemini_eval_round + 1;
156 manifest.add_entry(shplonk_round, "Shplonk:Q", frs_per_G);
157 manifest.add_challenge(shplonk_round, "Shplonk:z");
158
159 // KZG:W
160 const size_t kzg_round = shplonk_round + 1;
161 manifest.add_entry(kzg_round, "KZG:W", frs_per_G);
162
163 return manifest;
164 }
165
166 // Helper function to add no-ops
167 static void add_random_ops(std::shared_ptr<bb::ECCOpQueue>& op_queue, size_t count = 1)
168 {
169 for (size_t i = 0; i < count; i++) {
170 op_queue->random_op_ultra_only();
171 }
172 }
173
174 static void add_mixed_ops(std::shared_ptr<bb::ECCOpQueue>& op_queue, size_t count = 100)
175 {
176 auto P1 = G1::random_element();
177 auto P2 = G1::random_element();
178 auto z = Fr::random_element();
179 for (size_t i = 0; i < count; i++) {
180 op_queue->add_accumulate(P1);
181 op_queue->mul_accumulate(P2, z);
182 }
183 op_queue->eq_and_reset();
184 }
185
186 // Construct a test circuit based on some random operations
187 static CircuitBuilder generate_test_circuit(const Fq& batching_challenge_v,
188 const Fq& evaluation_challenge_x,
189 const size_t circuit_size_parameter = 500)
190 {
191
192 auto op_queue = std::make_shared<ECCOpQueue>();
193 // Construct zk_columns
194 op_queue->construct_zk_columns();
195 // Table with correct final structure for translator
196 add_mixed_ops(op_queue, circuit_size_parameter / 2);
198 // Merge with fixed append
199 op_queue->merge_fixed_append(op_queue->get_append_offset());
200
201 return CircuitBuilder{ batching_challenge_v, evaluation_challenge_x, op_queue };
202 }
203
204 static bool prove_and_verify(const CircuitBuilder& circuit_builder,
205 const Fq& evaluation_challenge_x,
206 const Fq& batching_challenge_v)
207 {
208 // Setup prover transcript
209 auto prover_transcript = std::make_shared<Transcript>();
210 prover_transcript->send_to_verifier("init", Fq::random_element());
211 auto initial_transcript = prover_transcript->export_proof();
212
213 // Setup verifier transcript
214 auto verifier_transcript = std::make_shared<Transcript>(initial_transcript);
215 verifier_transcript->template receive_from_prover<Fq>("init");
216
217 // Create proving key and prover
218 auto proving_key = std::make_shared<TranslatorProvingKey>(circuit_builder);
219 TranslatorProver prover{ proving_key, prover_transcript };
220
221 // Generate proof
222 auto proof = prover.construct_proof();
223
224 // Commit to op queue wires
226 op_queue_commitments[0] =
227 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.op);
228 op_queue_commitments[1] =
229 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.x_lo_y_hi);
230 op_queue_commitments[2] =
231 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.x_hi_z_1);
232 op_queue_commitments[3] =
233 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.y_lo_z_2);
234
235 // Get accumulated_result from the prover
236 uint256_t accumulated_result = prover.get_accumulated_result();
237
238 // Create verifier
239 TranslatorVerifier verifier(verifier_transcript,
240 proof,
241 evaluation_challenge_x,
242 batching_challenge_v,
243 accumulated_result,
244 op_queue_commitments);
245
246 // Verify proof: get reduction result and check all components
247 auto result = verifier.reduce_to_pairing_check();
248 return result.pairing_points.check() && result.reduction_succeeded;
249 }
250};
251
259TEST_F(TranslatorTests, ProofLengthCheck)
260{
261 using Fq = fq;
262
263 Fq batching_challenge_v = Fq::random_element();
264 Fq evaluation_challenge_x = Fq::random_element();
265
266 // Generate a circuit and its verification key (computed at runtime from the proving key)
267 CircuitBuilder circuit_builder = generate_test_circuit(batching_challenge_v, evaluation_challenge_x);
268
269 // Setup prover transcript
270 auto prover_transcript = std::make_shared<Transcript>();
271 prover_transcript->send_to_verifier("init", Fq::random_element());
272 prover_transcript->export_proof();
273 auto proving_key = std::make_shared<TranslatorProvingKey>(circuit_builder);
274 TranslatorProver prover{ proving_key, prover_transcript };
275
276 // Generate proof
277 auto proof = prover.construct_proof();
278
279 EXPECT_EQ(proof.size(), TranslatorFlavor::PROOF_LENGTH);
280}
281
287{
288 using Fq = fq;
289
290 Fq batching_challenge_v = Fq::random_element();
291 Fq evaluation_challenge_x = Fq::random_element();
292
293 // Generate a circuit without no-ops
294 CircuitBuilder circuit_builder = generate_test_circuit(batching_challenge_v, evaluation_challenge_x);
295
296 EXPECT_TRUE(TranslatorCircuitChecker::check(circuit_builder));
297 bool verified = prove_and_verify(circuit_builder, evaluation_challenge_x, batching_challenge_v);
298 EXPECT_TRUE(verified);
299}
300
307{
308 using Fq = fq;
309
310 Fq batching_challenge_v = Fq::random_element();
311 Fq evaluation_challenge_x = Fq::random_element();
312
313 // Add the same operations to the ECC op queue; the native computation is performed under the hood.
314 auto op_queue = std::make_shared<bb::ECCOpQueue>();
315 // Seed a no-op to supply the 2 leading zero rows Translator's op-queue wires need for shiftability.
316 op_queue->no_op_ultra_only();
317 add_random_ops(op_queue, CircuitBuilder::NUM_RANDOM_OPS_START);
318 add_mixed_ops(op_queue, 100);
319 op_queue->merge();
320 auto circuit_builder = CircuitBuilder{ batching_challenge_v, evaluation_challenge_x, op_queue, /*avm_mode=*/true };
321
322 EXPECT_TRUE(TranslatorCircuitChecker::check(circuit_builder));
323 bool verified = prove_and_verify(circuit_builder, evaluation_challenge_x, batching_challenge_v);
324 EXPECT_TRUE(verified);
325}
326
336{
337 using Fq = fq;
338
339 auto prover_transcript = std::make_shared<Transcript>();
340 prover_transcript->send_to_verifier("init", Fq::random_element());
341 prover_transcript->export_proof();
342 Fq batching_challenge_v = Fq::random_element();
343 Fq evaluation_challenge_x = Fq::random_element();
344
345 // Generate the default fixed VK
347
348 // Lambda for manually computing a verification key for a given circuit and comparing it to the fixed VK
349 auto compare_computed_vk_against_fixed = [&](size_t circuit_size_parameter) {
350 CircuitBuilder circuit_builder =
351 generate_test_circuit(batching_challenge_v, evaluation_challenge_x, circuit_size_parameter);
352 auto proving_key = std::make_shared<TranslatorProvingKey>(circuit_builder);
353 TranslatorProver prover{ proving_key, prover_transcript };
354 TranslatorFlavor::VerificationKey computed_vk = create_vk_from_proving_key(proving_key->proving_key);
355 auto labels = TranslatorFlavor::VerificationKey::get_labels();
356
357 size_t index = 0;
358 for (auto [vk_commitment, fixed_commitment] : zip_view(computed_vk.get_all(), fixed_vk.get_all())) {
359 if (vk_commitment != fixed_commitment) {
360 info("// ", labels[index]);
361 info("Commitment(uint256_t(\"0x", vk_commitment.x, "\"),");
362 info(" uint256_t(\"0x", vk_commitment.y, "\")),");
363 }
364 EXPECT_EQ(vk_commitment, fixed_commitment) << "Mismatch at label: " << labels[index];
365 ++index;
366 }
367
368 EXPECT_EQ(computed_vk, fixed_vk);
369 };
370
371 // Check consistency of the fixed VK with the computed VK for some different circuit sizes
372 const size_t circuit_size_parameter_1 = 1 << 2;
373 const size_t circuit_size_parameter_2 = 1 << 3;
374
375 compare_computed_vk_against_fixed(circuit_size_parameter_1);
376 compare_computed_vk_against_fixed(circuit_size_parameter_2);
377
378 // Verify that the hardcoded VK hash matches the computed hash
379 auto computed_hash = compute_translator_vk_hash();
380 auto hardcoded_hash = TranslatorHardcodedVKAndHash::vk_hash();
381 if (computed_hash != hardcoded_hash) {
382 info("VK hash mismatch! Update TranslatorHardcodedVKAndHash::vk_hash() with:");
383 info("0x", computed_hash);
384 }
385 EXPECT_EQ(computed_hash, hardcoded_hash) << "Hardcoded VK hash does not match computed hash";
386}
387
393TEST_F(TranslatorTests, TranscriptPinned)
394{
395 using Fq = fq;
396
397 Fq batching_challenge_v = Fq::random_element();
398 Fq evaluation_challenge_x = Fq::random_element();
399
400 CircuitBuilder circuit_builder = generate_test_circuit(batching_challenge_v, evaluation_challenge_x);
401
402 // Create proving key and prover
403 auto prover_transcript = std::make_shared<Transcript>();
404 auto proving_key = std::make_shared<TranslatorProvingKey>(circuit_builder);
405 TranslatorProver prover{ proving_key, prover_transcript };
406
407 // Generate proof
408 auto proof = prover.construct_proof();
409
410 // Setup verifier transcript with manifest tracking
411 auto verifier_transcript = std::make_shared<Transcript>(proof);
412 verifier_transcript->enable_manifest();
413
414 // Get accumulated_result from the prover
415 uint256_t accumulated_result = prover.get_accumulated_result();
416
417 // Commit to op queue wires
419 op_queue_commitments[0] = proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.op);
420 op_queue_commitments[1] =
421 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.x_lo_y_hi);
422 op_queue_commitments[2] =
423 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.x_hi_z_1);
424 op_queue_commitments[3] =
425 proving_key->proving_key->commitment_key.commit(proving_key->proving_key->polynomials.y_lo_z_2);
426
427 // Create verifier with all required inputs
428 TranslatorVerifier verifier(verifier_transcript,
429 proof,
430 evaluation_challenge_x,
431 batching_challenge_v,
432 accumulated_result,
433 op_queue_commitments);
434
435 // Run verification - just reduce to pairing check to exercise the transcript
436 [[maybe_unused]] auto result = verifier.reduce_to_pairing_check();
437
438 // Compare verifier manifest against hardcoded expected structure
439 auto expected_manifest = build_expected_translator_manifest();
440 auto verifier_manifest = verifier_transcript->get_manifest();
441
442 EXPECT_EQ(verifier_manifest, expected_manifest);
443}
444
461TEST_F(TranslatorTests, EvaluationPartition)
462{
463 using Flavor = TranslatorFlavor;
464 using FF = Flavor::FF;
465
466 // Fill all entities with distinct values (entity index as value)
468 {
469 size_t idx = 0;
470 for (auto& e : evals.get_all()) {
471 e = FF(idx++);
472 }
473 }
474
475 // Collect addresses of all entities touched by each getter
476 std::set<FF*> covered;
477
478 for (auto& e : evals.get_minicircuit_wires()) {
479 EXPECT_TRUE(covered.insert(&e).second) << "minicircuit wire overlaps with a previous entity";
480 }
481 EXPECT_EQ(covered.size(), Flavor::NUM_MINICIRCUIT_WIRES);
482
483 for (auto& e : evals.get_minicircuit_wires_shifted()) {
484 EXPECT_TRUE(covered.insert(&e).second) << "minicircuit wire shift overlaps with a previous entity";
485 }
486 EXPECT_EQ(covered.size(), 2 * Flavor::NUM_MINICIRCUIT_WIRES);
487
488 for (auto& e : evals.get_full_circuit_entities()) {
489 EXPECT_TRUE(covered.insert(&e).second) << "full-circuit entity overlaps with a previous entity";
490 }
491 EXPECT_EQ(covered.size(), 2 * Flavor::NUM_MINICIRCUIT_WIRES + Flavor::NUM_FULL_CIRCUIT_EVALUATIONS);
492
493 // Concat polys are reconstructed (not sent in proof), but still in AllEntities
494 for (auto& e : evals.get_concatenated()) {
495 EXPECT_TRUE(covered.insert(&e).second) << "concatenated poly overlaps with a previous entity";
496 }
497 EXPECT_EQ(covered.size(),
498 2 * Flavor::NUM_MINICIRCUIT_WIRES + Flavor::NUM_FULL_CIRCUIT_EVALUATIONS +
499 Flavor::NUM_CONCATENATED_POLYS);
500
501 // The computable precomputed selectors are the remaining entities
502 size_t remaining = Flavor::NUM_ALL_ENTITIES - covered.size();
503 EXPECT_EQ(remaining, Flavor::NUM_COMPUTABLE_PRECOMPUTED);
504
505 // Verify the remaining entities are exactly the computable precomputed ones
506 for (auto& e : evals.get_all()) {
507 if (covered.find(&e) == covered.end()) {
508 // This entity must be one of the 12 computable precomputed selectors
509 remaining--;
510 }
511 }
512 EXPECT_EQ(remaining, 0UL);
513}
514
526TEST_F(TranslatorTests, RepeatedCommitmentsIndicesCorrect)
527{
528 using Flavor = TranslatorFlavor;
529 using Commitment = Flavor::Commitment;
530
531 fq batching_challenge_v = fq::random_element();
532 fq evaluation_challenge_x = fq::random_element();
533 CircuitBuilder circuit_builder = generate_test_circuit(batching_challenge_v, evaluation_challenge_x);
534 auto pk = std::make_shared<TranslatorProvingKey>(circuit_builder);
535
536 pk->proving_key->commitment_key = Flavor::CommitmentKey(pk->proving_key->circuit_size);
537
538 auto pcs_unshifted = pk->proving_key->polynomials.get_pcs_unshifted();
539 auto pcs_to_be_shifted = pk->proving_key->polynomials.get_pcs_to_be_shifted();
540
541 // Commit to all PCS polynomials
542 const auto& ck = pk->proving_key->commitment_key;
543 std::vector<Commitment> unshifted_comms;
544 for (auto& poly : pcs_unshifted) {
545 unshifted_comms.push_back(ck.commit(poly));
546 }
547 std::vector<Commitment> shifted_comms;
548 for (auto& poly : pcs_to_be_shifted) {
549 shifted_comms.push_back(ck.commit(poly));
550 }
551
552 // Build the commitment vector exactly as Shplemini does: [Q, pcs_unshifted..., pcs_to_be_shifted...]
553 std::vector<Commitment> commitments;
554 commitments.push_back(Commitment::one()); // dummy Q
555 commitments.insert(commitments.end(), unshifted_comms.begin(), unshifted_comms.end());
556 commitments.insert(commitments.end(), shifted_comms.begin(), shifted_comms.end());
557
558 constexpr auto repeated = Flavor::REPEATED_COMMITMENTS;
559 // Same offset logic as remove_repeated_commitments
560 constexpr size_t offset = Flavor::HasZK ? 2 : 1;
561
562 // Verify both ranges using the same indexing as remove_repeated_commitments
563 auto check_range = [&](const auto& range, const std::string& label) {
564 for (size_t i = 0; i < range.count; i++) {
565 EXPECT_EQ(commitments[range.original_start + offset + i], commitments[range.duplicate_start + offset + i])
566 << label << " commitment mismatch at index " << i;
567 }
568 };
569
570 check_range(repeated.first, "Range 1");
571 check_range(repeated.second, "Range 2");
572}
573
574TEST_F(TranslatorTests, VerifierPopulatesAllEntities)
575{
576 using Flavor = TranslatorFlavor;
577 using FF = Flavor::FF;
578
579 // Prepare random minicircuit evaluations (154 values)
581 for (auto& v : mid) {
582 v = FF::random_element(&engine);
583 }
584
585 // Prepare random full-circuit evaluations (26 values)
587 for (auto& v : full_circuit) {
588 v = FF::random_element(&engine);
589 }
590
591 // Random challenge (computable precomputed selectors depend on this)
592 std::vector<FF> challenge(Flavor::CONST_TRANSLATOR_LOG_N);
593 for (auto& u : challenge) {
594 u = FF::random_element(&engine);
595 }
596
597 // Verifier reconstruction: start from zero, populate via the two verifier methods
599 Flavor::set_minicircuit_evaluations(evals, mid);
600 Flavor::complete_full_circuit_evaluations(evals, full_circuit, std::span<const FF>(challenge));
601
602 // Every entity should now be nonzero (probability of a random FF being zero is negligible)
603 auto all = evals.get_all();
604 for (size_t i = 0; i < Flavor::NUM_ALL_ENTITIES; i++) {
605 EXPECT_NE(all[i], FF(0)) << "Entity " << i << " was not populated by verifier methods";
606 }
607}
static bool prove_and_verify(const CircuitBuilder &circuit_builder, const Fq &evaluation_challenge_x, const Fq &batching_challenge_v)
static void add_random_ops(std::shared_ptr< bb::ECCOpQueue > &op_queue, size_t count=1)
Flavor::Commitment Commitment
static CircuitBuilder generate_test_circuit(const Fq &batching_challenge_v, const Fq &evaluation_challenge_x, const size_t circuit_size_parameter=500)
static void SetUpTestSuite()
static void add_mixed_ops(std::shared_ptr< bb::ECCOpQueue > &op_queue, size_t count=100)
static TranscriptManifest build_expected_translator_manifest()
Build the expected transcript manifest for Translator verification.
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
Manages ECC operations for the Goblin proving system.
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
static constexpr bool HasZK
typename Curve::ScalarField FF
static constexpr size_t NUM_ALL_ENTITIES
typename G1::affine_element Commitment
bb::CommitmentKey< Curve > CommitmentKey
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
Simple verification key class for fixed-size circuits (ECCVM, Translator, AVM).
Definition flavor.hpp:101
static std::vector< fr > serialize_to_fields(const T &val)
Conversion from transcript values to bb::frs.
void add_entry(size_t round, const std::string &element_label, size_t element_size)
void add_challenge(size_t round, const std::string &label)
Add a single challenge label to the manifest for the given round.
TranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of EccOpQ...
static bool check(const Builder &circuit)
Check the witness satisifies the circuit.
static constexpr size_t NUM_FULL_CIRCUIT_EVALUATIONS
BaseTranscript< Codec, HashFunction > Transcript
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t PROOF_LENGTH
TranslatorCircuitBuilder CircuitBuilder
Curve::ScalarField FF
Curve::AffineElement Commitment
static constexpr size_t NUM_MINICIRCUIT_EVALUATIONS
static constexpr size_t LOG_MINI_CIRCUIT_SIZE
Translator verifier class that verifies the proof of the Translator circuit.
ReductionResult reduce_to_pairing_check()
Reduce the translator proof to a pairing check.
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
static affine_element random_element(numeric::RNG *engine=nullptr) noexcept
Samples a random point on the curve.
group_elements::affine_element< Fq, Fr, Params > affine_element
Definition group.hpp:44
#define info(...)
Definition log.hpp:93
ssize_t offset
Definition engine.cpp:62
RNG & get_debug_randomness(bool reset, std::uint_fast64_t seed)
Definition engine.cpp:245
std::filesystem::path bb_crs_path()
void init_file_crs_factory(const std::filesystem::path &path)
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
field< Bn254FqParams > fq
Definition fq.hpp:153
TEST_F(IPATest, ChallengesAreZero)
Definition ipa.test.cpp:155
field< Bn254FrParams > fr
Definition fr.hpp:155
CommitmentKey< Curve > ck
VerifierCommitmentKey< Curve > vk
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::string to_string(bb::avm2::ValueTag tag)
static std::vector< Commitment > get_all()
static field random_element(numeric::RNG *engine=nullptr) noexcept
TranslatorFlavor::VerificationKey create_vk_from_proving_key(const std::shared_ptr< TranslatorFlavor::ProvingKey > &proving_key)
TranslatorFlavor::FF compute_translator_vk_hash()