From 0ca70eb4b5f42d735db2a61b8197b4fda9d28347 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 07:57:18 +0000 Subject: [PATCH] =?UTF-8?q?host:=20doc=20=E2=80=94=20wasm=20kernel=20boot?= =?UTF-8?q?=20crash=20fixed=20(crypto),=20boost=20still=20blocked=20on=20w?= =?UTF-8?q?eb-stack=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- plans/host-spa.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plans/host-spa.md b/plans/host-spa.md index 67d19698..aea518e1 100644 --- a/plans/host-spa.md +++ b/plans/host-spa.md @@ -43,7 +43,29 @@ graceful degradation to plain server-rendered pages with no JS. WASM kernel (sx.rose-ash.com avoids this because its Docker image ships a consistent bundle and it navigates via client-router page-routes, not boost). -## Rebuild attempt (2026-06-28) — FAILED, reverted +## UPDATE 2026-06-29 — kernel BOOT crash fixed (crypto WASM-safe) + +The boot crash was NOT the build pipeline — it was the kernel's crypto stack +assuming 63-bit native int. On the web targets (js_of_ocaml 32-bit, wasm_of_ocaml +31-bit) sha2/cbor/cid/ed25519 truncated, and ed25519 precomputes `sqrtm1` + +`base_point` AT MODULE INIT via a base-2^26 bignum whose 52-bit products overflow +→ `Char.chr(-4)` crash on load. Fixed in `fce9e0c6` (sx_sha2 Int32 rounds + +Int64 length, sx_cbor Int64 width-select, sx_cid bounded base32, sx_ed25519 Int64 +bignum mul/div_small). Verified: NIST/CID vectors match native↔js↔wasm; native +conformance 271/271; **the freshly-built browser kernel now BOOTS** (SxKernel +live, data-sx-ready=true, crypto-sha256 correct on js + wasm). + +REMAINING for boost (separate layer — web-stack loading, NOT crypto): +- `.sxbc` still fail `VM: unknown opcode 0` against the SX-level `vm.sx` + interpreter, even freshly recompiled — a bytecode-format mismatch (likely the + sx-vm-extensions merge changed sx_vm.ml's opcodes but the served `vm.sx` wasn't + regenerated). So the web stack falls back to `.sx` source. +- `boot.sx` SOURCE then fails `Expected list, got string` (fails on the old + main-worktree kernel too), so `process-boosted` never runs → boost 0/N. + Next: either regenerate `vm.sx` to match the compiler so `.sxbc` load, or fix + the `boot.sx` source-eval failure so source fallback completes. + +## Rebuild attempt (2026-06-28) — FAILED, reverted (superseded by the fix above) Tried it: `dune build browser/sx_browser.bc.wasm.js` succeeded (with many `integer-overflow` warnings — "generated code might be incorrect"), and