penumbra-zone / web

Apache License 2.0
12 stars 15 forks source link

clearing extension cache isn't working properly #1496

Open TalDerei opened 1 month ago

TalDerei commented 1 month ago

refreshing the extension cache on the mainnet displays irregular behaviors, possibly leading to unpredictable cache states and causing synchronization issues. Refreshing the cache should immediately start resyncing rather than throwing an error and navigating back to the onboarding page.

cc @turbocrime

https://github.com/user-attachments/assets/26fb65c0-a35f-4451-bd34-597241aee151

turbocrime commented 1 month ago

this is mostly due to the way prax runs services, and this should probably be filed as a series of prax issues.

currently, there prax implements no good way to ensure that the block processor and wallet services are killed and cleaned up properly, so to achieve this prax just restarts its background worker. this is very effective but ungraceful.

restarting the background worker breaks all the content scripts. then, the immediate next thing that happens is the background worker begins genesis sync again, which due to single-threadedness blocks the listeners that would normally init the new content scripts, and the rpc services that would serve requests.

a few things need to happen to make this nicer

  1. abort controllers for all wallet services
  2. content scripts that handle loss of context
  3. better abort signalling for content scripts https://github.com/penumbra-zone/web/pull/1517

and ideally,

  1. independent worker for rpc services
  2. independent worker for block processor