Skip to content

Commit

Permalink
Test wasm32-unknown-unknown target (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
spapinistarkware committed Aug 21, 2024
1 parent e11fc78 commit 47bac77
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 12 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ jobs:
CARGO_TARGET_WASM32_WASI_RUNNER: "wasmtime run --"
RUSTFLAGS: -C target-feature=+simd128

run-wasm32-unknown-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-01-04
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- uses: jetli/[email protected]
with:
version: 'latest'
- run: cd crates/prover && wasm-pack test --node
env:
RUSTFLAGS: -C target-feature=+simd128

run-neon-tests:
runs-on: macos-latest-xlarge
steps:
Expand Down
90 changes: 78 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ serde = { version = "1.0", features = ["derive"] }
aligned = "0.4.2"
test-log = { version = "0.2.15", features = ["trace"] }
tracing-subscriber = "0.3.18"
[target.'cfg(all(target_family = "wasm", not(target_os = "wasi")))'.dev-dependencies]
wasm-bindgen-test = "0.3.43"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.criterion]
features = ["html_reports"]
Expand All @@ -44,6 +46,7 @@ version = "0.5.1"

[lib]
bench = false
crate-type = ["cdylib", "lib"]

[lints.rust]
warnings = "deny"
Expand Down
13 changes: 13 additions & 0 deletions crates/prover/src/examples/poseidon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,19 @@ mod tests {
};
use crate::math::matrix::{RowMajorMatrix, SquareMatrix};

#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
#[wasm_bindgen_test::wasm_bindgen_test]
fn test_poseidon_prove_wasm() {
const LOG_N_INSTANCES: u32 = 10;
let config = PcsConfig {
pow_bits: 10,
fri_config: FriConfig::new(5, 1, 64),
};

// Prove.
prove_poseidon(LOG_N_INSTANCES, config);
}

#[test]
fn test_apply_m4() {
let m4 = RowMajorMatrix::<BaseField, 4>::new(
Expand Down

0 comments on commit 47bac77

Please sign in to comment.