arnaucube
arnaucube/NovaPublic Self-hosted repository
fix build (#48)

* fix build

* switch to stable
Srinath Setty srinath@microsoft.com
Wed, 11 May 2022 11:57:27 +0530
commit

485eb3fac64ed7319382e4841510a2d33d4d0464

parent

f11a8f19d162b4336af8d27c0943476978a50a66

4 files changed, 16 insertions(+), 40 deletions(-)

jump to
M .github/workflows/rust.yml → .github/workflows/rust.yml

@@ -12,7 +12,7 @@ runs-on: ubuntu-latest

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
M Cargo.toml → 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"
M rustfmt.toml → 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
M src/gadgets/ecc.rs → src/gadgets/ecc.rs

@@ -560,36 +560,13 @@ }

} #[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::<Fp, Fq>::random_vartime();

@@ -601,35 +578,35 @@ let e = a.scalar_mul(&s);

// 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();