From 8f8348a8de8f0a2a324d94ceaa2dcac8ad8d72cc Mon Sep 17 00:00:00 2001 From: Giacomo Pasini Date: Thu, 5 Sep 2024 13:50:23 +0200 Subject: [PATCH] separate integrations tests --- .github/workflows/build-test.yml | 75 +++++++++++++++------ .github/workflows/nightly.yml | 74 -------------------- cl/cl/src/nullifier.rs | 17 +++++ proof_of_leadership/risc0/prover/src/lib.rs | 1 - 4 files changed, 72 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index d39966c7f..61c0a2577 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -29,8 +29,11 @@ jobs: profile: minimal toolchain: stable override: true + - uses: cargo-bins/cargo-binstall@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install risc0 - run: cargo install cargo-risczero && cargo risczero install + run: cargo binstall cargo-risczero && cargo risczero install env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions-rs/cargo@v1 @@ -74,28 +77,22 @@ jobs: - name: Setup build environment (Windows) if: matrix.os == 'windows-latest' uses: ./.github/actions/mingw-env - - name: Install risc0 - run: cargo install cargo-risczero && cargo risczero install + - uses: cargo-bins/cargo-binstall@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Cargo build (Other OSes) - if: matrix.os != 'macos-latest-xlarge' + - name: Install risc0 + run: cargo binstall -y cargo-risczero && cargo risczero install + - name: Cargo build uses: actions-rs/cargo@v1 with: command: build args: --all --no-default-features --features ${{ matrix.feature }} - - name: Cargo build (MacOS) - if: matrix.os == 'macos-latest-xlarge' - uses: actions-rs/cargo@v1 - with: - command: build - args: --all --no-default-features --features ${{ matrix.feature }},metal - - name: Cargo test (Ubuntu) - if: matrix.os == 'ubuntu-latest' + - name: Cargo test (Other OSes) + if: matrix.os != 'windows-latest' uses: actions-rs/cargo@v1 with: command: test - args: --all --no-default-features --features ${{ matrix.feature }} + args: --all --no-default-features --features ${{ matrix.feature }} --exclude tests - name: Cargo test (Windows) if: matrix.os == 'windows-latest' uses: actions-rs/cargo@v1 @@ -104,15 +101,51 @@ jobs: SLOW_TEST_ENV: true with: command: test + args: --workspace --no-default-features --features ${{ matrix.feature }} --exclude tests + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: integration-test-artifacts + path: tests/.tmp* + + integration: + name: Integration tests + strategy: + fail-fast: false # all OSes should be tested even if one fails (default: true) + matrix: + feature: [ libp2p, "libp2p,mixnet" ] + os: [ ubuntu-latest, macos-latest ] # drop windows for now as risc0 does not support it + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: arduino/setup-protoc@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Setup Rust toolchain (Other OSes) + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: cargo-bins/cargo-binstall@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install risc0 + run: cargo binstall -y cargo-risczero && cargo risczero install + - name: Cargo build + uses: actions-rs/cargo@v1 + with: + command: build args: --all --no-default-features --features ${{ matrix.feature }} - - name: Cargo Test (MacOs) - if: matrix.os == 'macos-latest-xlarge' # need metal acceleration + - name: Cargo test uses: actions-rs/cargo@v1 env: - CONSENSUS_SLOT_TIME: 15 + CONSENSUS_SLOT_TIME: 270 with: command: test - args: --all --no-default-features --features ${{ matrix.feature }},prove,metal -- --include-ignored + args: --manifest-path tests/Cargo.toml --features ${{ matrix.feature }},prove - uses: actions/upload-artifact@v3 if: failure() with: @@ -138,9 +171,11 @@ jobs: toolchain: stable override: true components: rustfmt, clippy - + - uses: cargo-bins/cargo-binstall@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install risc0 - run: cargo install cargo-risczero && cargo risczero install + run: cargo binstall cargo-risczero && cargo risczero install env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run cargo fmt diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 63362aca1..000000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,74 +0,0 @@ -on: - schedule: - - cron: '0 0 * * *' - - -name: Nightly consensus tests - -jobs: - test: - name: Test Suite - strategy: - fail-fast: false # all OSes should be tested even if one fails (default: true) - matrix: - feature: [ libp2p, "libp2p,mixnet" ] - os: [ ubuntu-latest, macos-latest ] # drop windows for now as risc0 does not support it - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: arduino/setup-protoc@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Setup Rust toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Cargo build - uses: actions-rs/cargo@v1 - with: - command: build - args: --all --no-default-features --features ${{ matrix.feature }} - - name: Integration tests - uses: actions-rs/cargo@v1 - env: - CONSENSUS_SLOT_TIME: 260 # cpu only proving on ci machines is quite slow - with: - command: test - args: --manifest-path tests/Cargo.toml --no-default-features --features ${{ matrix.feature }},prove - - name: Ignored tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --all --ignored - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: integration-test-artifacts - path: tests/.tmp* - - risc0: - name: Risc0 tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Install risc0 - run: cargo install cargo-risczero && cargo risczero install - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: --manifest-path proof_of_leadership/risc0/prover/Cargo.toml - diff --git a/cl/cl/src/nullifier.rs b/cl/cl/src/nullifier.rs index 870e1a485..ab39f8ff9 100644 --- a/cl/cl/src/nullifier.rs +++ b/cl/cl/src/nullifier.rs @@ -88,6 +88,23 @@ mod test { use super::*; + #[ignore = "nullifier test vectors not stable yet"] + #[test] + fn test_nullifier_commitment_vectors() { + assert_eq!( + NullifierSecret([0u8; 16]).commit().hex(), + "384318f9864fe57647bac344e2afdc500a672dedb29d2dc63b004e940e4b382a" + ); + assert_eq!( + NullifierSecret([1u8; 16]).commit().hex(), + "0fd667e6bb39fbdc35d6265726154b839638ea90bcf4e736953ccf27ca5f870b" + ); + assert_eq!( + NullifierSecret([u8::MAX; 16]).commit().hex(), + "1cb78e487eb0b3116389311fdde84cd3f619a4d7f487b29bf5a002eed3784d75" + ); + } + #[test] fn test_nullifier_same_sk_different_nonce() { let mut rng = rand::thread_rng(); diff --git a/proof_of_leadership/risc0/prover/src/lib.rs b/proof_of_leadership/risc0/prover/src/lib.rs index c373ea60a..9f7b2b823 100644 --- a/proof_of_leadership/risc0/prover/src/lib.rs +++ b/proof_of_leadership/risc0/prover/src/lib.rs @@ -61,7 +61,6 @@ mod test { } #[test] - #[ignore] fn test_leader_prover() { let mut rng = thread_rng();