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.
140
141 static constexpr std::array<size_t, 29> SUBRELATION_PARTIAL_LENGTHS{
142 8, // COLLISION_CHECK_1
143 8, // COLLISION_CHECK_2
144 8, // COLLISION_CHECK_3
145 8, // COLLISION_CHECK_4
146 3, // INACTIVE_SLICE_1 (deg 2)
147 3, // INACTIVE_SLICE_2 (deg 2)
148 3, // INACTIVE_SLICE_3 (deg 2)
149 3, // INACTIVE_SLICE_4 (deg 2)
150 3, // PHASE_SELECTOR_MUTUAL_EXCLUSIVITY (deg 2)
151 4, // ROUND_TRANSITION_FORCES_DELTA_ONE (deg 3)
152 5, // ROUND_TRANSITION_SKEW_IMPLIES_ROUND_31 (deg 4)
153 4, // ROUND_TRANSITION_EXACTLY_ONE_DOUBLE_OR_SKEW (deg 3)
154 5, // ROUND_TRANSITION_NEEDS_DOUBLE_OR_SKEW (deg 4)
155 3, // DOUBLE_IMPLIES_NEXT_IS_ADD (deg 2)
156 3, // COUNT_SHIFT_ZERO_ON_ROUND_CHANGE (deg 2)
157 4, // COUNT_INCREMENT_WITHIN_ROUND (deg 3)
158 5, // COUNT_ZERO_AT_ROUND_BOUNDARY_OR_TRANSITION (deg 4)
159 3, // MSM_TRANSITION_ROUND_ZERO (deg 2)
160 4, // MSM_TRANSITION_PC (deg 3)
161 3, // ADD_CONTINUITY_2 (deg 2)
162 3, // ADD_CONTINUITY_3 (deg 2)
163 3, // ADD_CONTINUITY_4 (deg 2)
164 5, // ADD_CROSS_ROW_CONTINUITY (deg 4)
165 2, // ADD1_DECOMPOSITION (deg 1)
166 4, // SKEW_PERSISTS_UNTIL_MSM_TRANSITION (deg 3)
167 3, // SKEW_IMPLIES_ROUND_32 (deg 2)
168 3, // DOUBLE_REQUIRES_ROUND_CHANGE (deg 2)
169 8, // IDLE_ROW_PRESERVES_ACC_X
170 8, // IDLE_ROW_PRESERVES_ACC_Y
171 };
172 static_assert(NUM_SUBRELATIONS == SUBRELATION_PARTIAL_LENGTHS.size());
173
174 template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
175 static void accumulate(ContainerOverSubrelations& accumulator,
176 const AllEntities& in,
177 const Parameters& params,
178 const FF& scaling_factor);
179};
180
182
183} // 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, 29 > 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