Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecc_msm_relation.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Raju], commit: 2a49eb6 }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
9
10namespace bb {
11
43template <typename FF_> class ECCVMMSMRelationImpl {
44 public:
45 using FF = FF_;
46
47 // Named subrelation indices — matches SUBRELATION_PARTIAL_LENGTHS ordering.
48 // Grouped by logical function within the Strauss MSM algorithm.
49 enum SubrelationIndex : size_t {
50 // Addition round: accumulator update and slope constraints
54 // Skew round: accumulator update and slope constraint
58 // Collision checks: x-coordinate non-equality for point additions
63 // Doubling round: accumulator update and slope constraint
67 // Inactive slice zeroing: force slice_i = 0 when add_i = 0
72 // Phase selector mutual exclusivity: at most one of q_add, q_double, q_skew active
74 // Round transition forces round_delta == 1
76 // Round transition with skew implies round == 31
78 // Round transition requires exactly one of double or skew on next row
80 // Round transition needs double or skew (cannot have neither)
82 // Double implies next row is an add row
84 // Count shift must be zero when round changes
86 // Count increments within the same round by number of active adds
88 // Count must be zero at round boundary or MSM transition
90 // MSM transition implies round = 0
92 // MSM transition: pc = pc_shift + msm_size
94 // Addition continuity: add2 requires add1
96 // Addition continuity: add3 requires add2
98 // Addition continuity: add4 requires add3
100 // Cross-row continuity: if add spans two rows, add4 must be 1
102 // add1 = q_add + q_skew
104 // q_skew persists until MSM transition: q_skew && !msm_transition_shift => q_skew_shift
106 // q_skew implies round == 32
108 // Doubling requires a round change (round_delta must be 1 if q_double_shift)
110 // Additional addition slope constraints (split to prevent cancellation)
114 // Additional doubling slope constraints (split to prevent cancellation)
118 // Additional skew slope constraints (split to prevent cancellation)
122 // Idle row: accumulator preserved when no phase selector is active
126 };
127
128 static constexpr std::array<size_t, 47> SUBRELATION_PARTIAL_LENGTHS{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
129 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
130 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 };
131 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
132
133 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
134 static void accumulate(ContainerOverSubrelations& accumulator,
135 const AllEntities& in,
136 const Parameters& /* unused */,
137 const FF& scaling_factor);
138};
139
141
142} // namespace bb
MSM relations that evaluate the Strauss multiscalar multiplication algorithm.
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &, const FF &scaling_factor)
MSM relations that evaluate the Strauss multiscalar multiplication algorithm.
static constexpr std::array< size_t, 47 > SUBRELATION_PARTIAL_LENGTHS
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
Entry point for Barretenberg command-line interface.
Definition api.hpp:5