mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-09 21:58:06 -05:00
# Bring Back WebAssembly Support for ZeroKit - Update minor versions of all dependencies. - Update documentation to reflect these changes. - ~~Vendor `wasmer` v4.4.0 in [my git repository](https://github.com/vinhtc27/wasmer) for `ark-circom` v0.5.0.~~ - Resolve `wasm-pack` build failures (`os error 2`) caused by a Node.js version mismatch. - Restore the previous CI pipeline for the `rln-wasm` feature and update to the stable toolchain. - ~~Use `ark-circom` with the `wasm` feature for WebAssembly compatibility and the `rln.wasm` file for witness calculation.~~ - ~~Fix dependency issues related to `ark-circom` v0.5.0, which currently uses `wasmer` v4.4.0 and is affected by this [issue](https://github.com/rust-lang/rust/issues/91632#issuecomment-1477914703).~~ - Install WABT with `brew` and `apt-get` instead of cloning to fix `wasm-strip not found` issue in the CI workflow. - Install `wasm-pack` with `curl` instead of using `wasm-pack-action` to fix parse exception error in the CI workflow. - Use the `.wasm` file with JS bindings for witness calculation, which is generated from [`iden3/circom`](https://github.com/iden3/circom) during circuit compilation. This allows witness computation outside RLN instance. - Refactor the `rln` module by moving circuit-related files to the `src/circuit` folder for better organization. - Remove `ark-circom` and `wasmer` by cloning the [CircomReduction](3c95ed98e2/src/circom/qap.rs (L12)) struct and the [read_zkey](3c95ed98e2/src/zkey.rs (L53)) function into the `rln` module, which reduces the repository's build size and speeds up compilation time and the CI workflow duration. - These change also address [#282](https://github.com/vacp2p/zerokit/issues/282) by removing `wasmer` and `wasmer-wasix`, which lack x32 system support. - Benchmark `rln-wasm` with `wasm_bindgen_test`, covering RLN instance creation, key generation, witness calculation, proving, and verification. Also, add them to `v0.6.1` in [benchmark-v0.6.1](https://github.com/vacp2p/zerokit/tree/benchmark-v0.6.1) for comparison. - Add `arkzkey` feature for rln-wasm, including tests, benchmarks, CI workflow updates, and related documentation. - Benchmark rln-wasm in the browser using HTML, covering initialization, RLN instance creation, proving, and verification; fork to the `benchmark-v0.7.0` branch for later use [here](https://github.com/vacp2p/zerokit/tree/benchmark-v0.7.0). - Fix clippy error: "this `repeat().take()` can be written more concisely" on CI workflow for `utils` module. ([error](https://github.com/vacp2p/zerokit/actions/runs/14258579070/job/39965568013)) - Update Makefile.toml to be able to run `make build`, `make test`, and `make bench` from root and inside each modules.
193 lines
5.3 KiB
YAML
193 lines
5.3 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "!.github/workflows/*.yml"
|
|
- "!rln-wasm/**"
|
|
- "!rln/src/**"
|
|
- "!rln/resources/**"
|
|
- "!utils/src/**"
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "!.github/workflows/*.yml"
|
|
- "!rln-wasm/**"
|
|
- "!rln/src/**"
|
|
- "!rln/resources/**"
|
|
- "!utils/src/**"
|
|
|
|
name: Tests
|
|
|
|
jobs:
|
|
utils-test:
|
|
strategy:
|
|
matrix:
|
|
platform: [ ubuntu-latest, macos-latest ]
|
|
crate: [ utils ]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: test - ${{ matrix.crate }} - ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: cargo-make test
|
|
run: |
|
|
cargo make test --release
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
rln-test:
|
|
strategy:
|
|
matrix:
|
|
platform: [ ubuntu-latest, macos-latest ]
|
|
crate: [ rln ]
|
|
feature: [ "default", "arkzkey", "stateless" ]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: test - ${{ matrix.crate }} - ${{ matrix.platform }} - ${{ matrix.feature }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: cargo-make test
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make test --release
|
|
else
|
|
cargo make test_${{ matrix.feature }} --release
|
|
fi
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
rln-wasm:
|
|
strategy:
|
|
matrix:
|
|
platform: [ ubuntu-latest, macos-latest ]
|
|
feature: [ "default", "arkzkey" ]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: test - rln-wasm - ${{ matrix.platform }} - ${{ matrix.feature }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install Dependencies
|
|
run: make installdeps
|
|
- name: cargo-make build
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make build
|
|
else
|
|
cargo make build_${{ matrix.feature }}
|
|
fi
|
|
working-directory: rln-wasm
|
|
- name: cargo-make test
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make test --release
|
|
else
|
|
cargo make test_${{ matrix.feature }} --release
|
|
fi
|
|
working-directory: rln-wasm
|
|
|
|
lint:
|
|
strategy:
|
|
matrix:
|
|
# we run lint tests only on ubuntu
|
|
platform: [ ubuntu-latest ]
|
|
crate: [ rln, rln-wasm, utils ]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: lint - ${{ matrix.crate }} - ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install Dependencies
|
|
run: make installdeps
|
|
- name: cargo fmt
|
|
if: success() || failure()
|
|
run: cargo fmt -- --check
|
|
working-directory: ${{ matrix.crate }}
|
|
- name: cargo clippy
|
|
if: success() || failure()
|
|
run: |
|
|
cargo clippy --release
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
benchmark-utils:
|
|
# run only in pull requests
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
matrix:
|
|
# we run benchmark tests only on ubuntu
|
|
platform: [ ubuntu-latest ]
|
|
crate: [ utils ]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: benchmark - ${{ matrix.platform }} - ${{ matrix.crate }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: boa-dev/criterion-compare-action@v3
|
|
with:
|
|
branchName: ${{ github.base_ref }}
|
|
cwd: ${{ matrix.crate }}
|
|
|
|
benchmark-rln:
|
|
# run only in pull requests
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
matrix:
|
|
# we run benchmark tests only on ubuntu
|
|
platform: [ ubuntu-latest ]
|
|
crate: [ rln ]
|
|
feature: [ "default", "arkzkey" ]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: benchmark - ${{ matrix.platform }} - ${{ matrix.crate }} - ${{ matrix.feature }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: boa-dev/criterion-compare-action@v3
|
|
with:
|
|
branchName: ${{ github.base_ref }}
|
|
cwd: ${{ matrix.crate }}
|
|
features: ${{ matrix.feature }} |