From febd7635fbee31e7e94eac1ba38f75cd22793bde Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Fri, 16 Dec 2022 22:35:32 -0500 Subject: [PATCH] Rename all `*Parameters` to `*Config` (#136) * Rename all `*Parameters` to `*Config` * Tweak --- Cargo.toml | 1 + bls12_377/src/constraints/curves.rs | 34 ++++++++----------- bls12_377/src/constraints/pairing.rs | 4 +-- bls12_377/src/curves/g1.rs | 20 +++++------ bls12_377/src/curves/g2.rs | 10 +++--- bls12_377/src/curves/mod.rs | 20 +++++------ bls12_381/src/curves/g1.rs | 26 +++++++------- bls12_381/src/curves/g2.rs | 34 +++++++++---------- bls12_381/src/curves/mod.rs | 12 +++---- bls12_381/src/curves/util.rs | 12 +++---- bn254/src/curves/g1.rs | 8 ++--- bn254/src/curves/g2.rs | 8 ++--- bn254/src/curves/mod.rs | 20 +++++------ bw6_761/src/curves/g1.rs | 10 +++--- bw6_761/src/curves/g2.rs | 10 +++--- bw6_761/src/curves/mod.rs | 20 +++++------ cp6_782/src/curves/g1.rs | 10 +++--- cp6_782/src/curves/g2.rs | 10 +++--- cp6_782/src/curves/mod.rs | 2 +- ed25519/src/constraints/curves.rs | 4 +-- ed25519/src/curves/mod.rs | 16 ++++----- ed_on_bls12_377/src/constraints/curves.rs | 4 +-- ed_on_bls12_377/src/curves/mod.rs | 16 ++++----- ed_on_bls12_381/src/constraints/curves.rs | 4 +-- ed_on_bls12_381/src/curves/mod.rs | 26 +++++++------- .../src/constraints/curves.rs | 6 ++-- .../src/curves/mod.rs | 26 +++++++------- ed_on_bn254/src/constraints/curves.rs | 2 +- ed_on_bn254/src/curves/mod.rs | 16 ++++----- ed_on_cp6_782/src/constraints/curves.rs | 4 +-- ed_on_cp6_782/src/curves/mod.rs | 16 ++++----- ed_on_mnt4_298/src/constraints/curves.rs | 4 +-- ed_on_mnt4_298/src/curves/mod.rs | 16 ++++----- ed_on_mnt4_753/src/constraints/curves.rs | 4 +-- ed_on_mnt4_753/src/curves/mod.rs | 16 ++++----- mnt4_298/src/constraints/curves.rs | 26 ++++++-------- mnt4_298/src/constraints/pairing.rs | 4 +-- mnt4_298/src/curves/g1.rs | 12 +++---- mnt4_298/src/curves/g2.rs | 16 ++++----- mnt4_298/src/curves/mod.rs | 12 +++---- mnt4_753/src/constraints/curves.rs | 26 ++++++-------- mnt4_753/src/constraints/pairing.rs | 4 +-- mnt4_753/src/curves/g1.rs | 12 +++---- mnt4_753/src/curves/g2.rs | 16 ++++----- mnt4_753/src/curves/mod.rs | 12 +++---- mnt6_298/src/constraints/curves.rs | 26 ++++++-------- mnt6_298/src/constraints/pairing.rs | 4 +-- mnt6_298/src/curves/g1.rs | 12 +++---- mnt6_298/src/curves/g2.rs | 18 +++++----- mnt6_298/src/curves/mod.rs | 14 ++++---- mnt6_753/src/constraints/curves.rs | 26 ++++++-------- mnt6_753/src/constraints/pairing.rs | 4 +-- mnt6_753/src/curves/g1.rs | 12 +++---- mnt6_753/src/curves/g2.rs | 18 +++++----- mnt6_753/src/curves/mod.rs | 15 ++++---- pallas/src/constraints/curves.rs | 4 +-- pallas/src/curves/mod.rs | 10 +++--- secp256k1/src/constraints/curves.rs | 4 +-- secp256k1/src/curves/mod.rs | 10 +++--- secq256k1/src/constraints/curves.rs | 4 +-- secq256k1/src/curves/mod.rs | 10 +++--- vesta/src/constraints/curves.rs | 4 +-- vesta/src/curves/mod.rs | 10 +++--- 63 files changed, 382 insertions(+), 414 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d28c365..9abcd04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,5 +65,6 @@ debug = true [patch.crates-io] ark-ff = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" } +ark-ec = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" } ark-poly = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" } ark-serialize = { git = "https://github.com/arkworks-rs/algebra/", branch = "release-0.4" } \ No newline at end of file diff --git a/bls12_377/src/constraints/curves.rs b/bls12_377/src/constraints/curves.rs index 19869c8..07b4b93 100644 --- a/bls12_377/src/constraints/curves.rs +++ b/bls12_377/src/constraints/curves.rs @@ -1,45 +1,39 @@ -use ark_ec::{bls12::Bls12Parameters, CurveConfig}; +use ark_ec::{bls12::Bls12Config, CurveConfig}; use ark_r1cs_std::{ fields::fp::FpVar, groups::{bls12, curves::twisted_edwards::AffineVar as TEAffineVar}, }; -use crate::Parameters; +use crate::Config; /// An element of G1 in the BLS12-377 bilinear group. -pub type G1Var = bls12::G1Var; +pub type G1Var = bls12::G1Var; /// An element of G2 in the BLS12-377 bilinear group. -pub type G2Var = bls12::G2Var; +pub type G2Var = bls12::G2Var; /// An element of G1 (in TE Affine form) in the BLS12-377 bilinear group. pub type G1TEAffineVar = TEAffineVar< - ::G1Parameters, - FpVar<<::G1Parameters as CurveConfig>::BaseField>, + ::G1Config, + FpVar<<::G1Config as CurveConfig>::BaseField>, >; /// Represents the cached precomputation that can be performed on a G1 element /// which enables speeding up pairing computation. -pub type G1PreparedVar = bls12::G1PreparedVar; +pub type G1PreparedVar = bls12::G1PreparedVar; /// Represents the cached precomputation that can be performed on a G2 element /// which enables speeding up pairing computation. -pub type G2PreparedVar = bls12::G2PreparedVar; +pub type G2PreparedVar = bls12::G2PreparedVar; #[test] fn test() { - use ark_ec::models::bls12::Bls12Parameters; - ark_curve_constraint_tests::curves::sw_test::< - ::G1Parameters, - G1Var, - >() - .unwrap(); + use ark_ec::models::bls12::Bls12Config; + ark_curve_constraint_tests::curves::sw_test::<::G1Config, G1Var>() + .unwrap(); ark_curve_constraint_tests::curves::te_test::< - ::G1Parameters, + ::G1Config, G1TEAffineVar, >() .unwrap(); - ark_curve_constraint_tests::curves::sw_test::< - ::G2Parameters, - G2Var, - >() - .unwrap(); + ark_curve_constraint_tests::curves::sw_test::<::G2Config, G2Var>() + .unwrap(); } diff --git a/bls12_377/src/constraints/pairing.rs b/bls12_377/src/constraints/pairing.rs index 7880636..95dcc90 100644 --- a/bls12_377/src/constraints/pairing.rs +++ b/bls12_377/src/constraints/pairing.rs @@ -1,8 +1,8 @@ -use crate::Parameters; +use crate::Config; /// Specifies the constraints for computing a pairing in the BLS12-377 bilinear /// group. -pub type PairingVar = ark_r1cs_std::pairing::bls12::PairingVar; +pub type PairingVar = ark_r1cs_std::pairing::bls12::PairingVar; #[test] fn test() { diff --git a/bls12_377/src/curves/g1.rs b/bls12_377/src/curves/g1.rs index 57e6192..f7f6103 100644 --- a/bls12_377/src/curves/g1.rs +++ b/bls12_377/src/curves/g1.rs @@ -11,9 +11,9 @@ use core::ops::Neg; use crate::{Fq, Fr}; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -25,7 +25,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = MontFp!("5285428838741532253824584287042945485047145357130994810877"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; @@ -41,9 +41,9 @@ impl SWCurveConfig for Parameters { } } -pub type G1SWAffine = SWAffine; -pub type G1TEAffine = TEAffine; -pub type G1TEProjective = TEProjective; +pub type G1SWAffine = SWAffine; +pub type G1TEAffine = TEAffine; +pub type G1TEProjective = TEProjective; /// Bls12_377::G1 also has a twisted Edwards form. /// It can be obtained via the following script, implementing @@ -92,7 +92,7 @@ pub type G1TEProjective = TEProjective; /// # b = -TE1d/TE1a /// TE2d = Fp(122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179) /// ``` -impl TECurveConfig for Parameters { +impl TECurveConfig for Config { /// COEFF_A = -1 const COEFF_A: Fq = MontFp!("-1"); @@ -102,7 +102,7 @@ impl TECurveConfig for Parameters { /// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y) const GENERATOR: G1TEAffine = G1TEAffine::new_unchecked(TE_GENERATOR_X, TE_GENERATOR_Y); - type MontCurveConfig = Parameters; + type MontCurveConfig = Config; /// Multiplication by `a` is multiply by `-1`. #[inline(always)] @@ -140,14 +140,14 @@ impl TECurveConfig for Parameters { // # MB = s // MB=Fp(10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931) // ``` -impl MontCurveConfig for Parameters { +impl MontCurveConfig for Config { /// COEFF_A = 228097355113300204138531148905234651262148041026195375645000724271212049151994375092458297304264351187709081232384 const COEFF_A: Fq = MontFp!("228097355113300204138531148905234651262148041026195375645000724271212049151994375092458297304264351187709081232384"); /// COEFF_B = 10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931 const COEFF_B: Fq = MontFp!("10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931"); - type TECurveConfig = Parameters; + type TECurveConfig = Config; } /// G1_GENERATOR_X = diff --git a/bls12_377/src/curves/g2.rs b/bls12_377/src/curves/g2.rs index fadf608..d25265b 100644 --- a/bls12_377/src/curves/g2.rs +++ b/bls12_377/src/curves/g2.rs @@ -6,11 +6,11 @@ use ark_ff::{Field, MontFp, Zero}; use crate::{g1, Fq, Fq2, Fr}; -pub type G2Affine = Affine; +pub type G2Affine = Affine; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq2; type ScalarField = Fr; @@ -34,9 +34,9 @@ impl CurveConfig for Parameters { MontFp!("6764900296503390671038341982857278410319949526107311149686707033187604810669"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = [0, 0] - const COEFF_A: Fq2 = Fq2::new(g1::Parameters::COEFF_A, g1::Parameters::COEFF_A); + const COEFF_A: Fq2 = Fq2::new(g1::Config::COEFF_A, g1::Config::COEFF_A); // As per https://eprint.iacr.org/2012/072.pdf, // this curve has b' = b/i, where b is the COEFF_B of G1, and x^6 -i is diff --git a/bls12_377/src/curves/mod.rs b/bls12_377/src/curves/mod.rs index 6173f1d..d7c6695 100644 --- a/bls12_377/src/curves/mod.rs +++ b/bls12_377/src/curves/mod.rs @@ -1,6 +1,6 @@ use ark_ec::{ bls12, - bls12::{Bls12, Bls12Parameters, TwistType}, + bls12::{Bls12, Bls12Config, TwistType}, }; use crate::*; @@ -11,9 +11,9 @@ pub mod g2; #[cfg(test)] mod tests; -pub struct Parameters; +pub struct Config; -impl Bls12Parameters for Parameters { +impl Bls12Config for Config { const X: &'static [u64] = &[0x8508c00000000001]; /// `x` is positive. const X_IS_NEGATIVE: bool = false; @@ -22,15 +22,15 @@ impl Bls12Parameters for Parameters { type Fp2Config = Fq2Config; type Fp6Config = Fq6Config; type Fp12Config = Fq12Config; - type G1Parameters = g1::Parameters; - type G2Parameters = g2::Parameters; + type G1Config = g1::Config; + type G2Config = g2::Config; } -pub type Bls12_377 = Bls12; +pub type Bls12_377 = Bls12; -pub type G1Affine = bls12::G1Affine; -pub type G1Projective = bls12::G1Projective; -pub type G2Affine = bls12::G2Affine; -pub type G2Projective = bls12::G2Projective; +pub type G1Affine = bls12::G1Affine; +pub type G1Projective = bls12::G1Projective; +pub type G2Affine = bls12::G2Affine; +pub type G2Projective = bls12::G2Projective; pub use g1::{G1TEAffine, G1TEProjective}; diff --git a/bls12_381/src/curves/g1.rs b/bls12_381/src/curves/g1.rs index e00c2dc..e964a0a 100644 --- a/bls12_381/src/curves/g1.rs +++ b/bls12_381/src/curves/g1.rs @@ -1,7 +1,7 @@ use crate::*; use ark_ec::{ bls12, - bls12::Bls12Parameters, + bls12::Bls12Config, models::CurveConfig, short_weierstrass::{Affine, SWCurveConfig}, AffineRepr, Group, @@ -14,13 +14,13 @@ use crate::util::{ read_g1_compressed, read_g1_uncompressed, serialize_fq, EncodingFlags, G1_SERIALIZED_SIZE, }; -pub type G1Affine = bls12::G1Affine; -pub type G1Projective = bls12::G1Projective; +pub type G1Affine = bls12::G1Affine; +pub type G1Projective = bls12::G1Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -33,7 +33,7 @@ impl CurveConfig for Parameters { MontFp!("52435875175126190458656871551744051925719901746859129887267498875565241663483"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; @@ -57,12 +57,12 @@ impl SWCurveConfig for Parameters { // An early-out optimization described in Section 6. // If uP == P but P != point of infinity, then the point is not in the right // subgroup. - let x_times_p = p.mul_bigint(crate::Parameters::X); + let x_times_p = p.mul_bigint(crate::Config::X); if x_times_p.eq(p) && !p.infinity { return false; } - let minus_x_squared_times_p = x_times_p.mul_bigint(crate::Parameters::X).neg(); + let minus_x_squared_times_p = x_times_p.mul_bigint(crate::Config::X).neg(); let endomorphism_p = endomorphism(p); minus_x_squared_times_p.eq(&endomorphism_p) } @@ -74,7 +74,7 @@ impl SWCurveConfig for Parameters { // // It is enough to multiply by (1 - x), instead of (x - 1)^2 / 3 let h_eff = one_minus_x().into_bigint(); - Parameters::mul_affine(&p, h_eff.as_ref()).into() + Config::mul_affine(&p, h_eff.as_ref()).into() } fn deserialize_with_mode( @@ -139,7 +139,7 @@ impl SWCurveConfig for Parameters { } fn one_minus_x() -> Fr { - const X: Fr = Fr::from_sign_and_limbs(!crate::Parameters::X_IS_NEGATIVE, crate::Parameters::X); + const X: Fr = Fr::from_sign_and_limbs(!crate::Config::X_IS_NEGATIVE, crate::Config::X); Fr::one() - X } @@ -154,7 +154,7 @@ pub const G1_GENERATOR_Y: Fq = MontFp!("1339506544944476473020471379941921221584 /// BETA is a non-trivial cubic root of unity in Fq. pub const BETA: Fq = MontFp!("793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350"); -pub fn endomorphism(p: &Affine) -> Affine { +pub fn endomorphism(p: &Affine) -> Affine { // Endomorphism of the points on the curve. // endomorphism_p(x,y) = (BETA * x, y) // where BETA is a non-trivial cubic root of unity in Fq. @@ -169,7 +169,7 @@ mod test { use super::*; use ark_std::{rand::Rng, UniformRand}; - fn sample_unchecked() -> Affine { + fn sample_unchecked() -> Affine { let mut rng = ark_std::test_rng(); loop { let x = Fq::rand(&mut rng); @@ -185,7 +185,7 @@ mod test { fn test_cofactor_clearing() { const SAMPLES: usize = 100; for _ in 0..SAMPLES { - let p: Affine = sample_unchecked(); + let p: Affine = sample_unchecked(); let p = p.clear_cofactor(); assert!(p.is_on_curve()); assert!(p.is_in_correct_subgroup_assuming_on_curve()); diff --git a/bls12_381/src/curves/g2.rs b/bls12_381/src/curves/g2.rs index ab6e24c..bf8625f 100644 --- a/bls12_381/src/curves/g2.rs +++ b/bls12_381/src/curves/g2.rs @@ -2,7 +2,7 @@ use ark_std::ops::Neg; use ark_ec::{ bls12, - bls12::Bls12Parameters, + bls12::Bls12Config, models::CurveConfig, short_weierstrass::{Affine, Projective, SWCurveConfig}, AffineRepr, CurveGroup, Group, @@ -16,13 +16,13 @@ use crate::{ *, }; -pub type G2Affine = bls12::G2Affine; -pub type G2Projective = bls12::G2Projective; +pub type G2Affine = bls12::G2Affine; +pub type G2Projective = bls12::G2Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq2; type ScalarField = Fr; @@ -47,12 +47,12 @@ impl CurveConfig for Parameters { MontFp!("26652489039290660355457965112010883481355318854675681319708643586776743290055"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = [0, 0] - const COEFF_A: Fq2 = Fq2::new(g1::Parameters::COEFF_A, g1::Parameters::COEFF_A); + const COEFF_A: Fq2 = Fq2::new(g1::Config::COEFF_A, g1::Config::COEFF_A); /// COEFF_B = [4, 4] - const COEFF_B: Fq2 = Fq2::new(g1::Parameters::COEFF_B, g1::Parameters::COEFF_B); + const COEFF_B: Fq2 = Fq2::new(g1::Config::COEFF_B, g1::Config::COEFF_B); /// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y) const GENERATOR: G2Affine = G2Affine::new_unchecked(G2_GENERATOR_X, G2_GENERATOR_Y); @@ -67,8 +67,8 @@ impl SWCurveConfig for Parameters { // // Checks that [p]P = [X]P - let mut x_times_point = point.mul_bigint(crate::Parameters::X); - if crate::Parameters::X_IS_NEGATIVE { + let mut x_times_point = point.mul_bigint(crate::Config::X); + if crate::Config::X_IS_NEGATIVE { x_times_point = -x_times_point; } @@ -86,11 +86,11 @@ impl SWCurveConfig for Parameters { // When multiplying, use -c1 instead, and then negate the result. That's much // more efficient, since the scalar -c1 has less limbs and a much lower Hamming // weight. - let x: &'static [u64] = crate::Parameters::X; + let x: &'static [u64] = crate::Config::X; let p_projective = p.into_group(); // [x]P - let x_p = Parameters::mul_affine(p, &x).neg(); + let x_p = Config::mul_affine(p, &x).neg(); // ψ(P) let psi_p = p_power_endomorphism(&p); // (ψ^2)(2P) @@ -101,7 +101,7 @@ impl SWCurveConfig for Parameters { tmp += &psi_p; // tmp2 = [x^2]P + [x]ψ(P) - let mut tmp2: Projective = tmp; + let mut tmp2: Projective = tmp; tmp2 = tmp2.mul_bigint(x).neg(); // add up all the terms @@ -224,7 +224,7 @@ pub const DOUBLE_P_POWER_ENDOMORPHISM: Fq2 = Fq2::new( Fq::ZERO ); -pub fn p_power_endomorphism(p: &Affine) -> Affine { +pub fn p_power_endomorphism(p: &Affine) -> Affine { // The p-power endomorphism for G2 is defined as follows: // 1. Note that G2 is defined on curve E': y^2 = x^3 + 4(u+1). // To map a point (x, y) in E' to (s, t) in E, @@ -252,7 +252,7 @@ pub fn p_power_endomorphism(p: &Affine) -> Affine { } /// For a p-power endomorphism psi(P), compute psi(psi(P)) -pub fn double_p_power_endomorphism(p: &Projective) -> Projective { +pub fn double_p_power_endomorphism(p: &Projective) -> Projective { let mut res = *p; res.x *= DOUBLE_P_POWER_ENDOMORPHISM; @@ -287,9 +287,9 @@ mod test { let mut rng = ark_std::test_rng(); const SAMPLES: usize = 10; for _ in 0..SAMPLES { - let p = Affine::::rand(&mut rng); + let p = Affine::::rand(&mut rng); let optimised = p.clear_cofactor().into_group(); - let naive = g2::Parameters::mul_affine(&p, h_eff); + let naive = g2::Config::mul_affine(&p, h_eff); assert_eq!(optimised, naive); } } diff --git a/bls12_381/src/curves/mod.rs b/bls12_381/src/curves/mod.rs index cb81dee..3460d95 100644 --- a/bls12_381/src/curves/mod.rs +++ b/bls12_381/src/curves/mod.rs @@ -1,4 +1,4 @@ -use ark_ec::bls12::{Bls12, Bls12Parameters, TwistType}; +use ark_ec::bls12::{Bls12, Bls12Config, TwistType}; use crate::{Fq, Fq12Config, Fq2Config, Fq6Config}; @@ -14,11 +14,11 @@ pub use self::{ g2::{G2Affine, G2Projective}, }; -pub type Bls12_381 = Bls12; +pub type Bls12_381 = Bls12; -pub struct Parameters; +pub struct Config; -impl Bls12Parameters for Parameters { +impl Bls12Config for Config { const X: &'static [u64] = &[0xd201000000010000]; const X_IS_NEGATIVE: bool = true; const TWIST_TYPE: TwistType = TwistType::M; @@ -26,6 +26,6 @@ impl Bls12Parameters for Parameters { type Fp2Config = Fq2Config; type Fp6Config = Fq6Config; type Fp12Config = Fq12Config; - type G1Parameters = self::g1::Parameters; - type G2Parameters = self::g2::Parameters; + type G1Config = self::g1::Config; + type G2Config = self::g2::Config; } diff --git a/bls12_381/src/curves/util.rs b/bls12_381/src/curves/util.rs index a81f260..7d73ed8 100644 --- a/bls12_381/src/curves/util.rs +++ b/bls12_381/src/curves/util.rs @@ -2,9 +2,7 @@ use ark_ec::{short_weierstrass::Affine, AffineRepr}; use ark_ff::{BigInteger384, PrimeField}; use ark_serialize::SerializationError; -use crate::{ - g1::Parameters as G1Parameters, g2::Parameters as G2Parameters, Fq, Fq2, G1Affine, G2Affine, -}; +use crate::{g1::Config as G1Config, g2::Config as G2Config, Fq, Fq2, G1Affine, G2Affine}; pub const G1_SERIALIZED_SIZE: usize = 48; pub const G2_SERIALIZED_SIZE: usize = 96; @@ -91,7 +89,7 @@ pub(crate) fn read_fq_with_offset( pub(crate) fn read_g1_compressed( mut reader: R, -) -> Result, ark_serialize::SerializationError> { +) -> Result, ark_serialize::SerializationError> { let mut bytes = [0u8; G1_SERIALIZED_SIZE]; reader .read_exact(&mut bytes) @@ -121,7 +119,7 @@ pub(crate) fn read_g1_compressed( pub(crate) fn read_g1_uncompressed( mut reader: R, -) -> Result, ark_serialize::SerializationError> { +) -> Result, ark_serialize::SerializationError> { let mut bytes = [0u8; 2 * G1_SERIALIZED_SIZE]; reader .read_exact(&mut bytes) @@ -151,7 +149,7 @@ pub(crate) fn read_g1_uncompressed( pub(crate) fn read_g2_compressed( mut reader: R, -) -> Result, ark_serialize::SerializationError> { +) -> Result, ark_serialize::SerializationError> { let mut bytes = [0u8; G2_SERIALIZED_SIZE]; reader .read_exact(&mut bytes) @@ -183,7 +181,7 @@ pub(crate) fn read_g2_compressed( pub(crate) fn read_g2_uncompressed( mut reader: R, -) -> Result, ark_serialize::SerializationError> { +) -> Result, ark_serialize::SerializationError> { let mut bytes = [0u8; 2 * G2_SERIALIZED_SIZE]; reader .read_exact(&mut bytes) diff --git a/bn254/src/curves/g1.rs b/bn254/src/curves/g1.rs index 6b55614..25a6e59 100644 --- a/bn254/src/curves/g1.rs +++ b/bn254/src/curves/g1.rs @@ -7,11 +7,11 @@ use ark_ff::{Field, MontFp, Zero}; use crate::{Fq, Fr}; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -pub type G1Affine = Affine; +pub type G1Affine = Affine; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -22,7 +22,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; diff --git a/bn254/src/curves/g2.rs b/bn254/src/curves/g2.rs index 1a792d0..7e45d6b 100644 --- a/bn254/src/curves/g2.rs +++ b/bn254/src/curves/g2.rs @@ -6,12 +6,12 @@ use ark_ff::{Field, MontFp, Zero}; use crate::{Fq, Fq2, Fr}; -pub type G2Affine = Affine; +pub type G2Affine = Affine; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq2; type ScalarField = Fr; @@ -30,7 +30,7 @@ impl CurveConfig for Parameters { MontFp!("10944121435919637613327163357776759465618812564592884533313067514031822496649"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = [0, 0] const COEFF_A: Fq2 = Fq2::ZERO; diff --git a/bn254/src/curves/mod.rs b/bn254/src/curves/mod.rs index 4c3a540..3494887 100644 --- a/bn254/src/curves/mod.rs +++ b/bn254/src/curves/mod.rs @@ -1,6 +1,6 @@ use ark_ec::{ bn, - bn::{Bn, BnParameters, TwistType}, + bn::{Bn, BnConfig, TwistType}, }; use ark_ff::MontFp; @@ -12,9 +12,9 @@ pub mod g2; #[cfg(test)] mod tests; -pub struct Parameters; +pub struct Config; -impl BnParameters for Parameters { +impl BnConfig for Config { const X: &'static [u64] = &[4965661367192848881]; /// `x` is positive. const X_IS_NEGATIVE: bool = false; @@ -37,13 +37,13 @@ impl BnParameters for Parameters { type Fp2Config = Fq2Config; type Fp6Config = Fq6Config; type Fp12Config = Fq12Config; - type G1Parameters = g1::Parameters; - type G2Parameters = g2::Parameters; + type G1Config = g1::Config; + type G2Config = g2::Config; } -pub type Bn254 = Bn; +pub type Bn254 = Bn; -pub type G1Affine = bn::G1Affine; -pub type G1Projective = bn::G1Projective; -pub type G2Affine = bn::G2Affine; -pub type G2Projective = bn::G2Projective; +pub type G1Affine = bn::G1Affine; +pub type G1Projective = bn::G1Projective; +pub type G2Affine = bn::G2Affine; +pub type G2Projective = bn::G2Projective; diff --git a/bw6_761/src/curves/g1.rs b/bw6_761/src/curves/g1.rs index 08ddc3c..f3cb3ae 100644 --- a/bw6_761/src/curves/g1.rs +++ b/bw6_761/src/curves/g1.rs @@ -6,13 +6,13 @@ use ark_ff::{Field, MontFp}; use crate::{Fq, Fr}; -pub type G1Affine = Affine; -pub type G1Projective = Projective; +pub type G1Affine = Affine; +pub type G1Projective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -33,7 +33,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = MontFp!("91141326767669940707819291241958318717982251277713150053234367522357946997763584490607453720072232540829942217804"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; diff --git a/bw6_761/src/curves/g2.rs b/bw6_761/src/curves/g2.rs index a57b012..abf83d4 100644 --- a/bw6_761/src/curves/g2.rs +++ b/bw6_761/src/curves/g2.rs @@ -6,13 +6,13 @@ use ark_ff::{Field, MontFp}; use crate::{Fq, Fr}; -pub type G2Affine = Affine; -pub type G2Projective = Projective; +pub type G2Affine = Affine; +pub type G2Projective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -33,7 +33,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = MontFp!("214911522365886453591244899095480747723790054550866810551297776298664428889000553861210287833206024638187939842124"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; diff --git a/bw6_761/src/curves/mod.rs b/bw6_761/src/curves/mod.rs index d178e31..cfbbf4f 100644 --- a/bw6_761/src/curves/mod.rs +++ b/bw6_761/src/curves/mod.rs @@ -1,6 +1,6 @@ use ark_ec::{ bw6, - bw6::{BW6Parameters, TwistType, BW6}, + bw6::{BW6Config, TwistType, BW6}, }; use ark_ff::{biginteger::BigInteger768 as BigInteger, BigInt}; @@ -13,9 +13,9 @@ pub mod g2; mod tests; #[derive(PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl BW6Parameters for Parameters { +impl BW6Config for Config { const X: BigInteger = BigInt::new([ 0x8508c00000000001, 0x0, @@ -50,13 +50,13 @@ impl BW6Parameters for Parameters { type Fp = Fq; type Fp3Config = Fq3Config; type Fp6Config = Fq6Config; - type G1Parameters = g1::Parameters; - type G2Parameters = g2::Parameters; + type G1Config = g1::Config; + type G2Config = g2::Config; } -pub type BW6_761 = BW6; +pub type BW6_761 = BW6; -pub type G1Affine = bw6::G1Affine; -pub type G1Projective = bw6::G1Projective; -pub type G2Affine = bw6::G2Affine; -pub type G2Projective = bw6::G2Projective; +pub type G1Affine = bw6::G1Affine; +pub type G1Projective = bw6::G1Projective; +pub type G2Affine = bw6::G2Affine; +pub type G2Projective = bw6::G2Projective; diff --git a/cp6_782/src/curves/g1.rs b/cp6_782/src/curves/g1.rs index 4b83f3e..6859a11 100644 --- a/cp6_782/src/curves/g1.rs +++ b/cp6_782/src/curves/g1.rs @@ -9,8 +9,8 @@ use ark_std::vec::Vec; use crate::{Fq, Fr}; -pub type G1Affine = Affine; -pub type G1Projective = Projective; +pub type G1Affine = Affine; +pub type G1Projective = Projective; #[derive(Clone, Debug, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize)] pub struct G1Prepared(pub G1Affine); @@ -52,9 +52,9 @@ impl Default for G1Prepared { } #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -76,7 +76,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = MontFp!("163276846538158998893990986356139314746223949404500031940624325017036397274793417940375498603127780919653358641788"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 5 const COEFF_A: Fq = MontFp!("5"); diff --git a/cp6_782/src/curves/g2.rs b/cp6_782/src/curves/g2.rs index b427f8d..806fc5d 100644 --- a/cp6_782/src/curves/g2.rs +++ b/cp6_782/src/curves/g2.rs @@ -9,8 +9,8 @@ use ark_std::vec::Vec; use crate::{Fq, Fq3, Fr}; -pub type G2Affine = Affine; -pub type G2Projective = Projective; +pub type G2Affine = Affine; +pub type G2Projective = Projective; #[derive(Clone, Debug, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize)] pub struct G2Prepared(pub G2Affine); @@ -52,9 +52,9 @@ impl Default for G2Prepared { } #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq3; type ScalarField = Fr; @@ -100,7 +100,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = MontFp!("45586359457219724873147353901735745013467692594291916855200979604570630929674383405372210802279573887880950375598"); } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = (0, 0, COEFF_A * TWIST^2) = (0, 0, 5) const COEFF_A: Fq3 = Fq3::new(Fq::ZERO, Fq::ZERO, MontFp!("5")); diff --git a/cp6_782/src/curves/mod.rs b/cp6_782/src/curves/mod.rs index bf38127..d6c2594 100644 --- a/cp6_782/src/curves/mod.rs +++ b/cp6_782/src/curves/mod.rs @@ -78,7 +78,7 @@ impl CP6_782 { let old_rx_square = old_rx.square(); let old_rx_square_3 = old_rx_square.double() + &old_rx_square; - let old_rx_square_3_a = old_rx_square_3 + &g2::Parameters::COEFF_A; + let old_rx_square_3_a = old_rx_square_3 + &g2::Config::COEFF_A; let old_ry_double_inverse = old_ry.double().inverse().unwrap(); let gamma = old_rx_square_3_a * &old_ry_double_inverse; diff --git a/ed25519/src/constraints/curves.rs b/ed25519/src/constraints/curves.rs index 7401d17..fffc1a3 100644 --- a/ed25519/src/constraints/curves.rs +++ b/ed25519/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use crate::{constraints::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; #[test] fn test() { - ark_curve_constraint_tests::curves::te_test::().unwrap(); + ark_curve_constraint_tests::curves::te_test::().unwrap(); } diff --git a/ed25519/src/curves/mod.rs b/ed25519/src/curves/mod.rs index 000e816..9f3cebe 100644 --- a/ed25519/src/curves/mod.rs +++ b/ed25519/src/curves/mod.rs @@ -8,13 +8,13 @@ use ark_ff::MontFp; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct EdwardsParameters; +pub struct EdwardsConfig; -impl CurveConfig for EdwardsParameters { +impl CurveConfig for EdwardsConfig { type BaseField = Fq; type ScalarField = Fr; @@ -27,7 +27,7 @@ impl CurveConfig for EdwardsParameters { MontFp!("2713877091499598330239944961141122840321418634767465352250731601857045344121"); } -impl TECurveConfig for EdwardsParameters { +impl TECurveConfig for EdwardsConfig { /// COEFF_A = -1 const COEFF_A: Fq = MontFp!("-1"); @@ -38,7 +38,7 @@ impl TECurveConfig for EdwardsParameters { /// Standard generators from . const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = EdwardsParameters; + type MontCurveConfig = EdwardsConfig; /// Multiplication by `a` is just negation. #[inline(always)] @@ -48,7 +48,7 @@ impl TECurveConfig for EdwardsParameters { } // We want to emphasize that this Montgomery curve is not Curve25519. -impl MontCurveConfig for EdwardsParameters { +impl MontCurveConfig for EdwardsConfig { /// COEFF_A = 486662 const COEFF_A: Fq = MontFp!("486662"); @@ -57,7 +57,7 @@ impl MontCurveConfig for EdwardsParameters { const COEFF_B: Fq = MontFp!("57896044618658097711785492504343953926634992332820282019728792003956564333285"); - type TECurveConfig = EdwardsParameters; + type TECurveConfig = EdwardsConfig; } /// GENERATOR_X = diff --git a/ed_on_bls12_377/src/constraints/curves.rs b/ed_on_bls12_377/src/constraints/curves.rs index 7401d17..fffc1a3 100644 --- a/ed_on_bls12_377/src/constraints/curves.rs +++ b/ed_on_bls12_377/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use crate::{constraints::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; #[test] fn test() { - ark_curve_constraint_tests::curves::te_test::().unwrap(); + ark_curve_constraint_tests::curves::te_test::().unwrap(); } diff --git a/ed_on_bls12_377/src/curves/mod.rs b/ed_on_bls12_377/src/curves/mod.rs index 4aae1e1..3f1b8ac 100644 --- a/ed_on_bls12_377/src/curves/mod.rs +++ b/ed_on_bls12_377/src/curves/mod.rs @@ -9,13 +9,13 @@ use crate::{fq::Fq, fr::Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct EdwardsParameters; +pub struct EdwardsConfig; -impl CurveConfig for EdwardsParameters { +impl CurveConfig for EdwardsConfig { type BaseField = Fq; type ScalarField = Fr; @@ -28,7 +28,7 @@ impl CurveConfig for EdwardsParameters { MontFp!("527778859339273151515551558673846658209717731602102048798421311598680340096"); } -impl TECurveConfig for EdwardsParameters { +impl TECurveConfig for EdwardsConfig { /// COEFF_A = -1 const COEFF_A: Fq = MontFp!("-1"); @@ -38,7 +38,7 @@ impl TECurveConfig for EdwardsParameters { /// Generated randomly const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = EdwardsParameters; + type MontCurveConfig = EdwardsConfig; /// Multiplication by `a` is just negation. /// Is `a` 1 or -1? @@ -48,7 +48,7 @@ impl TECurveConfig for EdwardsParameters { } } -impl MontCurveConfig for EdwardsParameters { +impl MontCurveConfig for EdwardsConfig { /// COEFF_A = 0x8D26E3FADA9010A26949031ECE3971B93952AD84D4753DDEDB748DA37E8F552 /// = 3990301581132929505568273333084066329187552697088022219156688740916631500114 const COEFF_A: Fq = @@ -59,7 +59,7 @@ impl MontCurveConfig for EdwardsParameters { const COEFF_B: Fq = MontFp!("4454160168295440918680551605697480202188346638066041608778544715000777738925"); - type TECurveConfig = EdwardsParameters; + type TECurveConfig = EdwardsConfig; } /// GENERATOR_X = diff --git a/ed_on_bls12_381/src/constraints/curves.rs b/ed_on_bls12_381/src/constraints/curves.rs index 13b386a..6f3d85d 100644 --- a/ed_on_bls12_381/src/constraints/curves.rs +++ b/ed_on_bls12_381/src/constraints/curves.rs @@ -3,10 +3,10 @@ use ark_r1cs_std::groups::curves::{short_weierstrass::ProjectiveVar, twisted_edw use crate::{constraints::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; /// A variable that is the R1CS equivalent of `crate::SWProjective` -pub type SWVar = ProjectiveVar; +pub type SWVar = ProjectiveVar; #[test] fn test() { diff --git a/ed_on_bls12_381/src/curves/mod.rs b/ed_on_bls12_381/src/curves/mod.rs index 893fee3..34007cd 100644 --- a/ed_on_bls12_381/src/curves/mod.rs +++ b/ed_on_bls12_381/src/curves/mod.rs @@ -10,10 +10,10 @@ use crate::{Fq, Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; -pub type SWAffine = short_weierstrass::Affine; -pub type SWProjective = short_weierstrass::Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; +pub type SWAffine = short_weierstrass::Affine; +pub type SWProjective = short_weierstrass::Projective; /// `JubJub` is a twisted Edwards curve. These curves have equations of the /// form: ax² + y² = 1 - dx²y². @@ -49,11 +49,11 @@ pub type SWProjective = short_weierstrass::Projective; /// [here](https://github.com/zhenfeizhang/bandersnatch/blob/main/bandersnatch/script/jubjub.sage) /// to convert between the different representations. #[derive(Clone, Default, PartialEq, Eq)] -pub struct JubjubParameters; -pub type EdwardsParameters = JubjubParameters; -pub type SWParameters = JubjubParameters; +pub struct JubjubConfig; +pub type EdwardsConfig = JubjubConfig; +pub type SWConfig = JubjubConfig; -impl CurveConfig for JubjubParameters { +impl CurveConfig for JubjubConfig { type BaseField = Fq; type ScalarField = Fr; @@ -66,7 +66,7 @@ impl CurveConfig for JubjubParameters { MontFp!("819310549611346726241370945440405716213240158234039660170669895299022906775"); } -impl TECurveConfig for JubjubParameters { +impl TECurveConfig for JubjubConfig { /// COEFF_A = -1 const COEFF_A: Fq = MontFp!("-1"); @@ -77,7 +77,7 @@ impl TECurveConfig for JubjubParameters { /// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y) const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = JubjubParameters; + type MontCurveConfig = JubjubConfig; /// Multiplication by `a` is simply negation here. #[inline(always)] @@ -86,14 +86,14 @@ impl TECurveConfig for JubjubParameters { } } -impl MontCurveConfig for JubjubParameters { +impl MontCurveConfig for JubjubConfig { /// COEFF_A = 40962 const COEFF_A: Fq = MontFp!("40962"); /// COEFF_B = -40964 const COEFF_B: Fq = MontFp!("-40964"); - type TECurveConfig = JubjubParameters; + type TECurveConfig = JubjubConfig; } const GENERATOR_X: Fq = @@ -102,7 +102,7 @@ const GENERATOR_X: Fq = const GENERATOR_Y: Fq = MontFp!("13262374693698910701929044844600465831413122818447359594527400194675274060458"); -impl SWCurveConfig for JubjubParameters { +impl SWCurveConfig for JubjubConfig { /// COEFF_A = 52296097456646850916096512823759002727550416093741407922227928430486925478210 const COEFF_A: Self::BaseField = MontFp!("52296097456646850916096512823759002727550416093741407922227928430486925478210"); diff --git a/ed_on_bls12_381_bandersnatch/src/constraints/curves.rs b/ed_on_bls12_381_bandersnatch/src/constraints/curves.rs index 073e154..53883b5 100644 --- a/ed_on_bls12_381_bandersnatch/src/constraints/curves.rs +++ b/ed_on_bls12_381_bandersnatch/src/constraints/curves.rs @@ -2,11 +2,11 @@ use ark_r1cs_std::groups::curves::{short_weierstrass::ProjectiveVar, twisted_edw use crate::{constraints::FqVar, *}; -/// A variable that is the R1CS equivalent of `crate::BandersnatchParameters`. -pub type EdwardsVar = AffineVar; +/// A variable that is the R1CS equivalent of `crate::BandersnatchConfig`. +pub type EdwardsVar = AffineVar; /// A variable that is the R1CS equivalent of `crate::SWProjective` -pub type SWVar = ProjectiveVar; +pub type SWVar = ProjectiveVar; #[test] fn test() { diff --git a/ed_on_bls12_381_bandersnatch/src/curves/mod.rs b/ed_on_bls12_381_bandersnatch/src/curves/mod.rs index d96e259..7fe48b4 100644 --- a/ed_on_bls12_381_bandersnatch/src/curves/mod.rs +++ b/ed_on_bls12_381_bandersnatch/src/curves/mod.rs @@ -10,11 +10,11 @@ use crate::{Fq, Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; -pub type SWAffine = short_weierstrass::Affine; -pub type SWProjective = short_weierstrass::Projective; +pub type SWAffine = short_weierstrass::Affine; +pub type SWProjective = short_weierstrass::Projective; /// `bandersnatch` is an incomplete twisted Edwards curve. These curves have /// equations of the form: ax² + y² = 1 + dx²y². @@ -49,12 +49,12 @@ pub type SWProjective = short_weierstrass::Projective; /// Script to transfer between different curves are available /// #[derive(Clone, Default, PartialEq, Eq)] -pub struct BandersnatchParameters; +pub struct BandersnatchConfig; -pub type EdwardsParameters = BandersnatchParameters; -pub type SWParameters = BandersnatchParameters; +pub type EdwardsConfig = BandersnatchConfig; +pub type SWConfig = BandersnatchConfig; -impl CurveConfig for BandersnatchParameters { +impl CurveConfig for BandersnatchConfig { type BaseField = Fq; type ScalarField = Fr; @@ -67,7 +67,7 @@ impl CurveConfig for BandersnatchParameters { MontFp!("9831726595336160714896451345284868594481866920080427688839802480047265754601"); } -impl TECurveConfig for BandersnatchParameters { +impl TECurveConfig for BandersnatchConfig { /// COEFF_A = -5 const COEFF_A: Fq = MontFp!("-5"); @@ -79,7 +79,7 @@ impl TECurveConfig for BandersnatchParameters { /// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y) const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(TE_GENERATOR_X, TE_GENERATOR_Y); - type MontCurveConfig = BandersnatchParameters; + type MontCurveConfig = BandersnatchConfig; /// Multiplication by `a` is multiply by `-5`. #[inline(always)] @@ -88,7 +88,7 @@ impl TECurveConfig for BandersnatchParameters { } } -impl MontCurveConfig for BandersnatchParameters { +impl MontCurveConfig for BandersnatchConfig { /// COEFF_A = 29978822694968839326280996386011761570173833766074948509196803838190355340952 const COEFF_A: Fq = MontFp!("29978822694968839326280996386011761570173833766074948509196803838190355340952"); @@ -97,7 +97,7 @@ impl MontCurveConfig for BandersnatchParameters { const COEFF_B: Fq = MontFp!("25465760566081946422412445027709227188579564747101592991722834452325077642517"); - type TECurveConfig = BandersnatchParameters; + type TECurveConfig = BandersnatchConfig; } // The TE form generator is generated following Zcash's fashion: @@ -125,7 +125,7 @@ const SW_GENERATOR_X: Fq = const SW_GENERATOR_Y: Fq = MontFp!("12663882780877899054958035777720958383845500985908634476792678820121468453298"); -impl SWCurveConfig for BandersnatchParameters { +impl SWCurveConfig for BandersnatchConfig { /// COEFF_A = 10773120815616481058602537765553212789256758185246796157495669123169359657269 const COEFF_A: Self::BaseField = MontFp!("10773120815616481058602537765553212789256758185246796157495669123169359657269"); diff --git a/ed_on_bn254/src/constraints/curves.rs b/ed_on_bn254/src/constraints/curves.rs index df411c0..2d22578 100644 --- a/ed_on_bn254/src/constraints/curves.rs +++ b/ed_on_bn254/src/constraints/curves.rs @@ -3,7 +3,7 @@ use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use crate::{constraints::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; #[test] fn test() { diff --git a/ed_on_bn254/src/curves/mod.rs b/ed_on_bn254/src/curves/mod.rs index 772f381..f6783e0 100644 --- a/ed_on_bn254/src/curves/mod.rs +++ b/ed_on_bn254/src/curves/mod.rs @@ -9,8 +9,8 @@ use crate::{Fq, Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; /// `Baby-JubJub` is a twisted Edwards curve. These curves have equations of the /// form: ax² + y² = 1 + dx²y². @@ -20,9 +20,9 @@ pub type EdwardsProjective = Projective; /// /// q = 21888242871839275222246405745257275088548364400416034343698204186575808495617 #[derive(Clone, Default, PartialEq, Eq)] -pub struct EdwardsParameters; +pub struct EdwardsConfig; -impl CurveConfig for EdwardsParameters { +impl CurveConfig for EdwardsConfig { type BaseField = Fq; type ScalarField = Fr; @@ -35,7 +35,7 @@ impl CurveConfig for EdwardsParameters { MontFp!("2394026564107420727433200628387514462817212225638746351800188703329891451411"); } -impl TECurveConfig for EdwardsParameters { +impl TECurveConfig for EdwardsConfig { /// COEFF_A = 1 const COEFF_A: Fq = Fq::ONE; @@ -52,16 +52,16 @@ impl TECurveConfig for EdwardsParameters { /// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y) const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = EdwardsParameters; + type MontCurveConfig = EdwardsConfig; } -impl MontCurveConfig for EdwardsParameters { +impl MontCurveConfig for EdwardsConfig { /// COEFF_A = 168698 const COEFF_A: Fq = MontFp!("168698"); /// COEFF_B = 168700 const COEFF_B: Fq = MontFp!("168700"); - type TECurveConfig = EdwardsParameters; + type TECurveConfig = EdwardsConfig; } const GENERATOR_X: Fq = diff --git a/ed_on_cp6_782/src/constraints/curves.rs b/ed_on_cp6_782/src/constraints/curves.rs index 7401d17..fffc1a3 100644 --- a/ed_on_cp6_782/src/constraints/curves.rs +++ b/ed_on_cp6_782/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use crate::{constraints::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; #[test] fn test() { - ark_curve_constraint_tests::curves::te_test::().unwrap(); + ark_curve_constraint_tests::curves::te_test::().unwrap(); } diff --git a/ed_on_cp6_782/src/curves/mod.rs b/ed_on_cp6_782/src/curves/mod.rs index 875279a..3ae30ba 100644 --- a/ed_on_cp6_782/src/curves/mod.rs +++ b/ed_on_cp6_782/src/curves/mod.rs @@ -9,13 +9,13 @@ use crate::{Fq, Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct EdwardsParameters; +pub struct EdwardsConfig; -impl CurveConfig for EdwardsParameters { +impl CurveConfig for EdwardsConfig { type BaseField = Fq; type ScalarField = Fr; @@ -27,7 +27,7 @@ impl CurveConfig for EdwardsParameters { const COFACTOR_INV: Fr = MontFp!("12124894969357926281749346891948134384518445910386624712788431705725441736421489799867521238554906438478484045560"); } -impl TECurveConfig for EdwardsParameters { +impl TECurveConfig for EdwardsConfig { /// COEFF_A = -1 = const COEFF_A: Fq = MontFp!("-1"); @@ -37,7 +37,7 @@ impl TECurveConfig for EdwardsParameters { /// AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y) const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = EdwardsParameters; + type MontCurveConfig = EdwardsConfig; /// Multiplication by `a` is just negation. #[inline(always)] @@ -46,14 +46,14 @@ impl TECurveConfig for EdwardsParameters { } } -impl MontCurveConfig for EdwardsParameters { +impl MontCurveConfig for EdwardsConfig { /// COEFF_A = 0x95D53EB3F6AC3F7A53C26020144439DC6073BCAE513E03FD06B6B3BAA390F25E51534B26719E33F4CD906D4DA9B535 const COEFF_A: Fq = MontFp!("90083623084271891037116870487743067984710080209539149685414147055329063590616489392386084989619674926965747987765"); /// COEFF_B = 0x118650763CE64AB4BE743604C8D05013DC2663652A3D58B21ECAB7BFF65B70DB8BA09F9098E61CC903B2F92B2564ACA const COEFF_B: Fq = MontFp!("168580802928697202973535863207150465551683432545375510854470115611391404757724333382582803149953685197474573470410"); - type TECurveConfig = EdwardsParameters; + type TECurveConfig = EdwardsConfig; } /// GENERATOR_X = diff --git a/ed_on_mnt4_298/src/constraints/curves.rs b/ed_on_mnt4_298/src/constraints/curves.rs index 88bac55..f869684 100644 --- a/ed_on_mnt4_298/src/constraints/curves.rs +++ b/ed_on_mnt4_298/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use crate::{constraints::fields::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; #[test] fn test() { - ark_curve_constraint_tests::curves::te_test::().unwrap(); + ark_curve_constraint_tests::curves::te_test::().unwrap(); } diff --git a/ed_on_mnt4_298/src/curves/mod.rs b/ed_on_mnt4_298/src/curves/mod.rs index db791da..b4acc5f 100644 --- a/ed_on_mnt4_298/src/curves/mod.rs +++ b/ed_on_mnt4_298/src/curves/mod.rs @@ -9,13 +9,13 @@ use crate::{fq::Fq, fr::Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct EdwardsParameters; +pub struct EdwardsConfig; -impl CurveConfig for EdwardsParameters { +impl CurveConfig for EdwardsConfig { type BaseField = Fq; type ScalarField = Fr; @@ -34,7 +34,7 @@ impl CurveConfig for EdwardsParameters { // R for Fq: 223364648326281414938801705359223029554923725549792420683051274872200260503540791531766876 // R for Fr: 104384076783966083500464392945960916666734135485183910065100558776489954102951241798239545 -impl TECurveConfig for EdwardsParameters { +impl TECurveConfig for EdwardsConfig { /// COEFF_A = -1 /// Needs to be in the Montgomery residue form in Fq /// I.e., -1 * R for Fq @@ -50,7 +50,7 @@ impl TECurveConfig for EdwardsParameters { /// Generated randomly const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = EdwardsParameters; + type MontCurveConfig = EdwardsConfig; /// Multiplication by `a` is just negation. #[inline(always)] @@ -59,14 +59,14 @@ impl TECurveConfig for EdwardsParameters { } } -impl MontCurveConfig for EdwardsParameters { +impl MontCurveConfig for EdwardsConfig { /// COEFF_A = 203563247015667910991582090642011229452721346107806307863040223071914240315202967004285204 const COEFF_A: Fq = MontFp!("203563247015667910991582090642011229452721346107806307863040223071914240315202967004285204"); /// COEFF_B = 272359039153593414761767159011037222092403532445017207690227512667250406992205523555677931 const COEFF_B: Fq = MontFp!("272359039153593414761767159011037222092403532445017207690227512667250406992205523555677931"); - type TECurveConfig = EdwardsParameters; + type TECurveConfig = EdwardsConfig; } /// GENERATOR_X = diff --git a/ed_on_mnt4_753/src/constraints/curves.rs b/ed_on_mnt4_753/src/constraints/curves.rs index 88bac55..f869684 100644 --- a/ed_on_mnt4_753/src/constraints/curves.rs +++ b/ed_on_mnt4_753/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use crate::{constraints::fields::FqVar, *}; /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. -pub type EdwardsVar = AffineVar; +pub type EdwardsVar = AffineVar; #[test] fn test() { - ark_curve_constraint_tests::curves::te_test::().unwrap(); + ark_curve_constraint_tests::curves::te_test::().unwrap(); } diff --git a/ed_on_mnt4_753/src/curves/mod.rs b/ed_on_mnt4_753/src/curves/mod.rs index de530fd..5f5ebb9 100644 --- a/ed_on_mnt4_753/src/curves/mod.rs +++ b/ed_on_mnt4_753/src/curves/mod.rs @@ -9,13 +9,13 @@ use crate::{fq::Fq, fr::Fr}; #[cfg(test)] mod tests; -pub type EdwardsAffine = Affine; -pub type EdwardsProjective = Projective; +pub type EdwardsAffine = Affine; +pub type EdwardsProjective = Projective; #[derive(Clone, Default, PartialEq, Eq)] -pub struct EdwardsParameters; +pub struct EdwardsConfig; -impl CurveConfig for EdwardsParameters { +impl CurveConfig for EdwardsConfig { type BaseField = Fq; type ScalarField = Fr; @@ -27,7 +27,7 @@ impl CurveConfig for EdwardsParameters { const COFACTOR_INV: Fr = MontFp!("4582647449616135528381398492791944685893671397494963179726320631987147963874964803303316505414568319530101512550297775574042810022553679071007001162683923594233560231270043634777390699589793776691858866199511300853468155295505"); } -impl TECurveConfig for EdwardsParameters { +impl TECurveConfig for EdwardsConfig { /// COEFF_A = -1 const COEFF_A: Fq = MontFp!("-1"); @@ -37,7 +37,7 @@ impl TECurveConfig for EdwardsParameters { /// Generated randomly const GENERATOR: EdwardsAffine = EdwardsAffine::new_unchecked(GENERATOR_X, GENERATOR_Y); - type MontCurveConfig = EdwardsParameters; + type MontCurveConfig = EdwardsConfig; /// Multiplication by `a` is just negation. #[inline(always)] @@ -46,14 +46,14 @@ impl TECurveConfig for EdwardsParameters { } } -impl MontCurveConfig for EdwardsParameters { +impl MontCurveConfig for EdwardsConfig { /// COEFF_A = 40212480635445336270302172549278415015971955924352275480357619589919378421241453024646804979794897776496091377551124233752850182852486874251193367187677349266115879541798515219680194853352256809837126277708211496794264654247419 const COEFF_A: Fq = MontFp!("40212480635445336270302172549278415015971955924352275480357619589919378421241453024646804979794897776496091377551124233752850182852486874251193367187677349266115879541798515219680194853352256809837126277708211496794264654247419"); /// COEFF_B = 1686010332473617132042042241962222112198753995601673591425883331105974391329653748412088783995441144921979594337334243570322874639106980818502874667119046899605536783551549221790223284494141659774809441351696667426519821912580 const COEFF_B: Fq = MontFp!("1686010332473617132042042241962222112198753995601673591425883331105974391329653748412088783995441144921979594337334243570322874639106980818502874667119046899605536783551549221790223284494141659774809441351696667426519821912580"); - type TECurveConfig = EdwardsParameters; + type TECurveConfig = EdwardsConfig; } /// GENERATOR_X = diff --git a/mnt4_298/src/constraints/curves.rs b/mnt4_298/src/constraints/curves.rs index 8804e39..7d4779f 100644 --- a/mnt4_298/src/constraints/curves.rs +++ b/mnt4_298/src/constraints/curves.rs @@ -1,30 +1,24 @@ use ark_r1cs_std::groups::mnt4; -use crate::Parameters; +use crate::Config; /// An element of G1 in the MNT4-298 bilinear group. -pub type G1Var = mnt4::G1Var; +pub type G1Var = mnt4::G1Var; /// An element of G2 in the MNT4-298 bilinear group. -pub type G2Var = mnt4::G2Var; +pub type G2Var = mnt4::G2Var; /// Represents the cached precomputation that can be performed on a G1 element /// which enables speeding up pairing computation. -pub type G1PreparedVar = mnt4::G1PreparedVar; +pub type G1PreparedVar = mnt4::G1PreparedVar; /// Represents the cached precomputation that can be performed on a G2 element /// which enables speeding up pairing computation. -pub type G2PreparedVar = mnt4::G2PreparedVar; +pub type G2PreparedVar = mnt4::G2PreparedVar; #[test] fn test() { - use ark_ec::models::mnt4::MNT4Parameters; - ark_curve_constraint_tests::curves::sw_test::< - ::G1Parameters, - G1Var, - >() - .unwrap(); - ark_curve_constraint_tests::curves::sw_test::< - ::G2Parameters, - G2Var, - >() - .unwrap(); + use ark_ec::models::mnt4::MNT4Config; + ark_curve_constraint_tests::curves::sw_test::<::G1Config, G1Var>() + .unwrap(); + ark_curve_constraint_tests::curves::sw_test::<::G2Config, G2Var>() + .unwrap(); } diff --git a/mnt4_298/src/constraints/pairing.rs b/mnt4_298/src/constraints/pairing.rs index 6397626..a3d8fdf 100644 --- a/mnt4_298/src/constraints/pairing.rs +++ b/mnt4_298/src/constraints/pairing.rs @@ -1,8 +1,8 @@ -use crate::Parameters; +use crate::Config; /// Specifies the constraints for computing a pairing in the MNT4-298 bilinear /// group. -pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar; +pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar; #[test] fn test() { diff --git a/mnt4_298/src/curves/g1.rs b/mnt4_298/src/curves/g1.rs index 51c9935..a80b161 100644 --- a/mnt4_298/src/curves/g1.rs +++ b/mnt4_298/src/curves/g1.rs @@ -6,14 +6,14 @@ use ark_ff::{Field, MontFp}; use crate::{Fq, Fr}; -pub type G1Affine = mnt4::G1Affine; -pub type G1Projective = mnt4::G1Projective; -pub type G1Prepared = mnt4::G1Prepared; +pub type G1Affine = mnt4::G1Affine; +pub type G1Projective = mnt4::G1Projective; +pub type G1Prepared = mnt4::G1Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -25,7 +25,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 2 /// Reference: const COEFF_A: Fq = MontFp!("2"); diff --git a/mnt4_298/src/curves/g2.rs b/mnt4_298/src/curves/g2.rs index 5b7e97e..fe640d7 100644 --- a/mnt4_298/src/curves/g2.rs +++ b/mnt4_298/src/curves/g2.rs @@ -1,20 +1,20 @@ use ark_ec::{ mnt4, - mnt4::MNT4Parameters, + mnt4::MNT4Config, models::{short_weierstrass::SWCurveConfig, CurveConfig}, }; use ark_ff::{Field, MontFp}; use crate::{Fq, Fq2, Fr, G1_COEFF_A_NON_RESIDUE}; -pub type G2Affine = mnt4::G2Affine; -pub type G2Projective = mnt4::G2Projective; -pub type G2Prepared = mnt4::G2Prepared; +pub type G2Affine = mnt4::G2Affine; +pub type G2Projective = mnt4::G2Projective; +pub type G2Prepared = mnt4::G2Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq2; type ScalarField = Fr; @@ -40,8 +40,8 @@ pub const MUL_BY_A_C0: Fq = G1_COEFF_A_NON_RESIDUE; /// MUL_BY_A_C1 = NONRESIDUE * COEFF_A pub const MUL_BY_A_C1: Fq = G1_COEFF_A_NON_RESIDUE; -impl SWCurveConfig for Parameters { - const COEFF_A: Fq2 = crate::Parameters::TWIST_COEFF_A; +impl SWCurveConfig for Config { + const COEFF_A: Fq2 = crate::Config::TWIST_COEFF_A; // B coefficient of MNT4-298 G2 = // ``` // mnt4298_twist_coeff_b = mnt4298_Fq2(mnt4298_Fq::zero(), diff --git a/mnt4_298/src/curves/mod.rs b/mnt4_298/src/curves/mod.rs index fbaafe6..ac821bf 100644 --- a/mnt4_298/src/curves/mod.rs +++ b/mnt4_298/src/curves/mod.rs @@ -1,4 +1,4 @@ -use ark_ec::models::mnt4::{MNT4Parameters, MNT4}; +use ark_ec::models::mnt4::{MNT4Config, MNT4}; use ark_ff::{biginteger::BigInteger320, BigInt, Field, MontFp}; use crate::{Fq, Fq2, Fq2Config, Fq4Config, Fr}; @@ -14,11 +14,11 @@ pub use self::{ g2::{G2Affine, G2Prepared, G2Projective}, }; -pub type MNT4_298 = MNT4; +pub type MNT4_298 = MNT4; -pub struct Parameters; +pub struct Config; -impl MNT4Parameters for Parameters { +impl MNT4Config for Config { const TWIST: Fq2 = Fq2::new(Fq::ZERO, Fq::ONE); // A coefficient of MNT4-298 G2 = // ``` @@ -46,8 +46,8 @@ impl MNT4Parameters for Parameters { type Fr = Fr; type Fp2Config = Fq2Config; type Fp4Config = Fq4Config; - type G1Parameters = self::g1::Parameters; - type G2Parameters = self::g2::Parameters; + type G1Config = self::g1::Config; + type G2Config = self::g2::Config; } // 34 diff --git a/mnt4_753/src/constraints/curves.rs b/mnt4_753/src/constraints/curves.rs index fd96848..a590621 100644 --- a/mnt4_753/src/constraints/curves.rs +++ b/mnt4_753/src/constraints/curves.rs @@ -1,30 +1,24 @@ use ark_r1cs_std::groups::mnt4; -use crate::Parameters; +use crate::Config; /// An element of G1 in the MNT4-753 bilinear group. -pub type G1Var = mnt4::G1Var; +pub type G1Var = mnt4::G1Var; /// An element of G2 in the MNT4-753 bilinear group. -pub type G2Var = mnt4::G2Var; +pub type G2Var = mnt4::G2Var; /// Represents the cached precomputation that can be performed on a G1 element /// which enables speeding up pairing computation. -pub type G1PreparedVar = mnt4::G1PreparedVar; +pub type G1PreparedVar = mnt4::G1PreparedVar; /// Represents the cached precomputation that can be performed on a G2 element /// which enables speeding up pairing computation. -pub type G2PreparedVar = mnt4::G2PreparedVar; +pub type G2PreparedVar = mnt4::G2PreparedVar; #[test] fn test() { - use ark_ec::models::mnt4::MNT4Parameters; - ark_curve_constraint_tests::curves::sw_test::< - ::G1Parameters, - G1Var, - >() - .unwrap(); - ark_curve_constraint_tests::curves::sw_test::< - ::G2Parameters, - G2Var, - >() - .unwrap(); + use ark_ec::models::mnt4::MNT4Config; + ark_curve_constraint_tests::curves::sw_test::<::G1Config, G1Var>() + .unwrap(); + ark_curve_constraint_tests::curves::sw_test::<::G2Config, G2Var>() + .unwrap(); } diff --git a/mnt4_753/src/constraints/pairing.rs b/mnt4_753/src/constraints/pairing.rs index 10b8f11..70e48f4 100644 --- a/mnt4_753/src/constraints/pairing.rs +++ b/mnt4_753/src/constraints/pairing.rs @@ -1,8 +1,8 @@ -use crate::Parameters; +use crate::Config; /// Specifies the constraints for computing a pairing in the MNT4-753 bilinear /// group. -pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar; +pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar; #[test] fn test() { diff --git a/mnt4_753/src/curves/g1.rs b/mnt4_753/src/curves/g1.rs index 19334cf..5b2a25e 100644 --- a/mnt4_753/src/curves/g1.rs +++ b/mnt4_753/src/curves/g1.rs @@ -6,14 +6,14 @@ use ark_ff::{Field, MontFp}; use crate::{Fq, Fr}; -pub type G1Affine = mnt4::G1Affine; -pub type G1Projective = mnt4::G1Projective; -pub type G1Prepared = mnt4::G1Prepared; +pub type G1Affine = mnt4::G1Affine; +pub type G1Projective = mnt4::G1Projective; +pub type G1Prepared = mnt4::G1Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -24,7 +24,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 2 const COEFF_A: Fq = MontFp!("2"); diff --git a/mnt4_753/src/curves/g2.rs b/mnt4_753/src/curves/g2.rs index 820d520..94e7d44 100644 --- a/mnt4_753/src/curves/g2.rs +++ b/mnt4_753/src/curves/g2.rs @@ -1,20 +1,20 @@ use ark_ec::{ mnt4, - mnt4::MNT4Parameters, + mnt4::MNT4Config, models::{short_weierstrass::SWCurveConfig, CurveConfig}, }; use ark_ff::{Field, MontFp}; use crate::{Fq, Fq2, Fr, G1_COEFF_A_NON_RESIDUE}; -pub type G2Affine = mnt4::G2Affine; -pub type G2Projective = mnt4::G2Projective; -pub type G2Prepared = mnt4::G2Prepared; +pub type G2Affine = mnt4::G2Affine; +pub type G2Projective = mnt4::G2Projective; +pub type G2Prepared = mnt4::G2Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq2; type ScalarField = Fr; @@ -47,8 +47,8 @@ pub const MUL_BY_A_C0: Fq = G1_COEFF_A_NON_RESIDUE; /// MUL_BY_A_C1 = NONRESIDUE * COEFF_A pub const MUL_BY_A_C1: Fq = G1_COEFF_A_NON_RESIDUE; -impl SWCurveConfig for Parameters { - const COEFF_A: Fq2 = crate::Parameters::TWIST_COEFF_A; +impl SWCurveConfig for Config { + const COEFF_A: Fq2 = crate::Config::TWIST_COEFF_A; // B coefficient of MNT4-753 G2 = // ``` // mnt4753_twist_coeff_b = mnt4753_Fq2(mnt4753_Fq::zero(), diff --git a/mnt4_753/src/curves/mod.rs b/mnt4_753/src/curves/mod.rs index aca6f31..68381dc 100644 --- a/mnt4_753/src/curves/mod.rs +++ b/mnt4_753/src/curves/mod.rs @@ -1,4 +1,4 @@ -use ark_ec::models::mnt4::{MNT4Parameters, MNT4}; +use ark_ec::models::mnt4::{MNT4Config, MNT4}; use ark_ff::{ biginteger::{BigInt, BigInteger768}, Field, Fp2, MontFp, @@ -17,11 +17,11 @@ pub use self::{ g2::{G2Affine, G2Prepared, G2Projective}, }; -pub type MNT4_753 = MNT4; +pub type MNT4_753 = MNT4; -pub struct Parameters; +pub struct Config; -impl MNT4Parameters for Parameters { +impl MNT4Config for Config { const TWIST: Fp2 = Fp2::new(Fq::ZERO, Fq::ONE); // A coefficient of MNT4-753 G2 = // ``` @@ -69,8 +69,8 @@ impl MNT4Parameters for Parameters { type Fr = Fr; type Fp2Config = Fq2Config; type Fp4Config = Fq4Config; - type G1Parameters = self::g1::Parameters; - type G2Parameters = self::g2::Parameters; + type G1Config = self::g1::Config; + type G2Config = self::g2::Config; } // 26 diff --git a/mnt6_298/src/constraints/curves.rs b/mnt6_298/src/constraints/curves.rs index 0f529d1..183a1f9 100644 --- a/mnt6_298/src/constraints/curves.rs +++ b/mnt6_298/src/constraints/curves.rs @@ -1,30 +1,24 @@ use ark_r1cs_std::groups::mnt6; -use crate::Parameters; +use crate::Config; /// An element of G1 in the MNT6-298 bilinear group. -pub type G1Var = mnt6::G1Var; +pub type G1Var = mnt6::G1Var; /// An element of G2 in the MNT6-298 bilinear group. -pub type G2Var = mnt6::G2Var; +pub type G2Var = mnt6::G2Var; /// Represents the cached precomputation that can be performed on a G1 element /// which enables speeding up pairing computation. -pub type G1PreparedVar = mnt6::G1PreparedVar; +pub type G1PreparedVar = mnt6::G1PreparedVar; /// Represents the cached precomputation that can be performed on a G2 element /// which enables speeding up pairing computation. -pub type G2PreparedVar = mnt6::G2PreparedVar; +pub type G2PreparedVar = mnt6::G2PreparedVar; #[test] fn test() { - use ark_ec::models::mnt6::MNT6Parameters; - ark_curve_constraint_tests::curves::sw_test::< - ::G1Parameters, - G1Var, - >() - .unwrap(); - ark_curve_constraint_tests::curves::sw_test::< - ::G2Parameters, - G2Var, - >() - .unwrap(); + use ark_ec::models::mnt6::MNT6Config; + ark_curve_constraint_tests::curves::sw_test::<::G1Config, G1Var>() + .unwrap(); + ark_curve_constraint_tests::curves::sw_test::<::G2Config, G2Var>() + .unwrap(); } diff --git a/mnt6_298/src/constraints/pairing.rs b/mnt6_298/src/constraints/pairing.rs index 20861c2..7d595c0 100644 --- a/mnt6_298/src/constraints/pairing.rs +++ b/mnt6_298/src/constraints/pairing.rs @@ -1,8 +1,8 @@ -use crate::Parameters; +use crate::Config; /// Specifies the constraints for computing a pairing in the MNT6-298 bilinear /// group. -pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar; +pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar; #[test] fn test() { diff --git a/mnt6_298/src/curves/g1.rs b/mnt6_298/src/curves/g1.rs index 5026f14..661eb34 100644 --- a/mnt6_298/src/curves/g1.rs +++ b/mnt6_298/src/curves/g1.rs @@ -6,14 +6,14 @@ use ark_ff::{Field, MontFp}; use crate::{Fq, Fr}; -pub type G1Affine = mnt6::G1Affine; -pub type G1Projective = mnt6::G1Projective; -pub type G1Prepared = mnt6::G1Prepared; +pub type G1Affine = mnt6::G1Affine; +pub type G1Projective = mnt6::G1Projective; +pub type G1Prepared = mnt6::G1Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -24,7 +24,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 11 const COEFF_A: Fq = MontFp!("11"); diff --git a/mnt6_298/src/curves/g2.rs b/mnt6_298/src/curves/g2.rs index c325980..6d3b78e 100644 --- a/mnt6_298/src/curves/g2.rs +++ b/mnt6_298/src/curves/g2.rs @@ -1,20 +1,20 @@ use ark_ec::{ mnt6, - mnt6::MNT6Parameters, + mnt6::MNT6Config, models::{short_weierstrass::SWCurveConfig, CurveConfig}, }; use ark_ff::{Field, MontFp}; use crate::{g1, Fq, Fq3, Fr}; -pub type G2Affine = mnt6::G2Affine; -pub type G2Projective = mnt6::G2Projective; -pub type G2Prepared = mnt6::G2Prepared; +pub type G2Affine = mnt6::G2Affine; +pub type G2Projective = mnt6::G2Projective; +pub type G2Prepared = mnt6::G2Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq3; type ScalarField = Fr; @@ -48,10 +48,10 @@ pub const MUL_BY_A_C0: Fq = MontFp!("55"); pub const MUL_BY_A_C1: Fq = MontFp!("55"); /// MUL_BY_A_C2 = COEFF_A -pub const MUL_BY_A_C2: Fq = g1::Parameters::COEFF_A; +pub const MUL_BY_A_C2: Fq = g1::Config::COEFF_A; -impl SWCurveConfig for Parameters { - const COEFF_A: Fq3 = crate::Parameters::TWIST_COEFF_A; +impl SWCurveConfig for Config { + const COEFF_A: Fq3 = crate::Config::TWIST_COEFF_A; const COEFF_B: Fq3 = Fq3::new( // 5 * G1::COEFF_B MontFp!("57578116384997352636487348509878309737146377454014423897662211075515354005624851787652233"), diff --git a/mnt6_298/src/curves/mod.rs b/mnt6_298/src/curves/mod.rs index 767d146..51e5eb0 100644 --- a/mnt6_298/src/curves/mod.rs +++ b/mnt6_298/src/curves/mod.rs @@ -1,5 +1,5 @@ use ark_ec::{ - models::mnt6::{MNT6Parameters, MNT6}, + models::mnt6::{MNT6Config, MNT6}, short_weierstrass::SWCurveConfig, }; use ark_ff::{biginteger::BigInteger320, BigInt, Field, Fp3}; @@ -17,14 +17,14 @@ pub use self::{ g2::{G2Affine, G2Prepared, G2Projective}, }; -pub type MNT6_298 = MNT6; +pub type MNT6_298 = MNT6; -pub struct Parameters; +pub struct Config; -impl MNT6Parameters for Parameters { +impl MNT6Config for Config { const TWIST: Fp3 = Fp3::::new(Fq::ZERO, Fq::ONE, Fq::ZERO); const TWIST_COEFF_A: Fp3 = - Fp3::::new(Fq::ZERO, Fq::ZERO, g1::Parameters::COEFF_A); + Fp3::::new(Fq::ZERO, Fq::ZERO, g1::Config::COEFF_A); // https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt4_80.ml#L88 const ATE_LOOP_COUNT: &'static [i8] = &[ @@ -44,6 +44,6 @@ impl MNT6Parameters for Parameters { type Fr = Fr; type Fp3Config = Fq3Config; type Fp6Config = Fq6Config; - type G1Parameters = self::g1::Parameters; - type G2Parameters = self::g2::Parameters; + type G1Config = self::g1::Config; + type G2Config = self::g2::Config; } diff --git a/mnt6_753/src/constraints/curves.rs b/mnt6_753/src/constraints/curves.rs index c35a921..ce07efe 100644 --- a/mnt6_753/src/constraints/curves.rs +++ b/mnt6_753/src/constraints/curves.rs @@ -1,30 +1,24 @@ use ark_r1cs_std::groups::mnt6; -use crate::Parameters; +use crate::Config; /// An element of G1 in the MNT6-753 bilinear group. -pub type G1Var = mnt6::G1Var; +pub type G1Var = mnt6::G1Var; /// An element of G2 in the MNT6-753 bilinear group. -pub type G2Var = mnt6::G2Var; +pub type G2Var = mnt6::G2Var; /// Represents the cached precomputation that can be performed on a G1 element /// which enables speeding up pairing computation. -pub type G1PreparedVar = mnt6::G1PreparedVar; +pub type G1PreparedVar = mnt6::G1PreparedVar; /// Represents the cached precomputation that can be performed on a G2 element /// which enables speeding up pairing computation. -pub type G2PreparedVar = mnt6::G2PreparedVar; +pub type G2PreparedVar = mnt6::G2PreparedVar; #[test] fn test() { - use ark_ec::models::mnt6::MNT6Parameters; - ark_curve_constraint_tests::curves::sw_test::< - ::G1Parameters, - G1Var, - >() - .unwrap(); - ark_curve_constraint_tests::curves::sw_test::< - ::G2Parameters, - G2Var, - >() - .unwrap(); + use ark_ec::models::mnt6::MNT6Config; + ark_curve_constraint_tests::curves::sw_test::<::G1Config, G1Var>() + .unwrap(); + ark_curve_constraint_tests::curves::sw_test::<::G2Config, G2Var>() + .unwrap(); } diff --git a/mnt6_753/src/constraints/pairing.rs b/mnt6_753/src/constraints/pairing.rs index a58d34c..f57e95b 100644 --- a/mnt6_753/src/constraints/pairing.rs +++ b/mnt6_753/src/constraints/pairing.rs @@ -1,8 +1,8 @@ -use crate::Parameters; +use crate::Config; /// Specifies the constraints for computing a pairing in the MNT6-753 bilinear /// group. -pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar; +pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar; #[test] fn test() { diff --git a/mnt6_753/src/curves/g1.rs b/mnt6_753/src/curves/g1.rs index 13aac9f..4e49168 100644 --- a/mnt6_753/src/curves/g1.rs +++ b/mnt6_753/src/curves/g1.rs @@ -6,14 +6,14 @@ use ark_ff::{Field, MontFp}; use crate::{Fq, Fr}; -pub type G1Affine = mnt6::G1Affine; -pub type G1Projective = mnt6::G1Projective; -pub type G1Prepared = mnt6::G1Prepared; +pub type G1Affine = mnt6::G1Affine; +pub type G1Projective = mnt6::G1Projective; +pub type G1Prepared = mnt6::G1Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -24,7 +24,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 11 const COEFF_A: Fq = MontFp!("11"); diff --git a/mnt6_753/src/curves/g2.rs b/mnt6_753/src/curves/g2.rs index 1b07142..e20169f 100644 --- a/mnt6_753/src/curves/g2.rs +++ b/mnt6_753/src/curves/g2.rs @@ -1,20 +1,20 @@ use ark_ec::{ mnt6, - mnt6::MNT6Parameters, + mnt6::MNT6Config, models::{short_weierstrass::SWCurveConfig, CurveConfig}, }; use ark_ff::{Field, MontFp}; use crate::{g1, Fq, Fq3, Fr}; -pub type G2Affine = mnt6::G2Affine; -pub type G2Projective = mnt6::G2Projective; -pub type G2Prepared = mnt6::G2Prepared; +pub type G2Affine = mnt6::G2Affine; +pub type G2Projective = mnt6::G2Projective; +pub type G2Prepared = mnt6::G2Prepared; #[derive(Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq3; type ScalarField = Fr; @@ -64,10 +64,10 @@ pub const MUL_BY_A_C0: Fq = MontFp!("121"); pub const MUL_BY_A_C1: Fq = MontFp!("121"); /// MUL_BY_A_C2 = COEFF_A -pub const MUL_BY_A_C2: Fq = g1::Parameters::COEFF_A; +pub const MUL_BY_A_C2: Fq = g1::Config::COEFF_A; -impl SWCurveConfig for Parameters { - const COEFF_A: Fq3 = crate::Parameters::TWIST_COEFF_A; +impl SWCurveConfig for Config { + const COEFF_A: Fq3 = crate::Config::TWIST_COEFF_A; // B coefficient of MNT6-753 G2 = // ``` // mnt6753_twist_coeff_b = mnt6753_Fq3(mnt6753_G1::coeff_b * mnt6753_Fq3::non_residue, diff --git a/mnt6_753/src/curves/mod.rs b/mnt6_753/src/curves/mod.rs index 488279a..52a1cf8 100644 --- a/mnt6_753/src/curves/mod.rs +++ b/mnt6_753/src/curves/mod.rs @@ -1,5 +1,5 @@ use ark_ec::models::{ - mnt6::{MNT6Parameters, MNT6}, + mnt6::{MNT6Config, MNT6}, short_weierstrass::SWCurveConfig, }; use ark_ff::{biginteger::BigInteger768, BigInt, Field, Fp3}; @@ -17,11 +17,11 @@ pub use self::{ g2::{G2Affine, G2Prepared, G2Projective}, }; -pub type MNT6_753 = MNT6; +pub type MNT6_753 = MNT6; -pub struct Parameters; +pub struct Config; -impl MNT6Parameters for Parameters { +impl MNT6Config for Config { const TWIST: Fp3 = Fp3::new(Fq::ZERO, Fq::ONE, Fq::ZERO); // A coefficient of MNT6-753 G2 = // ``` @@ -29,8 +29,7 @@ impl MNT6Parameters for Parameters { // mnt6753_G1::coeff_a); // = (ZERO, ZERO, A_COEFF); // ``` - const TWIST_COEFF_A: Fp3 = - Fp3::new(Fq::ZERO, Fq::ZERO, g1::Parameters::COEFF_A); + const TWIST_COEFF_A: Fp3 = Fp3::new(Fq::ZERO, Fq::ZERO, g1::Config::COEFF_A); // https://github.com/o1-labs/snarky/blob/9c21ab2bb23874604640740d646a932e813432c3/snarkette/mnt6753.ml const ATE_LOOP_COUNT: &'static [i8] = &[ @@ -71,6 +70,6 @@ impl MNT6Parameters for Parameters { type Fr = Fr; type Fp3Config = Fq3Config; type Fp6Config = Fq6Config; - type G1Parameters = self::g1::Parameters; - type G2Parameters = self::g2::Parameters; + type G1Config = self::g1::Config; + type G2Config = self::g2::Config; } diff --git a/pallas/src/constraints/curves.rs b/pallas/src/constraints/curves.rs index 8fa5bdf..4baebca 100644 --- a/pallas/src/constraints/curves.rs +++ b/pallas/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar; use crate::{constraints::FBaseVar, *}; /// A group element in the Pallas prime-order group. -pub type GVar = ProjectiveVar; +pub type GVar = ProjectiveVar; #[test] fn test() { - ark_curve_constraint_tests::curves::sw_test::().unwrap(); + ark_curve_constraint_tests::curves::sw_test::().unwrap(); } diff --git a/pallas/src/curves/mod.rs b/pallas/src/curves/mod.rs index 0ed568e..de331f3 100644 --- a/pallas/src/curves/mod.rs +++ b/pallas/src/curves/mod.rs @@ -10,9 +10,9 @@ use crate::{fq::Fq, fr::Fr}; mod tests; #[derive(Copy, Clone, Default, PartialEq, Eq)] -pub struct PallasParameters; +pub struct PallasConfig; -impl CurveConfig for PallasParameters { +impl CurveConfig for PallasConfig { type BaseField = Fq; type ScalarField = Fr; @@ -23,10 +23,10 @@ impl CurveConfig for PallasParameters { const COFACTOR_INV: Fr = Fr::ONE; } -pub type Affine = sw::Affine; -pub type Projective = sw::Projective; +pub type Affine = sw::Affine; +pub type Projective = sw::Projective; -impl SWCurveConfig for PallasParameters { +impl SWCurveConfig for PallasConfig { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; diff --git a/secp256k1/src/constraints/curves.rs b/secp256k1/src/constraints/curves.rs index 390d714..b6eedd0 100644 --- a/secp256k1/src/constraints/curves.rs +++ b/secp256k1/src/constraints/curves.rs @@ -2,9 +2,9 @@ use crate::{constraints::FqVar, *}; use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar; /// A group element in the secp256k1 curve. -pub type GVar = ProjectiveVar; +pub type GVar = ProjectiveVar; #[test] fn test() { - ark_curve_constraint_tests::curves::sw_test::().unwrap(); + ark_curve_constraint_tests::curves::sw_test::().unwrap(); } diff --git a/secp256k1/src/curves/mod.rs b/secp256k1/src/curves/mod.rs index 6bf439c..7c4fcb8 100644 --- a/secp256k1/src/curves/mod.rs +++ b/secp256k1/src/curves/mod.rs @@ -9,13 +9,13 @@ use crate::{fq::Fq, fr::Fr}; #[cfg(test)] mod tests; -pub type Affine = sw::Affine; -pub type Projective = sw::Projective; +pub type Affine = sw::Affine; +pub type Projective = sw::Projective; #[derive(Copy, Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -27,7 +27,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; diff --git a/secq256k1/src/constraints/curves.rs b/secq256k1/src/constraints/curves.rs index 561d85c..cb68303 100644 --- a/secq256k1/src/constraints/curves.rs +++ b/secq256k1/src/constraints/curves.rs @@ -2,9 +2,9 @@ use crate::{constraints::FqVar, *}; use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar; /// A group element in the secq256k1 curve. -pub type GVar = ProjectiveVar; +pub type GVar = ProjectiveVar; #[test] fn test() { - ark_curve_constraint_tests::curves::sw_test::().unwrap(); + ark_curve_constraint_tests::curves::sw_test::().unwrap(); } diff --git a/secq256k1/src/curves/mod.rs b/secq256k1/src/curves/mod.rs index 0796dd3..b7b4dbe 100644 --- a/secq256k1/src/curves/mod.rs +++ b/secq256k1/src/curves/mod.rs @@ -9,13 +9,13 @@ use crate::{fq::Fq, fr::Fr}; #[cfg(test)] mod tests; -pub type Affine = sw::Affine; -pub type Projective = sw::Projective; +pub type Affine = sw::Affine; +pub type Projective = sw::Projective; #[derive(Copy, Clone, Default, PartialEq, Eq)] -pub struct Parameters; +pub struct Config; -impl CurveConfig for Parameters { +impl CurveConfig for Config { type BaseField = Fq; type ScalarField = Fr; @@ -27,7 +27,7 @@ impl CurveConfig for Parameters { const COFACTOR_INV: Fr = Fr::ONE; } -impl SWCurveConfig for Parameters { +impl SWCurveConfig for Config { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO; diff --git a/vesta/src/constraints/curves.rs b/vesta/src/constraints/curves.rs index b959458..ef44140 100644 --- a/vesta/src/constraints/curves.rs +++ b/vesta/src/constraints/curves.rs @@ -3,9 +3,9 @@ use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar; use crate::{constraints::FBaseVar, *}; /// A group element in the Vesta prime-order group. -pub type GVar = ProjectiveVar; +pub type GVar = ProjectiveVar; #[test] fn test() { - ark_curve_constraint_tests::curves::sw_test::().unwrap(); + ark_curve_constraint_tests::curves::sw_test::().unwrap(); } diff --git a/vesta/src/curves/mod.rs b/vesta/src/curves/mod.rs index 28d5261..7135499 100644 --- a/vesta/src/curves/mod.rs +++ b/vesta/src/curves/mod.rs @@ -9,9 +9,9 @@ use ark_ff::{Field, MontFp, Zero}; mod tests; #[derive(Copy, Clone, Default, PartialEq, Eq)] -pub struct VestaParameters; +pub struct VestaConfig; -impl CurveConfig for VestaParameters { +impl CurveConfig for VestaConfig { type BaseField = Fq; type ScalarField = Fr; @@ -22,10 +22,10 @@ impl CurveConfig for VestaParameters { const COFACTOR_INV: Fr = Fr::ONE; } -pub type Affine = sw::Affine; -pub type Projective = sw::Projective; +pub type Affine = sw::Affine; +pub type Projective = sw::Projective; -impl SWCurveConfig for VestaParameters { +impl SWCurveConfig for VestaConfig { /// COEFF_A = 0 const COEFF_A: Fq = Fq::ZERO;