diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2256978..9a90f44 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Install - run: rustup default nightly + run: rustup default stable - name: Install rustfmt Components run: rustup component add rustfmt - name: Install clippy diff --git a/Cargo.toml b/Cargo.toml index eef36b0..53d86f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ keywords = ["zkSNARKs", "cryptography", "proofs"] [dependencies] bellperson = { version = "0.20", default-features = false } -ff = { version = "0.11.0", features = ["derive"] } +ff = "0.11.0" merlin = "2.0.0" rand = "0.8.4" digest = "0.8.1" diff --git a/rustfmt.toml b/rustfmt.toml index 351c26a..d05b46e 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,4 @@ edition = "2018" tab_spaces = 2 newline_style = "Unix" -use_try_shorthand = true -imports_granularity = "crate" +use_try_shorthand = true \ No newline at end of file diff --git a/src/gadgets/ecc.rs b/src/gadgets/ecc.rs index 1e82f93..9f2a488 100644 --- a/src/gadgets/ecc.rs +++ b/src/gadgets/ecc.rs @@ -559,37 +559,14 @@ where } } -#[cfg(test)] -#[allow(clippy::too_many_arguments)] -mod fp { - use ff::PrimeField; - - #[derive(PrimeField)] - #[PrimeFieldModulus = "28948022309329048855892746252171976963363056481941560715954676764349967630337"] - #[PrimeFieldGenerator = "5"] - #[PrimeFieldReprEndianness = "little"] - pub struct Fp([u64; 4]); -} - -#[cfg(test)] -#[allow(clippy::too_many_arguments)] -mod fq { - use ff::PrimeField; - - #[derive(PrimeField)] - #[PrimeFieldModulus = "28948022309329048855892746252171976963363056481941647379679742748393362948097"] - #[PrimeFieldGenerator = "5"] - #[PrimeFieldReprEndianness = "little"] - pub struct Fq([u64; 4]); -} - #[cfg(test)] mod tests { use super::*; #[test] fn test_ecc_ops() { - use super::{fp::Fp, fq::Fq}; + type Fp = pasta_curves::pallas::Base; + type Fq = pasta_curves::pallas::Scalar; // perform some curve arithmetic let a = Point::::random_vartime(); @@ -601,35 +578,35 @@ mod tests { // perform the same computation by translating to pasta_curve types let a_pasta = EpAffine::from_xy( - pasta_curves::Fp::from_repr(a.x.to_repr().0).unwrap(), - pasta_curves::Fp::from_repr(a.y.to_repr().0).unwrap(), + pasta_curves::Fp::from_repr(a.x.to_repr()).unwrap(), + pasta_curves::Fp::from_repr(a.y.to_repr()).unwrap(), ) .unwrap(); let b_pasta = EpAffine::from_xy( - pasta_curves::Fp::from_repr(b.x.to_repr().0).unwrap(), - pasta_curves::Fp::from_repr(b.y.to_repr().0).unwrap(), + pasta_curves::Fp::from_repr(b.x.to_repr()).unwrap(), + pasta_curves::Fp::from_repr(b.y.to_repr()).unwrap(), ) .unwrap(); let c_pasta = (a_pasta + b_pasta).to_affine(); let d_pasta = (a_pasta + a_pasta).to_affine(); let e_pasta = a_pasta - .mul(pasta_curves::Fq::from_repr(s.to_repr().0).unwrap()) + .mul(pasta_curves::Fq::from_repr(s.to_repr()).unwrap()) .to_affine(); // transform c, d, and e into pasta_curve types let c_pasta_2 = EpAffine::from_xy( - pasta_curves::Fp::from_repr(c.x.to_repr().0).unwrap(), - pasta_curves::Fp::from_repr(c.y.to_repr().0).unwrap(), + pasta_curves::Fp::from_repr(c.x.to_repr()).unwrap(), + pasta_curves::Fp::from_repr(c.y.to_repr()).unwrap(), ) .unwrap(); let d_pasta_2 = EpAffine::from_xy( - pasta_curves::Fp::from_repr(d.x.to_repr().0).unwrap(), - pasta_curves::Fp::from_repr(d.y.to_repr().0).unwrap(), + pasta_curves::Fp::from_repr(d.x.to_repr()).unwrap(), + pasta_curves::Fp::from_repr(d.y.to_repr()).unwrap(), ) .unwrap(); let e_pasta_2 = EpAffine::from_xy( - pasta_curves::Fp::from_repr(e.x.to_repr().0).unwrap(), - pasta_curves::Fp::from_repr(e.y.to_repr().0).unwrap(), + pasta_curves::Fp::from_repr(e.x.to_repr()).unwrap(), + pasta_curves::Fp::from_repr(e.y.to_repr()).unwrap(), ) .unwrap();