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
30
31namespace bb {
32
33namespace detail {
34template <typename> struct ref_array_extent;
35template <typename T, std::size_t N> struct ref_array_extent<RefArray<T, N>> {
36 static constexpr std::size_t value = N;
37};
38} // namespace detail
39
41
42 public:
45 using PCS = KZG<Curve>;
53 using Codec = FrCodec;
56
57 // indicates when evaluating sumcheck, edges must be extended to be MAX_PARTIAL_RELATION_LENGTH
58 static constexpr bool USE_SHORT_MONOMIALS = false;
59
60 // Indicates that this flavor runs with ZK Sumcheck.
61 static constexpr bool HasZK = true;
62 // Translator has no disabled rows at the top of the trace.
63 static constexpr size_t TRACE_OFFSET = 0;
64 // Translator proof size and its recursive verifier circuit are genuinely fixed, hence no padding is needed.
65 static constexpr bool USE_PADDING = false;
66 // Important: these constants cannot be arbitrarily changed - please consult with a member of the Crypto team if
67 // they become too small.
68
69 // The number of entities added for ZK (gemini_masking_poly)
70 static constexpr size_t NUM_MASKING_POLYNOMIALS = 1;
71
72 // None of this parameters can be changed
73 // Number of wires representing the op queue whose commitments are going to be checked against those from the
74 // final round of merge
75 static constexpr size_t NUM_OP_QUEUE_WIRES = 4;
76
77 // How many mini_circuit_size polynomials are concatenated in one concatenated poly
78 static constexpr size_t CONCATENATION_GROUP_SIZE = 16;
79
80 // The fixed log size of Translator mini circuit. It should be determined by the size of the EccOpQueue.
81 static constexpr size_t LOG_MINI_CIRCUIT_SIZE = CONST_TRANSLATOR_MINI_CIRCUIT_LOG_SIZE;
82
83 // Log of size of concatenated and ordered polynomials
85
86 // For the translator, the genuine and virtual log circuit size coincide
87 static constexpr size_t VIRTUAL_LOG_N = CONST_TRANSLATOR_LOG_N;
88
89 static constexpr size_t MINI_CIRCUIT_SIZE = 1UL << LOG_MINI_CIRCUIT_SIZE;
90
91 // The number of concatenated polynomials (4 range constraint groups + 1 non-range group)
92 static constexpr size_t NUM_CONCATENATED_POLYS = 5;
93
94 // The step in the DeltaRangeConstraint relation i.e. the maximum difference between two consecutive values
95 static constexpr size_t SORT_STEP = 3;
96
97 // Number of wires
98 static constexpr size_t NUM_WIRES = CircuitBuilder::NUM_WIRES;
99
100 // The result of evaluating the polynomials in the nonnative form in translator circuit, stored as limbs and
101 // referred to as accumulated_result. This is reconstructed in it's base field form and sent to the verifier
102 // responsible for checking it against the evaluations received from ECCVM.
103 static constexpr size_t RESULT_ROW = CircuitBuilder::RESULT_ROW;
104
105 // Number of random ops found at he end of Translator trace multiplied by 2 as each accumulation gates occupies two
106 // rows.
108
109 // Maximum number of random masking values any ordered polynomial will have at the end
110 // Total scattered masking positions = CONCATENATION_GROUP_SIZE * NUM_MASKED_ROWS_END
111 // This is the space reserved at the end of each ordered polynomial (contiguous)
113
114 // Index at which random coefficients start (for zk) within Translator trace.
115 // The first 2 rows are zeros for polynomial shiftability (one op's worth of rows).
116 static constexpr size_t RANDOMNESS_START = 2;
117
118 // The bitness of the range constraint
120
121 // Number of bits in a binary limb
122 // This is not a configurable value. Relations are sepcifically designed for it to be 68
124
126 // define the tuple of Relations that comprise the Sumcheck relation
127 template <typename FF>
136
137 static constexpr size_t NUM_SUBRELATIONS = compute_number_of_subrelations<Relations>();
138 using SubrelationSeparators = std::array<FF, NUM_SUBRELATIONS - 1>;
139
140 static constexpr size_t MAX_PARTIAL_RELATION_LENGTH = compute_max_partial_relation_length<Relations>();
141
142 // BATCHED_RELATION_PARTIAL_LENGTH = algebraic degree of sumcheck relation *after* multiplying by the `pow_zeta`
143 // random polynomial e.g. For \sum(x) [A(x) * B(x) + C(x)] * PowZeta(X), relation length = 2 and random relation
144 // length = 3.
145 // The degree has to be further increased because the relation is multiplied by the Row Disabling Polynomial
146 // total degree = sumcheck relation degree + 1 (PowZeta) + 1 (masking)
149 "LIBRA_UNIVARIATES_LENGTH must be equal to Translator::BATCHED_RELATION_PARTIAL_LENGTH");
151
152 static constexpr size_t num_frs_comm = FrCodec::calc_num_fields<Commitment>();
153 static constexpr size_t num_frs_fr = FrCodec::calc_num_fields<FF>();
154 static constexpr size_t num_frs_fq = FrCodec::calc_num_fields<BF>();
155
160 template <typename DataType_> class PrecomputedEntities {
161 public:
162 bool operator==(const PrecomputedEntities& other) const = default;
163 using DataType = DataType_;
165 ordered_extra_range_constraints_numerator, // column 0
166 lagrange_first, // column 1
167 lagrange_last, // column 2
168 lagrange_odd_in_minicircuit, // column 3
169 lagrange_even_in_minicircuit, // column 4
170 lagrange_result_row, // column 5
171 lagrange_last_in_minicircuit, // column 6
172 lagrange_masking, // column 7
173 lagrange_mini_masking, // column 8
174 lagrange_real_last, // column 9
175 lagrange_ordered_masking); // column 10
176 };
177
178 template <typename DataType> class ConcatenatedPolynomials {
179 public:
180 DEFINE_FLAVOR_MEMBERS(DataType,
181 concatenated_range_constraints_0, // column 0
182 concatenated_range_constraints_1, // column 1
183 concatenated_range_constraints_2, // column 2
184 concatenated_range_constraints_3, // column 3
185 concatenated_non_range) // column 4
186 };
190 template <typename DataType> class NonRangeMainWires {
191 public:
192 DEFINE_FLAVOR_MEMBERS(DataType,
193 p_x_low_limbs, // column 0
194 p_x_high_limbs, // column 1
195 p_y_low_limbs, // column 2
196 p_y_high_limbs, // column 3
197 z_low_limbs, // column 4
198 z_high_limbs, // column 5
199 accumulators_binary_limbs_0, // column 6
200 accumulators_binary_limbs_1, // column 7
201 accumulators_binary_limbs_2, // column 8
202 accumulators_binary_limbs_3, // column 9
203 quotient_low_binary_limbs, // column 10
204 quotient_high_binary_limbs, // column 11
205 relation_wide_limbs) // column 12
206 };
207
211 template <typename DataType> class RangeConstraintWires {
212 public:
214 p_x_low_limbs_range_constraint_0, // column 0
215 p_x_low_limbs_range_constraint_1, // column 17
216 p_x_low_limbs_range_constraint_2, // column 18
217 p_x_low_limbs_range_constraint_3, // column 19
218 p_x_low_limbs_range_constraint_4, // column 20
219 p_x_low_limbs_range_constraint_tail, // column 21
220 p_x_high_limbs_range_constraint_0, // column 22
221 p_x_high_limbs_range_constraint_1, // column 23
222 p_x_high_limbs_range_constraint_2, // column 24
223 p_x_high_limbs_range_constraint_3, // column 25
224 p_x_high_limbs_range_constraint_4, // column 26
225 p_x_high_limbs_range_constraint_tail, // column 27
226 p_y_low_limbs_range_constraint_0, // column 28
227 p_y_low_limbs_range_constraint_1, // column 29
228 p_y_low_limbs_range_constraint_2, // column 30
229 p_y_low_limbs_range_constraint_3, // column 31
230 p_y_low_limbs_range_constraint_4, // column 32
231 p_y_low_limbs_range_constraint_tail, // column 33
232 p_y_high_limbs_range_constraint_0, // column 34
233 p_y_high_limbs_range_constraint_1, // column 35
234 p_y_high_limbs_range_constraint_2, // column 36
235 p_y_high_limbs_range_constraint_3, // column 37
236 p_y_high_limbs_range_constraint_4, // column 38
237 p_y_high_limbs_range_constraint_tail, // column 39
238 z_low_limbs_range_constraint_0, // column 40
239 z_low_limbs_range_constraint_1, // column 41
240 z_low_limbs_range_constraint_2, // column 42
241 z_low_limbs_range_constraint_3, // column 43
242 z_low_limbs_range_constraint_4, // column 44
243 z_low_limbs_range_constraint_tail, // column 45
244 z_high_limbs_range_constraint_0, // column 46
245 z_high_limbs_range_constraint_1, // column 47
246 z_high_limbs_range_constraint_2, // column 48
247 z_high_limbs_range_constraint_3, // column 49
248 z_high_limbs_range_constraint_4, // column 50
249 z_high_limbs_range_constraint_tail, // column 51
250 accumulator_low_limbs_range_constraint_0, // column 52
251 accumulator_low_limbs_range_constraint_1, // column 53
252 accumulator_low_limbs_range_constraint_2, // column 54
253 accumulator_low_limbs_range_constraint_3, // column 55
254 accumulator_low_limbs_range_constraint_4, // column 56
255 accumulator_low_limbs_range_constraint_tail, // column 57
256 accumulator_high_limbs_range_constraint_0, // column 58
257 accumulator_high_limbs_range_constraint_1, // column 59
258 accumulator_high_limbs_range_constraint_2, // column 60
259 accumulator_high_limbs_range_constraint_3, // column 61
260 accumulator_high_limbs_range_constraint_4, // column 62
261 accumulator_high_limbs_range_constraint_tail, // column 63
262 quotient_low_limbs_range_constraint_0, // column 64
263 quotient_low_limbs_range_constraint_1, // column 65
264 quotient_low_limbs_range_constraint_2, // column 66
265 quotient_low_limbs_range_constraint_3, // column 67
266 quotient_low_limbs_range_constraint_4, // column 68
267 quotient_low_limbs_range_constraint_tail, // column 69
268 quotient_high_limbs_range_constraint_0, // column 70
269 quotient_high_limbs_range_constraint_1, // column 71
270 quotient_high_limbs_range_constraint_2, // column 72
271 quotient_high_limbs_range_constraint_3, // column 73
272 quotient_high_limbs_range_constraint_4, // column 74
273 quotient_high_limbs_range_constraint_tail, // column 75
274 relation_wide_limbs_range_constraint_0, // column 76
275 relation_wide_limbs_range_constraint_1, // column 77
276 relation_wide_limbs_range_constraint_2, // column 62
277 relation_wide_limbs_range_constraint_3); // column 63
278 };
279
283 template <typename DataType>
289
293 template <typename DataType> class OpQueueWiresToBeShiftedEntities {
294 public:
295 DEFINE_FLAVOR_MEMBERS(DataType,
296 x_lo_y_hi, // column 0
297 x_hi_z_1, // column 1
298 y_lo_z_2) // column 2
299 };
300
304 template <typename DataType>
310
311 // Note: These are technically derived from wires but do not depend on challenges (like z_perm). They are committed
312 // to in the wires commitment round.
313 template <typename DataType> class OrderedRangeConstraints {
314 public:
316 ordered_range_constraints_0, // column 0
317 ordered_range_constraints_1, // column 1
318 ordered_range_constraints_2, // column 2
319 ordered_range_constraints_3, // column 3
320 ordered_range_constraints_4); // column 4
321 };
322
326 template <typename DataType> class OpQueueWireNonshiftedEntities {
327 public:
329 op // column 0
330 );
331 };
332
336 template <typename DataType> class WireNonshiftedEntities : public OpQueueWireNonshiftedEntities<DataType> {
337 public:
339 };
340
341 template <typename DataType> class DerivedWitnessEntities {
342 public:
344 z_perm); // column 0
345 };
349 template <typename DataType>
410
414 template <typename DataType> class OpQueueShiftedEntities {
415 public:
416 DEFINE_FLAVOR_MEMBERS(DataType,
417 x_lo_y_hi_shift, // column 0
418 x_hi_z_1_shift, // column 1
419 y_lo_z_2_shift) // column 2
420 };
421
425 template <typename DataType> class NonOpQueueShiftedEntities {
426 public:
427 DEFINE_FLAVOR_MEMBERS(DataType,
428 p_x_low_limbs_shift, // column 3
429 p_x_high_limbs_shift, // column 10
430 p_y_low_limbs_shift, // column 17
431 p_y_high_limbs_shift, // column 24
432 z_low_limbs_shift, // column 31
433 z_high_limbs_shift, // column 38
434 accumulators_binary_limbs_0_shift, // column 45
435 accumulators_binary_limbs_1_shift, // column 46
436 accumulators_binary_limbs_2_shift, // column 47
437 accumulators_binary_limbs_3_shift, // column 48
438 quotient_low_binary_limbs_shift, // column 61
439 quotient_high_binary_limbs_shift, // column 62
440 relation_wide_limbs_shift, // column 75
441 p_x_low_limbs_range_constraint_0_shift, // column 4
442 p_x_low_limbs_range_constraint_1_shift, // column 5
443 p_x_low_limbs_range_constraint_2_shift, // column 6
444 p_x_low_limbs_range_constraint_3_shift, // column 7
445 p_x_low_limbs_range_constraint_4_shift, // column 8
446 p_x_low_limbs_range_constraint_tail_shift, // column 9
447 p_x_high_limbs_range_constraint_0_shift, // column 11
448 p_x_high_limbs_range_constraint_1_shift, // column 12
449 p_x_high_limbs_range_constraint_2_shift, // column 13
450 p_x_high_limbs_range_constraint_3_shift, // column 14
451 p_x_high_limbs_range_constraint_4_shift, // column 15
452 p_x_high_limbs_range_constraint_tail_shift, // column 16
453 p_y_low_limbs_range_constraint_0_shift, // column 18
454 p_y_low_limbs_range_constraint_1_shift, // column 19
455 p_y_low_limbs_range_constraint_2_shift, // column 20
456 p_y_low_limbs_range_constraint_3_shift, // column 21
457 p_y_low_limbs_range_constraint_4_shift, // column 22
458 p_y_low_limbs_range_constraint_tail_shift, // column 23
459 p_y_high_limbs_range_constraint_0_shift, // column 25
460 p_y_high_limbs_range_constraint_1_shift, // column 26
461 p_y_high_limbs_range_constraint_2_shift, // column 27
462 p_y_high_limbs_range_constraint_3_shift, // column 28
463 p_y_high_limbs_range_constraint_4_shift, // column 29
464 p_y_high_limbs_range_constraint_tail_shift, // column 30
465 z_low_limbs_range_constraint_0_shift, // column 32
466 z_low_limbs_range_constraint_1_shift, // column 33
467 z_low_limbs_range_constraint_2_shift, // column 34
468 z_low_limbs_range_constraint_3_shift, // column 35
469 z_low_limbs_range_constraint_4_shift, // column 36
470 z_low_limbs_range_constraint_tail_shift, // column 37
471 z_high_limbs_range_constraint_0_shift, // column 39
472 z_high_limbs_range_constraint_1_shift, // column 40
473 z_high_limbs_range_constraint_2_shift, // column 41
474 z_high_limbs_range_constraint_3_shift, // column 42
475 z_high_limbs_range_constraint_4_shift, // column 43
476 z_high_limbs_range_constraint_tail_shift, // column 44
477 accumulator_low_limbs_range_constraint_0_shift, // column 49
478 accumulator_low_limbs_range_constraint_1_shift, // column 50
479 accumulator_low_limbs_range_constraint_2_shift, // column 51
480 accumulator_low_limbs_range_constraint_3_shift, // column 52
481 accumulator_low_limbs_range_constraint_4_shift, // column 53
482 accumulator_low_limbs_range_constraint_tail_shift, // column 54
483 accumulator_high_limbs_range_constraint_0_shift, // column 55
484 accumulator_high_limbs_range_constraint_1_shift, // column 56
485 accumulator_high_limbs_range_constraint_2_shift, // column 57
486 accumulator_high_limbs_range_constraint_3_shift, // column 58
487 accumulator_high_limbs_range_constraint_4_shift, // column 59
488 accumulator_high_limbs_range_constraint_tail_shift, // column 60
489 quotient_low_limbs_range_constraint_0_shift, // column 63
490 quotient_low_limbs_range_constraint_1_shift, // column 64
491 quotient_low_limbs_range_constraint_2_shift, // column 65
492 quotient_low_limbs_range_constraint_3_shift, // column 66
493 quotient_low_limbs_range_constraint_4_shift, // column 67
494 quotient_low_limbs_range_constraint_tail_shift, // column 68
495 quotient_high_limbs_range_constraint_0_shift, // column 69
496 quotient_high_limbs_range_constraint_1_shift, // column 70
497 quotient_high_limbs_range_constraint_2_shift, // column 71
498 quotient_high_limbs_range_constraint_3_shift, // column 72
499 quotient_high_limbs_range_constraint_4_shift, // column 73
500 quotient_high_limbs_range_constraint_tail_shift, // column 74
501 relation_wide_limbs_range_constraint_0_shift, // column 76
502 relation_wide_limbs_range_constraint_1_shift, // column 77
503 relation_wide_limbs_range_constraint_2_shift, // column 78
504 relation_wide_limbs_range_constraint_3_shift) // column 79
505 };
506
510 template <typename DataType> class DerivedShiftedEntities {
511 public:
512 DEFINE_FLAVOR_MEMBERS(DataType,
513 ordered_range_constraints_0_shift, // column 80
514 ordered_range_constraints_1_shift, // column 81
515 ordered_range_constraints_2_shift, // column 82
516 ordered_range_constraints_3_shift, // column 83
517 ordered_range_constraints_4_shift, // column 84
518 z_perm_shift) // column 85
519 };
520
524 template <typename DataType>
525 class ShiftedEntities : public OpQueueShiftedEntities<DataType>,
526 public NonOpQueueShiftedEntities<DataType>,
527 public DerivedShiftedEntities<DataType> {
528 public:
542
548 {
549 static DataType zero_value = DataType(0);
550 return partition_minicircuit_wires_into_groups<DataType>(NonOpQueueShiftedEntities<DataType>::get_all(),
551 zero_value);
552 };
553 };
554
559 template <typename DataType> class MaskingEntities {
560 public:
561 DEFINE_FLAVOR_MEMBERS(DataType, gemini_masking_poly)
562 };
563
572 template <typename DataType>
573 class AllEntities : public MaskingEntities<DataType>,
574 public PrecomputedEntities<DataType>,
575 public WitnessEntities<DataType>,
576 public ShiftedEntities<DataType> {
577 public:
587
593
604 {
605 return concatenate(
606 MaskingEntities<DataType>::get_all(), // gemini_masking_poly
607 RefArray<DataType, 1>{ this->ordered_extra_range_constraints_numerator }, // non-computable precomputed
608 WireNonshiftedEntities<DataType>::get_all(), // op (from merge protocol)
609 OpQueueWiresToBeShiftedEntities<DataType>::get_all(), // x_lo_y_hi, x_hi_z_1, y_lo_z_2
613 }
614
626
629
646
651
656
657 friend std::ostream& operator<<(std::ostream& os, const AllEntities& a)
658 {
659 os << "{ ";
660 std::ios_base::fmtflags f(os.flags());
661 auto entities = a.get_all();
662 for (size_t i = 0; i < entities.size() - 1; i++) {
663 os << "e[" << std::setw(2) << i << "] = " << (entities[i]) << ",\n";
664 }
665 os << "e[" << std::setw(2) << (entities.size() - 1) << "] = " << entities[entities.size() - 1] << " }";
666
667 os.flags(f);
668 return os;
669 }
670 };
671
676 class AllValues : public AllEntities<FF> {
677 public:
679 using Base::Base;
680 };
681
682 // ========================================
683 // Derived entity counts (from entity class sizes)
684 // ========================================
688
689 // Witness = WireNonshifted + WireToBeShifted + OrderedRange + Derived + Concatenated
690 static constexpr size_t NUM_WITNESS_ENTITIES =
695
696 // Shifted = OpQueueShifted + NonOpQueueShifted + DerivedShifted
700
701 static constexpr size_t NUM_ALL_ENTITIES =
703
704 // All precomputed selectors except ordered_extra_range_constraints_numerator are computable
706
707 // Minicircuit wires: NonRangeMain + RangeConstraint (the non-op-queue wires that get shifted)
708 static constexpr size_t NUM_MINICIRCUIT_WIRES =
711 "Shifted minicircuit wires must match unshifted");
712 // 77 unshifted + 77 shifted minicircuit wire evaluations are sent mid-sumcheck
714
715 // Number of evaluations sent in proof (all minus computable precomputed minus reconstructed concat evals)
716 static constexpr size_t NUM_SENT_EVALUATIONS =
719
720 // Total number of minicircuit wires across all concatenation groups
724 "Range constraint wires must fill exactly 4 concatenation groups");
725
726 // PCS batch sizes
727 // Note: op-queue to-be-shifted wires (x_lo_y_hi, x_hi_z_1, y_lo_z_2) are registered in BOTH the
728 // unshifted and shifted PCS batches because the decomposition relation reads them in both forms.
735 static constexpr size_t NUM_PCS_UNSHIFTED = NUM_MASKING_POLYNOMIALS +
739
740 // Indices for partitioning AllEntities
743
744 // Commitments sent in wire round: concatenated + ordered range constraints
746
747 // A container to be fed to ShpleminiVerifier to avoid redundant scalar muls.
748 // Identifies commitments that appear in both the unshifted and shifted batches:
749 // Unshifted batch: masking(1) + ordered_extra(1) + op(1) + op_queue_tbs(3) + ordered(5) + z_perm(1) + concat(5)
750 // = 17
751 // Shifted batch: op_queue(3) + ordered(5) + z_perm(1) + concat(5) = 14
752 // Range 1: op_queue_tbs(3) + ordered(5) + z_perm(1) = 9 (contiguous in both batches)
753 // stored indices 2..10 (unshifted) ↔ 16..24 (shifted)
754 // Range 2: concatenated(5) — stored indices 11..15 (unshifted) ↔ 25..29 (shifted)
755 // (Stored indices are 0-based after ZK offset; offset=2 accounts for Q_commitment + gemini_masking_poly)
764
765 static constexpr size_t PROOF_LENGTH =
766 /* 1. Gemini masking poly commitment */ (num_frs_comm) +
767 /* 2. Wire commitments: concatenated + ordered */
769 /* 3. Z_PERM commitment */ (num_frs_comm) +
770 /* 4. Libra concatenation commitment */ (num_frs_comm) +
771 /* 5. Libra sum */ (num_frs_fr) +
772 /* 6. CONST_TRANSLATOR_LOG_N sumcheck univariates */
774 /* 7. sumcheck evaluations (computable precomputed and concat evals excluded) */
776 /* 8. Libra claimed evaluation */ (num_frs_fr) +
777 /* 9. Libra grand sum commitment */ (num_frs_comm) +
778 /* 10. Libra quotient commitment */ (num_frs_comm) +
779 /* 11. CONST_TRANSLATOR_LOG_N - 1 Gemini Fold commitments */
781 /* 12. CONST_TRANSLATOR_LOG_N Gemini a evaluations */
783 /* 13. NUM_SMALL_IPA_EVALUATIONS libra evals */ (NUM_SMALL_IPA_EVALUATIONS * num_frs_fr) +
784 /* 14. Shplonk Q commitment */ (num_frs_comm) +
785 /* 15. KZG W commitment */ (num_frs_comm);
786
787 // Proof length when using committed sumcheck: each round sends a commitment + 2 scalar evaluations
788 // instead of BATCHED_RELATION_PARTIAL_LENGTH scalars.
789 static constexpr size_t COMMITTED_SUMCHECK_PROOF_LENGTH =
792
793 // ===== Static assert to ensure a valid trace can be proven ======
794
795 // The number of "steps" inserted in ordered range constraint polynomials to ensure that the
796 // DeltaRangeConstraintRelation can always be satisfied if the polynomial is within the appropriate range.
797 static constexpr size_t SORTED_STEPS_COUNT = ((1 << MICRO_LIMB_BITS) / SORT_STEP) + 1;
798
799 // The number of masking values in the overflow columns used for the ordered range constraint
800 static constexpr size_t MASKING_OVERFLOW_COLUMN =
802
805 "Translator circuit is too small for defined number of steps "
806 "(TranslatorDeltaRangeConstraintRelation). ");
807
808 // ================================================================
809
817 template <typename DataType, typename WireRefs>
819 DataType& zero_value)
820 {
821 constexpr size_t num_non_range = NonRangeMainWires<DataType>::_members_size;
822 constexpr size_t num_range = RangeConstraintWires<DataType>::_members_size;
823 static_assert(num_range % CONCATENATION_GROUP_SIZE == 0);
824 constexpr size_t num_range_groups = num_range / CONCATENATION_GROUP_SIZE;
825
827 // Groups 0..num_range_groups-1: sequential chunks of range constraint wires
828 for (size_t g = 0; g < num_range_groups; g++) {
830 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
831 group.push_back(wire_refs[num_non_range + g * CONCATENATION_GROUP_SIZE + j]);
832 }
833 groups.push_back(std::move(group));
834 }
835 // Last group: non-range main wires + zero padding
837 for (size_t j = 0; j < num_non_range; j++) {
838 group.push_back(wire_refs[j]);
839 }
840 for (size_t j = num_non_range; j < CONCATENATION_GROUP_SIZE; j++) {
841 group.push_back(zero_value);
842 }
843 groups.push_back(std::move(group));
844 return groups;
845 }
846
850 template <typename FFType>
855
861 template <typename PolyContainer>
863 {
865 size_t dst = 0;
866 for (auto& wire : polys.get_minicircuit_wires()) {
867 result[dst++] = wire[0];
868 }
869 for (auto& wire : polys.get_minicircuit_wires_shifted()) {
870 result[dst++] = wire[0];
871 }
872 return result;
873 }
874
880 template <typename FFType>
883 {
884 size_t src = 0;
885 for (auto& wire : evals.get_minicircuit_wires()) {
886 wire = mid[src++];
887 }
888 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
889 wire = mid[src++];
890 }
891 }
892
901 template <typename FFType>
903 {
904 // 1. Compute the computable precomputed selector evaluations
905 compute_computable_precomputed(evals, challenge);
906
907 // 2. Scale minicircuit wire evaluations by L_0(u_top) = Π_{i=0}^{3} (1 - u_{LOG_MINI + i})
908 FFType l0 = FFType(1);
909 for (size_t i = 0; i < CONST_TRANSLATOR_LOG_N - LOG_MINI_CIRCUIT_SIZE; i++) {
910 l0 *= (FFType(1) - challenge[LOG_MINI_CIRCUIT_SIZE + i]);
911 }
912 for (auto& wire : evals.get_minicircuit_wires()) {
913 wire *= l0;
914 }
915 for (auto& wire : evals.get_minicircuit_wires_shifted()) {
916 wire *= l0;
917 }
918 }
919
928 template <typename FFType>
931 std::span<const FFType> challenge)
932 {
933 set_full_circuit_evaluations(evals, full_circuit);
934 complete_claimed_evaluations(evals, challenge);
935
936 // Reconstruct the 5 concatenated polynomial evaluations from (now L0-scaled) wire evaluations
937 auto groups = evals.get_groups_to_be_concatenated();
938 auto concat_evals = reconstruct_concatenated_evaluations(groups, challenge);
939 auto concat_refs = evals.get_concatenated();
940 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
941 concat_refs[g] = concat_evals[g];
942 }
943 }
944
957 template <typename FFType>
959 const std::vector<RefVector<FFType>>& groups, std::span<const FFType> challenge)
960 {
961 static constexpr size_t NUM_TOP_BITS = numeric::get_msb(CONCATENATION_GROUP_SIZE);
962
963 // Compute CONCATENATION_GROUP_SIZE-point Lagrange basis over the top challenges
964 // a = u[N - 4], b = u[N - 3], c = u[N - 2], d = u[N - 1]
965 // L(0) = (1 - d) * (1 - c) * (1 - b) * (1 - a)
966 // L(1) = (1 - d) * (1 - c) * (1 - b) * ( a)
967 // L(2) = (1 - d) * (1 - c) * ( b) * (1 - a)
968 // L(3) = (1 - d) * (1 - c) * ( b) * ( a)
969 // ...
971 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
972 lagrange_basis[j] = FFType(1);
973 for (size_t bit = 0; bit < NUM_TOP_BITS; bit++) {
974 const FFType& u = challenge[CONST_TRANSLATOR_LOG_N - NUM_TOP_BITS + bit];
975 lagrange_basis[j] *= ((j >> bit) & 1) ? u : (FFType(1) - u);
976 }
977 }
978
979 // L_0 is the "padding" factor from wires having support in [1, MINI)
980 // The reason we need to divide by L_0 is because L_j(u) already accounts for the challenges a, b, c, d:
981 // L_j(u) = (1 - d) * (1 - c) * (1 - b) * (1 - a) * L_j(0, u_bottom)
982 FFType padding_inv = lagrange_basis[0].invert();
983
984 auto reconstruct = [&](const auto& group) -> FFType {
985 FFType result = FFType(0);
986 for (size_t j = 0; j < CONCATENATION_GROUP_SIZE; j++) {
987 result += lagrange_basis[j] * group[j];
988 }
989 return result * padding_inv;
990 };
991
993 for (size_t g = 0; g < NUM_CONCATENATED_POLYS; g++) {
994 result[g] = reconstruct(groups[g]);
995 }
996 return result;
997 }
998
1002 template <typename FFType>
1004 {
1006 size_t dst = 0;
1007 for (auto& entity : evals.get_full_circuit_entities()) {
1008 result[dst++] = entity;
1009 }
1010 return result;
1011 }
1012
1016 template <typename FFType>
1019 {
1020 size_t src = 0;
1021 for (auto& entity : evals.get_full_circuit_entities()) {
1022 entity = full_circuit[src++];
1023 }
1024 }
1025
1029 class ProverPolynomials : public AllEntities<Polynomial> {
1030 public:
1036 {
1037
1038 const size_t circuit_size = 1 << CONST_TRANSLATOR_LOG_N;
1039 for (auto& ordered_range_constraint : get_ordered_range_constraints()) {
1040 ordered_range_constraint = Polynomial{ /*size*/ circuit_size - 1,
1041 /*largest possible index*/ circuit_size,
1042 1 };
1043 }
1044
1045 // Initialize 5 concatenated polynomials (full circuit_size, shiftable with start_index=1)
1046 // Row 0 of block 0 is the no-op row where all values are zero.
1047 for (auto& concat_poly : get_concatenated()) {
1048 concat_poly = Polynomial{ /*size*/ circuit_size - 1,
1049 /*virtual_size*/ circuit_size,
1050 /*start_index*/ 1 };
1051 }
1052 z_perm = Polynomial{ /*size*/ circuit_size - 1,
1053 /*virtual_size*/ circuit_size,
1054 /*start_index*/ 1 };
1055
1056 op = Polynomial{ MINI_CIRCUIT_SIZE, circuit_size };
1057
1058 // All minicircuit wires (non-op-queue) are only non-zero in [1, MINI_CIRCUIT_SIZE)
1060 if (poly.is_empty()) {
1061 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1062 /*virtual_size*/ circuit_size,
1063 /*start_index*/ 1 };
1064 }
1065 }
1066
1067 // Op queue wires to be shifted
1069 if (poly.is_empty()) {
1070 poly = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - 1,
1071 /*virtual_size*/ circuit_size,
1072 /*start_index*/ 1 };
1073 }
1074 }
1075
1076 // Initialize lagrange polynomials and the ordered extra range constraints numerator (the precomputed
1077 // polynomials) within the appropriate range they operate on
1078 lagrange_first = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size };
1079 lagrange_result_row = Polynomial{ /*size*/ 1, /*virtual_size*/ circuit_size, /*start_index*/ RESULT_ROW };
1080 lagrange_even_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END,
1081 /*virtual_size*/ circuit_size,
1082 /*start_index=*/RESULT_ROW };
1083 lagrange_odd_in_minicircuit = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RESULT_ROW - NUM_MASKED_ROWS_END - 1,
1084 /*virtual_size*/ circuit_size,
1085 /*start_index=*/RESULT_ROW + 1 };
1086 lagrange_last_in_minicircuit = Polynomial{ /*size*/ 1,
1087 /*virtual_size*/ circuit_size,
1088 /*start_index=*/MINI_CIRCUIT_SIZE - NUM_MASKED_ROWS_END - 1 };
1089 lagrange_mini_masking = Polynomial{ /*size*/ MINI_CIRCUIT_SIZE - RANDOMNESS_START,
1090 /*virtual_size*/ circuit_size,
1091 /*start_index=*/RANDOMNESS_START };
1092 // With concatenation, masking rows are scattered in concatenated polys: end of each of the 16 blocks
1093 // Must span full circuit since values go up to position 15*MINI+(MINI-1)
1094 lagrange_masking = Polynomial{ circuit_size, circuit_size };
1095 // Ordered masking: contiguous at the end (marks masking positions in ordered polynomials)
1096 lagrange_ordered_masking = Polynomial{ /*size*/ MAX_RANDOM_VALUES_PER_ORDERED,
1097 /*virtual_size*/ circuit_size,
1098 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED };
1099 lagrange_last = Polynomial{ /*size*/ 1,
1100 /*virtual_size*/ circuit_size,
1101 /*start_index*/ circuit_size - 1 };
1102 // lagrange_real_last marks the last position with sorted values in ordered polynomials
1103 // (where we check maximum value = 2^14 - 1). With contiguous masking at the end,
1104 // this is at position circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1.
1105 lagrange_real_last = Polynomial{ /*size*/ 1,
1106 /*virtual_size*/ circuit_size,
1107 /*start_index*/ circuit_size - MAX_RANDOM_VALUES_PER_ORDERED - 1 };
1108 ordered_extra_range_constraints_numerator =
1110 /*virtual_size*/ circuit_size,
1111 /*start_index*/ 0 };
1112
1113 set_shifted();
1114 }
1117 ProverPolynomials(ProverPolynomials&& o) noexcept = default;
1120 [[nodiscard]] static size_t get_polynomial_size() { return 1UL << CONST_TRANSLATOR_LOG_N; }
1125 [[nodiscard]] AllValues get_row(size_t row_idx) const
1126 {
1127 AllValues result;
1128 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
1129 // Translator polynomials have different support regions (start_index/end_index)
1130 // Return 0 for out-of-bounds access (which is the correct value outside support)
1131 if (row_idx >= polynomial.start_index() && row_idx < polynomial.end_index()) {
1132 result_field = polynomial[row_idx];
1133 } else {
1134 result_field = FF(0);
1135 }
1136 }
1137 return result;
1138 }
1139 // Set all shifted polynomials based on their to-be-shifted counterpart.
1140 // Uses get_all_to_be_shifted() (86 entries for Sumcheck), not get_to_be_shifted() (9 entries for PCS).
1142 {
1143 for (auto [shifted, to_be_shifted] : zip_view(get_shifted(), get_all_to_be_shifted())) {
1144 shifted = to_be_shifted.shifted();
1145 }
1146 }
1147 };
1148
1154 public:
1157
1158 ProverPolynomials polynomials; // storage for all polynomials evaluated by the prover
1160
1161 ProvingKey() = default;
1162 };
1163
1169 template <typename DataType_> class VKEntities {
1170 public:
1171 bool operator==(const VKEntities& other) const = default;
1172 using DataType = DataType_;
1173 DEFINE_FLAVOR_MEMBERS(DataType, ordered_extra_range_constraints_numerator);
1174 };
1175
1183
1189
1194
1199
1205 class CommitmentLabels : public AllEntities<std::string> {
1206 public:
1208 {
1209 // Concatenated polynomials (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1210 this->concatenated_range_constraints_0 = "CONCATENATED_RANGE_CONSTRAINTS_0";
1211 this->concatenated_range_constraints_1 = "CONCATENATED_RANGE_CONSTRAINTS_1";
1212 this->concatenated_range_constraints_2 = "CONCATENATED_RANGE_CONSTRAINTS_2";
1213 this->concatenated_range_constraints_3 = "CONCATENATED_RANGE_CONSTRAINTS_3";
1214 this->concatenated_non_range = "CONCATENATED_NON_RANGE";
1215
1216 // Ordered range constraints (sent via get_non_opqueue_wires_and_ordered_range_constraints)
1217 this->ordered_range_constraints_0 = "ORDERED_RANGE_CONSTRAINTS_0";
1218 this->ordered_range_constraints_1 = "ORDERED_RANGE_CONSTRAINTS_1";
1219 this->ordered_range_constraints_2 = "ORDERED_RANGE_CONSTRAINTS_2";
1220 this->ordered_range_constraints_3 = "ORDERED_RANGE_CONSTRAINTS_3";
1221 this->ordered_range_constraints_4 = "ORDERED_RANGE_CONSTRAINTS_4";
1222
1223 // Grand product (committed separately)
1224 this->z_perm = "Z_PERM";
1225 };
1226 };
1227
1228 template <typename Commitment, typename VerificationKey>
1229 class VerifierCommitments_ : public AllEntities<Commitment> {
1230 public:
1231 VerifierCommitments_(const std::shared_ptr<VerificationKey>& verification_key)
1232 {
1233 // Only ordered_extra_range_constraints_numerator needs a VK commitment for PCS.
1234 // All other precomputed selectors are computable (evaluations derived from sumcheck challenge).
1235 this->ordered_extra_range_constraints_numerator =
1236 verification_key->ordered_extra_range_constraints_numerator;
1237 }
1238 };
1239
1247 template <typename ProverPolynomialsOrPartiallyEvaluatedMultivariates, typename EdgeType>
1248 static bool skip_entire_row([[maybe_unused]] const ProverPolynomialsOrPartiallyEvaluatedMultivariates& polynomials,
1249 [[maybe_unused]] const EdgeType edge_idx)
1250 {
1251 auto s0 = polynomials.ordered_range_constraints_0_shift[edge_idx];
1252 auto s1 = polynomials.ordered_range_constraints_1_shift[edge_idx];
1253 auto s2 = polynomials.ordered_range_constraints_2_shift[edge_idx];
1254 auto s3 = polynomials.ordered_range_constraints_3_shift[edge_idx];
1255 auto s4 = polynomials.ordered_range_constraints_4_shift[edge_idx];
1256 auto s5 = polynomials.ordered_range_constraints_0_shift[edge_idx + 1];
1257 auto s6 = polynomials.ordered_range_constraints_1_shift[edge_idx + 1];
1258 auto s7 = polynomials.ordered_range_constraints_2_shift[edge_idx + 1];
1259 auto s8 = polynomials.ordered_range_constraints_3_shift[edge_idx + 1];
1260 auto s9 = polynomials.ordered_range_constraints_4_shift[edge_idx + 1];
1261 auto shift_0 = (s0 == 0) && (s1 == 0) && (s2 == 0) && (s3 == 0) && (s4 == 0) && (s5 == 0) && (s6 == 0) &&
1262 (s7 == 0) && (s8 == 0) && (s9 == 0);
1263 return shift_0 && (polynomials.z_perm[edge_idx] == polynomials.z_perm_shift[edge_idx]) &&
1264 (polynomials.z_perm[edge_idx + 1] == polynomials.z_perm_shift[edge_idx + 1]) &&
1265 polynomials.lagrange_last[edge_idx] == 0 && polynomials.lagrange_last[edge_idx + 1] == 0;
1266 }
1268};
1269
1270// Guard against drift between the runtime PCS entity lists and their compile-time counts;
1271// REPEATED_COMMITMENTS and PROOF_LENGTH depend on these counts and desync silently otherwise.
1273 .get_pcs_unshifted())>::value ==
1275 "get_pcs_unshifted() entity count must equal NUM_PCS_UNSHIFTED. If you added a witness entity, "
1276 "update both the runtime list and NUM_UNSHIFTED_WITNESSES_WITHOUT_CONCATENATED.");
1278 .get_pcs_to_be_shifted())>::value ==
1280 "get_pcs_to_be_shifted() entity count must equal NUM_PCS_TO_BE_SHIFTED. If you added a to-be-shifted "
1281 "entity, update both the runtime list and NUM_TO_BE_SHIFTED.");
1282
1283} // 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:101
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
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.