feat: WASM build target + single-threaded prover#79
Merged
Conversation
Enable Zolt to compile for wasm32-freestanding, the foundation for client-side proving in browsers and on phones. Key changes: - ThreadPool: conditional type — native work-stealing pool vs WASM sequential stub with identical API surface - MSM: gate bare std.Thread spawns, fall back to sequential Pippenger - Dory SRS: gate filesystem caching, add loadFromBytes for WASM, setupCached falls back to in-memory generation on WASM - Prover pipeline: platform-gated Timer/getenv/debug.print wrappers in debug.zig, used across all spartan stages and jolt_prover - Build system: gate executables/tests/benchmarks/Metal behind !is_wasm - C API: add zolt_load_elf_bytes (byte-slice ELF loading), zolt_proof_result_ptr, WASM allocator, optional thread pool - Fix u64→usize truncations across 15+ files for 32-bit wasm32 - Fix u6→Log2Int(usize) shift amounts for 32-bit shift registers Verified: zig build -Dtarget=wasm32-freestanding -Doptimize=ReleaseFast produces libzolt_capi.a with zero errors. Native build and tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
wasm32-freestandingcompilation support, enabling Zolt to run in browsers and on phones for client-side provingThreadPooltype: native work-stealing pool vs WASM sequential stub with identical APIstd.time,std.posix.getenv,std.Thread,std.fs,std.debug.print) across the entire prover pipelinezolt_load_elf_bytes(byte-slice ELF loading),zolt_proof_result_ptr, optional thread poolloadFromBytesfor passing pre-serialized SRS from JS host memoryu64→usizetruncations andu6→Log2Int(usize)shift amounts across 15+ files for 32-bit wasm32Test plan
zig build -Dtarget=wasm32-freestanding -Doptimize=ReleaseFastcompiles with zero errorszig build(native) compiles with zero errorszig build test(native) passes all testszig build fmtpasses🤖 Generated with Claude Code