Skip to content

Commit d7f4ec1

Browse files
author
notnotraju
committed
at msm_transition, set round = 0. (before we just set count = 0.)
1 parent 1b43eeb commit d7f4ec1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
179179
* `q_addK` and also `q_add` are all correctly constrained for K ∈ {1, 2, 3, 4}.
180180
* 1. The Precomputed table is correctly constrained; in particular, the values `precompute_pc`,
181181
* `precompute_round`, `precompute_skew`, `precompute_select`, and `wK` are all correctly constrained.
182-
* 2. `round` is monotonic and only updates when RAJU ADD HERE. should this be more constrained??!
182+
* 2. `round` monotonically increases from 0 to 32 before reseting back to 0. `round_shift - round == 1`
183+
* precisely when `q_double == 1`.
183184
* 3. `pc` is monotonic and only updates when there is an `msm_transition`. Here, it updates by `msm_size`,
184185
* which must be constrained somewhere else by a multiset argument. We detail this below.
185186
* 4. `q_add`, `q_skew`, and `q_double` are pairwise mutually exclusive.
@@ -433,7 +434,7 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
433434
// `round_transition == 0` if `round_delta == 0` or the next row is an MSM transition.
434435
// if `round_transition != 1`, then `round_transition == round_delta == 1` by the following constraint.
435436
// in particular, `round_transition` is boolean. (`round_delta` is not boolean precisely one step before an MSM
436-
// transition, but that does not concern us.)
437+
// transition, but that does not concern us here.)
437438
const auto round_transition = round_delta * (-msm_transition_shift + 1);
438439
std::get<18>(accumulator) += round_transition * (round_delta - 1) * scaling_factor;
439440

@@ -470,7 +471,8 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
470471
// this means that the first row with `round == 32` has q_skew == 1. then all subsequent q_skew entries must be 1,
471472
// _until_ we start our new MSM.
472473
std::get<33>(accumulator) += (-msm_transition_shift + 1) * q_skew * (-q_skew_shift + 1) * scaling_factor;
473-
// if q_skew == 1, then round == 32. This is redundant.
474+
// if q_skew == 1, then round == 32. This is almost certainly redundant but psychologically useful to "constrain
475+
// both ends".
474476
std::get<34>(accumulator) += q_skew * (-round + 32) * scaling_factor;
475477
// UPDATING THE COUNT
476478

@@ -490,9 +492,8 @@ void ECCVMMSMRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator
490492
std::get<25>(accumulator) +=
491493
is_not_first_row * (-msm_transition_shift + 1) * round_delta * count_shift * scaling_factor;
492494

493-
// if msm_transition = 1, then count = 0 (as we are starting a new MSM and hence a new wNAF
494-
// digit). RAJU QUESTION: should I make this * round instead of * count? Probably...? TEST before pushing.
495-
std::get<26>(accumulator) += msm_transition * count * scaling_factor;
495+
// if msm_transition = 1, then round = 0.
496+
std::get<26>(accumulator) += msm_transition * round * scaling_factor;
496497

497498
// if msm_transition_shift = 1, pc = pc_shift + msm_size
498499
// NB: `ecc_set_relation` ensures `msm_size` maps to `transcript.msm_count` for the current value of `pc`

0 commit comments

Comments
 (0)