feat: add WebGPU+WASM backend - #1789
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1bea45a. Configure here.
| func (r *Runtime[PK, VK, Proof]) ensurePrepared(handle string, pk pkEntry[PK], ccs *ccsEntry) error { | ||
| if pk.prepared { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
Prepared flag ignores constraint system
Medium Severity
The wasm runtime marks a proving key as prepared after the first successful PrepareWithCS and then skips all later preparation for that key handle. PLONK quotient setup and WebGPU preloads are tied to a specific constraint system, but the flag is not associated with which CCS handle was used. Reusing the same proving-key handle with a different constraint-system handle can skip required setup while still proving, yielding incorrect proofs or subtle verification failures.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1bea45a. Configure here.


Description
Still WIP. Adds dedicated shaders+backend which allows to use WebGPU acceleration for proof generation for PLONK/Groth16 over BN254/BLS12-377/BLS12-381.
Still incoming
Type of change
How has this been tested?
Dedicated pages for running in browser
How has this been benchmarked?
Checklist:
golangci-lintdoes not output errors locallyNote
High Risk
New unaudited cryptographic proving path with GPU/WASM bridging; correctness bugs could yield invalid proofs, and BLS G2 coverage is known incomplete.
Overview
Adds an experimental
backend/accelerated/webgpustack for in-browser Groth16 (and PLONK per layout/README) on BN254, BLS12-377, and BLS12-381.A Go coordinator built for
js/wasmkeeps compilation, witness solving, and final proof assembly in Go, but offloads quotient-H, batched G1/G2 MSMs, and BSB22 commitment/PoK MSMs to a TypeScript WebGPU runtime viasyscall/js(gnarkGroth16WebGPUand shared bridge helpers). Proving keys are uploaded once (Prepare/prepareKey) with scratch buffers and quotient-domain prewarm.Also includes WGSL shaders,
web/npm build (build:all, shader bundle generation), wasm entrypoints (native vs WebGPU runtimes), and testdata generators/fixtures for GPU kernel and prover regression..gitignorenow excludes WebGPU web build outputs.Marked WIP / not audited; README notes G2 API test failures on BLS12-377/381 while Groth16/PLONK prover tests pass.
Reviewed by Cursor Bugbot for commit 1bea45a. Bugbot is set up for automated code reviews on this repo. Configure here.