From 4b8ee54f8852459d30bbb60532c029354189c7ba Mon Sep 17 00:00:00 2001 From: Thor Kamphefner Date: Mon, 10 Jul 2023 16:10:03 -0700 Subject: [PATCH] silence warnings, autofix lints --- Cargo.toml | 6 +----- book/book.toml | 7 +------ halo2/Cargo.toml | 4 +--- halo2_gadgets/Cargo.toml | 12 ++++++------ halo2_gadgets/src/ecc/chip/constants.rs | 6 +++--- halo2_gadgets/src/ecc/chip/mul_fixed.rs | 6 +++--- halo2_gadgets/src/poseidon/pow5.rs | 6 +++--- .../src/poseidon/primitives/p128pow5t3.rs | 4 ++-- halo2_gadgets/src/sinsemilla.rs | 2 +- halo2_proofs/Cargo.toml | 14 +++++++------- halo2_proofs/src/protostar.rs | 3 +++ 11 files changed, 31 insertions(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b7878ae8..0470ddb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,2 @@ [workspace] -members = [ - "halo2", - "halo2_gadgets", - "halo2_proofs", -] +members = ["halo2", "halo2_gadgets", "halo2_proofs"] diff --git a/book/book.toml b/book/book.toml index 87448f16..3b98bbe1 100644 --- a/book/book.toml +++ b/book/book.toml @@ -1,10 +1,5 @@ [book] -authors = [ - "Jack Grigg", - "Sean Bowe", - "Daira Hopwood", - "Ying Tong Lai", -] +authors = ["Jack Grigg", "Sean Bowe", "Daira Hopwood", "Ying Tong Lai"] language = "en" multilingual = false src = "src" diff --git a/halo2/Cargo.toml b/halo2/Cargo.toml index 7a6bbaa9..532ef2e6 100644 --- a/halo2/Cargo.toml +++ b/halo2/Cargo.toml @@ -1,9 +1,7 @@ [package] name = "halo2" version = "0.1.0-beta.2" -authors = [ - "Jack Grigg ", -] +authors = ["Jack Grigg "] edition = "2021" rust-version = "1.56.1" description = "[BETA] Fast zero-knowledge proof-carrying data implementation with no trusted setup" diff --git a/halo2_gadgets/Cargo.toml b/halo2_gadgets/Cargo.toml index c4ebf6fa..186010fe 100644 --- a/halo2_gadgets/Cargo.toml +++ b/halo2_gadgets/Cargo.toml @@ -2,11 +2,11 @@ name = "halo2_gadgets" version = "0.2.0" authors = [ - "Sean Bowe ", - "Jack Grigg ", - "Daira Hopwood ", - "Ying Tong Lai ", - "Kris Nuttycombe ", + "Sean Bowe ", + "Jack Grigg ", + "Daira Hopwood ", + "Ying Tong Lai ", + "Kris Nuttycombe ", ] edition = "2021" rust-version = "1.56.1" @@ -32,7 +32,7 @@ halo2curves = { git = 'https://github.com/privacy-scaling-explorations/halo2curv proptest = { version = "1.0.0", optional = true } rand = "0.8" subtle = "2.3" -uint = "0.9.2" # MSRV 1.56.1 +uint = "0.9.2" # MSRV 1.56.1 # Developer tooling dependencies plotters = { version = "0.3.0", optional = true } diff --git a/halo2_gadgets/src/ecc/chip/constants.rs b/halo2_gadgets/src/ecc/chip/constants.rs index 62961654..80e2272b 100644 --- a/halo2_gadgets/src/ecc/chip/constants.rs +++ b/halo2_gadgets/src/ecc/chip/constants.rs @@ -49,7 +49,7 @@ fn compute_window_table(base: C, num_windows: usize) -> Vec<[C; .map(|k| { // scalar = (k+2)*(8^w) let scalar = C::Scalar::from(k as u64 + 2) - * C::Scalar::from(H as u64).pow(&[w as u64, 0, 0, 0]); + * C::Scalar::from(H as u64).pow([w as u64, 0, 0, 0]); (base * scalar).to_affine() }) .collect::>() @@ -62,14 +62,14 @@ fn compute_window_table(base: C, num_windows: usize) -> Vec<[C; // For the last window, we compute [k * (2^3)^w - sum]B, where sum is defined // as sum = \sum_{j = 0}^{`num_windows - 2`} 2^{3j+1} let sum = (0..(num_windows - 1)).fold(C::Scalar::ZERO, |acc, j| { - acc + C::Scalar::from(2).pow(&[FIXED_BASE_WINDOW_SIZE as u64 * j as u64 + 1, 0, 0, 0]) + acc + C::Scalar::from(2).pow([FIXED_BASE_WINDOW_SIZE as u64 * j as u64 + 1, 0, 0, 0]) }); window_table.push( (0..H) .map(|k| { // scalar = k * (2^3)^w - sum, where w = `num_windows - 1` let scalar = C::Scalar::from(k as u64) - * C::Scalar::from(H as u64).pow(&[(num_windows - 1) as u64, 0, 0, 0]) + * C::Scalar::from(H as u64).pow([(num_windows - 1) as u64, 0, 0, 0]) - sum; (base * scalar).to_affine() }) diff --git a/halo2_gadgets/src/ecc/chip/mul_fixed.rs b/halo2_gadgets/src/ecc/chip/mul_fixed.rs index 0005a108..39baa676 100644 --- a/halo2_gadgets/src/ecc/chip/mul_fixed.rs +++ b/halo2_gadgets/src/ecc/chip/mul_fixed.rs @@ -372,7 +372,7 @@ impl> Config { base: &F, ) -> Result { // `scalar = [(k_w + 2) ⋅ 8^w] - let scalar = k.map(|k| (k + *TWO_SCALAR) * (*H_SCALAR).pow(&[w as u64, 0, 0, 0])); + let scalar = k.map(|k| (k + *TWO_SCALAR) * (*H_SCALAR).pow([w as u64, 0, 0, 0])); self.process_window::<_, NUM_WINDOWS>(region, offset, w, k_usize, scalar, base) } @@ -389,12 +389,12 @@ impl> Config { // offset_acc = \sum_{j = 0}^{NUM_WINDOWS - 2} 2^{FIXED_BASE_WINDOW_SIZE*j + 1} let offset_acc = (0..(NUM_WINDOWS - 1)).fold(pallas::Scalar::zero(), |acc, w| { - acc + (*TWO_SCALAR).pow(&[FIXED_BASE_WINDOW_SIZE as u64 * w as u64 + 1, 0, 0, 0]) + acc + (*TWO_SCALAR).pow([FIXED_BASE_WINDOW_SIZE as u64 * w as u64 + 1, 0, 0, 0]) }); // `scalar = [k * 8^(NUM_WINDOWS - 1) - offset_acc]`. let scalar = scalar.windows_field()[scalar.windows_field().len() - 1] - .map(|k| k * (*H_SCALAR).pow(&[(NUM_WINDOWS - 1) as u64, 0, 0, 0]) - offset_acc); + .map(|k| k * (*H_SCALAR).pow([(NUM_WINDOWS - 1) as u64, 0, 0, 0]) - offset_acc); self.process_window::<_, NUM_WINDOWS>( region, diff --git a/halo2_gadgets/src/poseidon/pow5.rs b/halo2_gadgets/src/poseidon/pow5.rs index 7abd8632..e8ea7abf 100644 --- a/halo2_gadgets/src/poseidon/pow5.rs +++ b/halo2_gadgets/src/poseidon/pow5.rs @@ -444,7 +444,7 @@ impl Pow5State { .value() .map(|v| *v + config.round_constants[round][idx]) }); - let r: Value> = q.map(|q| q.map(|q| q.pow(&config.alpha))).collect(); + let r: Value> = q.map(|q| q.map(|q| q.pow(config.alpha))).collect(); let m = &config.m_reg; let state = m.iter().map(|m_i| { r.as_ref().map(|r| { @@ -470,7 +470,7 @@ impl Pow5State { let p: Value> = self.0.iter().map(|word| word.0.value().cloned()).collect(); let r: Value> = p.map(|p| { - let r_0 = (p[0] + config.round_constants[round][0]).pow(&config.alpha); + let r_0 = (p[0] + config.round_constants[round][0]).pow(config.alpha); let r_i = p[1..] .iter() .enumerate() @@ -510,7 +510,7 @@ impl Pow5State { } let r_mid: Value> = p_mid.map(|p| { - let r_0 = (p[0] + config.round_constants[round + 1][0]).pow(&config.alpha); + let r_0 = (p[0] + config.round_constants[round + 1][0]).pow(config.alpha); let r_i = p[1..] .iter() .enumerate() diff --git a/halo2_gadgets/src/poseidon/primitives/p128pow5t3.rs b/halo2_gadgets/src/poseidon/primitives/p128pow5t3.rs index c8d54d9a..e31ce042 100644 --- a/halo2_gadgets/src/poseidon/primitives/p128pow5t3.rs +++ b/halo2_gadgets/src/poseidon/primitives/p128pow5t3.rs @@ -22,7 +22,7 @@ impl Spec for P128Pow5T3 { } fn sbox(val: Fp) -> Fp { - val.pow_vartime(&[5]) + val.pow_vartime([5]) } fn secure_mds() -> usize { @@ -48,7 +48,7 @@ impl Spec for P128Pow5T3 { } fn sbox(val: Fq) -> Fq { - val.pow_vartime(&[5]) + val.pow_vartime([5]) } fn secure_mds() -> usize { diff --git a/halo2_gadgets/src/sinsemilla.rs b/halo2_gadgets/src/sinsemilla.rs index 543d49f5..4c0ba55d 100644 --- a/halo2_gadgets/src/sinsemilla.rs +++ b/halo2_gadgets/src/sinsemilla.rs @@ -197,7 +197,7 @@ where // Each message piece must have at most `floor(C::Base::CAPACITY / K)` words. // This ensures that the all-ones bitstring is canonical in the field. let piece_max_num_words = C::Base::CAPACITY as usize / K; - assert!(num_words <= piece_max_num_words as usize); + assert!(num_words <= piece_max_num_words); // Closure to parse a bitstring (little-endian) into a base field element. let to_base_field = |bits: &[Value]| -> Value { diff --git a/halo2_proofs/Cargo.toml b/halo2_proofs/Cargo.toml index 1d744357..411394bd 100644 --- a/halo2_proofs/Cargo.toml +++ b/halo2_proofs/Cargo.toml @@ -2,10 +2,10 @@ name = "halo2_proofs" version = "0.2.0" authors = [ - "Sean Bowe ", - "Ying Tong Lai ", - "Daira Hopwood ", - "Jack Grigg ", + "Sean Bowe ", + "Ying Tong Lai ", + "Daira Hopwood ", + "Jack Grigg ", ] edition = "2021" rust-version = "1.56.1" @@ -68,7 +68,9 @@ assert_matches = "1.5" criterion = "0.3" gumdrop = "0.8" proptest = "1" -rand_core = { version = "0.6", default-features = false, features = ["getrandom"] } +rand_core = { version = "0.6", default-features = false, features = [ + "getrandom", +] } [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] getrandom = { version = "0.2", features = ["js"] } @@ -88,5 +90,3 @@ bench = false [[example]] name = "circuit-layout" required-features = ["dev-graph"] - - diff --git a/halo2_proofs/src/protostar.rs b/halo2_proofs/src/protostar.rs index bd18e140..4b25f4c1 100644 --- a/halo2_proofs/src/protostar.rs +++ b/halo2_proofs/src/protostar.rs @@ -1,4 +1,7 @@ //! Contains logic for handling halo2 circuits with Protostar +#![allow(unused_imports)] +#![allow(unused_variables)] +#![allow(dead_code)] mod error_check; mod gate;