Browse Source

The scalar to be multiplied by should be at most `num_limbs` long (#171)

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
master
mmagician 1 year ago
committed by GitHub
parent
commit
8765798eb0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      curve-constraint-tests/src/lib.rs

+ 6
- 4
curve-constraint-tests/src/lib.rs

@ -315,12 +315,14 @@ pub mod curves {
}
assert!(cs.is_satisfied().unwrap());
let modulus = <C::ScalarField as PrimeField>::MODULUS.as_ref().to_vec();
let modulus = C::ScalarField::MODULUS.as_ref().to_vec();
let mut max = modulus.clone();
for limb in &mut max {
*limb = u64::MAX;
}
let num_limbs = max.len();
let modulus_num_bits_mod_64 = <C::ScalarField as PrimeField>::MODULUS_BIT_SIZE % 64;
if modulus_num_bits_mod_64 != 0 {
*max.last_mut().unwrap() >>= 64 - modulus_num_bits_mod_64;
@ -332,10 +334,10 @@ pub mod curves {
.to_vec(),
vec![u64::rand(&mut rng)],
(-C::ScalarField::one()).into_bigint().as_ref().to_vec(),
<C::ScalarField as PrimeField>::MODULUS.as_ref().to_vec(),
modulus,
max,
vec![0; 50],
vec![1000012341233u64; 36],
vec![0u64; num_limbs],
vec![1000012341233u64; num_limbs],
];
let mut input = vec![];

Loading…
Cancel
Save