Add constraints for relevant curves (#3)

This commit is contained in:
Pratyush Mishra
2020-10-19 12:45:23 -07:00
committed by GitHub
parent f6132a4c0e
commit 66a1fc9cf7
68 changed files with 2670 additions and 467 deletions

View File

@@ -0,0 +1,26 @@
use crate::{Fq, Fq2Parameters, Fq4Parameters};
use ark_r1cs_std::fields::{fp::FpVar, fp2::Fp2Var, fp4::Fp4Var};
/// A variable that is the R1CS equivalent of `crate::Fq`.
pub type FqVar = FpVar<Fq>;
/// A variable that is the R1CS equivalent of `crate::Fq2`.
pub type Fq2Var = Fp2Var<Fq2Parameters>;
/// A variable that is the R1CS equivalent of `crate::Fq4`.
pub type Fq4Var = Fp4Var<Fq4Parameters>;
#[test]
fn mnt4_753_field_gadgets_test() {
use super::*;
use crate::{Fq, Fq2, Fq4};
use ark_curve_constraint_tests::fields::*;
field_test::<_, _, FqVar>().unwrap();
frobenius_tests::<Fq, _, FqVar>(13).unwrap();
field_test::<_, _, Fq2Var>().unwrap();
frobenius_tests::<Fq2, _, Fq2Var>(13).unwrap();
field_test::<_, _, Fq4Var>().unwrap();
frobenius_tests::<Fq4, _, Fq4Var>(13).unwrap();
}