From 6044aff625bc0716c11f7efc6e0a86926d9119ae Mon Sep 17 00:00:00 2001 From: Srinath Setty Date: Mon, 21 Nov 2022 10:42:11 -0800 Subject: [PATCH] Update crate versions (#119) * update crate versions * fix clippy issues * cargo fmt --- Cargo.toml | 11 +++++------ src/bellperson/shape_cs.rs | 2 +- src/r1cs.rs | 10 ++-------- src/spartan_with_ipa_pc/mod.rs | 4 ++-- src/spartan_with_ipa_pc/polynomial.rs | 2 +- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 128b6f4..de0d3bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nova-snark" -version = "0.8.1" +version = "0.9.0" authors = ["Srinath Setty "] edition = "2021" description = "Recursive zkSNARKs without trusted setup" @@ -11,7 +11,7 @@ license-file = "LICENSE" keywords = ["zkSNARKs", "cryptography", "proofs"] [dependencies] -bellperson = { version = "0.22", default-features = false } +bellperson = { version = "0.24", default-features = false } ff = "0.12.0" merlin = "2.0.0" rand = "0.8.4" @@ -24,9 +24,9 @@ itertools = "0.9.0" subtle = "2.4" pasta_curves = { version = "0.4.0", features = ["repr-c"] } pasta-msm = "0.1.3" -neptune = { version = "7.2.0", default-features = false } +neptune = { version = "8.1.0", default-features = false } generic-array = "0.14.4" -bellperson-nonnative = { version = "0.3.1", default-features = false, features = ["wasm"] } +bellperson-nonnative = { version = "0.4.0", default-features = false } num-bigint = { version = "0.4", features = ["serde", "rand"] } num-traits = "0.2" serde = { version = "1.0", features = ["derive"] } @@ -46,5 +46,4 @@ name = "compressed-snark" harness = false [features] -default = [ "bellperson/default", "bellperson-nonnative/default", "neptune/default" ] -wasm = [ "bellperson/wasm", "bellperson-nonnative/wasm", "neptune/wasm" ] +default = [ "bellperson/default", "bellperson-nonnative/default", "neptune/default" ] \ No newline at end of file diff --git a/src/bellperson/shape_cs.rs b/src/bellperson/shape_cs.rs index 982be24..edd1334 100644 --- a/src/bellperson/shape_cs.rs +++ b/src/bellperson/shape_cs.rs @@ -147,7 +147,7 @@ where let negone = -::one(); let powers_of_two = (0..G::Scalar::NUM_BITS) - .map(|i| G::Scalar::from(2u64).pow_vartime(&[u64::from(i)])) + .map(|i| G::Scalar::from(2u64).pow_vartime([u64::from(i)])) .collect::>(); let pp = |s: &mut String, lc: &LinearCombination| { diff --git a/src/r1cs.rs b/src/r1cs.rs index 8a82ca5..8a6d50a 100644 --- a/src/r1cs.rs +++ b/src/r1cs.rs @@ -191,13 +191,7 @@ impl R1CSShape { assert_eq!(Cz.len(), self.num_cons); let res: usize = (0..self.num_cons) - .map(|i| { - if Az[i] * Bz[i] == U.u * Cz[i] + W.E[i] { - 0 - } else { - 1 - } - }) + .map(|i| usize::from(Az[i] * Bz[i] != U.u * Cz[i] + W.E[i])) .sum(); res == 0 @@ -235,7 +229,7 @@ impl R1CSShape { assert_eq!(Cz.len(), self.num_cons); let res: usize = (0..self.num_cons) - .map(|i| if Az[i] * Bz[i] == Cz[i] { 0 } else { 1 }) + .map(|i| usize::from(Az[i] * Bz[i] != Cz[i])) .sum(); res == 0 diff --git a/src/spartan_with_ipa_pc/mod.rs b/src/spartan_with_ipa_pc/mod.rs index 754e61b..7b9aefb 100644 --- a/src/spartan_with_ipa_pc/mod.rs +++ b/src/spartan_with_ipa_pc/mod.rs @@ -98,7 +98,7 @@ impl RelaxedR1CSSNARKTrait for RelaxedR1CSSNARK { let (num_rounds_x, num_rounds_y) = ( (pk.S.num_cons as f64).log2() as usize, - ((pk.S.num_vars as f64).log2() as usize + 1) as usize, + ((pk.S.num_vars as f64).log2() as usize + 1), ); // outer sum-check @@ -264,7 +264,7 @@ impl RelaxedR1CSSNARKTrait for RelaxedR1CSSNARK { let (num_rounds_x, num_rounds_y) = ( (vk.S.num_cons as f64).log2() as usize, - ((vk.S.num_vars as f64).log2() as usize + 1) as usize, + ((vk.S.num_vars as f64).log2() as usize + 1), ); // outer sum-check diff --git a/src/spartan_with_ipa_pc/polynomial.rs b/src/spartan_with_ipa_pc/polynomial.rs index 3c1a389..8586483 100644 --- a/src/spartan_with_ipa_pc/polynomial.rs +++ b/src/spartan_with_ipa_pc/polynomial.rs @@ -20,7 +20,7 @@ impl EqPolynomial { pub fn evals(&self) -> Vec { let ell = self.r.len(); - let mut evals: Vec = vec![Scalar::zero(); (2_usize).pow(ell as u32) as usize]; + let mut evals: Vec = vec![Scalar::zero(); (2_usize).pow(ell as u32)]; let mut size = 1; evals[0] = Scalar::one();