Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
translator_flavor.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Planned, auditors: [], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
35
36namespace bb {
37
38namespace detail {
39template <typename> struct ref_array_extent;
40template <typename T, std::size_t N> struct ref_array_extent<RefArray<T, N>> {
41 static constexpr std::size_t value = N;
42};
43} // namespace detail
44
46
47 public:
50 using PCS = KZG<Curve>;
58 using Codec = FrCodec;
61
62 // indicates when evaluating sumcheck, edges must be extended to be MAX_PARTIAL_RELATION_LENGTH
63 static constexpr bool USE_SHORT_MONOMIALS = false;
64
65 // Indicates that this flavor runs with ZK Sumcheck.
66 static constexpr bool HasZK = true;
67 // Translator has no disabled rows at the top of the trace.
68 static constexpr size_t TRACE_OFFSET = 0;
69 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
70 static constexpr bool USE_PADDING = false;
71 // Important: these constants cannot be arbitrarily changed - please consult with a member of the Crypto team if
72 // they become too small.
73
74 // The number of entities added for ZK (gemini_masking_poly)
75 static constexpr size_t NUM_MASKING_POLYNOMIALS = 1;
76
77 // None of this parameters can be changed
78 // Number of wires representing the op queue whose commitments are going to be checked against those from the
79 // final round of merge
80 static constexpr size_t NUM_OP_QUEUE_WIRES = 4;
81
82 // How many mini_circuit_size polynomials are concatenated in one concatenated poly
83 static constexpr size_t CONCATENATION_GROUP_SIZE = 16;
84
85 // The fixed log size of Translator mini circuit. It should be determined by the size of the EccOpQueue.
86 static constexpr size_t LOG_MINI_CIRCUIT_SIZE = CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE;
87
88 // Log of size of concatenated and ordered polynomials
90
91 // For the translator, the genuine and virtual log circuit size coincide
92 static constexpr size_t VIRTUAL_LOG_N = CONST_TRANSLATOR_LOG_N;
93
94 static constexpr size_t MINI_CIRCUIT_SIZE = 1UL << LOG_MINI_CIRCUIT_SIZE;
95
96 // The number of concatenated polynomials (4 range constraint groups + 1 non-range group)
97 static constexpr size_t NUM_CONCATENATED_POLYS = 5;
98
99 // The step in the DeltaRangeConstraint relation i.e. the maximum difference between two consecutive values
100 static constexpr size_t SORT_STEP = 3;
101
102 // Number of wires
103 static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
104
105 // The result of evaluating the polynomials in the nonnative form in translator circuit, stored as limbs and
106 // referred to as accumulated_result. This is reconstructed in it's base field form and sent to the verifier
107 // responsible for checking it against the evaluations received from ECCVM.
108 static constexpr size_t RESULT_ROW = CircuitBuilder::RESULT_ROW;
109
110 // Number of random ops found at he end of Translator trace multiplied by 2 as each accumulation gates occupies two
111 // rows.
113
114 // Maximum number of random masking values any ordered polynomial will have at the end
115 // Total scattered masking positions = CONCATENATION_GROUP_SIZE * NUM_MASKED_ROWS_END
116 // This is the space reserved at the end of each ordered polynomial (contiguous)
118
119 // Index at which random coefficients start (for zk) within Translator trace.
120 // The first 2 rows are zeros for polynomial shiftability (one op's worth of rows).
121 static constexpr size_t RANDOMNESS_START = 2;
122
123 // The bitness of the range constraint
125
126 // Number of bits in a binary limb
127 // This is not a configurable value. Relations are sepcifically designed for it to be 68
129
131 // define the tuple of Relations that comprise the Sumcheck relation
132 template <typename FF>
141
142 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
143 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
144
145 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
146
147 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
148 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
149 // length = 3.
150 // The degree has to be further increased because the relation is multiplied by the Row Disabling Polynomial
151 // total degree = sumcheck relation degree + 1 (PowZeta) + 1 (masking)
154 "LIBRA_UNIVARIATES_LENGTH must be equal to Translator::BATCHED_RELATION_PARTIAL_LENGTH");
156
157 static constexpr size_t num_frs_comm = FrCodec::calc_num_fields<Commitment>();
158 static constexpr size_t num_frs_fr = FrCodec::calc_num_fields<FF>();
159 static constexpr size_t num_frs_fq = FrCodec::calc_num_fields<BF>();
160
165 template <typename DataType_> class PrecomputedEntities {
166 public:
167 bool operator==(const PrecomputedEntities& other) const = default;
168 using DataType = DataType_;
170 ordered_extra_range_constraints_numerator, // column 0
171 lagrange_first, // column 1
172 lagrange_last, // column 2
173 lagrange_odd_in_minicircuit, // column 3
174 lagrange_even_in_minicircuit, // column 4
175 lagrange_result_row, // column 5
176 lagrange_last_in_minicircuit, // column 6
177 lagrange_masking, // column 7
178 lagrange_mini_masking, // column 8
179 lagrange_real_last, // column 9
180 lagrange_ordered_masking); // column 10
181 };
182
183 template <typename DataType> class ConcatenatedPolynomials {
184 public:
185 DEFINE_FLAVOR_MEMBERS(DataType,
186 concatenated_range_constraints_0, // column 0
187 concatenated_range_constraints_1, // column 1
188 concatenated_range_constraints_2, // column 2
189 concatenated_range_constraints_3, // column 3
190 concatenated_non_range) // column 4
191 };
195 template <typename DataType> class NonRangeMainWires {
196 public:
197 DEFINE_FLAVOR_MEMBERS(DataType,
198 p_x_low_limbs, // column 0
199 p_x_high_limbs, // column 1
200 p_y_low_limbs, // column 2
201 p_y_high_limbs, // column 3
202 z_low_limbs, // column 4
203 z_high_limbs, // column 5
204 accumulators_binary_limbs_0, // column 6
205 accumulators_binary_limbs_1, // column 7
206 accumulators_binary_limbs_2, // column 8
207 accumulators_binary_limbs_3, // column 9
208 quotient_low_binary_limbs, // column 10
209 quotient_high_binary_limbs, // column 11
210 relation_wide_limbs) // column 12
211 };
212
216 template <typename DataType> class RangeConstraintWires {
217 public:
219 p_x_low_limbs_range_constraint_0, // column 0
220 p_x_low_limbs_range_constraint_1, // column 17
221 p_x_low_limbs_range_constraint_2, // column 18
222 p_x_low_limbs_range_constraint_3, // column 19
223 p_x_low_limbs_range_constraint_4, // column 20
224 p_x_low_limbs_range_constraint_tail, // column 21
225 p_x_high_limbs_range_constraint_0, // column 22
226 p_x_high_limbs_range_constraint_1, // column 23
227 p_x_high_limbs_range_constraint_2, // column 24
228 p_x_high_limbs_range_constraint_3, // column 25
229 p_x_high_limbs_range_constraint_4, // column 26
230 p_x_high_limbs_range_constraint_tail, // column 27
231 p_y_low_limbs_range_constraint_0, // column 28
232 p_y_low_limbs_range_constraint_1, // column 29
233 p_y_low_limbs_range_constraint_2, // column 30
234 p_y_low_limbs_range_constraint_3, // column 31
235 p_y_low_limbs_range_constraint_4, // column 32
236 p_y_low_limbs_range_constraint_tail, // column 33
237 p_y_high_limbs_range_constraint_0, // column 34
238 p_y_high_limbs_range_constraint_1, // column 35
239 p_y_high_limbs_range_constraint_2, // column 36
240 p_y_high_limbs_range_constraint_3, // column 37
241 p_y_high_limbs_range_constraint_4, // column 38
242 p_y_high_limbs_range_constraint_tail, // column 39
243 z_low_limbs_range_constraint_0, // column 40
244 z_low_limbs_range_constraint_1, // column 41
245 z_low_limbs_range_constraint_2, // column 42
246 z_low_limbs_range_constraint_3, // column 43
247 z_low_limbs_range_constraint_4, // column 44
248 z_low_limbs_range_constraint_tail, // column 45
249 z_high_limbs_range_constraint_0, // column 46
250 z_high_limbs_range_constraint_1, // column 47
251 z_high_limbs_range_constraint_2, // column 48
252 z_high_limbs_range_constraint_3, // column 49
253 z_high_limbs_range_constraint_4, // column 50
254 z_high_limbs_range_constraint_tail, // column 51
255 accumulator_low_limbs_range_constraint_0, // column 52
256 accumulator_low_limbs_range_constraint_1, // column 53
257 accumulator_low_limbs_range_constraint_2, // column 54
258 accumulator_low_limbs_range_constraint_3, // column 55
259 accumulator_low_limbs_range_constraint_4, // column 56
260 accumulator_low_limbs_range_constraint_tail, // column 57
261 accumulator_high_limbs_range_constraint_0, // column 58
262 accumulator_high_limbs_range_constraint_1, // column 59
263 accumulator_high_limbs_range_constraint_2, // column 60
264 accumulator_high_limbs_range_constraint_3, // column 61
265 accumulator_high_limbs_range_constraint_4, // column 62
266 accumulator_high_limbs_range_constraint_tail, // column 63
267 quotient_low_limbs_range_constraint_0, // column 64
268 quotient_low_limbs_range_constraint_1, // column 65
269 quotient_low_limbs_range_constraint_2, // column 66
270 quotient_low_limbs_range_constraint_3, // column 67
271 quotient_low_limbs_range_constraint_4, // column 68
272 quotient_low_limbs_range_constraint_tail, // column 69
273 quotient_high_limbs_range_constraint_0, // column 70
274 quotient_high_limbs_range_constraint_1, // column 71
275 quotient_high_limbs_range_constraint_2, // column 72
276 quotient_high_limbs_range_constraint_3, // column 73
277 quotient_high_limbs_range_constraint_4, // column 74
278 quotient_high_limbs_range_constraint_tail, // column 75
279 relation_wide_limbs_range_constraint_0, // column 76
280 relation_wide_limbs_range_constraint_1, // column 77
281 relation_wide_limbs_range_constraint_2, // column 62
282 relation_wide_limbs_range_constraint_3); // column 63
283 };
284
288 template <typename DataType>
294
298 template <typename DataType> class OpQueueWiresToBeShiftedEntities {
299 public:
300 DEFINE_FLAVOR_MEMBERS(DataType,
301 x_lo_y_hi, // column 0
302 x_hi_z_1, // column 1
303 y_lo_z_2) // column 2
304 };
305
309 template <typename DataType>
315
316 // Note: These are technically derived from wires but do not depend on challenges (like z_perm). They are committed
317 // to in the wires commitment round.
318 template <typename DataType> class OrderedRangeConstraints {
319 public:
321 ordered_range_constraints_0, // column 0
322 ordered_range_constraints_1, // column 1
323 ordered_range_constraints_2, // column 2
324 ordered_range_constraints_3, // column 3
325 ordered_range_constraints_4); // column 4
326 };
327
331 template <typename DataType> class OpQueueWireNonshiftedEntities {
332 public:
334 op // column 0
335 );
336 };
337
341 template <typename DataType> class WireNonshiftedEntities : public OpQueueWireNonshiftedEntities<DataType> {
342 public:
344 };
345
346 template <typename DataType> class DerivedWitnessEntities {
347 public:
349 z_perm); // column 0
350 };
354 template <typename DataType>
415
419 template <typename DataType> class OpQueueShiftedEntities {
420 public:
421 DEFINE_FLAVOR_MEMBERS(DataType,
422 x_lo_y_hi_shift, // column 0
423 x_hi_z_1_shift, // column 1
424 y_lo_z_2_shift) // column 2
425 };
426
430 template <typename DataType> class NonOpQueueShiftedEntities {
431 public:
432 DEFINE_FLAVOR_MEMBERS(DataType,
433 p_x_low_limbs_shift, // column 3
434 p_x_high_limbs_shift, // column 10
435 p_y_low_limbs_shift, // column 17
436 p_y_high_limbs_shift, // column 24
437 z_low_limbs_shift, // column 31
438 z_high_limbs_shift, // column 38
439 accumulators_binary_limbs_0_shift, // column 45
440 accumulators_binary_limbs_1_shift, // column 46
441 accumulators_binary_limbs_2_shift, // column 47
442 accumulators_binary_limbs_3_shift, // column 48
443 quotient_low_binary_limbs_shift, // column 61
444 quotient_high_binary_limbs_shift, // column 62
445 relation_wide_limbs_shift, // column 75
446 p_x_low_limbs_range_constraint_0_shift, // column 4
447 p_x_low_limbs_range_constraint_1_shift, // column 5
448 p_x_low_limbs_range_constraint_2_shift, // column 6
449 p_x_low_limbs_range_constraint_3_shift, // column 7
450 p_x_low_limbs_range_constraint_4_shift, // column 8
451 p_x_low_limbs_range_constraint_tail_shift, // column 9
452 p_x_high_limbs_range_constraint_0_shift, // column 11
453 p_x_high_limbs_range_constraint_1_shift, // column 12
454 p_x_high_limbs_range_constraint_2_shift, // column 13
455 p_x_high_limbs_range_constraint_3_shift, // column 14
456 p_x_high_limbs_range_constraint_4_shift, // column 15
457 p_x_high_limbs_range_constraint_tail_shift, // column 16
458 p_y_low_limbs_range_constraint_0_shift, // column 18
459 p_y_low_limbs_range_constraint_1_shift, // column 19
460 p_y_low_limbs_range_constraint_2_shift, // column 20
461 p_y_low_limbs_range_constraint_3_shift, // column 21
462 p_y_low_limbs_range_constraint_4_shift, // column 22
463 p_y_low_limbs_range_constraint_tail_shift, // column 23
464 p_y_high_limbs_range_constraint_0_shift, // column 25
465 p_y_high_limbs_range_constraint_1_shift, // column 26
466 p_y_high_limbs_range_constraint_2_shift, // column 27
467 p_y_high_limbs_range_constraint_3_shift, // column 28
468 p_y_high_limbs_range_constraint_4_shift, // column 29
469 p_y_high_limbs_range_constraint_tail_shift, // column 30
470 z_low_limbs_range_constraint_0_shift, // column 32
471 z_low_limbs_range_constraint_1_shift, // column 33
472 z_low_limbs_range_constraint_2_shift, // column 34
473 z_low_limbs_range_constraint_3_shift, // column 35
474 z_low_limbs_range_constraint_4_shift, // column 36
475 z_low_limbs_range_constraint_tail_shift, // column 37
476 z_high_limbs_range_constraint_0_shift, // column 39
477 z_high_limbs_range_constraint_1_shift, // column 40
478 z_high_limbs_range_constraint_2_shift, // column 41
479 z_high_limbs_range_constraint_3_shift, // column 42
480 z_high_limbs_range_constraint_4_shift, // column 43
481 z_high_limbs_range_constraint_tail_shift, // column 44
482 accumulator_low_limbs_range_constraint_0_shift, // column 49
483 accumulator_low_limbs_range_constraint_1_shift, // column 50
484 accumulator_low_limbs_range_constraint_2_shift, // column 51
485 accumulator_low_limbs_range_constraint_3_shift, // column 52
486 accumulator_low_limbs_range_constraint_4_shift, // column 53
487 accumulator_low_limbs_range_constraint_tail_shift, // column 54
488 accumulator_high_limbs_range_constraint_0_shift, // column 55
489 accumulator_high_limbs_range_constraint_1_shift, // column 56
490 accumulator_high_limbs_range_constraint_2_shift, // column 57
491 accumulator_high_limbs_range_constraint_3_shift, // column 58
492 accumulator_high_limbs_range_constraint_4_shift, // column 59
493 accumulator_high_limbs_range_constraint_tail_shift, // column 60
494 quotient_low_limbs_range_constraint_0_shift, // column 63
495 quotient_low_limbs_range_constraint_1_shift, // column 64
496 quotient_low_limbs_range_constraint_2_shift, // column 65
497 quotient_low_limbs_range_constraint_3_shift, // column 66
498 quotient_low_limbs_range_constraint_4_shift, // column 67
499 quotient_low_limbs_range_constraint_tail_shift, // column 68
500 quotient_high_limbs_range_constraint_0_shift, // column 69
501 quotient_high_limbs_range_constraint_1_shift, // column 70
502 quotient_high_limbs_range_constraint_2_shift, // column 71
503 quotient_high_limbs_range_constraint_3_shift, // column 72
504 quotient_high_limbs_range_constraint_4_shift, // column 73
505 quotient_high_limbs_range_constraint_tail_shift, // column 74
506 relation_wide_limbs_range_constraint_0_shift, // column 76
507 relation_wide_limbs_range_constraint_1_shift, // column 77
508 relation_wide_limbs_range_constraint_2_shift, // column 78
509 relation_wide_limbs_range_constraint_3_shift) // column 79
510 };
511
515 template <typename DataType> class DerivedShiftedEntities {
516 public:
517 DEFINE_FLAVOR_MEMBERS(DataType,
518 ordered_range_constraints_0_shift, // column 80
519 ordered_range_constraints_1_shift, // column 81
520 ordered_range_constraints_2_shift, // column 82
521 ordered_range_constraints_3_shift, // column 83
522 ordered_range_constraints_4_shift, // column 84
523 z_perm_shift) // column 85
524 };
525
529 template <typename DataType>
530 class ShiftedEntities : public OpQueueShiftedEntities<DataType>,
531 public NonOpQueueShiftedEntities<DataType>,
532 public DerivedShiftedEntities<DataType> {
533 public:
547
553 {
554 static DataType zero_value = DataType(0);
555 return partition_minicircuit_wires_into_groups<DataType>(NonOpQueueShiftedEntities<DataType>::get_all(),
556 zero_value);
557 };
558 };
559
564 template <typename DataType> class MaskingEntities {
565 public:
566 DEFINE_FLAVOR_MEMBERS(DataType, gemini_masking_poly)
567 };
568
577 template <typename DataType>
578 class AllEntities : public MaskingEntities<DataType>,
579 public PrecomputedEntities<DataType>,
580 public WitnessEntities<DataType>,
581 public ShiftedEntities<DataType> {
582 public:
592
598
609 {
610 return concatenate(
611 MaskingEntities<DataType>::get_all(), // gemini_masking_poly
612 RefArray<DataType, 1>{ this->ordered_extra_range_constraints_numerator }, // non-computable precomputed
613 WireNonshiftedEntities<DataType>::get_all(), // op (from merge protocol)
614 OpQueueWiresToBeShiftedEntities<DataType>::get_all(), // x_lo_y_hi, x_hi_z_1, y_lo_z_2
618 }
619
631
634
651
656
661
662 friend std::ostream& operator<<(std::ostream& os, const AllEntities& a)
663 {
664 os << "{ ";
665 std::ios_base::fmtflags f(os.flags());
666 auto entities = a.get_all();
667 for (size_t i = 0; i < entities.size() - 1; i++) {
668 os << "e[" << std::setw(2) << i << "] = " << (entities[i]) << ",\n";
669 }
670 os << "e[" << std::setw(2) << (entities.size() - 1) << "] = " << entities[entities.size() - 1] << " }";
671
672 os.flags(f);
673 return os;
674 }
675 };
676
681 class AllValues : public AllEntities<FF> {
682 public:
684 using Base::Base;
685 };
686
687 // ========================================
688 // Derived entity counts (from entity class sizes)
689 // ========================================
693
694 // Witness = WireNonshifted + WireToBeShifted + OrderedRange + Derived + Concatenated
695 static constexpr size_t NUM_WITNESS_ENTITIES =
700
701 // Shifted = OpQueueShifted + NonOpQueueShifted + DerivedShifted
705
706 static constexpr size_t NUM_ALL_ENTITIES =
708
709 // All precomputed selectors except ordered_extra_range_constraints_numerator are computable
711
712 // Minicircuit wires: NonRangeMain + RangeConstraint (the non-op-queue wires that get shifted)
713 static constexpr size_t NUM_MINICIRCUIT_WIRES =
716 "Shifted minicircuit wires must match unshifted");
717 // 77 unshifted + 77 shifted minicircuit wire evaluations are sent mid-sumcheck
719
720 // Number of evaluations sent in proof (all minus computable precomputed minus reconstructed concat evals)
721 static constexpr size_t NUM_SENT_EVALUATIONS =
724
725 // Total number of minicircuit wires across all concatenation groups
729 "Range constraint wires must fill exactly 4 concatenation groups");
730
731 // PCS batch sizes
732 // Note: op-queue to-be-shifted wires (x_lo_y_hi, x_hi_z_1, y_lo_z_2) are registered in BOTH the
733 // unshifted and shifted PCS batches because the decomposition relation reads them in both forms.
740 static constexpr size_t NUM_PCS_UNSHIFTED = NUM_MASKING_POLYNOMIALS +
744
745 // Indices for partitioning AllEntities
748
749 // Commitments sent in wire round: concatenated + ordered range constraints
751
752 // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls.
753 // Identifies commitments that appear in both the unshifted and shifted batches:
754 // Unshifted batch: masking(1) + ordered_extra(1) + op(1) + op_queue_tbs(3) + ordered(5) + z_perm(1) + concat(5)
755 // = 17
756 // Shifted batch: op_queue(3) + ordered(5) + z_perm(1) + concat(5) = 14
757 // Range 1: op_queue_tbs(3) + ordered(5) + z_perm(1) = 9 (contiguous in both batches)
758 // stored indices 2..10 (unshifted) ↔ 16..24 (shifted)
759 // Range 2: concatenated(5) — stored indices 11..15 (unshifted) ↔ 25..29 (shifted)
760 // (Stored indices are 0-based after ZK offset; offset=2 accounts for Q_commitment + gemini_masking_poly)
769
770 static constexpr size_t PROOF_LENGTH =
771 /* 1. Gemini masking poly commitment */ (num_frs_comm) +
772 /* 2. Wire commitments: concatenated + ordered */
774 /* 3. Z_PERM commitment */ (num_frs_comm) +
775 /* 4. Libra concatenation commitment */ (num_frs_comm) +
776 /* 5. Libra sum */ (num_frs_fr) +
777 /* 6. CONST_TRANSLATOR_LOG_N sumcheck univariates */
779 /* 7. sumcheck evaluations (computable precomputed and concat evals excluded) */
781 /* 8. Libra claimed evaluation */ (num_frs_fr) +
782 /* 9. Libra grand sum commitment */ (num_frs_comm) +
783 /* 10. Libra quotient commitment */ (num_frs_comm) +
784 /* 11. CONST_TRANSLATOR_LOG_N - 1 Gemini Fold commitments */
786 /* 12. CONST_TRANSLATOR_LOG_N Gemini a evaluations */
788 /* 13. NUM_SMALL_IPA_EVALUATIONS libra evals */ (NUM_SMALL_IPA_EVALUATIONS * num_frs_fr) +
789 /* 14. Shplonk Q commitment */ (num_frs_comm) +
790 /* 15. KZG W commitment */ (num_frs_comm);
791
792 // Proof length when using committed sumcheck: each round sends a commitment + 2 scalar evaluations
793 // instead of BATCHED_RELATION_PARTIAL_LENGTH scalars.
794 static constexpr size_t COMMITTED_SUMCHECK_PROOF_LENGTH =
797
798 // ===== Static assert to ensure a valid trace can be proven ======
799
800 // The number of "steps" inserted in ordered range constraint polynomials to ensure that the
801 // DeltaRangeConstraintRelation can always be satisfied if the polynomial is within the appropriate range.
802 static constexpr size_t SORTED_STEPS_COUNT = ((1 << MICRO_LIMB_BITS) / SORT_STEP) + 1;
803
804 // The number of masking values in the overflow columns used for the ordered range constraint
805 static constexpr size_t MASKING_OVERFLOW_COLUMN =
807
810 "Translator circuit is too small for defined number of steps "
811 "(TranslatorDeltaRangeConstraintRelation). ");
812
813 // ================================================================
814
822 template <typename DataType, typename WireRefs>
824 DataType& zero_value)
825 {
826 constexpr size_t num_non_range = NonRangeMainWires<DataType>::_members_size;
827 constexpr size_t num_range = RangeConstraintWires<DataType>::_members_size;
828 static_assert(num_range % CONCATENATION_GROUP_SIZE == 0);
829 constexpr size_t num_range_groups = num_range / CONCATENATION_GROUP_SIZE;
830
832 // Groups 0..num_range_groups-1: sequential chunks of range constraint wires
833 for (size_t g = 0; g < num_range_groups; g++) {
835 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
836 group.push_back(wire_refs[num_non_range + g * CONCATENATION_GROUP_SIZE + j]);
837 }
838 groups.push_back(std::move(group));
839 }
840 // Last group: non-range main wires + zero padding
842 for (size_t j = 0; j < num_non_range; j++) {
843 group.push_back(wire_refs[j]);
844 }
845 for (size_t j = num_non_range; j < CONCATENATION_GROUP_SIZE; j++) {
846 group.push_back(zero_value);
847 }
848 groups.push_back(std::move(group));
849 return groups;
850 }
851
855 template <typename FFType>
860
866 template <typename PolyContainer>
868 {
870 size_t dst = 0;
871 for (auto& wire : polys.get_minicircuit_wires()) {
872 result[dst++] = wire[0];
873 }
874 for (auto& wire : polys.get_minicircuit_wires_shifted()) {
875 result[dst++] = wire[0];
876 }
877 return result;
878 }
879
885 template <typename FFType>
888 {
889 size_t src = 0;
890 for (auto& wire : evals.get_minicircuit_wires()) {
891 wire = mid[src++];
892 }
893 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
894 wire = mid[src++];
895 }
896 }
897
906 template <typename FFType>
908 {
909 // 1. Compute the computable precomputed selector evaluations
910 compute_computable_precomputed(evals, challenge);
911
912 // 2. Scale minicircuit wire evaluations by L_0(u_top) = Π_{i=0}^{3} (1 - u_{LOG_MINI + i})
913 FFType l0 = FFType(1);
914 for (size_t i = 0; i < CONST_TRANSLATOR_LOG_N - LOG_MINI_CIRCUIT_SIZE; i++) {
915 l0 *= (FFType(1) - challenge[LOG_MINI_CIRCUIT_SIZE + i]);
916 }
917 for (auto& wire : evals.get_minicircuit_wires()) {
918 wire *= l0;
919 }
920 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
921 wire *= l0;
922 }
923 }
924
933 template <typename FFType>
936 std::span<const FFType> challenge)
937 {
938 set_full_circuit_evaluations(evals, full_circuit);
939 complete_claimed_evaluations(evals, challenge);
940
941 // Reconstruct the 5 concatenated polynomial evaluations from (now L0-scaled) wire evaluations
942 auto groups = evals.get_groups_to_be_concatenated();
943 auto concat_evals = reconstruct_concatenated_evaluations(groups, challenge);
944 auto concat_refs = evals.get_concatenated();
945 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
946 concat_refs[g] = concat_evals[g];
947 }
948 }
949
962 template <typename FFType>
964 const std::vector<RefVector<FFType>>& groups, std::span<const FFType> challenge)
965 {
966 static constexpr size_t NUM_TOP_BITS = numeric::get_msb(CONCATENATION_GROUP_SIZE);
967
968 // Compute CONCATENATION_GROUP_SIZE-point Lagrange basis over the top challenges
969 // a = u[N - 4], b = u[N - 3], c = u[N - 2], d = u[N - 1]
970 // L(0) = (1 - d) * (1 - c) * (1 - b) * (1 - a)
971 // L(1) = (1 - d) * (1 - c) * (1 - b) * ( a)
972 // L(2) = (1 - d) * (1 - c) * ( b) * (1 - a)
973 // L(3) = (1 - d) * (1 - c) * ( b) * ( a)
974 // ...
976 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
977 lagrange_basis[j] = FFType(1);
978 for (size_t bit = 0; bit < NUM_TOP_BITS; bit++) {
979 const FFType& u = challenge[CONST_TRANSLATOR_LOG_N - NUM_TOP_BITS + bit];
980 lagrange_basis[j] *= ((j >> bit) & 1) ? u : (FFType(1) - u);
981 }
982 }
983
984 // L_0 is the "padding" factor from wires having support in [1, MINI)
985 // The reason we need to divide by L_0 is because L_j(u) already accounts for the challenges a, b, c, d:
986 // L_j(u) = (1 - d) * (1 - c) * (1 - b) * (1 - a) * L_j(0, u_bottom)
987 FFType padding_inv = lagrange_basis[0].invert();
988
989 auto reconstruct = [&](const auto& group) -> FFType {
990 FFType result = FFType(0);
991 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
992 result += lagrange_basis[j] * group[j];
993 }
994 return result * padding_inv;
995 };
996
998 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
999 result[g] = reconstruct(groups[g]);
1000 }
1001 return result;
1002 }
1003
1007 template <typename FFType>
1009 {
1011 size_t dst = 0;
1012 for (auto& entity : evals.get_full_circuit_entities()) {
1013 result[dst++] = entity;
1014 }
1015 return result;
1016 }
1017
1021 template <typename FFType>
1024 {
1025 size_t src = 0;
1026 for (auto& entity : evals.get_full_circuit_entities()) {
1027 entity = full_circuit[src++];
1028 }
1029 }
1030
1034 class ProverPolynomials : public AllEntities<Polynomial> {
1035 public:
1041 {
1042
1043 const size_t circuit_size = 1 << CONST_TRANSLATOR_LOG_N;
1044 for (auto& ordered_range_constraint : get_ordered_range_constraints()) {
1045 ordered_range_constraint = Polynomial{ /*size*/ circuit_size - 1,
1046 /*largest possible index*/ circuit_size,
1047 1 };
1048 }
1049
1050 // Initialize 5 concatenated polynomials (full circuit_size, shiftable with start_index=1)
1051 // Row 0 of block 0 is the no-op row where all values are zero.
1052 for (auto& concat_poly : get_concatenated()) {
1053 concat_poly = Polynomial{ /*size*/ circuit_size - 1,
1054 /*virtual_size*/ circuit_size,
1055 /*start_index*/ 1 };
1056 }
1057 z_perm = Polynomial{ /*size*/ circuit_size - 1,
1058 /*virtual_size*/ circuit_size,
1059 /*start_index*/ 1 };
1060
1061 op = Polynomial{ MINI_CIRCUIT_SIZE, circuit_size };
1062
1063 // All minicircuit wires (non-op-queue) are only non-zero in [1, MINI_CIRCUIT_SIZE)
1065 if (poly.is_empty()) {
1066 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1067 /*virtual_size*/ circuit_size,
1068 /*start_index*/ 1 };
1069 }
1070 }
1071
1072 // Op queue wires to be shifted
1074 if (poly.is_empty()) {
1075 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1076 /*virtual_size*/ circuit_size,
1077 /*start_index*/ 1 };
1078 }
1079 }
1080
1081 // Initialize lagrange polynomials and the ordered extra range constraints numerator (the precomputed
1082 // polynomials) within the appropriate range they operate on
1083 lagrange_first = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size };
1084 lagrange_result_row = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size, /*start_index*/ RESULT_ROW };
1085 lagrange_even_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END,
1086 /*virtual_size*/ circuit_size,
1087 /*start_index=*/RESULT_ROW };
1088 lagrange_odd_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END - 1,
1089 /*virtual_size*/ circuit_size,
1090 /*start_index=*/RESULT_ROW + 1 };
1091 lagrange_last_in_minicircuit = Polynomial{ /*size*/ 1,
1092 /*virtual_size*/ circuit_size,
1093 /*start_index=*/MINI_CIRCUIT_SIZE - NUM_MASKED_ROWS_END - 1 };
1094 lagrange_mini_masking = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RANDOMNESS_START,
1095 /*virtual_size*/ circuit_size,
1096 /*start_index=*/RANDOMNESS_START };
1097 // With concatenation, masking rows are scattered in concatenated polys: end of each of the 16 blocks
1098 // Must span full circuit since values go up to position 15*MINI+(MINI-1)
1099 lagrange_masking = Polynomial{ circuit_size, circuit_size };
1100 // Ordered masking: contiguous at the end (marks masking positions in ordered polynomials)
1101 lagrange_ordered_masking = Polynomial{ /*size*/ MAX_RANDOM_VALUES_PER_ORDERED,
1102 /*virtual_size*/ circuit_size,
1103 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED };
1104 lagrange_last = Polynomial{ /*size*/ 1,
1105 /*virtual_size*/ circuit_size,
1106 /*start_index*/ circuit_size - 1 };
1107 // lagrange_real_last marks the last position with sorted values in ordered polynomials
1108 // (where we check maximum value = 2^14 - 1). With contiguous masking at the end,
1109 // this is at position circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1.
1110 lagrange_real_last = Polynomial{ /*size*/ 1,
1111 /*virtual_size*/ circuit_size,
1112 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1 };
1113 ordered_extra_range_constraints_numerator =
1115 /*virtual_size*/ circuit_size,
1116 /*start_index*/ 0 };
1117
1118 set_shifted();
1119 }
1122 ProverPolynomials(ProverPolynomials&& o) noexcept = default;
1125 [[nodiscard]] static size_t get_polynomial_size() { return 1UL << CONST_TRANSLATOR_LOG_N; }
1130 [[nodiscard]] AllValues get_row(size_t row_idx) const
1131 {
1132 AllValues result;
1133 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
1134 // Translator polynomials have different support regions (start_index/end_index)
1135 // Return 0 for out-of-bounds access (which is the correct value outside support)
1136 if (row_idx >= polynomial.start_index() && row_idx < polynomial.end_index()) {
1137 result_field = polynomial[row_idx];
1138 } else {
1139 result_field = FF(0);
1140 }
1141 }
1142 return result;
1143 }
1144 // Set all shifted polynomials based on their to-be-shifted counterpart.
1145 // Uses get_all_to_be_shifted() (86 entries for Sumcheck), not get_to_be_shifted() (9 entries for PCS).
1147 {
1148 for (auto [shifted, to_be_shifted] : zip_view(get_shifted(), get_all_to_be_shifted())) {
1149 shifted = to_be_shifted.shifted();
1150 }
1151 }
1152 };
1153
1159 public:
1162
1163 ProverPolynomials polynomials; // storage for all polynomials evaluated by the prover
1165
1166 ProvingKey() = default;
1167 };
1168
1174 template <typename DataType_> class VKEntities {
1175 public:
1176 bool operator==(const VKEntities& other) const = default;
1177 using DataType = DataType_;
1178 DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator);
1179 };
1180
1188
1194
1199
1204
1210 class CommitmentLabels : public AllEntities<std::string> {
1211 public:
1213 {
1214 // Concatenated polynomials (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1215 this->concatenated_range_constraints_0 = "CONCATENATED_RANGE_CONSTRAINTS_0";
1216 this->concatenated_range_constraints_1 = "CONCATENATED_RANGE_CONSTRAINTS_1";
1217 this->concatenated_range_constraints_2 = "CONCATENATED_RANGE_CONSTRAINTS_2";
1218 this->concatenated_range_constraints_3 = "CONCATENATED_RANGE_CONSTRAINTS_3";
1219 this->concatenated_non_range = "CONCATENATED_NON_RANGE";
1220
1221 // Ordered range constraints (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1222 this->ordered_range_constraints_0 = "ORDERED_RANGE_CONSTRAINTS_0";
1223 this->ordered_range_constraints_1 = "ORDERED_RANGE_CONSTRAINTS_1";
1224 this->ordered_range_constraints_2 = "ORDERED_RANGE_CONSTRAINTS_2";
1225 this->ordered_range_constraints_3 = "ORDERED_RANGE_CONSTRAINTS_3";
1226 this->ordered_range_constraints_4 = "ORDERED_RANGE_CONSTRAINTS_4";
1227
1228 // Grand product (committed separately)
1229 this->z_perm = "Z_PERM";
1230 };
1231 };
1232
1233 template <typename Commitment, typename VerificationKey>
1234 class VerifierCommitments_ : public AllEntities<Commitment> {
1235 public:
1236 VerifierCommitments_(const std::shared_ptr<VerificationKey>& verification_key)
1237 {
1238 // Only ordered_extra_range_constraints_numerator needs a VK commitment for PCS.
1239 // All other precomputed selectors are computable (evaluations derived from sumcheck challenge).
1240 this->ordered_extra_range_constraints_numerator =
1241 verification_key->ordered_extra_range_constraints_numerator;
1242 }
1243 };
1244
1252 template <typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
1253 static bool skip_entire_row([[maybe_unused]] const ProverPolynomialsOrPartiallyEvaluatedMultivariates& polynomials,
1254 [[maybe_unused]] const EdgeType edge_idx)
1255 {
1256 auto s0 = polynomials.ordered_range_constraints_0_shift[edge_idx];
1257 auto s1 = polynomials.ordered_range_constraints_1_shift[edge_idx];
1258 auto s2 = polynomials.ordered_range_constraints_2_shift[edge_idx];
1259 auto s3 = polynomials.ordered_range_constraints_3_shift[edge_idx];
1260 auto s4 = polynomials.ordered_range_constraints_4_shift[edge_idx];
1261 auto s5 = polynomials.ordered_range_constraints_0_shift[edge_idx + 1];
1262 auto s6 = polynomials.ordered_range_constraints_1_shift[edge_idx + 1];
1263 auto s7 = polynomials.ordered_range_constraints_2_shift[edge_idx + 1];
1264 auto s8 = polynomials.ordered_range_constraints_3_shift[edge_idx + 1];
1265 auto s9 = polynomials.ordered_range_constraints_4_shift[edge_idx + 1];
1266 auto shift_0 = (s0 == 0) && (s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0) && (s6 == 0) &&
1267 (s7 == 0) && (s8 == 0) && (s9 == 0);
1268 return shift_0 && (polynomials.z_perm[edge_idx] == polynomials.z_perm_shift[edge_idx]) &&
1269 (polynomials.z_perm[edge_idx + 1] == polynomials.z_perm_shift[edge_idx + 1]) &&
1270 polynomials.lagrange_last[edge_idx] == 0 && polynomials.lagrange_last[edge_idx + 1] == 0;
1271 }
1273};
1274
1276 public:
1279
1280 static constexpr bool USE_SHORT_MONOMIALS = true;
1281
1283 template <typename FF_>
1292
1293 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
1295 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
1298
1301
1306};
1307
1308// Guard against drift between the runtime PCS entity lists and their compile-time counts;
1309// REPEATED_COMMITMENTS and PROOF_LENGTH depend on these counts and desync silently otherwise.
1311 .get_pcs_unshifted())>::value ==
1313 "get_pcs_unshifted() entity count must equal NUM_PCS_UNSHIFTED. If you added a witness entity, "
1314 "update both the runtime list and NUM_UNSHIFTED_WITNESSES_WITHOUT_CONCATENATED.");
1316 .get_pcs_to_be_shifted())>::value ==
1318 "get_pcs_to_be_shifted() entity count must equal NUM_PCS_TO_BE_SHIFTED. If you added a to-be-shifted "
1319 "entity, update both the runtime list and NUM_TO_BE_SHIFTED.");
1320
1321} // namespace bb
Common transcript class for both parties. Stores the data for the current round, as well as the manif...
CommitmentKey object over a pairing group 𝔾₁.
Simple verification key class for fixed-size circuits (ECCVM, Translator, AVM).
Definition flavor.hpp:103
A container for storing the partially evaluated multivariates produced by sumcheck.
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
Definition ref_array.hpp:22
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
TranslatorCircuitBuilder creates a circuit that evaluates the correctness of the evaluation of EccOpQ...
A base class labelling all entities (for instance, all of the polynomials used by the prover during s...
DEFINE_COMPOUND_GET_ALL(MaskingEntities< DataType >, PrecomputedEntities< DataType >, WitnessEntities< DataType >, ShiftedEntities< DataType >) auto get_concatenated()
Getter for concatenated polynomials.
friend std::ostream & operator<<(std::ostream &os, const AllEntities &a)
auto get_pcs_unshifted()
All unshifted polynomials for PCS (excludes computable precomputed, includes concatenated).
auto get_full_circuit_entities()
Full-circuit entities sent in the proof (excludes computable precomputed, minicircuit wires,...
auto get_pcs_to_be_shifted()
All to-be-shifted polynomials for PCS (base to-be-shifted + concatenated).
auto get_ordered_range_constraints()
Getter for the ordered entities used in computing the denominator of the grand product in the permuta...
auto get_minicircuit_wires()
The 77 minicircuit wires (unshifted): NonRangeMain(13) + RangeConstraint(64).
auto get_minicircuit_wires_shifted()
The 77 minicircuit wire shifts: corresponds 1:1 with get_minicircuit_wires().
A field element for each entity of the flavor. These entities represent the prover polynomials evalua...
A container for commitment labels.
Ordered range constraint + z_perm shifted entities.
Container for ZK entities (gemini masking polynomial for ZK-PCS)
Non-op-queue minicircuit wire shifted entities (mirrors NonOpQueueWiresToBeShiftedEntities)
All non-op-queue wires that need to be shifted (composed of non-range main + range constraint)
Non-range main wires (13 wires that go into concatenated group 4)
Op queue shifted entities (mirrors OpQueueWiresToBeShiftedEntities)
Op queue wires (non-shifted): these represent the op queue and are provided by the merge protocol.
Op queue wires (to be shifted): first 3 wires of the to-be-shifted group.
DEFINE_FLAVOR_MEMBERS(DataType, ordered_range_constraints_0, ordered_range_constraints_1, ordered_range_constraints_2, ordered_range_constraints_3, ordered_range_constraints_4)
A base class labelling precomputed entities and (ordered) subsets of interest.
bool operator==(const PrecomputedEntities &other) const =default
DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator, lagrange_first, lagrange_last, lagrange_odd_in_minicircuit, lagrange_even_in_minicircuit, lagrange_result_row, lagrange_last_in_minicircuit, lagrange_masking, lagrange_mini_masking, lagrange_real_last, lagrange_ordered_masking)
A container for the prover polynomials handles.
ProverPolynomials(const ProverPolynomials &o)=delete
ProverPolynomials(ProverPolynomials &&o) noexcept=default
ProverPolynomials & operator=(const ProverPolynomials &)=delete
AllValues get_row(size_t row_idx) const
Returns the evaluations of all prover polynomials at one point on the boolean hypercube,...
ProverPolynomials()
ProverPolynomials constructor.
ProverPolynomials & operator=(ProverPolynomials &&o) noexcept=default
The proving key is responsible for storing the polynomials used by the prover.
Range constraint wires (64 wires that go into concatenated groups 0-3)
DEFINE_FLAVOR_MEMBERS(DataType, p_x_low_limbs_range_constraint_0, p_x_low_limbs_range_constraint_1, p_x_low_limbs_range_constraint_2, p_x_low_limbs_range_constraint_3, p_x_low_limbs_range_constraint_4, p_x_low_limbs_range_constraint_tail, p_x_high_limbs_range_constraint_0, p_x_high_limbs_range_constraint_1, p_x_high_limbs_range_constraint_2, p_x_high_limbs_range_constraint_3, p_x_high_limbs_range_constraint_4, p_x_high_limbs_range_constraint_tail, p_y_low_limbs_range_constraint_0, p_y_low_limbs_range_constraint_1, p_y_low_limbs_range_constraint_2, p_y_low_limbs_range_constraint_3, p_y_low_limbs_range_constraint_4, p_y_low_limbs_range_constraint_tail, p_y_high_limbs_range_constraint_0, p_y_high_limbs_range_constraint_1, p_y_high_limbs_range_constraint_2, p_y_high_limbs_range_constraint_3, p_y_high_limbs_range_constraint_4, p_y_high_limbs_range_constraint_tail, z_low_limbs_range_constraint_0, z_low_limbs_range_constraint_1, z_low_limbs_range_constraint_2, z_low_limbs_range_constraint_3, z_low_limbs_range_constraint_4, z_low_limbs_range_constraint_tail, z_high_limbs_range_constraint_0, z_high_limbs_range_constraint_1, z_high_limbs_range_constraint_2, z_high_limbs_range_constraint_3, z_high_limbs_range_constraint_4, z_high_limbs_range_constraint_tail, accumulator_low_limbs_range_constraint_0, accumulator_low_limbs_range_constraint_1, accumulator_low_limbs_range_constraint_2, accumulator_low_limbs_range_constraint_3, accumulator_low_limbs_range_constraint_4, accumulator_low_limbs_range_constraint_tail, accumulator_high_limbs_range_constraint_0, accumulator_high_limbs_range_constraint_1, accumulator_high_limbs_range_constraint_2, accumulator_high_limbs_range_constraint_3, accumulator_high_limbs_range_constraint_4, accumulator_high_limbs_range_constraint_tail, quotient_low_limbs_range_constraint_0, quotient_low_limbs_range_constraint_1, quotient_low_limbs_range_constraint_2, quotient_low_limbs_range_constraint_3, quotient_low_limbs_range_constraint_4, quotient_low_limbs_range_constraint_tail, quotient_high_limbs_range_constraint_0, quotient_high_limbs_range_constraint_1, quotient_high_limbs_range_constraint_2, quotient_high_limbs_range_constraint_3, quotient_high_limbs_range_constraint_4, quotient_high_limbs_range_constraint_tail, relation_wide_limbs_range_constraint_0, relation_wide_limbs_range_constraint_1, relation_wide_limbs_range_constraint_2, relation_wide_limbs_range_constraint_3)
Represents polynomials shifted by 1 or their evaluations, defined relative to WireToBeShiftedEntities...
std::vector< RefVector< DataType > > get_groups_to_be_concatenated_shifted()
Get the shifted versions of minicircuit wires organized into 5 concatenation groups.
DEFINE_COMPOUND_GET_ALL(OpQueueShiftedEntities< DataType >, NonOpQueueShiftedEntities< DataType >, DerivedShiftedEntities< DataType >) auto get_pcs_shifted()
PCS-level shifted evaluations matching get_to_be_shifted(): op_queue(3) + ordered_range(5) + z_perm(1...
The only precomputed commitment the verifier needs for PCS.
bool operator==(const VKEntities &other) const =default
DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator)
VerifierCommitments_(const std::shared_ptr< VerificationKey > &verification_key)
All wire entities that are not shifted (currently just the op queue wire)
All wires to be shifted (op queue + non-op-queue)
Container for all witness polynomials used/constructed by the prover.
auto get_all_to_be_shifted()
All polys that need shifted views for Sumcheck (corresponds 1:1 with ShiftedEntities).
DEFINE_COMPOUND_GET_ALL(WireNonshiftedEntities< DataType >, WireToBeShiftedEntities< DataType >, OrderedRangeConstraints< DataType >, DerivedWitnessEntities< DataType >, ConcatenatedPolynomials< DataType >) auto get_wires()
Entities constructed from circuit data.
auto get_non_opqueue_wires_and_ordered_range_constraints()
Concatenated polynomials and ordered range constraints (committed to by translator prover).
std::vector< RefVector< DataType > > get_groups_to_be_concatenated()
Get all minicircuit wire polynomials that are concatenated into the 5 concatenated polys.
auto get_concatenated()
Get the concatenated polynomials.
static constexpr size_t MINI_CIRCUIT_SIZE
static constexpr size_t MICRO_LIMB_BITS
std::tuple< TranslatorPermutationRelation< FF > > GrandProductRelations
static constexpr size_t num_frs_fq
static constexpr size_t NUM_MASKING_POLYNOMIALS
static constexpr size_t MAX_RANDOM_VALUES_PER_ORDERED
static bool skip_entire_row(const ProverPolynomialsOrPartiallyEvaluatedMultivariates &polynomials, const EdgeType edge_idx)
When evaluating the sumcheck protocol - can we skip evaluation of all relations for a given row?
static std::array< FFType, NUM_FULL_CIRCUIT_EVALUATIONS > get_full_circuit_evaluations(AllEntities< FFType > &evals)
Prover: extract the full-circuit evaluations via get_full_circuit_entities().
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
static constexpr size_t MASKING_OVERFLOW_COLUMN
static constexpr size_t NUM_ALL_ENTITIES
static constexpr size_t NUM_WIRES
static constexpr size_t NUM_SENT_EVALUATIONS
static constexpr size_t SORT_STEP
static constexpr RepeatedCommitmentsData REPEATED_COMMITMENTS
static constexpr size_t NUM_CONCATENATED_POLYS
static constexpr size_t num_frs_comm
static constexpr size_t TO_BE_SHIFTED_WITNESSES_START
static void compute_computable_precomputed(AllEntities< FFType > &evals, std::span< const FFType > challenge)
Compute the computable precomputed selector evaluations and write them into AllEntities.
static constexpr size_t TRACE_OFFSET
static constexpr size_t NUM_PCS_UNSHIFTED
static void set_minicircuit_evaluations(AllEntities< FFType > &evals, const std::array< FFType, NUM_MINICIRCUIT_EVALUATIONS > &mid)
Verifier: place the 154 raw mid-sumcheck minicircuit wire evaluations into AllEntities.
static constexpr size_t NUM_WITNESS_ENTITIES
static constexpr size_t NUM_FULL_CIRCUIT_EVALUATIONS
static constexpr size_t RANDOMNESS_START
static void complete_claimed_evaluations(AllEntities< FFType > &evals, std::span< const FFType > challenge)
Verifier: complete the claimed evaluations for the sumcheck relation check.
static constexpr size_t CONST_TRANSLATOR_LOG_N
static constexpr size_t NUM_OP_QUEUE_WIRES
static constexpr size_t PROOF_LENGTH
Curve::ScalarField FF
Curve::AffineElement Commitment
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
static constexpr size_t COMMITTED_SUMCHECK_PROOF_LENGTH
static constexpr size_t NUM_OP_QUEUE_TO_BE_SHIFTED
static constexpr size_t NUM_CONCATENATED_WIRES
static constexpr size_t NUM_MINICIRCUIT_EVALUATIONS
static constexpr size_t LOG_MINI_CIRCUIT_SIZE
static constexpr bool USE_PADDING
static void set_full_circuit_evaluations(AllEntities< FFType > &evals, const std::array< FFType, NUM_FULL_CIRCUIT_EVALUATIONS > &full_circuit)
Verifier: write the full-circuit evaluations back via get_full_circuit_entities().
static constexpr size_t NUM_COMMITMENTS_IN_PROOF
static constexpr bool HasZK
static constexpr size_t NUM_ORDERED_RANGE
static constexpr size_t CONCATENATION_GROUP_SIZE
static std::array< FFType, NUM_CONCATENATED_POLYS > reconstruct_concatenated_evaluations(const std::vector< RefVector< FFType > > &groups, std::span< const FFType > challenge)
Reconstruct concatenated polynomial evaluations from individual wire evaluations using the Lagrange b...
static constexpr size_t NUM_LIMB_BITS
static constexpr size_t RESULT_ROW
static constexpr size_t NUM_MASKED_ROWS_END
static constexpr size_t NUM_RELATIONS
static constexpr bool USE_SHORT_MONOMIALS
static constexpr size_t NUM_TO_BE_SHIFTED
std::tuple< TranslatorPermutationRelation< FF >, TranslatorDeltaRangeConstraintRelation< FF >, TranslatorOpcodeConstraintRelation< FF >, TranslatorAccumulatorTransferRelation< FF >, TranslatorDecompositionRelation< FF >, TranslatorNonNativeFieldRelation< FF >, TranslatorZeroConstraintsRelation< FF > > Relations_
static constexpr size_t NUM_PRECOMPUTED_ENTITIES
static constexpr size_t NUM_SHIFTED_ENTITIES
static std::vector< RefVector< DataType > > partition_minicircuit_wires_into_groups(WireRefs wire_refs, DataType &zero_value)
Partition minicircuit wire references into concatenation groups.
static constexpr size_t NUM_PCS_TO_BE_SHIFTED
static constexpr size_t SHIFTED_WITNESSES_START
static constexpr size_t SORTED_STEPS_COUNT
static constexpr size_t NUM_UNSHIFTED_WITNESSES_WITHOUT_CONCATENATED
static constexpr size_t NUM_SUBRELATIONS
static void complete_full_circuit_evaluations(AllEntities< FFType > &evals, const std::array< FFType, NUM_FULL_CIRCUIT_EVALUATIONS > &full_circuit, std::span< const FFType > challenge)
Verifier: complete full-circuit evaluations from received array and challenge.
static constexpr size_t NUM_WIRES_NON_SHIFTED
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
static constexpr size_t num_frs_fr
static std::array< FF, NUM_MINICIRCUIT_EVALUATIONS > get_minicircuit_evaluations(PolyContainer &polys)
Prover: read the 154 minicircuit wire evaluations from partially-evaluated polynomials.
static constexpr size_t NUM_COMPUTABLE_PRECOMPUTED
static constexpr size_t NUM_MINICIRCUIT_WIRES
static constexpr size_t VIRTUAL_LOG_N
static constexpr size_t BATCHED_RELATION_PARTIAL_LENGTH
std::array< FF, NUM_SUBRELATIONS - 1 > SubrelationSeparators
static constexpr size_t MAX_PARTIAL_RELATION_LENGTH
std::tuple< TranslatorPermutationShortRelation< FF_ >, TranslatorDeltaRangeConstraintShortRelation< FF_ >, TranslatorOpcodeConstraintShortRelation< FF_ >, TranslatorAccumulatorTransferShortRelation< FF_ >, TranslatorDecompositionShortRelation< FF_ >, TranslatorNonNativeFieldShortRelation< FF_ >, TranslatorZeroConstraintsShortRelation< FF_ > > Relations_
std::tuple< TranslatorPermutationShortRelation< FF > > GrandProductRelations
Representation of the Grumpkin Verifier Commitment Key inside a bn254 circuit.
typename Group::element Element
Definition bn254.hpp:21
bb::fq BaseField
Definition bn254.hpp:19
typename Group::affine_element AffineElement
Definition bn254.hpp:22
static constexpr uint32_t LIBRA_UNIVARIATES_LENGTH
Definition bn254.hpp:44
bb::fr ScalarField
Definition bn254.hpp:18
group class. Represents an elliptic curve group element. Group is parametrised by Fq and Fr
Definition group.hpp:38
FF a
Base class templates shared across Honk flavors.
#define DEFINE_FLAVOR_MEMBERS(DataType,...)
Define the body of a flavor class, included each member and a pointer view with which to iterate the ...
#define DEFINE_COMPOUND_GET_ALL(...)
constexpr T get_msb(const T in)
Definition get_msb.hpp:50
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
RefArray< T,(Ns+...)> constexpr concatenate(const RefArray< T, Ns > &... ref_arrays)
Concatenates multiple RefArray objects into a single RefArray.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Stores the fixed Translator VK commitment that depends only on the circuit size constant CONST_TRANSL...
static TranslatorSelectorEvaluations compute(std::span< const FF > u)
Compute evaluations of all 10 structured selectors at the sumcheck challenge.
void populate(Entities &target) const
Write all 10 computed evaluations into any entity struct with matching named fields.