Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix: random generator in ZAL MSM test #344

Merged
merged 1 commit into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions halo2_middleware/src/zal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,17 @@ mod test {
use rand_xorshift::XorShiftRng;

fn gen_points_scalars<C: CurveAffine>(k: usize) -> (Vec<C>, Vec<C::Scalar>) {
let rand = || XorShiftRng::from_seed([1; 16]);
let mut rng = XorShiftRng::seed_from_u64(3141592u64);

let points = (0..1 << k)
.map(|_| C::Curve::random(rand()))
.map(|_| C::Curve::random(&mut rng))
.collect::<Vec<_>>();
let mut affine_points = vec![C::identity(); 1 << k];
C::Curve::batch_normalize(&points[..], &mut affine_points[..]);
let points = affine_points;

let scalars = (0..1 << k)
.map(|_| C::Scalar::random(rand()))
.map(|_| C::Scalar::random(&mut rng))
.collect::<Vec<_>>();

(points, scalars)
Expand Down Expand Up @@ -364,8 +365,9 @@ mod test {

#[test]
fn test_msm_zal() {
let (points, scalars) = gen_points_scalars::<G1Affine>(4);
run_msm_zal_default(&points, &scalars, 4);
run_msm_zal_custom(&points, &scalars, 4);
const MSM_SIZE: usize = 12;
let (points, scalars) = gen_points_scalars::<G1Affine>(MSM_SIZE);
run_msm_zal_default(&points, &scalars, MSM_SIZE);
run_msm_zal_custom(&points, &scalars, MSM_SIZE);
}
}
Loading