Skip to content

feat: add WASM support for browser-based proof generation#246

Open
Bisht13 wants to merge 10 commits intomainfrom
px/wasm
Open

feat: add WASM support for browser-based proof generation#246
Bisht13 wants to merge 10 commits intomainfrom
px/wasm

Conversation

@Bisht13
Copy link
Collaborator

@Bisht13 Bisht13 commented Dec 19, 2025

Summary

  • Add wasm32 architecture support to Skyscraper field arithmetic
  • Add WASM bindings for Prover and Verifier (provekit-wasm)
  • Add Node.js and browser demo with noir_js integration

Changes

  • skyscraper: wasm32 block multiplier, fp-rounding stubs, SIMD codegen
  • provekit-wasm: Prover and Verifier classes with proveBytes() API
  • playground/wasm-node-demo: Setup scripts, browser UI, Node.js CLI demo

Usage

cd playground/wasm-node-demo
pnpm install
pnpm run setup -- path/to/noir-circuit
pnpm run demo # Node.js
pnpm run demo:web # Browser (localhost:8080)

Blocked on #198

@Bisht13 Bisht13 force-pushed the px/wasm branch 2 times, most recently from f2837b7 to 7a6d54e Compare December 19, 2025 19:20
@xrvdg xrvdg mentioned this pull request Dec 25, 2025
Bisht13 added 2 commits March 6, 2026 17:11
Add provekit-wasm crate with wasm-bindgen bindings for browser-based
proof generation. Gate mavros/witness-generation deps behind
cfg(not(wasm32)). Fix binary parser HEADER_SIZE off-by-one (20→21).
Enable shared memory via linker flags for wasm-bindgen-rayon threading.

Includes wasm-demo playground with noir_js witness generation,
multi-threaded proof computation, and platform-adaptive fallbacks
for iOS/Android/desktop.

complete_age_check (712k constraints): ~7s with 14 threads vs ~32s
single-threaded (4.5x speedup).
… auto-loading WASM

- Add WasmProver (.wpkp) and WasmVerifier (.wpkv) lightweight artifact formats
- Add convert-wasm CLI command and --wasm flag on prepare
- Enable in-browser proof verification via dedicated Verify Proof button
- Auto-load WASM on page open, load .wpkp/.wpkv in parallel
- WASM crate now accepts only .wpkp for proving and .wpkv for verifying
Bisht13 added 8 commits March 6, 2026 20:14
Rewrite setup.mjs to build WASM+CLI once and prepare both SHA256 and
Poseidon circuits automatically (no arguments needed). Wire circuit
selector in index.html to switch between circuits, sync
window.activeCircuit for demo-web.mjs, and fix DOM cleanup bug that
destroyed hidden proof elements on re-run.
…flow, and dashboard polish

- Embed circuit artifact in .wpkp so browser needs only 3 files (prover.wpkp, verifier.wpkv, inputs.json)
- Add getCircuit(), getNumConstraints(), getNumWitnesses() WASM bindings
- Wire constraints and witnesses counts to dashboard metric cards
- Add circuit descriptions that update per selected circuit
- Unify custom upload steps to match standard 5-step pipeline
- Fix icon observer for Loading/Verifying/Ready states
- Fix serve.mjs directory import resolution for wasm-bindgen-rayon workers
- Update CLI convert-wasm to accept circuit path for embedding
Eliminate the separate .wpkp/.wpkv WASM artifact formats. The WASM
prover now deserializes the full Prover struct from .pkp (XZ) and
Verifier from .pkv (Zstd) directly, reconstructing the circuit JSON
for noir_js from the embedded program and ABI fields.

- Rewrite WASM lib.rs to use ProverCore/VerifierCore with auto-detect
  XZ vs Zstd decompression (ruzstd StreamingDecoder)
- Remove WasmNoirProver, WasmProver, WasmVerifier structs and all
  their Prove/Verify impls from common, prover, verifier crates
- Delete convert-wasm CLI command and --wasm flag from prepare
- Update demo to fetch .pkp/.pkv, accept .pkp/.pkv uploads
- provekit-wasm: extract prove_inner to deduplicate prove_bytes/prove_js,
  add version validation, shared header parser, proper error formatting,
  add getrandom03 dep and dependency comments
- provekit-prover: deduplicate prove/prove_with_witness (507→374 lines),
  replace all panics/unwraps with Result propagation, prove_mavros takes
  [Vec<FieldElement>; 3] instead of Phase1Result
- provekit-common: remove WASM dead-code stubs, cfg-gate mod json,
  add doc comment on NoirProver field duplication rationale
- skyscraper/core: re-export compress_many to eliminate duplicated cfg
  blocks in pow.rs
- skyscraper/hla: delete dead rust_simd_codegen.rs (428 lines, never
  declared in lib.rs)
- skyscraper/bn254-multiplier: add inline(never) justification comment
- wasm-demo JS: remove dead code, debug logs, redundant comments,
  extract shared artifact loading (587→455 lines)
- Revert accidental verifier-server whitespace change
- Remove /wasm-node-demo/ from .gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant