Skip to content

Florian/wasm napi - #2893

Draft
Trivo25 wants to merge 14 commits into
florian/mesa-final-rcfrom
florian/wasm-napi
Draft

Florian/wasm napi#2893
Trivo25 wants to merge 14 commits into
florian/mesa-final-rcfrom
florian/wasm-napi

Conversation

@Trivo25

@Trivo25 Trivo25 commented Jul 2, 2026

Copy link
Copy Markdown
Member

No description provided.

Trivo25 and others added 14 commits July 2, 2026 05:50
The 'wasm' backend is now the wasm32-wasip1-threads build of the same
kimchi-napi crate that powers the native backend, loaded via generated
@napi-rs/wasm-runtime loaders. Native and wasm share one TS conversion
layer and one JSOO FFI handoff (globalThis.__o1js_kimchi_ffi).

Removed: worker-spec.js pointer marshalling, worker-helpers.js,
fix-wasm-bindings-node.js, the WebAssembly.Memory Proxy hack, the
wbg_rayon worker bootstrapping, and the wasm-bindgen conversion layer
(conversion-{core,proof,oracles,verifier-index}.ts, srs.ts).

- node-backend.js: thin loader for kimchi_napi.wasi.cjs; sets
  RAYON_NUM_THREADS before instantiation; noop thread pool
- web-backend.js: Option A — napi-wasm browser loader on the main
  thread (single-threaded rayon until worker-hosted Option B lands,
  see PLAN.md/STATE.md)
- crypto/bindings.ts: single napi conversion bundle, cached per module
- types now sourced from the generated kimchi_napi.wasi.d.cts
- build:wasm:* scripts rebuilt around napi build; JSOO postprocessing
  no longer rewrites requires
- @napi-rs/wasm-runtime added as a runtime dependency
- deleted bindings.unit-test.ts (its Rust reference fns were
  wasm-bindgen-only exports); gate-vector-napi.unit-test now also runs
  against the wasm build

Validated: wasm+native builds from one crate produce byte-identical
circuit digests, poseidon output and SRS points; rayon threading works
under Node; tsc clean. Requires a JSOO artifact rebuild in CI —
previously compiled artifacts reference the removed kimchi_wasm.cjs.

See PLAN.md (design + implementation report), STATE.md (current
status + web options), AGENT_LOG.md (migration gotchas).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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