arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
ark-curves-cherry-picked/bls12_377/src/constraints/fields.rs
bls12_377/src/constraints/fields.rsRaw
 1use ark_r1cs_std::fields::{fp::FpVar, fp12::Fp12Var, fp2::Fp2Var, fp6_3over2::Fp6Var};
 2
 3use crate::{Fq, Fq12Config, Fq2Config, Fq6Config};
 4
 5/// A variable that is the R1CS equivalent of `crate::Fq`.
 6pub type FqVar = FpVar<Fq>;
 7
 8/// A variable that is the R1CS equivalent of `crate::Fq2`.
 9pub type Fq2Var = Fp2Var<Fq2Config>;
10/// A variable that is the R1CS equivalent of `crate::Fq6`.
11pub type Fq6Var = Fp6Var<Fq6Config>;
12/// A variable that is the R1CS equivalent of `crate::Fq12`.
13pub type Fq12Var = Fp12Var<Fq12Config>;
14
15#[test]
16fn bls12_377_field_test() {
17    use super::*;
18    use crate::{Fq, Fq12, Fq2, Fq6};
19    use ark_curve_constraint_tests::fields::*;
20
21    field_test::<_, _, FqVar>().unwrap();
22    frobenius_tests::<Fq, _, FqVar>(13).unwrap();
23
24    field_test::<_, _, Fq2Var>().unwrap();
25    frobenius_tests::<Fq2, _, Fq2Var>(13).unwrap();
26
27    field_test::<_, _, Fq6Var>().unwrap();
28    frobenius_tests::<Fq6, _, Fq6Var>(13).unwrap();
29
30    field_test::<_, _, Fq12Var>().unwrap();
31    frobenius_tests::<Fq12, _, Fq12Var>(13).unwrap();
32}