Skip to content

Commit

Permalink
[Fix] scalar multiply completeness (#82)
Browse files Browse the repository at this point in the history
* fix: replace `scalar_multiply` with passthrough to MSM for now

* feat(msm): use strict mode always

* Previously did not use strict because we make assumptions about the
  curve `C`. Since this was not documented and is easy to miss, we use
strict mode always.
  • Loading branch information
jonathanpwang authored Jun 9, 2023
1 parent 8b9bdc2 commit 8d028d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions halo2-ecc/src/ecc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ where
assert!(!scalar.is_empty());
assert!((max_bits as u64) <= modulus::<F>().bits());
assert!(window_bits != 0);

multi_scalar_multiply::<F, FC, C>(chip, ctx, &[P], vec![scalar], max_bits, window_bits)
/*
let total_bits = max_bits * scalar.len();
let num_windows = (total_bits + window_bits - 1) / window_bits;
let rounded_bitlen = num_windows * window_bits;
Expand Down Expand Up @@ -582,6 +583,7 @@ where
// if at the end, return identity point (0,0) if still not started
let zero = chip.load_constant(ctx, FC::FieldType::zero());
ec_select(chip, ctx, curr_point, EcPoint::new(zero.clone(), zero), *is_started.last().unwrap())
*/
}

/// Checks that `P` is indeed a point on the elliptic curve `C`.
Expand Down Expand Up @@ -734,7 +736,7 @@ where
ctx,
&rand_start_vec[k],
&rand_start_vec[0],
k >= F::CAPACITY as usize,
true, // k >= F::CAPACITY as usize, // this assumed random points on `C` were of prime order equal to modulus of `F`. Since this is easily missed, we turn on strict mode always
);
let mut curr_point = start_point.clone();

Expand Down

0 comments on commit 8d028d4

Please sign in to comment.