diff --git a/.github/workflows/benches-mina-prover-set-baseline.yml b/.github/workflows/benches-mina-prover-set-baseline.yml index 379574219f7..02d72226dea 100644 --- a/.github/workflows/benches-mina-prover-set-baseline.yml +++ b/.github/workflows/benches-mina-prover-set-baseline.yml @@ -13,7 +13,7 @@ on: env: OCAML_VERSION: "4.14.2" - RUST_TOOLCHAIN_VERSION: "1.81" + RUST_TOOLCHAIN_VERSION: "1.91" jobs: diff --git a/.github/workflows/benches-mina-prover.yml b/.github/workflows/benches-mina-prover.yml index ba683cffe42..fb27bb605ce 100644 --- a/.github/workflows/benches-mina-prover.yml +++ b/.github/workflows/benches-mina-prover.yml @@ -5,7 +5,7 @@ on: env: OCAML_VERSION: "4.14.2" - RUST_TOOLCHAIN_VERSION: "1.81" + RUST_TOOLCHAIN_VERSION: "1.91" jobs: diff --git a/.github/workflows/benches.yml b/.github/workflows/benches.yml index ca1c621106d..3f4b4c5af24 100644 --- a/.github/workflows/benches.yml +++ b/.github/workflows/benches.yml @@ -7,7 +7,7 @@ on: env: OCAML_VERSION: "4.14.2" - RUST_TOOLCHAIN_VERSION: "1.81" + RUST_TOOLCHAIN_VERSION: "1.91" jobs: bench: diff --git a/.github/workflows/ci-nightly.yml b/.github/workflows/ci-nightly.yml index e874031764f..22dac848e37 100644 --- a/.github/workflows/ci-nightly.yml +++ b/.github/workflows/ci-nightly.yml @@ -28,7 +28,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - rust_toolchain_version: ["1.81"] + rust_toolchain_version: ["1.91"] # FIXME: currently not available for 5.0.0. # It might be related to boxroot dependency, and we would need to bump # up the ocaml-rs dependency diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcdd8da6834..7868265c909 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,21 +45,16 @@ jobs: run: echo 'version=["20"]' >> "$GITHUB_OUTPUT" - id: defaults run: | - echo 'rust_version=1.81' >> "$GITHUB_OUTPUT" + echo 'rust_version=1.91' >> "$GITHUB_OUTPUT" echo 'os=ubuntu-latest' >> "$GITHUB_OUTPUT" - id: matrix run: | - # NOTE: This custom matrix configuration is needed to use Rust 1.84 specifically for macOS. - # When https://github.com/o1-labs/proof-systems/issues/3254 is fixed, - # this can be simplified to use a standard matrix configuration. cat > matrix.json << 'EOF' { "include": [ - {"rust_toolchain_version": "1.81", "os": "ubuntu-latest"}, - {"rust_toolchain_version": "1.82", "os": "ubuntu-latest"}, - {"rust_toolchain_version": "1.81", "os": "ubuntu-24.04-arm"}, - {"rust_toolchain_version": "1.82", "os": "ubuntu-24.04-arm"}, - {"rust_toolchain_version": "1.84", "os": "macos-latest"} + {"rust_toolchain_version": "1.91", "os": "ubuntu-latest"}, + {"rust_toolchain_version": "1.91", "os": "ubuntu-24.04-arm"}, + {"rust_toolchain_version": "1.91", "os": "macos-latest"} ] } EOF @@ -98,10 +93,6 @@ jobs: rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }} ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} node: ${{ fromJSON(needs.define-matrix.outputs.node) }} - exclude: - # Skip Rust 1.84 due to linting issues - remove when - # https://github.com/o1-labs/proof-systems/pull/3245 is fixed - - rust_and_os: {rust_toolchain_version: '1.84', os: 'macos-latest'} runs-on: ${{ matrix.rust_and_os.os }} steps: - name: Checkout repository @@ -203,10 +194,6 @@ jobs: rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }} ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} node: ${{ fromJSON(needs.define-matrix.outputs.node) }} - exclude: - # Skip Rust 1.84 due to linting issues - remove when - # https://github.com/o1-labs/proof-systems/pull/3245 is fixed - - rust_and_os: {rust_toolchain_version: '1.84', os: 'macos-latest'} runs-on: ${{ matrix.rust_and_os.os }} steps: - name: Checkout repository @@ -276,10 +263,6 @@ jobs: rust_and_os: ${{ fromJSON(needs.define-matrix.outputs.matrix).include }} ocaml_version: ${{ fromJSON(needs.define-matrix.outputs.ocaml_version) }} node: ${{ fromJSON(needs.define-matrix.outputs.node) }} - exclude: - # Skip Rust 1.84 due to linting issues - remove when - # https://github.com/o1-labs/proof-systems/pull/3245 is fixed - - rust_and_os: {rust_toolchain_version: '1.84', os: 'macos-latest'} runs-on: ${{ matrix.rust_and_os.os }} steps: - name: Checkout repository diff --git a/.github/workflows/o1vm-ci.yml b/.github/workflows/o1vm-ci.yml index b2daf8bbe5d..71c98235e65 100644 --- a/.github/workflows/o1vm-ci.yml +++ b/.github/workflows/o1vm-ci.yml @@ -28,7 +28,7 @@ jobs: runs-on: ["ubuntu-latest"] strategy: matrix: - rust_toolchain_version: ["1.81"] + rust_toolchain_version: ["1.91"] # FIXME: currently not available for 5.0.0. # It might be related to boxroot dependency, and we would need to bump # up the ocaml-rs dependency diff --git a/.github/workflows/test-export-vectors.yml b/.github/workflows/test-export-vectors.yml index a64230b873b..f7c9e0371da 100644 --- a/.github/workflows/test-export-vectors.yml +++ b/.github/workflows/test-export-vectors.yml @@ -29,7 +29,7 @@ jobs: - name: Use shared Rust toolchain setting up steps uses: ./.github/actions/toolchain-shared with: - rust_toolchain_version: "1.81" + rust_toolchain_version: "1.91" - name: Use shared OCaml setting up steps uses: ./.github/actions/ocaml-shared diff --git a/arrabbiata/src/interpreter.rs b/arrabbiata/src/interpreter.rs index 38e4fcf4dbc..31161ab626d 100644 --- a/arrabbiata/src/interpreter.rs +++ b/arrabbiata/src/interpreter.rs @@ -1,3 +1,4 @@ +#![allow(clippy::doc_overindented_list_items)] //! This module contains the implementation of the IVC scheme in addition to //! running an arbitrary function that can use up to [crate::NUMBER_OF_COLUMNS] //! columns. diff --git a/arrabbiata/src/witness.rs b/arrabbiata/src/witness.rs index 87b2abe26ee..5b8fabd91d7 100644 --- a/arrabbiata/src/witness.rs +++ b/arrabbiata/src/witness.rs @@ -1,3 +1,6 @@ +// We can't use is_multiple_of as it's not available in the older nightly used for WASM builds +#![allow(clippy::manual_is_multiple_of)] + use ark_ec::CurveConfig; use ark_ff::PrimeField; use ark_poly::Evaluations; diff --git a/curves/Cargo.toml b/curves/Cargo.toml index 3c06d1e8f41..269059113e8 100644 --- a/curves/Cargo.toml +++ b/curves/Cargo.toml @@ -9,6 +9,11 @@ readme = "../README.md" edition = "2021" license = "Apache-2.0" +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + "cfg(feature, values(\"asm\"))", +] } + [dependencies] ark-bn254.workspace = true ark-ec.workspace = true diff --git a/hasher/src/roinput.rs b/hasher/src/roinput.rs index 3ed80bb270d..63ddf073226 100644 --- a/hasher/src/roinput.rs +++ b/hasher/src/roinput.rs @@ -260,7 +260,7 @@ impl ROInput { // Check that the number of bytes is consistent with the expected lengths let expected_len_bits = fields_len * Fp::MODULUS_BIT_SIZE as usize + bits_len; // Round up to nearest multiple of 8 - let expected_len = (expected_len_bits + 7) / 8 + SER_HEADER_SIZE; + let expected_len = expected_len_bits.div_ceil(8) + SER_HEADER_SIZE; if input.len() != expected_len { return Err(Error); } diff --git a/internal-tracing/src/lib.rs b/internal-tracing/src/lib.rs index f274a50237e..1cc237bc9b9 100644 --- a/internal-tracing/src/lib.rs +++ b/internal-tracing/src/lib.rs @@ -107,6 +107,8 @@ macro_rules! decl_traces { } #[cfg(feature = "ocaml_types")] + #[allow(non_local_definitions)] + #[allow(dead_code)] pub mod caml { use super::*; diff --git a/kimchi-stubs/src/lib.rs b/kimchi-stubs/src/lib.rs index b2cc631fc3e..b1e29eb015d 100644 --- a/kimchi-stubs/src/lib.rs +++ b/kimchi-stubs/src/lib.rs @@ -7,6 +7,9 @@ //! a math library that Proof-systems builds on top of. //! +#![allow(non_local_definitions)] +#![allow(unexpected_cfgs)] + extern crate libc; /// Caml helpers diff --git a/kimchi/benches/amortization.rs b/kimchi/benches/amortization.rs index a6c6f9529ce..1bbb6145a54 100644 --- a/kimchi/benches/amortization.rs +++ b/kimchi/benches/amortization.rs @@ -8,9 +8,7 @@ pub fn amortization(c: &mut Criterion) { let ctx = BenchmarkCtx::new(16); let proof_and_public = ctx.create_proof(); - let proofs: Vec<_> = core::iter::repeat(proof_and_public) - .take(1 << PROOFS) - .collect(); + let proofs: Vec<_> = std::iter::repeat_n(proof_and_public, 1 << PROOFS).collect(); group.sample_size(10); for size in 0..=PROOFS { diff --git a/kimchi/benches/proof_criterion_mina.rs b/kimchi/benches/proof_criterion_mina.rs index 0e0dfa26814..ff6c0527769 100644 --- a/kimchi/benches/proof_criterion_mina.rs +++ b/kimchi/benches/proof_criterion_mina.rs @@ -25,7 +25,7 @@ pub fn bench_proof_creation_mina(c: &mut Criterion) { // Parse filename "kimchi_inputs_CURVENAME_SEED.ser" into two parameters let (curve_name, seed): (&str, &str) = filename .split('/') - .last() + .next_back() .unwrap() .strip_prefix("kimchi_inputs_") .unwrap() diff --git a/kimchi/benches/proof_iai.rs b/kimchi/benches/proof_iai.rs index c5dc53ff850..b35a9caf937 100644 --- a/kimchi/benches/proof_iai.rs +++ b/kimchi/benches/proof_iai.rs @@ -8,7 +8,7 @@ fn bench_proof_creation() { fn bench_proof_creation_and_verification() { let ctx = BenchmarkCtx::new(14); let proof_and_public = ctx.create_proof(); - ctx.batch_verification(&vec![proof_and_public]); + ctx.batch_verification(&[proof_and_public]); } iai::main!(bench_proof_creation, bench_proof_creation_and_verification); diff --git a/kimchi/src/alphas.rs b/kimchi/src/alphas.rs index 83e9f519104..630e6539435 100644 --- a/kimchi/src/alphas.rs +++ b/kimchi/src/alphas.rs @@ -130,7 +130,7 @@ impl Alphas { &self, ty: ArgumentType, num: u32, - ) -> MustConsumeIterator>>>, F> { + ) -> MustConsumeIterator>>>, F> { let ty = if matches!(ty, ArgumentType::Gate(_)) { ArgumentType::Gate(GateType::Zero) } else { diff --git a/kimchi/src/bin/flamegraph.rs b/kimchi/src/bin/flamegraph.rs index 33c496c2193..76deb81cd50 100644 --- a/kimchi/src/bin/flamegraph.rs +++ b/kimchi/src/bin/flamegraph.rs @@ -27,7 +27,7 @@ fn main() { let ctx = BenchmarkCtx::new(4); let proof_and_public = ctx.create_proof(); loop { - ctx.batch_verification(black_box(&vec![proof_and_public.clone()])); + ctx.batch_verification(black_box(std::slice::from_ref(&proof_and_public))); } } _ => panic!("you must provide an argument (prove or verify)"), diff --git a/kimchi/src/circuits/lookup/index.rs b/kimchi/src/circuits/lookup/index.rs index 6644b333675..7d3d5d3aa59 100644 --- a/kimchi/src/circuits/lookup/index.rs +++ b/kimchi/src/circuits/lookup/index.rs @@ -13,7 +13,6 @@ use ark_poly::{ univariate::DensePolynomial as DP, EvaluationDomain, Evaluations as E, Radix2EvaluationDomain as D, }; -use core::iter; use itertools::repeat_n; use o1_utils::field_helpers::i32_to_field; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -287,12 +286,12 @@ impl LookupConstraintSystem { // it's 1 everywhere, except at the entries where // the runtime table applies - evals.extend(iter::repeat(F::one()).take(runtime_table_offset)); - evals.extend(iter::repeat(F::zero()).take(runtime_len)); - evals.extend( - iter::repeat(F::one()) - .take(d1_size - runtime_table_offset - runtime_len), - ); + evals.extend(std::iter::repeat_n(F::one(), runtime_table_offset)); + evals.extend(std::iter::repeat_n(F::zero(), runtime_len)); + evals.extend(std::iter::repeat_n( + F::one(), + d1_size - runtime_table_offset - runtime_len, + )); // although the last zk_rows are fine for e in evals.iter_mut().rev().take(zk_rows) { diff --git a/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs b/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs index 95b23771018..470330e6764 100644 --- a/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs +++ b/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs @@ -156,7 +156,7 @@ pub fn create_chain( for i in 0..num { // Create foreign field addition row for w in &mut witness { - w.extend(core::iter::repeat(F::zero()).take(1)); + w.extend(std::iter::repeat_n(F::zero(), 1)); } let right = ForeignElement::from_biguint(inputs[i + 1].clone()); let (output, _sign, ovf, carry) = @@ -298,7 +298,7 @@ pub fn extend_witness_bound_addition( // Extend the witness for the add gate let offset = witness[0].len(); for col in witness.iter_mut().take(COLUMNS) { - col.extend(core::iter::repeat(F::zero()).take(2)) + col.extend(std::iter::repeat_n(F::zero(), 2)) } init_bound_rows( diff --git a/kimchi/src/circuits/polynomials/foreign_field_mul/witness.rs b/kimchi/src/circuits/polynomials/foreign_field_mul/witness.rs index d2b0e3c1721..0857fd9041c 100644 --- a/kimchi/src/circuits/polynomials/foreign_field_mul/witness.rs +++ b/kimchi/src/circuits/polynomials/foreign_field_mul/witness.rs @@ -198,7 +198,7 @@ pub fn create( // Extend the witness by two rows for foreign field multiplication for w in &mut witness { - w.extend(core::iter::repeat(F::zero()).take(2)); + w.extend(std::iter::repeat_n(F::zero(), 2)); } // Create the foreign field multiplication witness rows @@ -329,7 +329,7 @@ impl ExternalChecks { for chunk in self.high_bounds.clone().chunks(2) { // Extend the witness for the generic gate for col in witness.iter_mut().take(COLUMNS) { - col.extend(core::iter::repeat(F::zero()).take(1)) + col.extend(std::iter::repeat_n(F::zero(), 1)) } let last_row = witness[0].len() - 1; // Fill in with dummy if it is an odd number of bounds diff --git a/kimchi/src/circuits/polynomials/keccak/constants.rs b/kimchi/src/circuits/polynomials/keccak/constants.rs index e8416cf2db0..10ab6114093 100644 --- a/kimchi/src/circuits/polynomials/keccak/constants.rs +++ b/kimchi/src/circuits/polynomials/keccak/constants.rs @@ -1,4 +1,4 @@ -/// Constants for each witness' index offsets and lengths +// Constants for each witness' index offsets and lengths // KECCAK PARAMETERS /// The dimension of the Keccak state diff --git a/kimchi/src/circuits/polynomials/keccak/witness.rs b/kimchi/src/circuits/polynomials/keccak/witness.rs index f7b003c8b4d..abd115f8c78 100644 --- a/kimchi/src/circuits/polynomials/keccak/witness.rs +++ b/kimchi/src/circuits/polynomials/keccak/witness.rs @@ -393,6 +393,7 @@ impl PiRho { let aux = grid!(100, rotation_e.expand_rot); for y in 0..DIM { for x in 0..DIM { + #[allow(clippy::needless_range_loop)] for q in 0..QUARTERS { state_b[(2 * x + 3 * y) % DIM][y][q] = aux(y, x, q); } diff --git a/kimchi/src/circuits/polynomials/turshi.rs b/kimchi/src/circuits/polynomials/turshi.rs index 45e6b9e2aa3..dad4f9a783a 100644 --- a/kimchi/src/circuits/polynomials/turshi.rs +++ b/kimchi/src/circuits/polynomials/turshi.rs @@ -1,3 +1,4 @@ +#![allow(clippy::doc_overindented_list_items)] //! This implements the constraints of the Cairo gates //! //! Cairo programs can have the following assembly-like instructions: diff --git a/kimchi/src/lib.rs b/kimchi/src/lib.rs index 13187fccdda..4842c0c52eb 100644 --- a/kimchi/src/lib.rs +++ b/kimchi/src/lib.rs @@ -1,4 +1,5 @@ #![doc = include_str!("../README.md")] +#![allow(non_local_definitions)] pub use groupmap; pub use mina_curves; diff --git a/kimchi/src/prover.rs b/kimchi/src/prover.rs index 129ed1226d8..16bde40cfe7 100644 --- a/kimchi/src/prover.rs +++ b/kimchi/src/prover.rs @@ -241,7 +241,7 @@ where } // padding - w.extend(core::iter::repeat(G::ScalarField::zero()).take(length_padding)); + w.extend(std::iter::repeat_n(G::ScalarField::zero(), length_padding)); // zk-rows for row in w.iter_mut().rev().take(index.cs.zk_rows as usize) { diff --git a/kimchi/src/snarky/runner.rs b/kimchi/src/snarky/runner.rs index e5b18198146..7efd1b69ed2 100644 --- a/kimchi/src/snarky/runner.rs +++ b/kimchi/src/snarky/runner.rs @@ -599,7 +599,7 @@ where } // pad with zeros for the public output part - public_input.extend(core::iter::repeat(F::zero()).take(self.public_output.len())); + public_input.extend(std::iter::repeat_n(F::zero(), self.public_output.len())); // re-initialize `next_var` (which will grow every time we compile or generate a witness) self.next_var = self.num_public_inputs; diff --git a/kimchi/src/tests/serde.rs b/kimchi/src/tests/serde.rs index b69cd23d170..8da853e75cc 100644 --- a/kimchi/src/tests/serde.rs +++ b/kimchi/src/tests/serde.rs @@ -49,7 +49,7 @@ mod tests { rmp_serde::from_slice(&ser_pf).unwrap(); // verify the deserialized proof (must accept the proof) - ctx.batch_verification(&vec![(de_pf, public_input)]); + ctx.batch_verification(&[(de_pf, public_input)]); } #[test] diff --git a/msm/src/circuit_design/witness.rs b/msm/src/circuit_design/witness.rs index 6246b16ee6b..0ed8e5c45e6 100644 --- a/msm/src/circuit_design/witness.rs +++ b/msm/src/circuit_design/witness.rs @@ -9,7 +9,7 @@ use crate::{ }; use ark_ff::PrimeField; use log::debug; -use std::{collections::BTreeMap, iter, marker::PhantomData}; +use std::{collections::BTreeMap, marker::PhantomData}; /// Witness builder environment. Operates on multiple rows at the same /// time. `CIx::N_COL` must be equal to `N_WIT + N_FSEL`; passing these two @@ -345,9 +345,8 @@ impl< ); if table_id.length() < domain_size { let n_repeated_dummy_value: usize = domain_size - table_id.length() - 1; - let repeated_dummy_value: Vec = iter::repeat(-F::one()) - .take(n_repeated_dummy_value) - .collect(); + let repeated_dummy_value: Vec = + std::iter::repeat_n(-F::one(), n_repeated_dummy_value).collect(); m.extend(repeated_dummy_value); m.push(F::from(n_repeated_dummy_value as u64)); } diff --git a/msm/src/fec/interpreter.rs b/msm/src/fec/interpreter.rs index 189bfd762b6..0e33baf952d 100644 --- a/msm/src/fec/interpreter.rs +++ b/msm/src/fec/interpreter.rs @@ -1,3 +1,5 @@ +#![allow(clippy::doc_overindented_list_items)] + use crate::{ circuit_design::{ capabilities::{read_column_array, write_column_array_const, write_column_const}, diff --git a/msm/src/lookups.rs b/msm/src/lookups.rs index c488a2f3c1a..387243b1246 100644 --- a/msm/src/lookups.rs +++ b/msm/src/lookups.rs @@ -4,7 +4,7 @@ use crate::logup::{Logup, LogupWitness, LookupTableID}; use ark_ff::{FftField, PrimeField}; use kimchi::circuits::domains::EvaluationDomains; use rand::{seq::SliceRandom, thread_rng, Rng}; -use std::{cmp::Ord, iter}; +use std::cmp::Ord; /// Dummy lookup table. For the cases when you don't need one -- a single dummy element 0. #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)] @@ -144,9 +144,8 @@ impl LookupWitness { }; let dummy_value = F::rand(&mut rng); let repeated_dummy_value: Vec = { - let r: Vec = iter::repeat(dummy_value) - .take((domain.d1.size - table_size) as usize) - .collect(); + let r: Vec = + std::iter::repeat_n(dummy_value, (domain.d1.size - table_size) as usize).collect(); r }; let t_evals = { diff --git a/msm/src/serialization/interpreter.rs b/msm/src/serialization/interpreter.rs index fb57eaad4bd..422c1692c1a 100644 --- a/msm/src/serialization/interpreter.rs +++ b/msm/src/serialization/interpreter.rs @@ -1,3 +1,6 @@ +// We can't use is_multiple_of as it's not available in the older nightly used for WASM builds +#![allow(clippy::manual_is_multiple_of)] + use ark_ff::{PrimeField, Zero}; use num_bigint::{BigInt, BigUint, ToBigInt}; use num_integer::Integer; diff --git a/msm/src/test/proof_system.rs b/msm/src/test/proof_system.rs index 491109c56d6..0f5cb9a0167 100644 --- a/msm/src/test/proof_system.rs +++ b/msm/src/test/proof_system.rs @@ -1,4 +1,4 @@ -/// Tests for the proof system itself, targeting prover and verifier. +//! Tests for the proof system itself, targeting prover and verifier. #[cfg(test)] mod tests { diff --git a/mvpoly/src/lib.rs b/mvpoly/src/lib.rs index bc32baff777..1bb3636be1a 100644 --- a/mvpoly/src/lib.rs +++ b/mvpoly/src/lib.rs @@ -4,8 +4,8 @@ //! Different representations are provided in the sub-modules: //! - `monomials`: a representation based on monomials //! - `prime`: a representation based on a mapping from variables to prime -//! numbers. This representation is unmaintained for now. We leave it -//! for interested users. +//! numbers. This representation is unmaintained for now. We leave it +//! for interested users. //! //! "Expressions", as defined in the [kimchi] crate, can be converted into a //! multi-variate polynomial using the `from_expr` method. diff --git a/mvpoly/src/utils.rs b/mvpoly/src/utils.rs index b50e70ad485..7a86ee6cff6 100644 --- a/mvpoly/src/utils.rs +++ b/mvpoly/src/utils.rs @@ -1,3 +1,5 @@ +// We can't use is_multiple_of as it's not available in the older nightly used for WASM builds +#![allow(clippy::manual_is_multiple_of)] //! This module contains functions to work with prime numbers and to compute //! dimension of multivariate spaces diff --git a/o1vm/src/interpreters/keccak/column.rs b/o1vm/src/interpreters/keccak/column.rs index d283039cb80..224e5d5dc37 100644 --- a/o1vm/src/interpreters/keccak/column.rs +++ b/o1vm/src/interpreters/keccak/column.rs @@ -356,7 +356,7 @@ impl From for usize { /// pub type KeccakWitness = Witness; -/// IMPLEMENTATIONS FOR COLUMN ALIAS +// IMPLEMENTATIONS FOR COLUMN ALIAS impl Index for KeccakWitness { type Output = T; diff --git a/o1vm/src/interpreters/keccak/interpreter.rs b/o1vm/src/interpreters/keccak/interpreter.rs index b1e06e4596d..55cd2d79d67 100644 --- a/o1vm/src/interpreters/keccak/interpreter.rs +++ b/o1vm/src/interpreters/keccak/interpreter.rs @@ -652,7 +652,7 @@ where } /////////////////////////// - /// SELECTOR OPERATIONS /// + // SELECTOR OPERATIONS // /////////////////////////// /// Returns a degree-2 variable that encodes whether the current step is a @@ -751,7 +751,7 @@ where } ///////////////////////// - /// COLUMN OPERATIONS /// + // COLUMN OPERATIONS // ///////////////////////// /// This function returns the composed sparse variable from shifts of any diff --git a/o1vm/src/interpreters/mips/witness.rs b/o1vm/src/interpreters/mips/witness.rs index 2f61955d987..d4e4a885dfa 100644 --- a/o1vm/src/interpreters/mips/witness.rs +++ b/o1vm/src/interpreters/mips/witness.rs @@ -1,3 +1,6 @@ +// We can't use is_multiple_of as it's not available in the older nightly used for WASM builds +#![allow(clippy::manual_is_multiple_of)] + use super::column::{N_MIPS_SEL_COLS, SCRATCH_SIZE, SCRATCH_SIZE_INVERSE}; use crate::{ cannon::{ diff --git a/o1vm/src/pickles/lookup_prover.rs b/o1vm/src/pickles/lookup_prover.rs index f5b7133ac71..7a3992a550c 100644 --- a/o1vm/src/pickles/lookup_prover.rs +++ b/o1vm/src/pickles/lookup_prover.rs @@ -15,7 +15,6 @@ use rand::{CryptoRng, RngCore}; /// This prover takes one Public Input and one Public Output /// It then proves that the sum 1/(beta + table) = PI - PO /// where the table term are term from fixed lookup or RAMLookup - pub fn lookup_prove< G: KimchiCurve, EFqSponge: FqSponge + Clone, diff --git a/o1vm/src/pickles/main.rs b/o1vm/src/pickles/main.rs index 113eda4f28e..b9e479da665 100644 --- a/o1vm/src/pickles/main.rs +++ b/o1vm/src/pickles/main.rs @@ -1,3 +1,5 @@ +#![allow(clippy::zombie_processes)] + use ark_ff::{UniformRand, Zero}; use clap::Parser; use kimchi::circuits::domains::EvaluationDomains; diff --git a/o1vm/src/test_preimage_read.rs b/o1vm/src/test_preimage_read.rs index be351afda79..3469f3ee168 100644 --- a/o1vm/src/test_preimage_read.rs +++ b/o1vm/src/test_preimage_read.rs @@ -1,3 +1,5 @@ +#![allow(clippy::zombie_processes)] + use crate::{ cannon::{PreimageKey, VmConfiguration}, cli, diff --git a/plonk-wasm/src/rayon.rs b/plonk-wasm/src/rayon.rs index 5127f1e7262..d79f26b0f37 100644 --- a/plonk-wasm/src/rayon.rs +++ b/plonk-wasm/src/rayon.rs @@ -25,6 +25,7 @@ where OP: FnOnce() -> R + Send, R: Send, { + #[allow(static_mut_refs)] let pool = unsafe { THREAD_POOL.as_ref().unwrap() }; pool.install(op) } diff --git a/plonk-wasm/src/wasm_ocaml_serde/de.rs b/plonk-wasm/src/wasm_ocaml_serde/de.rs index e66b7d611db..f3ebe13c149 100644 --- a/plonk-wasm/src/wasm_ocaml_serde/de.rs +++ b/plonk-wasm/src/wasm_ocaml_serde/de.rs @@ -23,7 +23,7 @@ impl ObjectAccess { } } -fn str_deserializer(s: &str) -> de::value::StrDeserializer { +fn str_deserializer(s: &str) -> de::value::StrDeserializer<'_, Error> { de::IntoDeserializer::into_deserializer(s) } diff --git a/poly-commitment/src/combine.rs b/poly-commitment/src/combine.rs index ad303a8bb5f..8a3d83c7abf 100644 --- a/poly-commitment/src/combine.rs +++ b/poly-commitment/src/combine.rs @@ -1,3 +1,5 @@ +// We can't use is_multiple_of as it's not available in the older nightly used for WASM builds +#![allow(clippy::manual_is_multiple_of)] //! Batch elliptic curve algorithms based on the batch-affine principle. //! //! The principle is the following: diff --git a/poly-commitment/src/commitment.rs b/poly-commitment/src/commitment.rs index 4e38d9ad757..dda1bec2563 100644 --- a/poly-commitment/src/commitment.rs +++ b/poly-commitment/src/commitment.rs @@ -269,7 +269,7 @@ where } } -impl<'a, 'b, C: AffineRepr> Add<&'a PolyComm> for &'b PolyComm { +impl<'a, C: AffineRepr> Add<&'a PolyComm> for &PolyComm { type Output = PolyComm; fn add(self, other: &'a PolyComm) -> PolyComm { @@ -290,7 +290,7 @@ impl<'a, 'b, C: AffineRepr> Add<&'a PolyComm> for &'b PolyComm { } } -impl<'a, 'b, C: AffineRepr + Sub> Sub<&'a PolyComm> for &'b PolyComm { +impl<'a, C: AffineRepr + Sub> Sub<&'a PolyComm> for &PolyComm { type Output = PolyComm; fn sub(self, other: &'a PolyComm) -> PolyComm { @@ -376,7 +376,7 @@ pub fn b_poly(chals: &[F], x: F) -> F { pow_twos.push(pow_twos[i - 1].square()); } - product((0..k).map(|i| (F::one() + (chals[i] * pow_twos[k - 1 - i])))) + product((0..k).map(|i| F::one() + (chals[i] * pow_twos[k - 1 - i]))) } pub fn b_poly_coefficients(chals: &[F]) -> Vec { @@ -638,6 +638,7 @@ pub fn combine_commitments( } #[cfg(feature = "ocaml_types")] +#[allow(non_local_definitions)] pub mod caml { // polynomial commitment use super::PolyComm; diff --git a/poly-commitment/src/ipa.rs b/poly-commitment/src/ipa.rs index 62882175e84..57063b8f81a 100644 --- a/poly-commitment/src/ipa.rs +++ b/poly-commitment/src/ipa.rs @@ -891,7 +891,7 @@ impl SRS { // polynomial commitments, we obtain a chunked commitment to the L_i // polynomials. let srs_size = self.g.len(); - let num_elems = (n + srs_size - 1) / srs_size; + let num_elems = n.div_ceil(srs_size); let mut chunks = Vec::with_capacity(num_elems); // For each chunk @@ -1027,6 +1027,7 @@ impl OpeningProof { } #[cfg(feature = "ocaml_types")] +#[allow(non_local_definitions)] pub mod caml { use super::OpeningProof; use ark_ec::AffineRepr; diff --git a/poly-commitment/src/utils.rs b/poly-commitment/src/utils.rs index 01237964438..eb8f6ab101f 100644 --- a/poly-commitment/src/utils.rs +++ b/poly-commitment/src/utils.rs @@ -33,7 +33,7 @@ impl ScaledChunkedPolynomial { } } -impl<'a, F: Field> ScaledChunkedPolynomial { +impl ScaledChunkedPolynomial { /// Compute the resulting scaled polynomial. /// Example: /// Given the two polynomials `1 + 2X` and `3 + 4X`, and the scaling @@ -74,9 +74,9 @@ impl<'a, F: Field> ScaledChunkedPolynomial { /// /// Parameters: /// - `plnms`: vector of polynomials, either in evaluations or coefficients form, together with -/// a set of scalars representing their blinders. +/// a set of scalars representing their blinders. /// - `polyscale`: scalar to combine the polynomials, which will be scaled based on the number of -/// polynomials to combine. +/// polynomials to combine. /// /// Output: /// - `combined_poly`: combined polynomial. The order of the output follows the order of `plnms`. diff --git a/poly-commitment/tests/commitment.rs b/poly-commitment/tests/commitment.rs index b2eace323d5..5ca718f3c79 100644 --- a/poly-commitment/tests/commitment.rs +++ b/poly-commitment/tests/commitment.rs @@ -78,7 +78,7 @@ impl AggregatedEvaluationProof { /// verify API understands pub fn verify_type( &self, - ) -> BatchEvaluationProof, OpeningProof> + ) -> BatchEvaluationProof<'_, Vesta, DefaultFqSponge, OpeningProof> { let mut coms = vec![]; for eval_com in &self.eval_commitments { diff --git a/poly-commitment/tests/ipa_commitment.rs b/poly-commitment/tests/ipa_commitment.rs index a109b391b77..686c522d698 100644 --- a/poly-commitment/tests/ipa_commitment.rs +++ b/poly-commitment/tests/ipa_commitment.rs @@ -96,7 +96,7 @@ fn test_offset_chunked_lagrange_commitments() { srs.get_lagrange_basis(domain); // Is this even taken into account?... - let num_chunks = (domain.size() + srs.g.len() - 1) / srs.g.len(); + let num_chunks = domain.size().div_ceil(srs.g.len()); assert!(num_chunks == 2); let expected_lagrange_commitments: Vec<_> = (0..n) diff --git a/poseidon/src/sponge.rs b/poseidon/src/sponge.rs index 248d09af500..4db3a81bf8e 100644 --- a/poseidon/src/sponge.rs +++ b/poseidon/src/sponge.rs @@ -262,6 +262,7 @@ where // #[cfg(feature = "ocaml_types")] +#[allow(non_local_definitions)] pub mod caml { use super::*; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4cef0b738ff..1a35d66439a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.81" +channel = "1.91" diff --git a/signer/src/schnorr.rs b/signer/src/schnorr.rs index 21f61a25427..a0ca0df1314 100644 --- a/signer/src/schnorr.rs +++ b/signer/src/schnorr.rs @@ -217,7 +217,7 @@ impl Schnorr { } // Convert bits to bytes for BLAKE2b - let mut input_bytes = vec![0u8; (all_bits.len() + 7) / 8]; + let mut input_bytes = vec![0u8; all_bits.len().div_ceil(8)]; for (i, &bit) in all_bits.iter().enumerate() { if bit { input_bytes[i / 8] |= 1 << (i % 8); diff --git a/turshi/src/memory.rs b/turshi/src/memory.rs index b9b972c8777..534823e49ca 100644 --- a/turshi/src/memory.rs +++ b/turshi/src/memory.rs @@ -8,7 +8,7 @@ use std::{ use crate::{helper::*, word::CairoWord}; use ark_ff::Field; -use core::iter::repeat; +use core::iter::repeat_n; /// This data structure stores the memory of the program pub struct CairoMemory { @@ -85,7 +85,7 @@ impl CairoMemory { // you will need to extend the vector with enough spaces (taking into account that // vectors start by index 0, the 0 address is dummy, and size starts in 1) if let Some(additional) = addr.checked_sub(self.len() - 1) { - self.data.extend(repeat(None).take(additional as usize)); + self.data.extend(repeat_n(None, additional as usize)); } } diff --git a/turshi/src/runner.rs b/turshi/src/runner.rs index fe7664ddb98..ecc8690d2e6 100644 --- a/turshi/src/runner.rs +++ b/turshi/src/runner.rs @@ -261,7 +261,7 @@ pub struct CairoStep<'a, F> { impl<'a, F: Field> CairoStep<'a, F> { /// Creates a new Cairo execution step from a step index, a Cairo word, and current pointers - pub fn new(mem: &mut CairoMemory, ptrs: CairoState) -> CairoStep { + pub fn new(mem: &mut CairoMemory, ptrs: CairoState) -> CairoStep<'_, F> { CairoStep { mem, curr: ptrs, @@ -503,7 +503,7 @@ pub struct CairoProgram<'a, F> { impl<'a, F: Field> CairoProgram<'a, F> { /// Creates a Cairo execution from the public information (memory and initial pointers) - pub fn new(mem: &mut CairoMemory, pc: u64) -> CairoProgram { + pub fn new(mem: &mut CairoMemory, pc: u64) -> CairoProgram<'_, F> { let ap = mem.len(); let mut prog = CairoProgram { steps: F::zero(), diff --git a/utils/src/chunked_polynomial.rs b/utils/src/chunked_polynomial.rs index 86f64a6b3cf..7bc8a575c3c 100644 --- a/utils/src/chunked_polynomial.rs +++ b/utils/src/chunked_polynomial.rs @@ -42,7 +42,7 @@ impl ChunkedPolynomial { scale *= zeta_n; } - while coeffs.last().map_or(false, |c| c.is_zero()) { + while coeffs.last().is_some_and(|c| c.is_zero()) { coeffs.pop(); } diff --git a/utils/src/foreign_field.rs b/utils/src/foreign_field.rs index fb05f4eb0db..d2603acae98 100644 --- a/utils/src/foreign_field.rs +++ b/utils/src/foreign_field.rs @@ -1,3 +1,5 @@ +// We can't use is_multiple_of as it's not available in the older nightly used for WASM builds +#![allow(clippy::manual_is_multiple_of)] //! Describes helpers for foreign field arithmetics //! Generic parameters are as follows: //! - `B` is a bit length of one limb diff --git a/utils/src/math.rs b/utils/src/math.rs index b7781fdccf4..7705fb4c346 100644 --- a/utils/src/math.rs +++ b/utils/src/math.rs @@ -19,5 +19,5 @@ pub fn ceil_log2(d: usize) -> usize { /// This function is bound to be stable soon. See pub fn div_ceil(a: usize, b: usize) -> usize { - (a + b - 1) / b + a.div_ceil(b) }