Skip to content

Commit 0d6f108

Browse files
author
notnotraju
committed
wip
1 parent 03798c9 commit 0d6f108

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

barretenberg/cpp/src/barretenberg/relations/ecc_vm/ecc_msm_relation_impl.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,13 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
167167
/**
168168
* @brief Addition relation
169169
*
170-
* All addition operations in ECCVMMSMRelationImpl are conditional additions!
171-
* This method returns two Accumulators that represent x/y coord of output.
172-
* Output is either an addition of inputs, or xa/ya dpeending on value of `selector`.
173-
* Additionally, we require `lambda = 0` if `selector = 0`.
174-
* The `collision_relation` accumulator tracks a subrelation that validates xb != xa.
175-
* Repeated calls to this method will increase the max degree of the Accumulator output
176-
* Degree of x_out, y_out = max degree of x_a/x_b + 1
177-
* 4 Iterations will produce an output degree of 6
170+
* All addition operations in ECCVMMSMRelationImpl are conditional additions, as we sometimes want to add values and
171+
* other times simply want to propagate values. (consider, e.g., when q_add2 == 0.) This method returns two
172+
* Accumulators that represent x/y coord of output. Output is either an addition of inputs (if `selector == 1`), or
173+
* xa/ya (if `selector == 0`). Additionally, we require `lambda = 0` if `selector = 0`. The `collision_relation`
174+
* accumulator tracks a subrelation that validates xb != xa. Repeated calls to this method will increase the max
175+
* degree of the Accumulator output Degree of x_out, y_out = max degree of x_a/x_b + 1 4 Iterations will produce an
176+
* output degree of 6
178177
*/
179178
auto add = [&](auto& xb,
180179
auto& yb,
@@ -186,6 +185,7 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
186185
auto& collision_relation) {
187186
// L * (1 - s) = 0
188187
// (combine) (L * (xb - xa - 1) - yb - ya) * s + L = 0
188+
// i.e., computation of lambda is valid.
189189
relation += selector * (lambda * (xb - xa - 1) - (yb - ya)) + lambda;
190190
collision_relation += selector * (xb - xa);
191191
// x3 = L.L + (-xb - xa) * q + (1 - q) xa
@@ -224,7 +224,7 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
224224
constexpr uint256_t oyu = offset_generator.y;
225225
const Accumulator xo(oxu);
226226
const Accumulator yo(oyu);
227-
227+
// set (x, y) to be either accumulator if `selector == 0` or OFFSET if `selector == 1`.
228228
auto x = xo * selector + xb * (-selector + 1);
229229
auto y = yo * selector + yb * (-selector + 1);
230230
relation += lambda * (x - xa) - (y - ya); // degree 3
@@ -235,12 +235,12 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
235235
};
236236

237237
// ADD operations (if row represents ADD round, not SKEW or DOUBLE)
238-
Accumulator add_relation(0);
238+
Accumulator add_relation(0); // validates the correctness of all elliptic curve additions.
239239
Accumulator x1_collision_relation(0);
240240
Accumulator x2_collision_relation(0);
241241
Accumulator x3_collision_relation(0);
242242
Accumulator x4_collision_relation(0);
243-
// If msm_transition = 1, we have started a new MSM. We need to treat the current value of [Acc] as the point at
243+
// If `msm_transition == 1`, we have started a new MSM. We need to treat the current value of [Acc] as the point at
244244
// infinity!
245245
auto [x_t1, y_t1] = first_add(acc_x, acc_y, x1, y1, lambda1, msm_transition, add_relation, x1_collision_relation);
246246
auto [x_t2, y_t2] = add(x2, y2, x_t1, y_t1, lambda2, add2, add_relation, x2_collision_relation);

0 commit comments

Comments
 (0)