zkBob / libzkbob-rs

Apache License 2.0
1 stars 3 forks source link

Fix timeout error during state sync on some Android/Windows devices #70

Closed AllFi closed 10 months ago

AllFi commented 1 year ago

We recently started encountering errors while syncing users on certain devices. This error sometimes leads to an inability to initialize zk the account and therefore to use our application.

After some local debugging I realized that the main issue is TimeoutError in IndexedDB. image

I am not entirely sure but I think what happens in our case is something like this:

  1. It should be noted that the current implementation of IndexedDB wrapper doesn't wait for transaction to commit, so it just creates some pending txs that eventually should be automatically committed
  2. So, if we have pending database transactions and start parsing zeropool transactions, the Web Worker thread remains constantly busy, and as a result, the autocommit fails to complete within 60 seconds.
  3. Finally, we have some timeout error that leads to panic in wasm and aborting state sync

Refs:

PR: https://github.com/zkBob/libzkbob-rs/pull/69