mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-12 08:51:36 +01:00
Upgrade to work with latest ark-ff (#95)
Co-authored-by: Sun <huachuang20@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ use ark_ec::{
|
||||
models::{ModelParameters, SWModelParameters},
|
||||
short_weierstrass_jacobian::{GroupAffine, GroupProjective},
|
||||
};
|
||||
use ark_ff::{field_new, Zero};
|
||||
use ark_ff::{MontFp, Zero};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -19,7 +19,7 @@ impl ModelParameters for VestaParameters {
|
||||
const COFACTOR: &'static [u64] = &[0x1];
|
||||
|
||||
/// COFACTOR_INV = 1
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, "1");
|
||||
const COFACTOR_INV: Fr = MontFp!(Fr, "1");
|
||||
}
|
||||
|
||||
pub type Affine = GroupAffine<VestaParameters>;
|
||||
@@ -27,10 +27,10 @@ pub type Projective = GroupProjective<VestaParameters>;
|
||||
|
||||
impl SWModelParameters for VestaParameters {
|
||||
/// COEFF_A = 0
|
||||
const COEFF_A: Fq = field_new!(Fq, "0");
|
||||
const COEFF_A: Fq = MontFp!(Fq, "0");
|
||||
|
||||
/// COEFF_B = 5
|
||||
const COEFF_B: Fq = field_new!(Fq, "5");
|
||||
const COEFF_B: Fq = MontFp!(Fq, "5");
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
@@ -44,8 +44,8 @@ impl SWModelParameters for VestaParameters {
|
||||
|
||||
/// G_GENERATOR_X = -1
|
||||
/// Encoded in Montgomery form, so the value here is -R mod p.
|
||||
pub const G_GENERATOR_X: Fq = field_new!(Fq, "-1");
|
||||
pub const G_GENERATOR_X: Fq = MontFp!(Fq, "-1");
|
||||
|
||||
/// G_GENERATOR_Y = 2
|
||||
/// Encoded in Montgomery form, so the value here is 2R mod p.
|
||||
pub const G_GENERATOR_Y: Fq = field_new!(Fq, "2");
|
||||
pub const G_GENERATOR_Y: Fq = MontFp!(Fq, "2");
|
||||
|
||||
18
vesta/src/curves/tests.rs
Normal file → Executable file
18
vesta/src/curves/tests.rs
Normal file → Executable file
@@ -1,21 +1,11 @@
|
||||
#![allow(unused_imports)]
|
||||
use ark_ff::{
|
||||
fields::{Field, FpParameters, PrimeField, SquareRootField},
|
||||
One, Zero,
|
||||
};
|
||||
use ark_serialize::CanonicalSerialize;
|
||||
use ark_std::test_rng;
|
||||
|
||||
use ark_ec::{models::SWModelParameters, AffineCurve, PairingEngine, ProjectiveCurve};
|
||||
use ark_std::ops::{AddAssign, MulAssign};
|
||||
use ark_std::rand::Rng;
|
||||
|
||||
use crate::{Affine, Projective, VestaParameters};
|
||||
|
||||
use ark_algebra_test_templates::{
|
||||
curves::{curve_tests, sw_tests},
|
||||
groups::group_test,
|
||||
};
|
||||
use ark_ec::AffineCurve;
|
||||
use ark_std::{rand::Rng, test_rng};
|
||||
|
||||
use crate::{Affine, Projective, VestaParameters};
|
||||
|
||||
#[test]
|
||||
fn test_projective_curve() {
|
||||
|
||||
Reference in New Issue
Block a user