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.
references #230. CI is currently failing because it depends on function definitions in penumbra-zone/web#1975. cc @vacekj
In #165, we bundled the mainnet genesis state with other extension assets. This PR handles syncing the bundled genesis block more manageably with a chunking approach, which also improves extension popup loading times during onboarding for existing wallets. Longer-term, the optimal solution is to migrate syncing out of the service worker and into a dedicated worker thread, freeing up the service worker.
Currently, the service worker initializes the wallet services and invokes the block processor interface to sync the genesis block. Until now, lower-powered devices and slower internet connections struggled to handle this heavy processing task, which presented some undesirable side-effects:
1. Blocking onboarding: extension's connection popup delays from appearing promptly after onboarding, approximately 30s+ on public wifi on my machine. The delay occurs because genesis sync requires crossing the wasm-boundary and performing heavy cryptographic operations on ~32K state payloads in the compact block. Consequently, the block processor couldn’t yield to the event loop to finish setting up the listeners responsible for initializing the content scripts while performing this operation, leaving the service worker continuously busy with genesis block sync.
2. Failed connection requests: a long-running genesis sync fails to acquire a connection handle.
before
Untitled.mp4
after
Screen.Recording.2024-12-22.at.9.59.34.PM.mov