Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecc_msm_short_relation.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
12
13namespace bb {
14
15template <typename FF_> class ECCVMMSMAddShortRelationImpl {
16 public:
17 using FF = FF_;
18
19 // Local indices map to base MSM subrelations ADD_ACC_X..ADD_SLOPE_4.
29
30 static constexpr std::array<size_t, 6> SUBRELATION_PARTIAL_LENGTHS{ 8, 8, 8, 8, 8, 8 };
31 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
32
33 template <typename AllEntities> inline static bool skip(const AllEntities& in) { return in.msm_add.is_zero(); }
34
35 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
36 static void accumulate(ContainerOverSubrelations& accumulator,
37 const AllEntities& in,
38 const Parameters& params,
39 const FF& scaling_factor);
40};
41
43
44template <typename FF_> class ECCVMMSMDoubleShortRelationImpl {
45 public:
46 using FF = FF_;
47
48 // Local indices map to base MSM subrelations DOUBLE_ACC_X..DOUBLE_SLOPE_4.
58
59 static constexpr std::array<size_t, 6> SUBRELATION_PARTIAL_LENGTHS{ 8, 8, 8, 8, 8, 8 };
60 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
61
62 template <typename AllEntities> inline static bool skip(const AllEntities& in) { return in.msm_double.is_zero(); }
63
64 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
65 static void accumulate(ContainerOverSubrelations& accumulator,
66 const AllEntities& in,
67 const Parameters& params,
68 const FF& scaling_factor);
69};
70
72
73template <typename FF_> class ECCVMMSMSkewShortRelationImpl {
74 public:
75 using FF = FF_;
76
77 // Local indices map to base MSM subrelations SKEW_ACC_X..SKEW_SLOPE_4.
87
88 static constexpr std::array<size_t, 6> SUBRELATION_PARTIAL_LENGTHS{ 8, 8, 8, 8, 8, 8 };
89 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
90
91 template <typename AllEntities> inline static bool skip(const AllEntities& in) { return in.msm_skew.is_zero(); }
92
93 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
94 static void accumulate(ContainerOverSubrelations& accumulator,
95 const AllEntities& in,
96 const Parameters& params,
97 const FF& scaling_factor);
98};
99
101
102template <typename FF_> class ECCVMMSMShortRelationImpl {
103 public:
104 using FF = FF_;
105
106 // Shared collision checks and the cheap MSM tail. These local indices map in order to base MSM subrelations
107 // COLLISION_CHECK_1..IDLE_ROW_PRESERVES_ACC_Y, after the ADD/DOUBLE/SKEW split pieces in the short flavor.
144
145 static constexpr std::array<size_t, 33> SUBRELATION_PARTIAL_LENGTHS{
146 8, // COLLISION_CHECK_1
147 8, // COLLISION_CHECK_2
148 8, // COLLISION_CHECK_3
149 8, // COLLISION_CHECK_4
150 3, // INACTIVE_SLICE_1 (deg 2)
151 3, // INACTIVE_SLICE_2 (deg 2)
152 3, // INACTIVE_SLICE_3 (deg 2)
153 3, // INACTIVE_SLICE_4 (deg 2)
154 3, // PHASE_SELECTOR_MUTUAL_EXCLUSIVITY (deg 2)
155 4, // ROUND_TRANSITION_FORCES_DELTA_ONE (deg 3)
156 5, // ROUND_TRANSITION_SKEW_IMPLIES_ROUND_31 (deg 4)
157 4, // ROUND_TRANSITION_EXACTLY_ONE_DOUBLE_OR_SKEW (deg 3)
158 5, // ROUND_TRANSITION_NEEDS_DOUBLE_OR_SKEW (deg 4)
159 3, // DOUBLE_IMPLIES_NEXT_IS_ADD (deg 2)
160 3, // COUNT_SHIFT_ZERO_ON_ROUND_CHANGE (deg 2)
161 4, // COUNT_INCREMENT_WITHIN_ROUND (deg 3)
162 5, // COUNT_ZERO_AT_ROUND_BOUNDARY_OR_TRANSITION (deg 4)
163 3, // MSM_TRANSITION_ROUND_ZERO (deg 2)
164 4, // MSM_TRANSITION_PC (deg 3)
165 3, // ADD_CONTINUITY_2 (deg 2)
166 3, // ADD_CONTINUITY_3 (deg 2)
167 3, // ADD_CONTINUITY_4 (deg 2)
168 5, // ADD_CROSS_ROW_CONTINUITY (deg 4)
169 2, // ADD1_DECOMPOSITION (deg 1)
170 4, // SKEW_PERSISTS_UNTIL_MSM_TRANSITION (deg 3)
171 3, // SKEW_IMPLIES_ROUND_32 (deg 2)
172 3, // DOUBLE_REQUIRES_ROUND_CHANGE (deg 2)
173 8, // IDLE_ROW_PRESERVES_ACC_X
174 8, // IDLE_ROW_PRESERVES_ACC_Y
175 4, // DOUBLE_SHIFT_FORBIDS_ROUND_31 (deg 3)
176 6, // MSM_TRANSITION_AT_ACTIVE_START (deg 5)
177 5, // MSM_PC_CONTINUITY (deg 4)
178 4, // MSM_PC_SKEW_CONTINUITY (deg 3)
179 };
180 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
181
182 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
183 static void accumulate(ContainerOverSubrelations& accumulator,
184 const AllEntities& in,
185 const Parameters& params,
186 const FF& scaling_factor);
187};
188
190
191} // namespace bb
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 6 > SUBRELATION_PARTIAL_LENGTHS
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
static constexpr std::array< size_t, 6 > SUBRELATION_PARTIAL_LENGTHS
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 33 > SUBRELATION_PARTIAL_LENGTHS
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
static bool skip(const AllEntities &in)
static constexpr std::array< size_t, 6 > 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