From 09f9c095d01b4d22cef5af8bc6796c11dbfcc1a6 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 10 Feb 2023 17:48:42 +0000 Subject: [PATCH 1/3] Bump MSRV to 1.60 - `blake2b_simd 1.0.1` raised its MSRV to 1.59. - `proptest 1.1.0` added a dependency on `unarray` which has an implicit MSRV of 1.60. --- .github/workflows/bench.yml | 2 +- .github/workflows/ci.yml | 10 +++++----- .github/workflows/lints-stable.yml | 6 +++--- README.md | 2 +- halo2/Cargo.toml | 2 +- halo2_gadgets/Cargo.toml | 2 +- halo2_gadgets/README.md | 2 +- halo2_proofs/Cargo.toml | 2 +- halo2_proofs/README.md | 2 +- rust-toolchain | 1 - rust-toolchain.toml | 2 ++ 11 files changed, 17 insertions(+), 16 deletions(-) delete mode 100644 rust-toolchain create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index c948247ae3..eee9f16aca 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 override: true - name: Run benchmark run: cargo bench -- --output-format bencher | tee output.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd37431e4e..6a9274d89a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 override: true - name: Run tests uses: actions-rs/cargo@v1 @@ -43,7 +43,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 override: true - name: Add target run: rustup target add ${{ matrix.target }} @@ -79,7 +79,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 override: true - name: cargo build uses: actions-rs/cargo@v1 @@ -124,7 +124,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 override: true - name: cargo fetch uses: actions-rs/cargo@v1 @@ -147,7 +147,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 diff --git a/.github/workflows/lints-stable.yml b/.github/workflows/lints-stable.yml index b12d3c0de8..8f2000a64e 100644 --- a/.github/workflows/lints-stable.yml +++ b/.github/workflows/lints-stable.yml @@ -5,7 +5,7 @@ on: pull_request jobs: clippy: - name: Clippy (1.56.1) + name: Clippy (1.60.0) timeout-minutes: 30 runs-on: ubuntu-latest @@ -13,12 +13,12 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.56.1 + toolchain: 1.60.0 components: clippy override: true - name: Run clippy uses: actions-rs/clippy-check@v1 with: - name: Clippy (1.56.1) + name: Clippy (1.60.0) token: ${{ secrets.GITHUB_TOKEN }} args: --all-features --all-targets -- -D warnings diff --git a/README.md b/README.md index 69167e0716..1f0c4e41f1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Minimum Supported Rust Version -Requires Rust **1.56.1** or higher. +Requires Rust **1.60** 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 7a6bbaa94f..ffe105cf21 100644 --- a/halo2/Cargo.toml +++ b/halo2/Cargo.toml @@ -5,7 +5,7 @@ authors = [ "Jack Grigg ", ] edition = "2021" -rust-version = "1.56.1" +rust-version = "1.59" 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 c21cf0f38b..ed2bdcfc1b 100644 --- a/halo2_gadgets/Cargo.toml +++ b/halo2_gadgets/Cargo.toml @@ -9,7 +9,7 @@ authors = [ "Kris Nuttycombe ", ] edition = "2021" -rust-version = "1.56.1" +rust-version = "1.59" 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 4ed744f81f..90a803c093 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.56.1+. +Requires Rust 1.60+. ## Documentation diff --git a/halo2_proofs/Cargo.toml b/halo2_proofs/Cargo.toml index 4319eb7558..4a6d1ac53f 100644 --- a/halo2_proofs/Cargo.toml +++ b/halo2_proofs/Cargo.toml @@ -8,7 +8,7 @@ authors = [ "Jack Grigg ", ] edition = "2021" -rust-version = "1.56.1" +rust-version = "1.59" description = """ Fast PLONK-based zero-knowledge proving system with no trusted setup """ diff --git a/halo2_proofs/README.md b/halo2_proofs/README.md index 7c226ff24c..26597d5abc 100644 --- a/halo2_proofs/README.md +++ b/halo2_proofs/README.md @@ -4,7 +4,7 @@ ## Minimum Supported Rust Version -Requires Rust **1.56.1** or higher. +Requires Rust **1.60** 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/rust-toolchain b/rust-toolchain deleted file mode 100644 index 43c989b553..0000000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -1.56.1 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000000..948d27daa4 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.60.0" From 55abb2464a1994a20c193d8ca03f78e3e8248f58 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 10 Feb 2023 17:58:24 +0000 Subject: [PATCH 2/3] CI: Use an internal composite action to reduce MSRV definitions --- .github/actions/prepare/action.yml | 14 ++++++++++++++ .github/workflows/bench.yml | 5 +---- .github/workflows/ci.yml | 31 +++++++----------------------- .github/workflows/lints-stable.yml | 11 ++++------- 4 files changed, 26 insertions(+), 35 deletions(-) create mode 100644 .github/actions/prepare/action.yml diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml new file mode 100644 index 0000000000..96c19021f6 --- /dev/null +++ b/.github/actions/prepare/action.yml @@ -0,0 +1,14 @@ +name: 'Prepare Halo 2' +description: 'Sets up the Rust toolchain' +inputs: + toolchain: + description: 'Rust toolchain to use (defaults to MSRV)' + required: false + default: 1.60.0 +runs: + using: 'composite' + steps: + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ inputs.toolchain }} + override: true diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index eee9f16aca..ef3bb203ad 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -14,10 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - override: true + - uses: ./.github/actions/prepare - name: Run benchmark run: cargo bench -- --output-format bencher | tee output.txt - name: Store benchmark result diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a9274d89a..559dab7925 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - override: true + - uses: ./.github/actions/prepare - name: Run tests uses: actions-rs/cargo@v1 with: @@ -41,10 +38,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - override: true + - uses: ./.github/actions/prepare - name: Add target run: rustup target add ${{ matrix.target }} - name: cargo build @@ -61,10 +55,9 @@ jobs: - uses: actions/checkout@v3 # Check bitrot with stable (as we don't need benchmarks or the test-dev-graph # feature flag to work with MSRV). - - uses: actions-rs/toolchain@v1 + - uses: ./.github/actions/prepare with: toolchain: stable - override: true # Build benchmarks and all-features to prevent bitrot - name: Build benchmarks uses: actions-rs/cargo@v1 @@ -77,10 +70,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - override: true + - uses: ./.github/actions/prepare - name: cargo build uses: actions-rs/cargo@v1 with: @@ -99,10 +89,9 @@ jobs: steps: - uses: actions/checkout@v3 # Use stable for this to ensure that cargo-tarpaulin can be built. - - uses: actions-rs/toolchain@v1 + - uses: ./.github/actions/prepare with: toolchain: stable - override: true - name: Install cargo-tarpaulin uses: actions-rs/cargo@v1 with: @@ -122,10 +111,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - override: true + - uses: ./.github/actions/prepare - name: cargo fetch uses: actions-rs/cargo@v1 with: @@ -145,10 +131,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - override: true + - uses: ./.github/actions/prepare - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/lints-stable.yml b/.github/workflows/lints-stable.yml index 8f2000a64e..cb3e1fba13 100644 --- a/.github/workflows/lints-stable.yml +++ b/.github/workflows/lints-stable.yml @@ -5,20 +5,17 @@ on: pull_request jobs: clippy: - name: Clippy (1.60.0) + name: Clippy (MSRV) timeout-minutes: 30 runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.60.0 - components: clippy - override: true + - uses: ./.github/actions/prepare + - run: rustup component add clippy - name: Run clippy uses: actions-rs/clippy-check@v1 with: - name: Clippy (1.60.0) + name: Clippy (MSRV) token: ${{ secrets.GITHUB_TOKEN }} args: --all-features --all-targets -- -D warnings From 8dbc554f6c23718131e865f05635a64f11c43530 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 10 Feb 2023 18:50:12 +0000 Subject: [PATCH 3/3] CI: Prepare feature flags in the internal composite action This ensures that we only run CI on crate-external feature flags that we intend to be covered by our MSRV. --- .github/actions/prepare/action.yml | 41 +++++++++++++++++++++++++++++- .github/workflows/ci.yml | 29 ++++++++++++++++----- .github/workflows/lints-beta.yml | 12 ++++++--- .github/workflows/lints-stable.yml | 10 ++++++-- 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml index 96c19021f6..ceb275485f 100644 --- a/.github/actions/prepare/action.yml +++ b/.github/actions/prepare/action.yml @@ -1,10 +1,26 @@ name: 'Prepare Halo 2' -description: 'Sets up the Rust toolchain' +description: 'Sets up the Rust toolchain and prepares feature flags' inputs: toolchain: description: 'Rust toolchain to use (defaults to MSRV)' required: false default: 1.60.0 + beta-features: + description: 'Include beta features' + required: false + default: false + nightly-features: + description: 'Include nightly features' + required: false + default: false + test-dependencies: + description: 'Include test dependencies' + required: false + default: true +outputs: + feature-flags: + description: 'Feature flags' + value: ${{ steps.prepare-flags.outputs.flags }} runs: using: 'composite' steps: @@ -12,3 +28,26 @@ runs: with: toolchain: ${{ inputs.toolchain }} override: true + - id: beta + shell: bash + run: echo "feature=beta" >> $GITHUB_OUTPUT + if: inputs.beta-features == 'true' + - id: nightly + shell: bash + run: echo "feature=nightly" >> $GITHUB_OUTPUT + if: inputs.nightly-features == 'true' + - id: test + shell: bash + run: echo "feature=test-dependencies" >> $GITHUB_OUTPUT + if: inputs.test-dependencies == 'true' + - id: prepare-flags + shell: bash + run: > + echo "flags=--no-default-features --features ' + batch + dev-graph + gadget-traces + ${{ steps.beta.outputs.feature }} + ${{ steps.nightly.outputs.feature }} + ${{ steps.test.outputs.feature }} + '" >> $GITHUB_OUTPUT diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 559dab7925..e74dab31d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,12 +20,18 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare + - id: prepare + uses: ./.github/actions/prepare - name: Run tests uses: actions-rs/cargo@v1 with: command: test - args: --verbose --release --workspace --features batch,dev-graph,gadget-traces,test-dependencies ${{ matrix.extra_flags }} + args: > + --verbose + --release + --workspace + ${{ steps.prepare.outputs.feature-flags }} + ${{ matrix.extra_flags }} build: name: Build target ${{ matrix.target }} @@ -38,14 +44,20 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare + - id: prepare + uses: ./.github/actions/prepare + with: + nightly-features: true + test-dependencies: false - name: Add target run: rustup target add ${{ matrix.target }} - name: cargo build uses: actions-rs/cargo@v1 with: command: build - args: --features batch,dev-graph,gadget-traces,nightly --target ${{ matrix.target }} + args: > + ${{ steps.prepare.outputs.feature-flags }} + --target ${{ matrix.target }} bitrot: name: Bitrot check @@ -89,9 +101,11 @@ jobs: steps: - uses: actions/checkout@v3 # Use stable for this to ensure that cargo-tarpaulin can be built. - - uses: ./.github/actions/prepare + - id: prepare + uses: ./.github/actions/prepare with: toolchain: stable + nightly-features: true - name: Install cargo-tarpaulin uses: actions-rs/cargo@v1 with: @@ -101,7 +115,10 @@ jobs: uses: actions-rs/cargo@v1 with: command: tarpaulin - args: --features batch,dev-graph,gadget-traces,test-dependencies,nightly --timeout 600 --out Xml + args: > + ${{ steps.prepare.outputs.feature-flags }} + --timeout 600 + --out Xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.1 diff --git a/.github/workflows/lints-beta.yml b/.github/workflows/lints-beta.yml index 71d183e370..dd3181e7fe 100644 --- a/.github/workflows/lints-beta.yml +++ b/.github/workflows/lints-beta.yml @@ -13,15 +13,19 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - id: prepare + uses: ./.github/actions/prepare with: toolchain: beta - components: clippy - override: true + nightly-features: true + - run: rustup component add clippy - name: Run Clippy (beta) uses: actions-rs/clippy-check@v1 continue-on-error: true with: name: Clippy (beta) token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features --all-targets -- -W clippy::all + args: > + ${{ steps.prepare.outputs.feature-flags }} + --all-targets + -- -W clippy::all diff --git a/.github/workflows/lints-stable.yml b/.github/workflows/lints-stable.yml index cb3e1fba13..a0effc7ba2 100644 --- a/.github/workflows/lints-stable.yml +++ b/.github/workflows/lints-stable.yml @@ -11,11 +11,17 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/prepare + - id: prepare + uses: ./.github/actions/prepare + with: + nightly-features: true - run: rustup component add clippy - name: Run clippy uses: actions-rs/clippy-check@v1 with: name: Clippy (MSRV) token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features --all-targets -- -D warnings + args: > + ${{ steps.prepare.outputs.feature-flags }} + --all-targets + -- -D warnings