Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
proof_compression.hpp
Go to the documentation of this file.
1#pragma once
2
12#include <cstddef>
13#include <cstdint>
14#include <vector>
15
16namespace bb {
17
35
36 static constexpr uint256_t SIGN_BIT_MASK = uint256_t(1) << 255;
37
38 // Fq values are stored as (lo, hi) Fr pairs split at 2*NUM_LIMB_BITS = 136 bits.
39 static constexpr uint64_t NUM_LIMB_BITS = 68;
40 static constexpr uint64_t FQ_SPLIT_BITS = NUM_LIMB_BITS * 2; // 136
41
43 template <typename Field> static bool y_is_negative(const Field& y)
44 {
45 return uint256_t(y) > (uint256_t(Field::modulus) - 1) / 2;
46 }
47
48 // =========================================================================
49 // Serialization helpers
50 // =========================================================================
51
52 static void write_u256(std::vector<uint8_t>& out, const uint256_t& val)
53 {
54 for (int i = 31; i >= 0; --i) {
55 out.push_back(static_cast<uint8_t>(val.data[i / 8] >> (8 * (i % 8))));
56 }
57 }
58
59 static uint256_t read_u256(const std::vector<uint8_t>& data, size_t& pos)
60 {
61 uint256_t val{ 0, 0, 0, 0 };
62 for (int i = 31; i >= 0; --i) {
63 val.data[i / 8] |= static_cast<uint64_t>(data[pos++]) << (8 * (i % 8));
64 }
65 return val;
66 }
67
68 static Fq reconstruct_fq(const Fr& lo, const Fr& hi)
69 {
70 return Fq(uint256_t(lo) + (uint256_t(hi) << FQ_SPLIT_BITS));
71 }
72
73 static std::pair<Fr, Fr> split_fq(const Fq& val)
74 {
75 constexpr uint256_t LOWER_MASK = (uint256_t(1) << FQ_SPLIT_BITS) - 1;
76 const uint256_t v = uint256_t(val);
77 return { Fr(v & LOWER_MASK), Fr(v >> FQ_SPLIT_BITS) };
78 }
79
80 // =========================================================================
81 // Walk functions — define proof layouts once for compress/decompress
82 // =========================================================================
83
88 template <typename ScalarFn, typename CommitmentFn>
89 static void walk_mega_zk_proof(ScalarFn&& process_scalar,
90 CommitmentFn&& process_commitment,
91 size_t num_public_inputs)
92 {
93 constexpr size_t log_n = MegaZKFlavor::VIRTUAL_LOG_N;
94
95 // Public inputs
96 for (size_t i = 0; i < num_public_inputs; i++) {
97 process_scalar();
98 }
99 // Witness commitments (hiding poly + 24 mega witness = NUM_WITNESS_ENTITIES total)
100 for (size_t i = 0; i < MegaZKFlavor::NUM_WITNESS_ENTITIES; i++) {
101 process_commitment();
102 }
103 // Libra concatenation commitment
104 process_commitment();
105 // Libra sum
106 process_scalar();
107 // Sumcheck round univariates
108 for (size_t i = 0; i < log_n * MegaZKFlavor::BATCHED_RELATION_PARTIAL_LENGTH; i++) {
109 process_scalar();
110 }
111 // Sumcheck evaluations
112 for (size_t i = 0; i < MegaZKFlavor::NUM_ALL_ENTITIES; i++) {
113 process_scalar();
114 }
115 // Libra claimed evaluation
116 process_scalar();
117 // Libra grand sum + quotient commitments
118 process_commitment();
119 process_commitment();
120 // Gemini fold commitments
121 for (size_t i = 0; i < log_n - 1; i++) {
122 process_commitment();
123 }
124 // Gemini fold evaluations
125 for (size_t i = 0; i < log_n; i++) {
126 process_scalar();
127 }
128 // Small IPA evaluations (for ZK)
129 for (size_t i = 0; i < NUM_SMALL_IPA_EVALUATIONS; i++) {
130 process_scalar();
131 }
132 // Shplonk Q + KZG W
133 process_commitment();
134 process_commitment();
135 }
136
141 template <typename ScalarFn, typename CommitmentFn>
142 static void walk_merge_proof(ScalarFn&& process_scalar, CommitmentFn&& process_commitment)
143 {
144 // shift_size
145 process_scalar();
146 // 4 merged table commitments
147 for (size_t i = 0; i < 4; i++) {
148 process_commitment();
149 }
150 // Reversed batched left tables commitment
151 process_commitment();
152 // 4 left + 4 right + 4 merged table evaluations + 1 reversed eval = 13 scalars
153 for (size_t i = 0; i < 13; i++) {
154 process_scalar();
155 }
156 // Shplonk Q + KZG W
157 process_commitment();
158 process_commitment();
159 }
160
167 template <typename ScalarFn, typename CommitmentFn>
168 static void walk_eccvm_proof(ScalarFn&& process_scalar, CommitmentFn&& process_commitment)
169 {
170 constexpr size_t log_n = CONST_ECCVM_LOG_N;
172
173 // Witness commitments (wires + derived + masking poly)
174 for (size_t i = 0; i < num_witness; i++) {
175 process_commitment();
176 }
177 // Libra concatenation commitment
178 process_commitment();
179 // Libra sum
180 process_scalar();
181 // Sumcheck round univariates: per round, Grumpkin commits then sends 2 evaluations
182 for (size_t i = 0; i < log_n; i++) {
183 process_commitment(); // univariate commitment for round i
184 process_scalar(); // eval at 0 for round i
185 process_scalar(); // eval at 1 for round i
186 }
187 // Sumcheck evaluations
188 for (size_t i = 0; i < ECCVMFlavor::NUM_ALL_ENTITIES; i++) {
189 process_scalar();
190 }
191 // Libra claimed evaluation
192 process_scalar();
193 // Libra grand sum + quotient commitments
194 process_commitment();
195 process_commitment();
196 // Gemini fold commitments
197 for (size_t i = 0; i < log_n - 1; i++) {
198 process_commitment();
199 }
200 // Gemini fold evaluations
201 for (size_t i = 0; i < log_n; i++) {
202 process_scalar();
203 }
204 // Small IPA evaluations (for sumcheck libra)
205 for (size_t i = 0; i < NUM_SMALL_IPA_EVALUATIONS; i++) {
206 process_scalar();
207 }
208 // Shplonk Q
209 process_commitment();
210
211 // --- Translation section ---
212 // Translator concatenated masking commitment
213 process_commitment();
214 // 5 translation evaluations (op, Px, Py, z1, z2)
215 for (size_t i = 0; i < NUM_TRANSLATION_EVALUATIONS; i++) {
216 process_scalar();
217 }
218 // Translation masking term evaluation
219 process_scalar();
220 // Translation grand sum + quotient commitments
221 process_commitment();
222 process_commitment();
223 // Translation SmallSubgroupIPA evaluations
224 for (size_t i = 0; i < NUM_SMALL_IPA_EVALUATIONS; i++) {
225 process_scalar();
226 }
227 // Translation Shplonk Q
228 process_commitment();
229 }
230
235 template <typename ScalarFn, typename CommitmentFn>
236 static void walk_ipa_proof(ScalarFn&& process_scalar, CommitmentFn&& process_commitment)
237 {
238 // L and R commitments per round
239 for (size_t i = 0; i < CONST_ECCVM_LOG_N; i++) {
240 process_commitment(); // L_i
241 process_commitment(); // R_i
242 }
243 // G_0 commitment
244 process_commitment();
245 // a_0 scalar
246 process_scalar();
247 }
248
253 template <typename ScalarFn, typename CommitmentFn>
254 static void walk_translator_proof(ScalarFn&& process_scalar, CommitmentFn&& process_commitment)
255 {
256 constexpr size_t log_n = TranslatorFlavor::CONST_TRANSLATOR_LOG_N;
257
258 // Gemini masking poly commitment
259 process_commitment();
260 // Wire commitments: concatenated + ordered range constraints
261 for (size_t i = 0; i < TranslatorFlavor::NUM_COMMITMENTS_IN_PROOF; i++) {
262 process_commitment();
263 }
264 // Z_PERM commitment
265 process_commitment();
266 // Libra concatenation commitment
267 process_commitment();
268 // Libra sum
269 process_scalar();
270 // Sumcheck round univariates
271 for (size_t i = 0; i < log_n * TranslatorFlavor::BATCHED_RELATION_PARTIAL_LENGTH; i++) {
272 process_scalar();
273 }
274 // Sumcheck evaluations (computable precomputed and concat evals excluded)
275 for (size_t i = 0; i < TranslatorFlavor::NUM_SENT_EVALUATIONS; i++) {
276 process_scalar();
277 }
278 // Libra claimed evaluation
279 process_scalar();
280 // Libra grand sum + quotient commitments
281 process_commitment();
282 process_commitment();
283 // Gemini fold commitments
284 for (size_t i = 0; i < log_n - 1; i++) {
285 process_commitment();
286 }
287 // Gemini fold evaluations
288 for (size_t i = 0; i < log_n; i++) {
289 process_scalar();
290 }
291 // Small IPA evaluations
292 for (size_t i = 0; i < NUM_SMALL_IPA_EVALUATIONS; i++) {
293 process_scalar();
294 }
295 // Shplonk Q + KZG W
296 process_commitment();
297 process_commitment();
298 }
299
303 template <typename BN254ScalarFn, typename BN254CommFn, typename GrumpkinScalarFn, typename GrumpkinCommFn>
304 static void walk_chonk_proof(BN254ScalarFn&& bn254_scalar,
305 BN254CommFn&& bn254_comm,
306 GrumpkinScalarFn&& grumpkin_scalar,
307 GrumpkinCommFn&& grumpkin_comm,
308 size_t mega_num_public_inputs)
309 {
310 walk_mega_zk_proof(bn254_scalar, bn254_comm, mega_num_public_inputs);
311 walk_merge_proof(bn254_scalar, bn254_comm);
312 walk_eccvm_proof(grumpkin_scalar, grumpkin_comm);
313 walk_ipa_proof(grumpkin_scalar, grumpkin_comm);
314 walk_translator_proof(bn254_scalar, bn254_comm);
315 }
316
317 // =========================================================================
318 // Walk count validation — ensure the constants used in walks match PROOF_LENGTH.
319 // These mirror the walk logic using the same constants; if a PROOF_LENGTH formula
320 // changes, the static_assert fires, prompting an update to the corresponding walk.
321 // =========================================================================
322
323 // Fr-elements per element type for each curve
324 static constexpr size_t BN254_FRS_PER_SCALAR = 1;
325 static constexpr size_t BN254_FRS_PER_COMM = 4; // Fq x,y each as (lo,hi) Fr pair
326 static constexpr size_t GRUMPKIN_FRS_PER_SCALAR = 2; // Fq stored as (lo,hi) Fr pair
327 static constexpr size_t GRUMPKIN_FRS_PER_COMM = 2; // Fr x,y coordinates
328
329 // clang-format off
330 // MegaZK (without public inputs) — mirrors walk_mega_zk_proof with num_public_inputs=0
331 static constexpr size_t EXPECTED_MEGA_ZK_FRS =
333 1 * BN254_FRS_PER_COMM + // libra concat
334 1 * BN254_FRS_PER_SCALAR + // libra sum
337 1 * BN254_FRS_PER_SCALAR + // libra claimed eval
338 2 * BN254_FRS_PER_COMM + // libra grand sum + quotient
339 (MegaZKFlavor::VIRTUAL_LOG_N - 1) * BN254_FRS_PER_COMM + // gemini folds
341 NUM_SMALL_IPA_EVALUATIONS * BN254_FRS_PER_SCALAR + // small IPA evals
342 2 * BN254_FRS_PER_COMM; // shplonk Q + KZG W
344
345 // Merge — mirrors walk_merge_proof
346 static constexpr size_t EXPECTED_MERGE_FRS =
347 1 * BN254_FRS_PER_SCALAR + // shift_size
348 5 * BN254_FRS_PER_COMM + // 4 merged tables + 1 reversed batched left
349 13 * BN254_FRS_PER_SCALAR + // evaluations
350 2 * BN254_FRS_PER_COMM; // shplonk Q + KZG W
351 static_assert(EXPECTED_MERGE_FRS == MERGE_PROOF_SIZE);
352
353 // ECCVM — mirrors walk_eccvm_proof
354 static constexpr size_t EXPECTED_ECCVM_FRS =
356 1 * GRUMPKIN_FRS_PER_COMM + // libra concat
357 1 * GRUMPKIN_FRS_PER_SCALAR + // libra sum
358 CONST_ECCVM_LOG_N * GRUMPKIN_FRS_PER_COMM + // sumcheck univariate comms
359 2 * CONST_ECCVM_LOG_N * GRUMPKIN_FRS_PER_SCALAR + // sumcheck univariate evals (2 per round)
361 1 * GRUMPKIN_FRS_PER_SCALAR + // libra claimed eval
362 2 * GRUMPKIN_FRS_PER_COMM + // libra grand sum + quotient
363 (CONST_ECCVM_LOG_N - 1) * GRUMPKIN_FRS_PER_COMM + // gemini folds
364 CONST_ECCVM_LOG_N * GRUMPKIN_FRS_PER_SCALAR + // gemini evals
365 NUM_SMALL_IPA_EVALUATIONS * GRUMPKIN_FRS_PER_SCALAR + // small IPA evals
366 1 * GRUMPKIN_FRS_PER_COMM + // shplonk Q
367 1 * GRUMPKIN_FRS_PER_COMM + // translator masking comm
368 NUM_TRANSLATION_EVALUATIONS * GRUMPKIN_FRS_PER_SCALAR + // translation evals
369 1 * GRUMPKIN_FRS_PER_SCALAR + // masking term eval
370 2 * GRUMPKIN_FRS_PER_COMM + // translation grand sum + quotient
371 NUM_SMALL_IPA_EVALUATIONS * GRUMPKIN_FRS_PER_SCALAR + // translation small IPA evals
372 1 * GRUMPKIN_FRS_PER_COMM; // translation shplonk Q
374
375 // IPA — mirrors walk_ipa_proof
376 static constexpr size_t EXPECTED_IPA_FRS =
377 2 * CONST_ECCVM_LOG_N * GRUMPKIN_FRS_PER_COMM + // L and R per round
378 1 * GRUMPKIN_FRS_PER_COMM + // G_0
379 1 * GRUMPKIN_FRS_PER_SCALAR; // a_0
380 static_assert(EXPECTED_IPA_FRS == IPA_PROOF_LENGTH);
381
382 // Translator — mirrors walk_translator_proof
383 static constexpr size_t EXPECTED_TRANSLATOR_FRS =
384 1 * BN254_FRS_PER_COMM + // gemini masking poly
385 TranslatorFlavor::NUM_COMMITMENTS_IN_PROOF * BN254_FRS_PER_COMM + // wire comms (concat + ordered)
386 1 * BN254_FRS_PER_COMM + // z_perm
387 1 * BN254_FRS_PER_COMM + // libra concat
388 1 * BN254_FRS_PER_SCALAR + // libra sum
391 1 * BN254_FRS_PER_SCALAR + // libra claimed eval
392 2 * BN254_FRS_PER_COMM + // libra grand sum + quotient
395 NUM_SMALL_IPA_EVALUATIONS * BN254_FRS_PER_SCALAR + // small IPA evals
396 2 * BN254_FRS_PER_COMM; // shplonk Q + KZG W
398 // clang-format on
399
400 public:
405 static size_t compressed_element_count(size_t mega_num_public_inputs = 0)
406 {
407 size_t count = 0;
408 auto counter = [&]() { count++; };
409 walk_chonk_proof(counter, counter, counter, counter, mega_num_public_inputs);
410 return count;
411 }
412
417 static size_t compressed_mega_num_public_inputs(size_t compressed_bytes)
418 {
419 BB_ASSERT(compressed_bytes % 32 == 0);
420 size_t total_elements = compressed_bytes / 32;
421 size_t fixed_elements = compressed_element_count(0);
422 BB_ASSERT(total_elements >= fixed_elements);
423 return total_elements - fixed_elements;
424 }
425
426 // =========================================================================
427 // Chonk proof compression
428 // =========================================================================
429
430 static std::vector<uint8_t> compress_chonk_proof(const ChonkProof& proof)
431 {
432 auto flat = proof.to_field_elements();
433 std::vector<uint8_t> out;
434 out.reserve(flat.size() * 32); // upper bound: every element compresses to 32 bytes
435 size_t offset = 0;
436
437 // BN254 callbacks
438 auto bn254_scalar = [&]() { write_u256(out, uint256_t(flat[offset++])); };
439
440 auto bn254_comm = [&]() {
441 bool is_infinity = flat[offset].is_zero() && flat[offset + 1].is_zero() && flat[offset + 2].is_zero() &&
442 flat[offset + 3].is_zero();
443 if (is_infinity) {
444 write_u256(out, uint256_t(0));
445 offset += 4;
446 return;
447 }
448
449 Fq x = reconstruct_fq(flat[offset], flat[offset + 1]);
450 Fq y = reconstruct_fq(flat[offset + 2], flat[offset + 3]);
451 offset += 4;
452
453 uint256_t x_val = uint256_t(x);
454 if (y_is_negative(y)) {
455 x_val |= SIGN_BIT_MASK;
456 }
457 write_u256(out, x_val);
458 };
459
460 // Grumpkin callbacks
461 // Grumpkin commitments have coordinates in BN254::ScalarField (Fr), so x and y are each 1 Fr.
462 auto grumpkin_comm = [&]() {
463 Fr x = flat[offset];
464 Fr y = flat[offset + 1];
465 offset += 2;
466
467 if (x.is_zero() && y.is_zero()) {
468 write_u256(out, uint256_t(0));
469 return;
470 }
471
472 uint256_t x_val = uint256_t(x);
473 if (y_is_negative(y)) {
474 x_val |= SIGN_BIT_MASK;
475 }
476 write_u256(out, x_val);
477 };
478
479 // Grumpkin scalars are Fq values stored as (lo, hi) Fr pairs
480 auto grumpkin_scalar = [&]() {
481 Fq fq_val = reconstruct_fq(flat[offset], flat[offset + 1]);
482 offset += 2;
483 write_u256(out, uint256_t(fq_val));
484 };
485
486 size_t mega_num_pub_inputs =
488 walk_chonk_proof(bn254_scalar, bn254_comm, grumpkin_scalar, grumpkin_comm, mega_num_pub_inputs);
489 BB_ASSERT(offset == flat.size());
490 return out;
491 }
492
493 static ChonkProof decompress_chonk_proof(const std::vector<uint8_t>& compressed, size_t mega_num_public_inputs)
494 {
495 HonkProof flat;
496 size_t pos = 0;
497
498 // BN254 callbacks
499 auto bn254_scalar = [&]() { flat.emplace_back(read_u256(compressed, pos)); };
500
501 auto bn254_comm = [&]() {
502 uint256_t raw = read_u256(compressed, pos);
503 bool sign = (raw & SIGN_BIT_MASK) != 0;
504 uint256_t x_val = raw & ~SIGN_BIT_MASK;
505
506 if (x_val == uint256_t(0) && !sign) {
507 for (int j = 0; j < 4; j++) {
508 flat.emplace_back(Fr::zero());
509 }
510 return;
511 }
512
513 Fq x(x_val);
514 Fq y_squared = x * x * x + Bn254G1Params::b;
515 auto [is_square, y] = y_squared.sqrt();
516 BB_ASSERT(is_square);
517
518 if (y_is_negative(y) != sign) {
519 y = -y;
520 }
521
522 auto [x_lo, x_hi] = split_fq(x);
523 auto [y_lo, y_hi] = split_fq(y);
524 flat.emplace_back(x_lo);
525 flat.emplace_back(x_hi);
526 flat.emplace_back(y_lo);
527 flat.emplace_back(y_hi);
528 };
529
530 // Grumpkin callbacks
531 auto grumpkin_comm = [&]() {
532 uint256_t raw = read_u256(compressed, pos);
533 bool sign = (raw & SIGN_BIT_MASK) != 0;
534 uint256_t x_val = raw & ~SIGN_BIT_MASK;
535
536 if (x_val == uint256_t(0) && !sign) {
537 flat.emplace_back(Fr::zero());
538 flat.emplace_back(Fr::zero());
539 return;
540 }
541
542 Fr x(x_val);
543 // Grumpkin curve: y² = x³ + b, where b = -17 (in BN254::ScalarField)
544 Fr y_squared = x * x * x + grumpkin::G1Params::b;
545 auto [is_square, y] = y_squared.sqrt();
546 BB_ASSERT(is_square);
547
548 if (y_is_negative(y) != sign) {
549 y = -y;
550 }
551
552 flat.emplace_back(x);
553 flat.emplace_back(y);
554 };
555
556 auto grumpkin_scalar = [&]() {
557 uint256_t raw = read_u256(compressed, pos);
558 Fq fq_val(raw);
559 auto [lo, hi] = split_fq(fq_val);
560 flat.emplace_back(lo);
561 flat.emplace_back(hi);
562 };
563
564 walk_chonk_proof(bn254_scalar, bn254_comm, grumpkin_scalar, grumpkin_comm, mega_num_public_inputs);
565 BB_ASSERT(pos == compressed.size());
567 }
568};
569
570} // namespace bb
#define BB_ASSERT(expression,...)
Definition assert.hpp:70
static constexpr size_t NUM_MASKING_POLYNOMIALS
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t PROOF_LENGTH
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t VIRTUAL_LOG_N
Compresses Chonk proofs from vector<fr> to compact byte representations.
static void walk_translator_proof(ScalarFn &&process_scalar, CommitmentFn &&process_commitment)
Walk a Translator proof (all BN254).
static constexpr size_t BN254_FRS_PER_COMM
static constexpr size_t EXPECTED_MERGE_FRS
static constexpr uint64_t FQ_SPLIT_BITS
static std::vector< uint8_t > compress_chonk_proof(const ChonkProof &proof)
static ChonkProof decompress_chonk_proof(const std::vector< uint8_t > &compressed, size_t mega_num_public_inputs)
static constexpr size_t EXPECTED_ECCVM_FRS
static size_t compressed_element_count(size_t mega_num_public_inputs=0)
Count the total compressed elements for a Chonk proof. Each element (scalar or commitment,...
static void walk_eccvm_proof(ScalarFn &&process_scalar, CommitmentFn &&process_commitment)
Walk an ECCVM proof (all Grumpkin).
static constexpr size_t EXPECTED_TRANSLATOR_FRS
curve::BN254::ScalarField Fr
static constexpr uint256_t SIGN_BIT_MASK
curve::BN254::BaseField Fq
static constexpr size_t GRUMPKIN_FRS_PER_SCALAR
static void write_u256(std::vector< uint8_t > &out, const uint256_t &val)
static constexpr size_t EXPECTED_MEGA_ZK_FRS
static constexpr size_t EXPECTED_IPA_FRS
static bool y_is_negative(const Field &y)
True if y is in the "upper half" of its field, used for point compression sign bit.
static void walk_merge_proof(ScalarFn &&process_scalar, CommitmentFn &&process_commitment)
Walk a Merge proof (42 Fr, all BN254).
static void walk_mega_zk_proof(ScalarFn &&process_scalar, CommitmentFn &&process_commitment, size_t num_public_inputs)
Walk a MegaZK proof (BN254, ZK sumcheck).
static constexpr size_t GRUMPKIN_FRS_PER_COMM
static size_t compressed_mega_num_public_inputs(size_t compressed_bytes)
Derive mega_num_public_inputs from compressed proof size.
static void walk_chonk_proof(BN254ScalarFn &&bn254_scalar, BN254CommFn &&bn254_comm, GrumpkinScalarFn &&grumpkin_scalar, GrumpkinCommFn &&grumpkin_comm, size_t mega_num_public_inputs)
Walk a full Chonk proof (5 sub-proofs across two curves).
static Fq reconstruct_fq(const Fr &lo, const Fr &hi)
static void walk_ipa_proof(ScalarFn &&process_scalar, CommitmentFn &&process_commitment)
Walk an IPA proof (64 Fr, all Grumpkin).
static uint256_t read_u256(const std::vector< uint8_t > &data, size_t &pos)
static constexpr uint64_t NUM_LIMB_BITS
static std::pair< Fr, Fr > split_fq(const Fq &val)
static constexpr size_t BN254_FRS_PER_SCALAR
static constexpr size_t NUM_SENT_EVALUATIONS
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t PROOF_LENGTH
static constexpr size_t NUM_COMMITMENTS_IN_PROOF
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
bb::fq BaseField
Definition bn254.hpp:19
bb::fr ScalarField
Definition bn254.hpp:18
const std::vector< MemoryValue > data
ssize_t offset
Definition engine.cpp:52
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
std::vector< fr > HonkProof
Definition proof.hpp:15
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
static constexpr fq b
Definition g1.hpp:31
HonkProof mega_proof
static ChonkProof_ from_field_elements(const std::vector< FF > &fields)
Common logic to reconstruct proof from field elements.
static constexpr size_t HIDING_KERNEL_PROOF_LENGTH_WITHOUT_PUBLIC_INPUTS
std::vector< FF > to_field_elements() const
Serialize proof to field elements (native mode)
constexpr std::pair< bool, field > sqrt() const noexcept
Compute square root of the field element.
BB_INLINE constexpr bool is_zero() const noexcept
static constexpr field zero()
static constexpr bb::fr b
Definition grumpkin.hpp:31