Skip to content

Commit

Permalink
silence warnings, autofix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
thor314 committed Jul 10, 2023
1 parent 51c7359 commit 4b8ee54
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 39 deletions.
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
[workspace]
members = [
"halo2",
"halo2_gadgets",
"halo2_proofs",
]
members = ["halo2", "halo2_gadgets", "halo2_proofs"]
7 changes: 1 addition & 6 deletions book/book.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 1 addition & 3 deletions halo2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[package]
name = "halo2"
version = "0.1.0-beta.2"
authors = [
"Jack Grigg <jack@electriccoin.co>",
]
authors = ["Jack Grigg <jack@electriccoin.co>"]
edition = "2021"
rust-version = "1.56.1"
description = "[BETA] Fast zero-knowledge proof-carrying data implementation with no trusted setup"
Expand Down
12 changes: 6 additions & 6 deletions halo2_gadgets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
name = "halo2_gadgets"
version = "0.2.0"
authors = [
"Sean Bowe <sean@electriccoin.co>",
"Jack Grigg <jack@electriccoin.co>",
"Daira Hopwood <daira@jacaranda.org>",
"Ying Tong Lai <yingtong@electriccoin.co>",
"Kris Nuttycombe <kris@electriccoin.co>",
"Sean Bowe <sean@electriccoin.co>",
"Jack Grigg <jack@electriccoin.co>",
"Daira Hopwood <daira@jacaranda.org>",
"Ying Tong Lai <yingtong@electriccoin.co>",
"Kris Nuttycombe <kris@electriccoin.co>",
]
edition = "2021"
rust-version = "1.56.1"
Expand All @@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions halo2_gadgets/src/ecc/chip/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn compute_window_table<C: CurveAffine>(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::<ArrayVec<C, H>>()
Expand All @@ -62,14 +62,14 @@ fn compute_window_table<C: CurveAffine>(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()
})
Expand Down
6 changes: 3 additions & 3 deletions halo2_gadgets/src/ecc/chip/mul_fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl<FixedPoints: super::FixedPoints<pallas::Affine>> Config<FixedPoints> {
base: &F,
) -> Result<NonIdentityEccPoint, Error> {
// `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)
}
Expand All @@ -389,12 +389,12 @@ impl<FixedPoints: super::FixedPoints<pallas::Affine>> Config<FixedPoints> {

// 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,
Expand Down
6 changes: 3 additions & 3 deletions halo2_gadgets/src/poseidon/pow5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl<F: Field, const WIDTH: usize> Pow5State<F, WIDTH> {
.value()
.map(|v| *v + config.round_constants[round][idx])
});
let r: Value<Vec<F>> = q.map(|q| q.map(|q| q.pow(&config.alpha))).collect();
let r: Value<Vec<F>> = 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| {
Expand All @@ -470,7 +470,7 @@ impl<F: Field, const WIDTH: usize> Pow5State<F, WIDTH> {
let p: Value<Vec<_>> = self.0.iter().map(|word| word.0.value().cloned()).collect();

let r: Value<Vec<_>> = 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()
Expand Down Expand Up @@ -510,7 +510,7 @@ impl<F: Field, const WIDTH: usize> Pow5State<F, WIDTH> {
}

let r_mid: Value<Vec<_>> = 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()
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/src/poseidon/primitives/p128pow5t3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Spec<Fp, 3, 2> for P128Pow5T3 {
}

fn sbox(val: Fp) -> Fp {
val.pow_vartime(&[5])
val.pow_vartime([5])
}

fn secure_mds() -> usize {
Expand All @@ -48,7 +48,7 @@ impl Spec<Fq, 3, 2> for P128Pow5T3 {
}

fn sbox(val: Fq) -> Fq {
val.pow_vartime(&[5])
val.pow_vartime([5])
}

fn secure_mds() -> usize {
Expand Down
2 changes: 1 addition & 1 deletion halo2_gadgets/src/sinsemilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>]| -> Value<C::Base> {
Expand Down
14 changes: 7 additions & 7 deletions halo2_proofs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
name = "halo2_proofs"
version = "0.2.0"
authors = [
"Sean Bowe <sean@electriccoin.co>",
"Ying Tong Lai <yingtong@electriccoin.co>",
"Daira Hopwood <daira@electriccoin.co>",
"Jack Grigg <jack@electriccoin.co>",
"Sean Bowe <sean@electriccoin.co>",
"Ying Tong Lai <yingtong@electriccoin.co>",
"Daira Hopwood <daira@electriccoin.co>",
"Jack Grigg <jack@electriccoin.co>",
]
edition = "2021"
rust-version = "1.56.1"
Expand Down Expand Up @@ -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"] }
Expand All @@ -88,5 +90,3 @@ bench = false
[[example]]
name = "circuit-layout"
required-features = ["dev-graph"]


3 changes: 3 additions & 0 deletions halo2_proofs/src/protostar.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 4b8ee54

Please sign in to comment.