diff --git a/math/src/gpu/icicle/bls12_377.rs b/math/src/gpu/icicle/bls12_377.rs index 159926a0e..5741fff12 100644 --- a/math/src/gpu/icicle/bls12_377.rs +++ b/math/src/gpu/icicle/bls12_377.rs @@ -42,7 +42,6 @@ impl ShortWeierstrassProjectivePoint { } } - fn from_icicle(icicle: &curve::G1Projective) -> Result { Ok(Self::new([ FieldElement::::from_icicle(&icicle.x).unwrap(), @@ -89,14 +88,14 @@ mod test { use super::*; use crate::{ elliptic_curve::{ - short_weierstrass::curves::bls12_377::curve::BLS12377FieldElement, traits::IsEllipticCurve, + short_weierstrass::curves::bls12_377::curve::BLS12377FieldElement, + traits::IsEllipticCurve, }, field::element::FieldElement, msm::pippenger::msm, }; impl ShortWeierstrassProjectivePoint { - fn from_icicle_affine( icicle: &curve::G1Affine, ) -> Result, ByteConversionError> { @@ -123,8 +122,9 @@ mod test { // convert value of 5 to icicle and back again and that icicle 5 matches let point = point_times_5(); let icicle_point = point.to_icicle(); - let res = ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) - .unwrap(); + let res = + ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) + .unwrap(); assert_eq!(point, res) } @@ -133,8 +133,9 @@ mod test { // Convert generator and see that it matches let point = BLS12377Curve::generator(); let icicle_point = point.to_icicle(); - let res = ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) - .unwrap(); + let res = + ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) + .unwrap(); assert_eq!(point, res) } @@ -156,24 +157,4 @@ mod test { let res = bls12_377_g1_msm(&lambda_scalars, &lambda_points, None).unwrap(); assert_eq!(res, expected); } - - /* - #[test] - fn icicle_1_ntt() { - const len: usize = 20; - let eight: BLS12377FieldElement = FieldElement::from(8); - let lambda_scalars = &vec![eight; len]; - let expected = Polynomial::evaluate_fft::( - &Polynomial::new(lambda_scalars), 1, None, - ).unwrap(); - let icicle_scalars = lambda_scalars.as_slice().iter() - .map(|scalar| scalar.to_icicle_scalar()) - .collect::>(); - println!("expected {:?}", expected); - let res = bls12_381_g1_ntt(&lambda_scalars, None, 4u64, false).unwrap(); - println!(); - println!("res {:?}", res); - assert_eq!(res, expected); - } - */ } diff --git a/math/src/gpu/icicle/bls12_381.rs b/math/src/gpu/icicle/bls12_381.rs index 8d9f2da7a..9f3031eaa 100644 --- a/math/src/gpu/icicle/bls12_381.rs +++ b/math/src/gpu/icicle/bls12_381.rs @@ -88,13 +88,13 @@ mod test { use super::*; use crate::{ elliptic_curve::{ - short_weierstrass::curves::bls12_381::curve::BLS12381FieldElement, traits::IsEllipticCurve, + short_weierstrass::curves::bls12_381::curve::BLS12381FieldElement, + traits::IsEllipticCurve, }, field::element::FieldElement, msm::pippenger::msm, }; - impl ShortWeierstrassProjectivePoint { fn from_icicle_affine( icicle: &curve::G1Affine, @@ -107,7 +107,6 @@ mod test { } } - fn point_times_5() -> ShortWeierstrassProjectivePoint { let x = BLS12381FieldElement::from_hex_unchecked( "32bcce7e71eb50384918e0c9809f73bde357027c6bf15092dd849aa0eac274d43af4c68a65fb2cda381734af5eecd5c", @@ -123,8 +122,9 @@ mod test { // convert value of 5 to icicle and back again and that icicle 5 matches let point = point_times_5(); let icicle_point = point.to_icicle(); - let res = ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) - .unwrap(); + let res = + ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) + .unwrap(); assert_eq!(point, res) } @@ -133,8 +133,9 @@ mod test { // Convert generator and see that it matches let point = BLS12381Curve::generator(); let icicle_point = point.to_icicle(); - let res = ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) - .unwrap(); + let res = + ShortWeierstrassProjectivePoint::::from_icicle_affine(&icicle_point) + .unwrap(); assert_eq!(point, res) } @@ -156,24 +157,4 @@ mod test { let res = bls12_381_g1_msm(&lambda_scalars, &lambda_points, None).unwrap(); assert_eq!(res, expected); } - - /* - #[test] - fn icicle_1_ntt() { - const len: usize = 20; - let eight: BLS12381FieldElement = FieldElement::from(8); - let lambda_scalars = &vec![eight; len]; - let expected = Polynomial::evaluate_fft::( - &Polynomial::new(lambda_scalars), 1, None, - ).unwrap(); - let icicle_scalars = lambda_scalars.as_slice().iter() - .map(|scalar| scalar.to_icicle_scalar()) - .collect::>(); - println!("expected {:?}", expected); - let res = bls12_381_g1_ntt(&lambda_scalars, None, 4u64, false).unwrap(); - println!(); - println!("res {:?}", res); - assert_eq!(res, expected); - } - */ } diff --git a/math/src/gpu/icicle/bn254.rs b/math/src/gpu/icicle/bn254.rs index 2fad6f67a..c21c1a48a 100644 --- a/math/src/gpu/icicle/bn254.rs +++ b/math/src/gpu/icicle/bn254.rs @@ -94,7 +94,6 @@ mod test { msm::pippenger::msm, }; - impl ShortWeierstrassProjectivePoint { fn from_icicle_affine( icicle: &curve::G1Affine, @@ -155,24 +154,4 @@ mod test { let res = bn254_g1_msm(&lambda_scalars, &lambda_points, None).unwrap(); assert_eq!(res, expected); } - - /* - #[test] - fn icicle_1_ntt() { - const len: usize = 20; - let eight: BN254FieldElement = FieldElement::from(8); - let lambda_scalars = &vec![eight; len]; - let expected = Polynomial::evaluate_fft::( - &Polynomial::new(lambda_scalars), 1, None, - ).unwrap(); - let icicle_scalars = lambda_scalars.as_slice().iter() - .map(|scalar| scalar.to_icicle_scalar()) - .collect::>(); - println!("expected {:?}", expected); - let res = bn254_g1_ntt(&lambda_scalars, None, 4u64, false).unwrap(); - println!(); - println!("res {:?}", res); - assert_eq!(res, expected); - } - */ }