mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-11 16:31:36 +01:00
Rename all *Parameters to *Config (#136)
* Rename all `*Parameters` to `*Config` * Tweak
This commit is contained in:
@@ -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<Parameters>;
|
||||
pub type G1Var = mnt4::G1Var<Config>;
|
||||
/// An element of G2 in the MNT4-753 bilinear group.
|
||||
pub type G2Var = mnt4::G2Var<Parameters>;
|
||||
pub type G2Var = mnt4::G2Var<Config>;
|
||||
|
||||
/// Represents the cached precomputation that can be performed on a G1 element
|
||||
/// which enables speeding up pairing computation.
|
||||
pub type G1PreparedVar = mnt4::G1PreparedVar<Parameters>;
|
||||
pub type G1PreparedVar = mnt4::G1PreparedVar<Config>;
|
||||
/// Represents the cached precomputation that can be performed on a G2 element
|
||||
/// which enables speeding up pairing computation.
|
||||
pub type G2PreparedVar = mnt4::G2PreparedVar<Parameters>;
|
||||
pub type G2PreparedVar = mnt4::G2PreparedVar<Config>;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
use ark_ec::models::mnt4::MNT4Parameters;
|
||||
ark_curve_constraint_tests::curves::sw_test::<
|
||||
<Parameters as MNT4Parameters>::G1Parameters,
|
||||
G1Var,
|
||||
>()
|
||||
.unwrap();
|
||||
ark_curve_constraint_tests::curves::sw_test::<
|
||||
<Parameters as MNT4Parameters>::G2Parameters,
|
||||
G2Var,
|
||||
>()
|
||||
.unwrap();
|
||||
use ark_ec::models::mnt4::MNT4Config;
|
||||
ark_curve_constraint_tests::curves::sw_test::<<Config as MNT4Config>::G1Config, G1Var>()
|
||||
.unwrap();
|
||||
ark_curve_constraint_tests::curves::sw_test::<<Config as MNT4Config>::G2Config, G2Var>()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -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<Parameters>;
|
||||
pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar<Config>;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
|
||||
@@ -6,14 +6,14 @@ use ark_ff::{Field, MontFp};
|
||||
|
||||
use crate::{Fq, Fr};
|
||||
|
||||
pub type G1Affine = mnt4::G1Affine<crate::Parameters>;
|
||||
pub type G1Projective = mnt4::G1Projective<crate::Parameters>;
|
||||
pub type G1Prepared = mnt4::G1Prepared<crate::Parameters>;
|
||||
pub type G1Affine = mnt4::G1Affine<crate::Config>;
|
||||
pub type G1Projective = mnt4::G1Projective<crate::Config>;
|
||||
pub type G1Prepared = mnt4::G1Prepared<crate::Config>;
|
||||
|
||||
#[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");
|
||||
|
||||
|
||||
@@ -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<crate::Parameters>;
|
||||
pub type G2Projective = mnt4::G2Projective<crate::Parameters>;
|
||||
pub type G2Prepared = mnt4::G2Prepared<crate::Parameters>;
|
||||
pub type G2Affine = mnt4::G2Affine<crate::Config>;
|
||||
pub type G2Projective = mnt4::G2Projective<crate::Config>;
|
||||
pub type G2Prepared = mnt4::G2Prepared<crate::Config>;
|
||||
|
||||
#[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(),
|
||||
|
||||
@@ -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<Parameters>;
|
||||
pub type MNT4_753 = MNT4<Config>;
|
||||
|
||||
pub struct Parameters;
|
||||
pub struct Config;
|
||||
|
||||
impl MNT4Parameters for Parameters {
|
||||
impl MNT4Config for Config {
|
||||
const TWIST: Fp2<Self::Fp2Config> = 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
|
||||
|
||||
Reference in New Issue
Block a user