mirror of
https://github.com/zkonduit/ezkl.git
synced 2026-01-08 22:08:07 -05:00
427 lines
15 KiB
YAML
427 lines
15 KiB
YAML
name: Rust
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths-ignore:
|
|
- "README.md"
|
|
- "cla.md"
|
|
pull_request:
|
|
branches: ["main"]
|
|
paths-ignore:
|
|
- "README.md"
|
|
- "cla.md"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- name: Build
|
|
run: cargo build --verbose
|
|
|
|
build-wasm:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: mwilliamson/setup-wasmtime-action@v2
|
|
with:
|
|
wasmtime-version: "3.0.1"
|
|
- name: Install wasm32-wasi
|
|
run: rustup target add wasm32-wasi
|
|
- name: Build wasm
|
|
run: cargo build --release --bin ezkl --target=wasm32-wasi
|
|
- name: Run help
|
|
run: wasmtime run './target/wasm32-wasi/release/ezkl.wasm' -- --help
|
|
|
|
docs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- name: Docs
|
|
run: cargo doc --verbose
|
|
|
|
library-tests:
|
|
runs-on: ubuntu-latest-32-cores
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Doc tests
|
|
# nextest doesn't support --doc tests
|
|
run: cargo test --doc --verbose
|
|
- name: Library tests
|
|
run: cargo nextest run --lib --verbose -- --include-ignored
|
|
|
|
wasm32-tests:
|
|
runs-on: ubuntu-latest
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: jetli/wasm-pack-action@v0.4.0
|
|
- uses: mwilliamson/setup-wasmtime-action@v2
|
|
with:
|
|
wasmtime-version: "3.0.1"
|
|
- uses: browser-actions/setup-chrome@v1
|
|
- uses: nanasess/setup-chromedriver@v2
|
|
- name: Install wasm32-unknown-unknown
|
|
run: rustup target add wasm32-unknown-unknown
|
|
- name: Install wasm runner
|
|
run: cargo install wasm-server-runner
|
|
- name: Add rust-src
|
|
run: rustup component add rust-src --toolchain nightly-2023-06-27-x86_64-unknown-linux-gnu
|
|
- name: Run wasm verifier tests
|
|
run: wasm-pack test --chrome --headless -- -Z build-std="panic_abort,std"
|
|
|
|
render-circuit:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: mwilliamson/setup-wasmtime-action@v2
|
|
with:
|
|
wasmtime-version: "3.0.1"
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Circuit Render
|
|
run: cargo nextest run --release --features render --verbose tests::render_circuit_
|
|
|
|
tutorial:
|
|
runs-on: ubuntu-latest
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Circuit Render
|
|
run: cargo nextest run --release --verbose tests::tutorial_
|
|
|
|
mock-proving-tests:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Mock proving tests (public outputs)
|
|
run: cargo nextest run --release --verbose tests::mock_public_outputs_ --test-threads 32
|
|
- name: Mock proving tests (public outputs + batch size == 10)
|
|
run: cargo nextest run --release --verbose tests::mock_large_batch_public_outputs_ --test-threads 32
|
|
- name: Mock proving tests (public inputs)
|
|
run: cargo nextest run --release --verbose tests::mock_public_inputs_ --test-threads 32
|
|
- name: Mock proving tests (public params)
|
|
run: cargo nextest run --release --verbose tests::mock_public_params_ --test-threads 32
|
|
- name: Mock proving tests (hashed inputs)
|
|
run: cargo nextest run --release --verbose tests::mock_hashed_input_::t --test-threads 32
|
|
- name: Mock proving tests (hashed outputs)
|
|
run: cargo nextest run --release --verbose tests::mock_hashed_output_::t --test-threads 32
|
|
- name: Mock proving tests (encrypted inputs)
|
|
run: cargo nextest run --release --verbose tests::mock_encrypted_input_::t --test-threads 32
|
|
- name: Mock proving tests (encrypted params)
|
|
run: cargo nextest run --release --verbose tests::mock_encrypted_params_::t --test-threads 32
|
|
- name: Mock proving tests (encrypted outputs)
|
|
run: cargo nextest run --release --verbose tests::mock_encrypted_output_::t --test-threads 32
|
|
- name: Mock proving tests (encrypted inputs + params)
|
|
run: cargo nextest run --release --verbose tests::mock_encrypted_input_params_::t --test-threads 32
|
|
- name: Mock proving tests (encrypted inputs + params + outputs)
|
|
run: cargo nextest run --release --verbose tests::mock_encrypted_all_::t --test-threads 32
|
|
- name: Mock proving tests (encrypted inputs + hashed params)
|
|
run: cargo nextest run --release --verbose tests::mock_encrypted_input_hashed_params_::t --test-threads 32
|
|
|
|
mock-proving-tests-wasi:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: mwilliamson/setup-wasmtime-action@v2
|
|
with:
|
|
wasmtime-version: "3.0.1"
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Install wasm32-wasi
|
|
run: rustup target add wasm32-wasi
|
|
- name: Mock proving tests (WASI) (public outputs)
|
|
run: cargo nextest run --release --verbose tests_wasi::mock_public_outputs_ --test-threads 32
|
|
- name: Mock proving tests (WASI) (public inputs)
|
|
run: cargo nextest run --release --verbose tests_wasi::mock_public_inputs_ --test-threads 32
|
|
- name: Mock proving tests (WASI) (public params)
|
|
run: cargo nextest run --release --verbose tests_wasi::mock_public_params_ --test-threads 32
|
|
|
|
prove-and-verify-evm-tests:
|
|
runs-on: ubuntu-latest-16-cores
|
|
needs:
|
|
[
|
|
build,
|
|
build-wasm,
|
|
library-tests,
|
|
mock-proving-tests,
|
|
mock-proving-tests-wasi,
|
|
python-tests,
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Install solc
|
|
run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
|
- name: Install Anvil
|
|
run: cargo install --git https://github.com/foundry-rs/foundry --profile local --locked foundry-cli anvil
|
|
- name: KZG prove and verify tests (EVM)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_prove_and_verify --test-threads 1
|
|
- name: KZG prove and verify tests (EVM + hashed inputs)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_hashed_input_prove_and_verify --test-threads 1
|
|
- name: KZG prove and verify tests (EVM + hashed params)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_hashed_params_prove_and_verify --test-threads 1
|
|
- name: KZG prove and verify tests (EVM + hashed outputs)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_hashed_output_prove_and_verify --test-threads 1
|
|
- name: KZG prove and verify tests (EVM + on chain inputs)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_on_chain_input_prove_and_verify --test-threads 1
|
|
- name: KZG prove and verify tests (EVM + on chain outputs)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_on_chain_output_prove_and_verify --test-threads 1
|
|
- name: KZG prove and verify tests (EVM + on chain inputs & outputs)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_on_chain_input_output_prove_and_verify --test-threads 1
|
|
|
|
prove-and-verify-tests:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs:
|
|
[
|
|
build,
|
|
build-wasm,
|
|
library-tests,
|
|
mock-proving-tests,
|
|
mock-proving-tests-wasi,
|
|
python-tests,
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: KZG prove and verify tests
|
|
run: cargo nextest run --release --verbose tests::kzg_prove_and_verify_::t --test-threads 8
|
|
- name: KZG prove and verify tests (hashed outputs)
|
|
run: cargo nextest run --release --verbose tests::kzg_prove_and_verify_hashed --test-threads 8
|
|
- name: KZG prove and verify tests (encrypted outputs)
|
|
run: cargo nextest run --release --verbose tests::kzg_prove_and_verify_encrypted --test-threads 8
|
|
|
|
fuzz-tests:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs:
|
|
[
|
|
build,
|
|
build-wasm,
|
|
library-tests,
|
|
mock-proving-tests,
|
|
mock-proving-tests-wasi,
|
|
python-tests,
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Install solc
|
|
run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
|
- name: Install Anvil
|
|
run: cargo install --git https://github.com/foundry-rs/foundry --profile local --locked foundry-cli anvil
|
|
- name: fuzz tests (EVM)
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_fuzz_ --test-threads 2
|
|
- name: fuzz tests
|
|
run: cargo nextest run --release --verbose tests::kzg_fuzz_ --test-threads 6
|
|
|
|
prove-and-verify-aggr-tests:
|
|
runs-on: self-hosted
|
|
needs:
|
|
[
|
|
build,
|
|
build-wasm,
|
|
library-tests,
|
|
mock-proving-tests,
|
|
mock-proving-tests-wasi,
|
|
python-tests,
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: KZG prove and verify aggr tests
|
|
run: cargo nextest run --release --verbose tests_aggr::kzg_aggr_prove_and_verify_ --test-threads 8
|
|
|
|
prove-and-verify-aggr-evm-tests:
|
|
runs-on: self-hosted
|
|
needs:
|
|
[
|
|
build,
|
|
build-wasm,
|
|
library-tests,
|
|
mock-proving-tests,
|
|
mock-proving-tests-wasi,
|
|
python-tests,
|
|
]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Install solc
|
|
run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
|
- name: Install Anvil
|
|
run: cargo install --git https://github.com/foundry-rs/foundry --profile local --locked foundry-cli anvil
|
|
- name: KZG prove and verify aggr tests
|
|
run: cargo nextest run --release --verbose tests_evm::kzg_evm_aggr_prove_and_verify_ --test-threads 8 -- --include-ignored
|
|
|
|
examples:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Download MNIST
|
|
run: sh data.sh
|
|
- name: Examples
|
|
run: cargo nextest run --release tests_examples
|
|
|
|
neg-tests:
|
|
runs-on: ubuntu-latest
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-nextest
|
|
locked: true
|
|
- name: Mock proving tests (should fail)
|
|
run: cargo nextest run neg_tests::neg_examples_
|
|
|
|
python-tests:
|
|
runs-on: ubuntu-latest-32-cores
|
|
needs: [build, build-wasm, library-tests, docs]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.7"
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-2023-06-27
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- name: Install solc
|
|
run: (hash svm 2>/dev/null || cargo install svm-rs) && svm install 0.8.20 && solc --version
|
|
- name: Setup Virtual Env and Install python dependencies
|
|
run: python -m venv .env; source .env/bin/activate; pip install -r requirements.txt;
|
|
- name: Install Anvil
|
|
run: cargo install --git https://github.com/foundry-rs/foundry --profile local --locked foundry-cli anvil
|
|
- name: Build python ezkl_lib
|
|
run: source .env/bin/activate; maturin develop --features python-bindings --release
|
|
- name: Run pytest
|
|
run: source .env/bin/activate; pytest
|