@provablehq/wasm 0.12.1 → 0.14.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,6 +41,65 @@ yarn build
41
41
 
42
42
  This will produce `.js` and `.wasm` files inside of the `dist` folder.
43
43
 
44
+ ### wasm64 build
45
+
46
+ The separate wasm64 build compiles the same Rust sources and snarkVM version as
47
+ wasm32 for `wasm64-unknown-unknown`, with an 8 GiB maximum, shared memory, atomics
48
+ and the existing Rayon pool. The caller still selects the thread count through
49
+ `initThreadPool(threads)`. Its bindings are published as
50
+ [`@provablehq/wasm64`](../wasm64/README.md), versioned in lockstep
51
+ with `@provablehq/wasm`.
52
+
53
+ From the repository root:
54
+
55
+ ```bash
56
+ yarn install --immutable
57
+ yarn build:wasm
58
+ yarn build:wasm64
59
+ yarn build:sdk
60
+ ```
61
+
62
+ Both builds use the toolchain in `rust-toolchain.toml`; the wasm64 build also
63
+ needs its `rust-src` component for `-Zbuild-std`. `yarn build:all` includes both
64
+ WASM variants and the SDK. The wasm64 artifacts are written to
65
+ `wasm64/dist/{testnet,mainnet}/` and `sdk/dist/wasm64/{testnet,mainnet}/`.
66
+ Development builds can set `BUILD_DEBUG=1` for the wasm64 build.
67
+
68
+ The wasm64 build uses Binaryen 125 instead of the wasm32 Binaryen 120, and a
69
+ wasm-bindgen CLI built from source with the same toolchain. It explicitly enables
70
+ the multivalue binding ABI, including for stripped release modules. Set
71
+ `WASM_OPT_BIN` to use a native Binaryen 125 `wasm-opt` executable instead of the
72
+ pinned npm tool.
73
+ Until upstream dependencies support threaded wasm64, the build applies the
74
+ compatibility patches in `build/wasm64/patches/` to checksum-verified crate
75
+ archives under `target/`. These patches implement 64-bit thread/TLS/stack
76
+ addresses and select browser backends in the dependencies. They contain no
77
+ proving diagnostics or changes to proof algorithms. Cargo's shared registry
78
+ sources are never modified. The first build needs network access; subsequent
79
+ builds reuse the prepared dependencies and compiled tools.
80
+
81
+ `build/wasm64/dependencies.js` generates `wasm64/Cargo.toml` from the current
82
+ SDK manifest, pointing at the same library and license-check sources. The
83
+ separate, tracked `wasm64/Cargo.lock` matches `Cargo.lock` except for the
84
+ patched crates, which resolve to the build-local copies. When updating SDK
85
+ dependencies, prepare the manifest with `node wasm/build/wasm64.js --prepare-only`
86
+ from the repository root, update that lockfile intentionally, and test both
87
+ variants. The snarkVM patches are pinned to the snarkVM release in `Cargo.toml`
88
+ and must be regenerated when it changes. The build itself always uses `--locked`;
89
+ it does not resolve or upgrade dependencies during compilation.
90
+
91
+ Run `yarn test:sdk:wasm64` on Node.js 24 after building. It runs the SDK test
92
+ suite against the wasm64 build instead of wasm32. Run
93
+ `yarn workspace @provablehq/sdk test:cjs:pack:wasm64` to pack and install the
94
+ three packages into a clean fixture, then test ESM, CommonJS, wasm64 shared
95
+ memory and Rayon workers on both networks. The local execution check downloads
96
+ public SRS parameters if they are not cached. On a Node.js line without wasm64
97
+ shared memory (before 24), add `--expect-unsupported` to assert instead that the
98
+ wasm64 entry points throw the documented error while the wasm32 entry still
99
+ works. The `runtime compat` jobs in `.github/workflows/sdk.yml` run both forms
100
+ on Node.js 20, 22, 24 and 26 for every pull request. The wasm64 GitHub Actions
101
+ workflow also checks the packages' export maps.
102
+
44
103
  ## Testing
45
104
 
46
105
  Run tests in Node.js