Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: chunk genesis sync #257

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: chunk genesis sync #257

wants to merge 3 commits into from

Conversation

TalDerei
Copy link
Contributor

@TalDerei TalDerei commented Dec 23, 2024

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

Screenshot 2024-12-22 at 5 29 09 PM
Untitled.mp4

after

Screen.Recording.2024-12-22.at.9.59.34.PM.mov

@TalDerei TalDerei self-assigned this Dec 23, 2024
@TalDerei TalDerei marked this pull request as draft December 23, 2024 06:51
@TalDerei TalDerei changed the title genesis sync: chunking feat: chunk genesis sync Jan 7, 2025
@TalDerei TalDerei marked this pull request as ready for review January 7, 2025 06:54
@TalDerei TalDerei requested a review from a team January 7, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant