From 093f3a62e02f54d57ea16711999449e3ae56011b Mon Sep 17 00:00:00 2001 From: Constance Beguier Date: Thu, 5 Oct 2023 14:44:29 +0200 Subject: [PATCH] Upgrade rust version to 1.65 (#20) Upgrade rust version from 1.60 to 1.65 --- .github/actions/prepare/action.yml | 2 +- README.md | 2 +- halo2/Cargo.toml | 2 +- halo2_gadgets/Cargo.toml | 2 +- halo2_gadgets/README.md | 2 +- halo2_gadgets/benches/poseidon.rs | 2 +- halo2_gadgets/src/ecc/chip/constants.rs | 12 ++++++------ halo2_gadgets/src/ecc/chip/mul_fixed.rs | 6 +++--- halo2_gadgets/src/poseidon/pow5.rs | 6 +++--- halo2_proofs/Cargo.toml | 4 ++-- halo2_proofs/README.md | 2 +- halo2_proofs/src/plonk/prover.rs | 2 +- halo2_proofs/src/plonk/verifier.rs | 2 +- halo2_proofs/src/poly/domain.rs | 4 ++-- rust-toolchain.toml | 2 +- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml index ceb275485f..e4b61976f7 100644 --- a/.github/actions/prepare/action.yml +++ b/.github/actions/prepare/action.yml @@ -4,7 +4,7 @@ inputs: toolchain: description: 'Rust toolchain to use (defaults to MSRV)' required: false - default: 1.60.0 + default: 1.65.0 beta-features: description: 'Include beta features' required: false diff --git a/README.md b/README.md index 9ade4d432a..085ab64097 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Minimum Supported Rust Version -Requires Rust **1.60** or higher. +Requires Rust **1.65** or higher. Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump. diff --git a/halo2/Cargo.toml b/halo2/Cargo.toml index 14e2716ad0..21a2fd443e 100644 --- a/halo2/Cargo.toml +++ b/halo2/Cargo.toml @@ -5,7 +5,7 @@ authors = [ "Jack Grigg ", ] edition = "2021" -rust-version = "1.59" +rust-version = "1.65" description = "[BETA] Fast zero-knowledge proof-carrying data implementation with no trusted setup" license = "MIT OR Apache-2.0" repository = "https://github.com/zcash/halo2" diff --git a/halo2_gadgets/Cargo.toml b/halo2_gadgets/Cargo.toml index 61b251f9d2..5529572cb1 100644 --- a/halo2_gadgets/Cargo.toml +++ b/halo2_gadgets/Cargo.toml @@ -9,7 +9,7 @@ authors = [ "Kris Nuttycombe ", ] edition = "2021" -rust-version = "1.59" +rust-version = "1.65" description = "Reusable gadgets and chip implementations for Halo 2" license = "MIT OR Apache-2.0" repository = "https://github.com/zcash/halo2" diff --git a/halo2_gadgets/README.md b/halo2_gadgets/README.md index 90a803c093..6811ec3e97 100644 --- a/halo2_gadgets/README.md +++ b/halo2_gadgets/README.md @@ -1,6 +1,6 @@ # halo2_gadgets [![Crates.io](https://img.shields.io/crates/v/halo2_gadgets.svg)](https://crates.io/crates/halo2_gadgets) # -Requires Rust 1.60+. +Requires Rust 1.65+. ## Documentation diff --git a/halo2_gadgets/benches/poseidon.rs b/halo2_gadgets/benches/poseidon.rs index 31f21d2795..ae303a217d 100644 --- a/halo2_gadgets/benches/poseidon.rs +++ b/halo2_gadgets/benches/poseidon.rs @@ -124,7 +124,7 @@ impl Spec for MySpec Fp { - val.pow_vartime(&[5]) + val.pow_vartime([5]) } fn secure_mds() -> usize { diff --git a/halo2_gadgets/src/ecc/chip/constants.rs b/halo2_gadgets/src/ecc/chip/constants.rs index e543d718db..7c57052457 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() }) @@ -197,7 +197,7 @@ pub fn test_lagrange_coeffs(base: C, num_windows: usize) { // Compute the actual x-coordinate of the multiple [(k+2)*(8^w)]B. let point = base * C::Scalar::from(bits as u64 + 2) - * C::Scalar::from(H as u64).pow(&[idx as u64, 0, 0, 0]); + * C::Scalar::from(H as u64).pow([idx as u64, 0, 0, 0]); let x = *point.to_affine().coordinates().unwrap().x(); // Check that the interpolated x-coordinate matches the actual one. @@ -214,10 +214,10 @@ pub fn test_lagrange_coeffs(base: C, num_windows: usize) { // Compute the actual x-coordinate of the multiple [k * (8^84) - offset]B, // where offset = \sum_{j = 0}^{83} 2^{3j+1} let offset = (0..(num_windows - 1)).fold(C::Scalar::ZERO, |acc, w| { - acc + C::Scalar::from(2).pow(&[FIXED_BASE_WINDOW_SIZE as u64 * w as u64 + 1, 0, 0, 0]) + acc + C::Scalar::from(2).pow([FIXED_BASE_WINDOW_SIZE as u64 * w as u64 + 1, 0, 0, 0]) }); let scalar = C::Scalar::from(bits 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]) - offset; let point = base * scalar; let x = *point.to_affine().coordinates().unwrap().x(); diff --git a/halo2_gadgets/src/ecc/chip/mul_fixed.rs b/halo2_gadgets/src/ecc/chip/mul_fixed.rs index d0781056b8..27cfd5fc5b 100644 --- a/halo2_gadgets/src/ecc/chip/mul_fixed.rs +++ b/halo2_gadgets/src/ecc/chip/mul_fixed.rs @@ -370,7 +370,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) } @@ -387,12 +387,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 7e7aa45b58..65266cfd80 100644 --- a/halo2_gadgets/src/poseidon/pow5.rs +++ b/halo2_gadgets/src/poseidon/pow5.rs @@ -442,7 +442,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| { @@ -468,7 +468,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() @@ -508,7 +508,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_proofs/Cargo.toml b/halo2_proofs/Cargo.toml index f82e03a5db..e04b901f18 100644 --- a/halo2_proofs/Cargo.toml +++ b/halo2_proofs/Cargo.toml @@ -8,7 +8,7 @@ authors = [ "Jack Grigg ", ] edition = "2021" -rust-version = "1.59" +rust-version = "1.65" description = """ Fast PLONK-based zero-knowledge proving system with no trusted setup """ @@ -50,7 +50,7 @@ group = "0.13" pasta_curves = "0.5" rand_core = { version = "0.6", default-features = false } tracing = "0.1" -blake2b_simd = "1" +blake2b_simd = "=1.0.1" # Last version required rust 1.66 maybe-rayon = {version = "0.1.0", default-features = false} # Developer tooling dependencies diff --git a/halo2_proofs/README.md b/halo2_proofs/README.md index 7aee8c065f..64bfe815f1 100644 --- a/halo2_proofs/README.md +++ b/halo2_proofs/README.md @@ -4,7 +4,7 @@ ## Minimum Supported Rust Version -Requires Rust **1.60** or higher. +Requires Rust **1.65** or higher. Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump. diff --git a/halo2_proofs/src/plonk/prover.rs b/halo2_proofs/src/plonk/prover.rs index e54f2129f0..7de4f1d9a1 100644 --- a/halo2_proofs/src/plonk/prover.rs +++ b/halo2_proofs/src/plonk/prover.rs @@ -596,7 +596,7 @@ pub fn create_proof< )?; let x: ChallengeX<_> = transcript.squeeze_challenge_scalar(); - let xn = x.pow(&[params.n, 0, 0, 0]); + let xn = x.pow([params.n, 0, 0, 0]); // Compute and hash instance evals for each circuit instance for instance in instance.iter() { diff --git a/halo2_proofs/src/plonk/verifier.rs b/halo2_proofs/src/plonk/verifier.rs index f141ebaf98..89defa0d64 100644 --- a/halo2_proofs/src/plonk/verifier.rs +++ b/halo2_proofs/src/plonk/verifier.rs @@ -203,7 +203,7 @@ pub fn verify_proof< // commitments open to the correct values. let vanishing = { // x^n - let xn = x.pow(&[params.n, 0, 0, 0]); + let xn = x.pow([params.n, 0, 0, 0]); let blinding_factors = vk.cs.blinding_factors(); let l_evals = vk diff --git a/halo2_proofs/src/poly/domain.rs b/halo2_proofs/src/poly/domain.rs index fb76af653c..ba7544b3ae 100644 --- a/halo2_proofs/src/poly/domain.rs +++ b/halo2_proofs/src/poly/domain.rs @@ -546,7 +546,7 @@ fn test_l_i() { let mut l = vec![]; let mut points = vec![]; for i in 0..8 { - points.push(domain.omega.pow(&[i, 0, 0, 0])); + points.push(domain.omega.pow([i, 0, 0, 0])); } for i in 0..8 { let mut l_i = vec![Scalar::zero(); 8]; @@ -556,7 +556,7 @@ fn test_l_i() { } let x = Scalar::random(OsRng); - let xn = x.pow(&[8, 0, 0, 0]); + let xn = x.pow([8, 0, 0, 0]); let evaluations = domain.l_i_range(x, xn, -7..=7); for i in 0..8 { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 948d27daa4..f8c2abbb3d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.60.0" +channel = "1.65.0"