Browse Source

fix build (#48)

* fix build

* switch to stable
main
Srinath Setty 2 years ago
committed by GitHub
parent
commit
485eb3fac6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 40 deletions
  1. +1
    -1
      .github/workflows/rust.yml
  2. +1
    -1
      Cargo.toml
  3. +1
    -2
      rustfmt.toml
  4. +13
    -36
      src/gadgets/ecc.rs

+ 1
- 1
.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

+ 1
- 1
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"

+ 1
- 2
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

+ 13
- 36
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::<Fp, Fq>::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();

Loading…
Cancel
Save