@@ -27,9 +27,15 @@ class ECCVMMSMMBuilder {
2727 static constexpr size_t NUM_WNAF_DIGITS_PER_SCALAR = bb::eccvm::NUM_WNAF_DIGITS_PER_SCALAR;
2828
2929 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.
3339 uint32_t msm_round = 0 ; // current "round" of MSM, in {0, ..., 32 = `NUM_WNAF_DIGITS_PER_SCALAR`}. With the
3440 // Straus algorithm, we proceed wNAF digit by wNAF digit, from left to right. (final
3541 // round deals with the `skew` bit.)
@@ -73,7 +79,7 @@ class ECCVMMSMMBuilder {
7379 * @brief Computes the row values for the Straus MSM columns of the ECCVM.
7480 *
7581 * 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).
7783 *
7884 * @param msms A vector of vectors of `ScalarMul`s, a.k.a. a vector of `MSM`s.
7985 * @param point_table_read_counts Table of read counts to be populated.
@@ -96,17 +102,23 @@ class ECCVMMSMMBuilder {
96102 // row = point_idx * rows_per_point_table + (some function of the slice value)
97103 //
98104 // 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
104110 // 5 | # | # | -5
105111 // 7 | # | # | -7
106112 // 9 | # | # | -9
107113 // 11 | # | # | -11
108114 // 13 | # | # | -13
109115 // 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
110122
111123 const size_t num_rows_in_read_counts_table =
112124 static_cast <size_t >(total_number_of_muls) *
@@ -146,7 +158,7 @@ class ECCVMMSMMBuilder {
146158 std::vector<size_t > msm_row_counts;
147159 msm_row_counts.reserve (msms.size () + 1 );
148160 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
150162 // multiplication will start at.
151163 std::vector<size_t > pc_values;
152164 pc_values.reserve (msms.size () + 1 );
@@ -203,7 +215,7 @@ class ECCVMMSMMBuilder {
203215 bool add = num_points_in_row > relative_point_idx;
204216 const size_t point_idx = offset + relative_point_idx;
205217 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.
207219 // -15 maps to the 1st point in the lookup table (array element 0)
208220 // -1 maps to the point in the lookup table that corresponds to the negation of the
209221 // original input point (i.e. the point we need to add into the accumulator if wnaf_skew
0 commit comments