@@ -27,9 +27,15 @@ class ECCVMMSMMBuilder {
27
27
static constexpr size_t NUM_WNAF_DIGITS_PER_SCALAR = bb::eccvm::NUM_WNAF_DIGITS_PER_SCALAR;
28
28
29
29
struct alignas (64 ) MSMRow {
30
- uint32_t pc = 0 ; // counter over all half-length (128 bit) scalar muls used to compute the required MSMs
31
- uint32_t msm_size = 0 ; // the number of points that will be scaled and summed
32
- uint32_t msm_count = 0 ; // number of multiplications processed so far in current MSM round
30
+ uint32_t pc = 0 ; // decreasing point-counter, over all half-length (128 bit) scalar muls used to compute
31
+ // the required MSMs. however, this value is _constant_ on a given MSM and more precisely
32
+ // refers to the number of half-length scalar muls completed up until we have started
33
+ // the current MSM.
34
+ uint32_t msm_size = 0 ; // the number of points in (a.k.a. the length of) the MSM in whose computation
35
+ // this VM row participates
36
+ uint32_t msm_count = 0 ; // number of multiplications processed so far (not including this row) in current MSM
37
+ // round (a.k.a. wNAF digit slot). this specifically refers to the number of wNAF-digit
38
+ // * point scalar products we have looked up and accumulated.
33
39
uint32_t msm_round = 0 ; // current "round" of MSM, in {0, ..., 32 = `NUM_WNAF_DIGITS_PER_SCALAR`}. With the
34
40
// Straus algorithm, we proceed wNAF digit by wNAF digit, from left to right. (final
35
41
// round deals with the `skew` bit.)
@@ -73,7 +79,7 @@ class ECCVMMSMMBuilder {
73
79
* @brief Computes the row values for the Straus MSM columns of the ECCVM.
74
80
*
75
81
* For a detailed description of the Straus algorithm and its relation to the ECCVM, please see
76
- * https://hackmd.io/@aztec-network/rJ5xhuCsn
82
+ * https://hackmd.io/@aztec-network/rJ5xhuCsn or, alternatively, the [ECCVM readme](README.md).
77
83
*
78
84
* @param msms A vector of vectors of `ScalarMul`s, a.k.a. a vector of `MSM`s.
79
85
* @param point_table_read_counts Table of read counts to be populated.
@@ -96,17 +102,23 @@ class ECCVMMSMMBuilder {
96
102
// row = point_idx * rows_per_point_table + (some function of the slice value)
97
103
//
98
104
// Illustration:
99
- // Block Structure Table structure :
100
- // | 0 | 1 | | Block_{0} | <-- pc = total_number_of_muls
101
- // | - | - | | Block_{1} | <-- pc = total_number_of_muls-(num muls in msm 0)
102
- // 1 | # | # | -1 | ... | ...
103
- // 3 | # | # | -3 | Block_{total_number_of_muls-1} | <-- pc = num muls in last msm
105
+ // Block Structure:
106
+ // | 0 | 1 |
107
+ // | - | - |
108
+ // 1 | # | # | -1
109
+ // 3 | # | # | -3
104
110
// 5 | # | # | -5
105
111
// 7 | # | # | -7
106
112
// 9 | # | # | -9
107
113
// 11 | # | # | -11
108
114
// 13 | # | # | -13
109
115
// 15 | # | # | -15
116
+ //
117
+ // Table structure:
118
+ // | Block_{0} | <-- pc = total_number_of_muls
119
+ // | Block_{1} | <-- pc = total_number_of_muls-(num muls in msm 0)
120
+ // | ... | ...
121
+ // | Block_{total_number_of_muls-1} | <-- pc = num muls in last msm
110
122
111
123
const size_t num_rows_in_read_counts_table =
112
124
static_cast <size_t >(total_number_of_muls) *
@@ -146,7 +158,7 @@ class ECCVMMSMMBuilder {
146
158
std::vector<size_t > msm_row_counts;
147
159
msm_row_counts.reserve (msms.size () + 1 );
148
160
msm_row_counts.push_back (1 );
149
- // compute the program counter (i.e. the index among all single scalar muls) that each multiscalar
161
+ // compute the point counter (i.e. the index among all single scalar muls) that each multiscalar
150
162
// multiplication will start at.
151
163
std::vector<size_t > pc_values;
152
164
pc_values.reserve (msms.size () + 1 );
@@ -203,7 +215,7 @@ class ECCVMMSMMBuilder {
203
215
bool add = num_points_in_row > relative_point_idx;
204
216
const size_t point_idx = offset + relative_point_idx;
205
217
if (add) {
206
- // pc starts at total_number_of_muls and decreases non-uniformly to 0
218
+ // `pc` starts at total_number_of_muls and decreases non-uniformly to 0.
207
219
// -15 maps to the 1st point in the lookup table (array element 0)
208
220
// -1 maps to the point in the lookup table that corresponds to the negation of the
209
221
// original input point (i.e. the point we need to add into the accumulator if wnaf_skew
0 commit comments