Skip to content

feat: Add primitive guest libraries #1642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
76126fe
Move guest libraries to openvm
Avaneesh-axiom May 6, 2025
b21f7b2
Remove blanket Field impl that clashes with guest libs
Avaneesh-axiom May 6, 2025
fb40a6d
Fix ruint bug
Avaneesh-axiom May 7, 2025
f8b0606
Fix lint in pairing library
Avaneesh-axiom May 7, 2025
2ae0939
Fix lint in guest-libs test programs
Avaneesh-axiom May 8, 2025
1776a08
restore ecdsa tests now that guest-libs is in openvm repo
Avaneesh-axiom May 9, 2025
3ac6b54
Remove redundant MIT licences (use the one at repo root)
Avaneesh-axiom May 9, 2025
c50d910
Fix dep in ff_derive tests
Avaneesh-axiom May 9, 2025
1fccaa5
Update kitchen sink benchmark to use guest-libs
Avaneesh-axiom May 9, 2025
88c66c7
Update regex benchmark to use guest-libs
Avaneesh-axiom May 9, 2025
abe7b88
Update pairing benchmark to use guest-libs
Avaneesh-axiom May 9, 2025
6cfddc2
Update ecrecover benchmark to use guest-libs
Avaneesh-axiom May 9, 2025
27fd404
Update benchmarks to use init build script
Avaneesh-axiom May 9, 2025
94a6729
Update rand dep for ff_derive tests
Avaneesh-axiom May 12, 2025
44ec8a5
Remove impl_field argument from guest-libs
Avaneesh-axiom May 12, 2025
3e92415
Fix lint
Avaneesh-axiom May 9, 2025
7e41530
Remove Cargo.lock
Avaneesh-axiom May 15, 2025
4d66c80
Fix lint
Avaneesh-axiom May 16, 2025
be726c4
Fix cargo shear
Avaneesh-axiom May 16, 2025
3020527
Update dep (cargo audit reports a vulnerability)
Avaneesh-axiom May 16, 2025
13fecc2
Update ecrecover benchmark to use RustCrypto's ecdsa traits
Avaneesh-axiom May 16, 2025
6a4efe2
Fix bug in ecrecover (our k256 was not being used)
Avaneesh-axiom May 17, 2025
a550714
Restore correct Reduce implementation
Avaneesh-axiom May 17, 2025
f99b6f4
Add ecdsa module to openvm_k256
Avaneesh-axiom May 19, 2025
2e13a05
Add ecdsa module to openvm_p256
Avaneesh-axiom May 19, 2025
3fd0a29
Remove guest directory from guest libraries
Avaneesh-axiom May 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/guest-lib-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Guest Library Tests

on:
push:
branches: ["main"]
pull_request:
branches: ["**"]
paths:
- "guest-libs/**"
- "Cargo.toml"
- ".github/workflows/guest-lib-tests.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
OPENVM_FAST_TEST: "1"

jobs:
integration-tests:
strategy:
matrix:
crate:
- { name: "sha2", path: "sha2" }
- { name: "keccak256", path: "keccak256" }
- { name: "ff_derive", path: "ff_derive" }
- { name: "k256", path: "k256" }
- { name: "p256", path: "p256" }
- { name: "ruint", path: "ruint" }
- { name: "pairing", path: "pairing" }
# Ensure tests run in parallel even if one fails
fail-fast: false

runs-on:
- runs-on=${{ github.run_id }}
- runner=64cpu-linux-arm64
- tag=crate-${{ matrix.crate.name }}
- extras=s3-cache

steps:
- uses: runs-on/action@v1
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
- "guest-libs/${{ matrix.crate.path }}/**"
- ".github/workflows/guest-lib-tests.yml"
- name: Skip if no changes
if: steps.filter.outputs.matched == 'false'
run: |
echo "No relevant changes, skipping tests."
exit 0

- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: taiki-e/install-action@nextest

- name: Run ${{ matrix.crate.name }} guest library tests
if: hashFiles(format('guest-libs/{0}/', matrix.crate.path)) != ''
working-directory: guest-libs/${{ matrix.crate.path }}
run: |
rustup component add rust-src --toolchain nightly-2025-02-14
FEATURE_ARGS=""
if [[ "${{ matrix.crate.name }}" == "pairing" ]]; then
FEATURE_ARGS="--features=bn254,bls12_381"
fi
cargo nextest run --cargo-profile=fast $FEATURE_ARGS --no-tests=pass
8 changes: 4 additions & 4 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- uses: codespell-project/actions-codespell@v2
with:
skip: Cargo.lock,./book/pnpm-lock.yaml,*.txt,./crates/toolchain/openvm/src/memcpy.s,./crates/toolchain/openvm/src/memset.s,./audits/*.pdf,
skip: Cargo.lock,./book/pnpm-lock.yaml,*.txt,./crates/toolchain/openvm/src/memcpy.s,./crates/toolchain/openvm/src/memset.s,./audits/*.pdf,./guest-libs/ruint/*
ignore_words_file: .codespellignore

- uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -60,13 +60,13 @@ jobs:
if [[ "$crate_path" == *"extensions/ecc/tests/programs"* ]]; then
echo "Running cargo clippy with k256 and p256 features for $crate_path"
cargo clippy --manifest-path "$crate_path/Cargo.toml" --all-targets --features "std k256 p256" -- -D warnings
elif [[ "$crate_path" == *"extensions/pairing/tests/programs"* ]]; then
elif [[ "$crate_path" == *"guest-libs/pairing/tests/programs"* ]]; then
echo "Running cargo clippy with openvm_pairing_guest::bn254 feature for $crate_path"
cargo clippy --manifest-path "$crate_path/Cargo.toml" --all-targets --features "std bn254" -- -D warnings
echo "Running cargo clippy with openvm_pairing_guest::bls12_381 feature for $crate_path"
cargo clippy --manifest-path "$crate_path/Cargo.toml" --all-targets --features "std bls12_381" -- -D warnings
elif [[ "$crate_path" == *"extensions/"* ]]; then
echo "Running cargo clippy for $crate_path"
elif [[ "$crate_path" == *"extensions/"* || "$crate_path" == *"guest-libs/"* ]]; then
echo "Running cargo clippy with std feature for $crate_path"
cargo clippy --manifest-path "$crate_path/Cargo.toml" --all-targets --features "std" -- -D warnings
else
echo "Running cargo clippy for $crate_path"
Expand Down
Loading
Loading