Florian/wasm napi - #2893
Draft
Trivo25 wants to merge 14 commits into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.