mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-08 23:11:29 +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::mnt6;
|
||||
|
||||
use crate::Parameters;
|
||||
use crate::Config;
|
||||
|
||||
/// An element of G1 in the MNT6-753 bilinear group.
|
||||
pub type G1Var = mnt6::G1Var<Parameters>;
|
||||
pub type G1Var = mnt6::G1Var<Config>;
|
||||
/// An element of G2 in the MNT6-753 bilinear group.
|
||||
pub type G2Var = mnt6::G2Var<Parameters>;
|
||||
pub type G2Var = mnt6::G2Var<Config>;
|
||||
|
||||
/// Represents the cached precomputation that can be performed on a G1 element
|
||||
/// which enables speeding up pairing computation.
|
||||
pub type G1PreparedVar = mnt6::G1PreparedVar<Parameters>;
|
||||
pub type G1PreparedVar = mnt6::G1PreparedVar<Config>;
|
||||
/// Represents the cached precomputation that can be performed on a G2 element
|
||||
/// which enables speeding up pairing computation.
|
||||
pub type G2PreparedVar = mnt6::G2PreparedVar<Parameters>;
|
||||
pub type G2PreparedVar = mnt6::G2PreparedVar<Config>;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
use ark_ec::models::mnt6::MNT6Parameters;
|
||||
ark_curve_constraint_tests::curves::sw_test::<
|
||||
<Parameters as MNT6Parameters>::G1Parameters,
|
||||
G1Var,
|
||||
>()
|
||||
.unwrap();
|
||||
ark_curve_constraint_tests::curves::sw_test::<
|
||||
<Parameters as MNT6Parameters>::G2Parameters,
|
||||
G2Var,
|
||||
>()
|
||||
.unwrap();
|
||||
use ark_ec::models::mnt6::MNT6Config;
|
||||
ark_curve_constraint_tests::curves::sw_test::<<Config as MNT6Config>::G1Config, G1Var>()
|
||||
.unwrap();
|
||||
ark_curve_constraint_tests::curves::sw_test::<<Config as MNT6Config>::G2Config, G2Var>()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -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<Parameters>;
|
||||
pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar<Config>;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
|
||||
@@ -6,14 +6,14 @@ use ark_ff::{Field, MontFp};
|
||||
|
||||
use crate::{Fq, Fr};
|
||||
|
||||
pub type G1Affine = mnt6::G1Affine<crate::Parameters>;
|
||||
pub type G1Projective = mnt6::G1Projective<crate::Parameters>;
|
||||
pub type G1Prepared = mnt6::G1Prepared<crate::Parameters>;
|
||||
pub type G1Affine = mnt6::G1Affine<crate::Config>;
|
||||
pub type G1Projective = mnt6::G1Projective<crate::Config>;
|
||||
pub type G1Prepared = mnt6::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 = 11
|
||||
const COEFF_A: Fq = MontFp!("11");
|
||||
|
||||
|
||||
@@ -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<crate::Parameters>;
|
||||
pub type G2Projective = mnt6::G2Projective<crate::Parameters>;
|
||||
pub type G2Prepared = mnt6::G2Prepared<crate::Parameters>;
|
||||
pub type G2Affine = mnt6::G2Affine<crate::Config>;
|
||||
pub type G2Projective = mnt6::G2Projective<crate::Config>;
|
||||
pub type G2Prepared = mnt6::G2Prepared<crate::Config>;
|
||||
|
||||
#[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,
|
||||
|
||||
@@ -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<Parameters>;
|
||||
pub type MNT6_753 = MNT6<Config>;
|
||||
|
||||
pub struct Parameters;
|
||||
pub struct Config;
|
||||
|
||||
impl MNT6Parameters for Parameters {
|
||||
impl MNT6Config for Config {
|
||||
const TWIST: Fp3<Self::Fp3Config> = 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<Self::Fp3Config> =
|
||||
Fp3::new(Fq::ZERO, Fq::ZERO, g1::Parameters::COEFF_A);
|
||||
const TWIST_COEFF_A: Fp3<Self::Fp3Config> = 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user