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
57 // Doubling round: accumulator update and slope constraint
64 // Skew round: accumulator update and slope constraint
71 // Collision checks: x-coordinate non-equality for point additions
76 // Inactive slice zeroing: force slice_i = 0 when add_i = 0
81 // Phase selector mutual exclusivity: at most one of q_add, q_double, q_skew active
83 // Round transition forces round_delta == 1
85 // Round transition with skew implies round == 31
87 // Round transition requires exactly one of double or skew on next row
89 // Round transition needs double or skew (cannot have neither)
91 // Double implies next row is an add row
93 // Count shift must be zero when round changes
95 // Count increments within the same round by number of active adds
97 // Count must be zero at round boundary or MSM transition
99 // MSM transition implies round = 0
101 // MSM transition: pc = pc_shift + msm_size
103 // Addition continuity: add2 requires add1
105 // Addition continuity: add3 requires add2
107 // Addition continuity: add4 requires add3
109 // Cross-row continuity: if add spans two rows, add4 must be 1
111 // add1 = q_add + q_skew
113 // q_skew persists until MSM transition: q_skew && !msm_transition_shift => q_skew_shift
115 // q_skew implies round == 32
117 // Doubling requires a round change (round_delta must be 1 if q_double_shift)
119 // Idle row: accumulator preserved when no phase selector is active
123 };
124
125 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,
126 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
127 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 };
128 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
129
130 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
131 static void accumulate(ContainerOverSubrelations& accumulator,
132 const AllEntities& in,
133 const Parameters& /* unused */,
134 const FF& scaling_factor);
135};
136
138
139} // 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