feat: rayon parallel wasm - #404
Draft
hitchho wants to merge 5 commits into
Draft
Conversation
Service workers cannot use DOM APIs that webpack's default async chunk loading generates (document.createElement, etc). - Split into browserConfig and workerConfig - Use target: 'webworker' for service-worker and wasm-build-action - Add dependencies to ensure worker builds after browser (clean order) - Update prod and beta configs to handle configuration array
Static WASM imports cause initialization at module load time, which fails in service worker context due to sync WASM instantiation restrictions. - Convert getAddressByIndex/getEphemeralByIndex to dynamic imports - Convert generateSpendKey/getFullViewingKey/getWalletId to dynamic imports - Convert isControlledAddress to dynamic import in validation - Make assertValidActionPlans async to support dynamic imports
- Add wasm-build-parallel.ts worker for rayon-based proving - Initialize parallel WASM with SharedArrayBuffer in worker context - Handle BUILD_PARALLEL message type in offscreen-handler - Load proving keys dynamically based on transaction plan actions
instead of failing with error when user triggers tx while logged out, now automatically opens login popup window. waits for login then continues to tx approval. closes window on success, throws if user closes without logging in.
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.
pr integrates parallel tx building enabling multithreaded proof generation in the extension and go penumbra in web to go nearly as fast as native(ux bottlenecked by blocktimes and current single action per block design). this pr is still draft pending on parallel wasm primitives to be merged in web repo so package.json can target on actual releases. built demo here.
splits webpack into separate
browserConfigandworkerConfigconfigurations. service workers requiretarget: 'webworker'to prevent webpack from generating DOM-based chunk loading code(
document.createElement,document.head.appendChild) which fails in worker contexts.browserConfig- standard browser target for UI entry pointsworkerConfig- WebWorker target for service-worker, wasm-build-action, wasm-build-paralleldependencies: ['browser']to ensure worker builds after browser (prevents CleanPlugin race)changed static WASM imports to dynamic
import()calls in files that run in service worker context. this prevents webpack from bundling WASM modules into the service worker bundle.src/routes/popup/home/index.tsx- Dynamic import forgetAddressByIndexsrc/state/wallets.ts- Dynamic import forgenerateSpendKey,getFullViewingKeysrc/state/tx-validation/assert-valid-plan.ts- Dynamic import forisControlledAddressnew dedicated worker that initializes rayon WASM and builds transactions. the worker is persistent (not terminated after each build) to cache WASM module initialization (~1-2s first load), rayon thread pool and proving keys (~70MB+ loaded from extension storage).
worker listens for multiple messages (no
once: true),offscreen-handler.tsmaintainspersistentWorkerreference and error handling recreates worker on fatal errors.