mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-08 21:28:11 -05:00
# Changes - Unified the `RLN` struct and core protocol types across public, FFI, and WASM so everything works consistently. - Fully refactored `protocol.rs` and `public.rs` to clean up the API surface and make the flow easier to work with. - Added (de)serialization for `RLN_Proof` and `RLN_ProofValues`, and matched all C, Nim, WASM, and Node.js examples. - Aligned FFI and WASM behavior, added missing APIs, and standardized how witness are created and passed around. - Reworked the error types, added clearer verification messages, and simplified the overall error structure. - Updated variable names, README, Rust docs, and examples across the repo, updated outdated RLN RFC link. - Refactored `rln-cli` to use the new public API, removed serialize-based cli example, and dropped the `eyre` crate. - Bumped dependencies, fixed CI, fixed `+atomic` flags for latest nightly Rust and added `Clippy.toml` for better fmt. - Added a `prelude.rs` file for easier use, cleaned up public access for types and types import across zerokit modules. - Separated keygen, proof handling, slashing logic, and witness into protocol folder.
178 lines
6.1 KiB
YAML
178 lines
6.1 KiB
YAML
name: Nightly build
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
linux:
|
|
name: Linux build
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
features:
|
|
- ["stateless"]
|
|
- ["stateless", "parallel"]
|
|
- ["pmtree-ft"]
|
|
- ["pmtree-ft", "parallel"]
|
|
- ["fullmerkletree"]
|
|
- ["fullmerkletree", "parallel"]
|
|
- ["optimalmerkletree"]
|
|
- ["optimalmerkletree", "parallel"]
|
|
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
|
|
env:
|
|
FEATURES_CARGO: ${{ join(matrix.features, ',') }}
|
|
FEATURES_TAG: ${{ join(matrix.features, '-') }}
|
|
TARGET: ${{ matrix.target }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- name: Install stable toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: ${{ env.TARGET }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: Cross build
|
|
run: |
|
|
cross build --release --target $TARGET --no-default-features --features "$FEATURES_CARGO" --workspace
|
|
mkdir release
|
|
cp target/$TARGET/release/librln* release/
|
|
tar -czvf $TARGET-$FEATURES_TAG-rln.tar.gz release/
|
|
- name: Upload archive artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.TARGET }}-${{ env.FEATURES_TAG }}-archive
|
|
path: ${{ env.TARGET }}-${{ env.FEATURES_TAG }}-rln.tar.gz
|
|
retention-days: 2
|
|
|
|
macos:
|
|
name: MacOS build
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
features:
|
|
- ["stateless"]
|
|
- ["stateless", "parallel"]
|
|
- ["pmtree-ft"]
|
|
- ["pmtree-ft", "parallel"]
|
|
- ["fullmerkletree"]
|
|
- ["fullmerkletree", "parallel"]
|
|
- ["optimalmerkletree"]
|
|
- ["optimalmerkletree", "parallel"]
|
|
target: [x86_64-apple-darwin, aarch64-apple-darwin]
|
|
env:
|
|
FEATURES_CARGO: ${{ join(matrix.features, ',') }}
|
|
FEATURES_TAG: ${{ join(matrix.features, '-') }}
|
|
TARGET: ${{ matrix.target }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- name: Install stable toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: ${{ env.TARGET }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: Cross build
|
|
run: |
|
|
cross build --release --target $TARGET --no-default-features --features "$FEATURES_CARGO" --workspace
|
|
mkdir release
|
|
cp target/$TARGET/release/librln* release/
|
|
tar -czvf $TARGET-$FEATURES_TAG-rln.tar.gz release/
|
|
- name: Upload archive artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.TARGET }}-${{ env.FEATURES_TAG }}-archive
|
|
path: ${{ env.TARGET }}-${{ env.FEATURES_TAG }}-rln.tar.gz
|
|
retention-days: 2
|
|
|
|
rln-wasm:
|
|
name: Build rln-wasm
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
feature:
|
|
- "default"
|
|
- "parallel"
|
|
- "utils"
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v4
|
|
- name: Install stable toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: wasm32-unknown-unknown
|
|
- name: Install nightly toolchain
|
|
uses: dtolnay/rust-toolchain@nightly
|
|
with:
|
|
components: rust-src
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: Build rln-wasm package
|
|
run: |
|
|
if [[ ${{ matrix.feature }} == *parallel* ]]; then
|
|
env CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--shared-memory -C link-arg=--max-memory=1073741824 -C link-arg=--import-memory -C link-arg=--export=__wasm_init_tls -C link-arg=--export=__tls_size -C link-arg=--export=__tls_align -C link-arg=--export=__tls_base" \
|
|
rustup run nightly wasm-pack build --release --target web --scope waku \
|
|
--features ${{ matrix.feature }} -Z build-std=panic_abort,std
|
|
else
|
|
wasm-pack build --release --target web --scope waku
|
|
fi
|
|
|
|
if [[ ${{ matrix.feature }} == "utils" ]]; then
|
|
sed -i.bak 's/rln-wasm/zerokit-rln-wasm-utils/g' pkg/package.json && rm pkg/package.json.bak
|
|
else
|
|
sed -i.bak 's/rln-wasm/zerokit-rln-wasm/g' pkg/package.json && rm pkg/package.json.bak
|
|
fi
|
|
|
|
mkdir release
|
|
cp -r pkg/* release/
|
|
tar -czvf rln-wasm-${{ matrix.feature }}.tar.gz release/
|
|
working-directory: rln-wasm
|
|
- name: Upload archive artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: rln-wasm-${{ matrix.feature }}-archive
|
|
path: rln-wasm/rln-wasm-${{ matrix.feature }}.tar.gz
|
|
retention-days: 2
|
|
|
|
prepare-prerelease:
|
|
name: Prepare pre-release
|
|
needs: [linux, macos, rln-wasm]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: master
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
- name: Delete tag
|
|
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
|
with:
|
|
delete_release: true
|
|
tag_name: nightly
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Create prerelease
|
|
run: |
|
|
start_tag=$(gh release list -L 2 --exclude-drafts | grep -v nightly | cut -d$'\t' -f3 | sed -n '1p')
|
|
gh release create nightly --prerelease --target master \
|
|
--title 'Nightly build ("master" branch)' \
|
|
--generate-notes \
|
|
--draft=false \
|
|
--notes-start-tag $start_tag \
|
|
*-archive/*.tar.gz \
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Delete artifacts
|
|
uses: geekyeggo/delete-artifact@v5
|
|
with:
|
|
failOnError: false
|
|
name: |
|
|
*-archive
|