diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a9c629ece..ee2df2fd7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: rustfmt - toolchain: nightly-2024-01-04 + toolchain: nightly-2024-03-10 - uses: Swatinem/rust-cache@v2 - run: scripts/rust_fmt.sh --check @@ -38,7 +38,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: clippy - toolchain: nightly-2024-01-04 + toolchain: nightly-2024-03-10 - uses: Swatinem/rust-cache@v2 - run: scripts/clippy.sh @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-01-04 + toolchain: nightly-2024-03-10 - uses: Swatinem/rust-cache@v2 - run: ./scripts/test_avx.sh @@ -58,9 +58,9 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-01-04 + toolchain: nightly-2024-03-10 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2024-01-04 test + - run: cargo +nightly-2024-03-10 test udeps: runs-on: ubuntu-latest @@ -69,7 +69,7 @@ jobs: - uses: dtolnay/rust-toolchain@master name: "Rust Toolchain Setup" with: - toolchain: nightly-2024-01-04 + toolchain: nightly-2024-03-10 - uses: Swatinem/rust-cache@v2 id: "cache-cargo" - if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} @@ -78,19 +78,18 @@ jobs: wget -O - -c https://github.com/est31/cargo-udeps/releases/download/v0.1.35/cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz cargo-udeps-*/cargo-udeps udeps env: - RUSTUP_TOOLCHAIN: nightly-2024-01-04 - + RUSTUP_TOOLCHAIN: nightly-2024-03-10 all-tests: runs-on: ubuntu-latest needs: - - clippy - - format - - run-tests - - run-avx-tests - - udeps + - clippy + - format + - run-tests + - run-avx-tests + - udeps steps: - - name: Decide whether all the needed jobs succeeded or failed - uses: re-actors/alls-green@v1.2.2 - with: - jobs: ${{ toJSON(needs) }} + - name: Decide whether all the needed jobs succeeded or failed + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 8098727db..fdb65c093 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -12,12 +12,12 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: rustfmt - toolchain: nightly-2024-01-04 + toolchain: nightly-2024-03-10 - uses: Swatinem/rust-cache@v2 - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Generate code coverage - run: cargo +nightly-2024-01-04 llvm-cov --codecov --output-path codecov.json + run: cargo +nightly-2024-03-10 llvm-cov --codecov --output-path codecov.json env: RUSTFLAGS: "-C target-feature=+avx512f" - name: Upload coverage to Codecov diff --git a/Cargo.toml b/Cargo.toml index 38612a10d..10fce2a1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ warnings = "deny" future-incompatible = "deny" nonstandard-style = "deny" rust-2018-idioms = "deny" -unused = "deny" [features] avx512 = [] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a0f1a930e..984e57270 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2024-01-04" +channel = "nightly-2024-03-10" diff --git a/scripts/clippy.sh b/scripts/clippy.sh index 8361cd25d..af80b0e90 100755 --- a/scripts/clippy.sh +++ b/scripts/clippy.sh @@ -1,3 +1,3 @@ #!/bin/bash -cargo +nightly-2024-01-04 clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \ +cargo +nightly-2024-03-10 clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \ -D nonstandard-style -D rust-2018-idioms -D unused diff --git a/scripts/rust_fmt.sh b/scripts/rust_fmt.sh index e4223f999..60faeb3c6 100755 --- a/scripts/rust_fmt.sh +++ b/scripts/rust_fmt.sh @@ -1,3 +1,3 @@ #!/bin/bash -cargo +nightly-2024-01-04 fmt --all -- "$@" +cargo +nightly-2024-03-10 fmt --all -- "$@" diff --git a/scripts/test_avx.sh b/scripts/test_avx.sh index d911a2479..b8745dfd2 100755 --- a/scripts/test_avx.sh +++ b/scripts/test_avx.sh @@ -1,4 +1,4 @@ #!/bin/bash # Can be used as a drop in replacement for `cargo test` with avx512f flag on. # For example, `./scripts/test_avx.sh` will run all tests(not only avx). -RUSTFLAGS="-Awarnings -C target-cpu=native -C target-feature=+avx512f -C opt-level=2" cargo +nightly-2024-01-04 test "$@" +RUSTFLAGS="-Awarnings -C target-cpu=native -C target-feature=+avx512f -C opt-level=2" cargo +nightly-2024-03-10 test "$@" diff --git a/src/commitment_scheme/merkle_multilayer.rs b/src/commitment_scheme/merkle_multilayer.rs index 5614c2387..ad764c40d 100644 --- a/src/commitment_scheme/merkle_multilayer.rs +++ b/src/commitment_scheme/merkle_multilayer.rs @@ -94,16 +94,14 @@ impl MerkleMultiLayer { } // Hashes a single sub-tree. -fn hash_subtree( +fn hash_subtree, H: Hasher, const IS_INTERMEDIATE: bool>( sub_tree_data: &mut [H::Hash], input: &MerkleTreeInput<'_, F>, relative_depth: usize, prev_hashes: &[H::Hash], config: &MerkleMultiLayerConfig, index_in_layer: usize, -) where - F: IntoSlice, -{ +) { // First layer is special, as it is the only layer that might have inputs from the previous // MultiLayer, and does not need to look at the current sub_tree for previous hash values. let dst = sub_tree_data diff --git a/src/commitment_scheme/mixed_degree_merkle_tree.rs b/src/commitment_scheme/mixed_degree_merkle_tree.rs index 8e1c760dc..0a5be154a 100644 --- a/src/commitment_scheme/mixed_degree_merkle_tree.rs +++ b/src/commitment_scheme/mixed_degree_merkle_tree.rs @@ -555,7 +555,7 @@ mod tests { let first_column_queries = vec![0, 7]; let second_column_queries = vec![3, 7]; let third_column_queries = vec![1, 2]; - let queries = vec![ + let queries = [ zero_column_queries, first_column_queries, second_column_queries, diff --git a/src/commitment_scheme/utils.rs b/src/commitment_scheme/utils.rs index f5d913539..ec532a120 100644 --- a/src/commitment_scheme/utils.rs +++ b/src/commitment_scheme/utils.rs @@ -67,14 +67,11 @@ pub fn hash_merkle_tree(data: &mut [&mut [H::NativeType]]) { /// Given a data of a tree, and a bottom layer of 'bottom_layer_node_size_bytes' sized nodes, hashes /// the entire tree. Nodes are hashed individually at the bottom layer. // TODO(Ohad): Write a similiar function for when F does not implement IntoSlice(Non le platforms). -pub fn hash_merkle_tree_from_bottom_layer<'a, F: Field, H: Hasher>( +pub fn hash_merkle_tree_from_bottom_layer, H: Hasher>( bottom_layer: &[F], bottom_layer_node_size_bytes: usize, data: &mut [&mut [H::NativeType]], -) where - F: IntoSlice, - H::NativeType: 'a, -{ +) { // Hash bottom layer. let dst_slice = data.get_mut(0).expect("Empty tree!"); let bottom_layer_data: &[H::NativeType] = @@ -206,13 +203,13 @@ pub fn inject_hash_in_pairs<'a: 'b, 'b, H: Hasher>( /// * `hash_inputs` - The hash inputs to inject into. /// * `chunk_idx` - The index of the chunk to inject. /// * `n_chunks_in_column` - The number of chunks every column is divided into. -pub fn inject_column_chunks<'b, 'a: 'b, H: Hasher, F: Field>( +pub fn inject_column_chunks<'b, 'a: 'b, H: Hasher, F>( columns: &'a [&'a [F]], hash_inputs: &'b mut [Vec<&'a [H::NativeType]>], chunk_idx: usize, n_chunks_in_column: usize, ) where - F: IntoSlice, + F: Field + IntoSlice, { for column in columns { let column_slice = get_column_chunk(column, chunk_idx, n_chunks_in_column); @@ -247,13 +244,15 @@ pub fn get_column_chunk(column: &[F], index_to_view: usize, n_total_chunks: u /// Hashes a layer of a Merkle tree. Nodes are injected with child hashes and chunks from the input /// columns (if any). // TODO(Ohad): Consider renaming after current hash_layer function is deprecated. -pub fn inject_and_hash_layer( +pub fn inject_and_hash_layer< + H: Hasher, + F: Field + IntoSlice, + const IS_INTERMEDIATE: bool, +>( child_hashes: &[H::Hash], dst: &mut [H::Hash], input_columns: &Iter<'_, &[F]>, -) where - F: IntoSlice, -{ +) { let produced_layer_length = dst.len(); if IS_INTERMEDIATE { assert_eq!( diff --git a/src/core/air/evaluation.rs b/src/core/air/evaluation.rs index fc7bdac5e..74125f1b9 100644 --- a/src/core/air/evaluation.rs +++ b/src/core/air/evaluation.rs @@ -209,7 +209,6 @@ mod tests { use rand::{Rng, SeedableRng}; use super::*; - use crate::core::backend::cpu::CPUCircleEvaluation; use crate::core::circle::CirclePoint; use crate::core::fields::m31::{M31, P}; use crate::qm31; diff --git a/src/core/backend/cpu/fri.rs b/src/core/backend/cpu/fri.rs index 5f772ab98..df9ca07a5 100644 --- a/src/core/backend/cpu/fri.rs +++ b/src/core/backend/cpu/fri.rs @@ -37,7 +37,7 @@ impl FriOps for CPUBackend { LineEvaluation::new(domain.double(), folded_values) } - fn fold_circle_into_line( + fn fold_circle_into_line( dst: &mut LineEvaluation, src: &CircleEvaluation, alpha: SecureField, diff --git a/src/core/backend/cpu/mod.rs b/src/core/backend/cpu/mod.rs index 44c11ead2..591be9516 100644 --- a/src/core/backend/cpu/mod.rs +++ b/src/core/backend/cpu/mod.rs @@ -52,7 +52,6 @@ pub type CPULineEvaluation = LineEvaluation + Sized { /// Panics if `src` is not double the length of `dst`. // TODO(andrew): Make folding factor generic. // TODO(andrew): Fold directly into FRI layer to prevent allocation. - fn fold_circle_into_line( + fn fold_circle_into_line( dst: &mut LineEvaluation, src: &CircleEvaluation, alpha: SecureField, @@ -746,7 +746,7 @@ impl> FriLayerVerifier { let mut all_subline_evals = Vec::new(); // Group queries by the subline they reside in. - for subline_queries in queries.group_by(|a, b| a >> FOLD_STEP == b >> FOLD_STEP) { + for subline_queries in queries.chunk_by(|a, b| a >> FOLD_STEP == b >> FOLD_STEP) { let subline_start = (subline_queries[0] >> FOLD_STEP) << FOLD_STEP; let subline_end = subline_start + (1 << FOLD_STEP); @@ -816,7 +816,7 @@ impl> FriLayerProver { // Group queries by the subline they reside in. // TODO(andrew): Explain what a "subline" is at the top of the module. - for query_group in queries.group_by(|a, b| a >> FOLD_STEP == b >> FOLD_STEP) { + for query_group in queries.chunk_by(|a, b| a >> FOLD_STEP == b >> FOLD_STEP) { let subline_start = (query_group[0] >> FOLD_STEP) << FOLD_STEP; let subline_end = subline_start + (1 << FOLD_STEP); diff --git a/src/lib.rs b/src/lib.rs index 4ee4907df..dfa90cd87 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,12 @@ #![feature( array_chunks, - iter_array_chunks, exact_size_is_empty, + get_many_mut, + int_roundings, is_sorted, + iter_array_chunks, new_uninit, - slice_group_by, - stdsimd, - get_many_mut, - int_roundings + stdarch_x86_avx512 )] pub mod commitment_scheme; pub mod core;