Skip to content

Keep the Full Resync form usable during background syncs - #8

Open
sqhell wants to merge 2 commits into
red-dev-inc:mainfrom
sqhell:fix/resync-dialog
Open

sqhell wants to merge 2 commits into
red-dev-inc:mainfrom
sqhell:fix/resync-dialog

Conversation

@sqhell

@sqhell sqhell commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Syncs are serialised on the JS side instead of refused: a module-level scheduler owns syncInProgress, periodic rescans skip their turn while a sync runs, and a full resync waits behind an in-flight rescan and can be cancelled while it waits.
  • The resync form stays mounted during background syncs; Confirm and Cancel are disabled once the resync starts; the birthday is validated inline against the chain height.
  • A custom birthday is written to the snap only once the resync succeeds, before the fresh wallet is swapped into state.

Why

The form was only rendered while no sync was running, and fullResync refused with "Sync already in progress" if a periodic rescan happened to be in flight. With a 35 s rescan interval the dialog vanished mid-typing and rejected Confirm at random. Writing the birthday before the resync succeeded also left a birthday the old wallet never used after a failure, which broke auto-recovery with "block is not in the main chain" when the value was above the tip.

Stack

Position 4 of 15 in the WebZjs release order, to be merged in this order into main. Independent of the feature PRs but rebased on #20 (chore/rust-checks) so its checks are green; the commits of this PR alone are here: sqhell/WebZjs@chore/rust-checks...fix/resync-dialog

  1. Make rustfmt and clippy pass on main #20 chore/rust-checks
  2. Reuse one web worker for every sync instead of spawning per call #6 fix/reuse-sync-worker
  3. Accept Trailers-Only gRPC responses from lightwalletd #7 fix/grpc-web-trailers-only
  4. Keep the Full Resync form usable during background syncs #8 fix/resync-dialog (this PR)
  5. Send again from the transaction history, with a caution for new recipients #9 feat/send-again
  6. Surface PCZT parse and signer errors instead of trapping; readable transfer errors #10 fix/pczt-parse-error
  7. Sign the change-paired Orchard spends NU6.3 bundles require #11 fix/sign-change-paired-spends
  8. Stop a full resync from an old birthday exhausting the wasm heap #12 fix/historic-sync-oom
  9. Point to Full Resync from the end of the transaction history #13 feat/history-resync-hint
  10. Make wallet persistence refuse stale and silent overwrites #14 fix/wallet-store-epochs
  11. Spend and count the Ironwood (NU6.3) pool #15 feat/ironwood-pool
  12. Classify history by what the wallet spent, not only by what it received #16 fix/history-from-spends
  13. Wallet stats card on the account summary #17 feat/wallet-stats
  14. Bounded sync steps, instance ids, close and worker poisoning #18 feat/resumable-sync
  15. Resumable, checkpointed full resync driven by sync steps #19 feat/resync-resume

Rust pins reference sqhell/zcash_client_memory and sqhell/librustzcash by revision so CI builds exactly what was tested; once the zcash_client_memory stack (red-dev-inc/zcash_client_memory #16 to #21) merges, the memory pin goes back to red-dev-inc/zcash_client_memory feat/snap-nu63. The integration branch test/all-fixes on the fork merges all fourteen and is the build that was tested end to end.

Tests

cd packages/web-wallet && yarn test

Rust-Checks has failed on main since the NU6.3 toolchain bump: rustfmt
differs in nine files, and clippy on nightly-2025-06-15 rejects ten
uninlined format arguments in webzjs-keys and one map iteration in
webzjs-requests under -D warnings. Apply rustfmt and clippy's own
suggestions; no behaviour changes.
…yncs

The resync form was rendered only while no sync was running, and fullResync
refused with "Sync already in progress" if a periodic rescan happened to be in
flight. With a 35 s rescan interval that made the dialog vanish mid-typing and
reject Confirm at random.

Syncs are now serialised on the JS side instead of refused: a small
module-level scheduler owns `syncInProgress`, periodic rescans skip their turn
while a sync runs, and a full resync waits behind an in-flight rescan. This
also closes the race where a rescan that had passed its guard could clear
`syncInProgress` while a full resync was still running. (The wasm wallet runs
syncs on one serial worker in a separate change; this one stands alone.)

The form stays mounted during background syncs. While the resync waits for a
running sync it can still be cancelled, which drops it from the queue; once it
starts, Confirm and Cancel are disabled until it settles, and a card mounted
while a resync is in flight shows that instead of offering another. The
birthday is validated against the chain height inline instead of an alert.

A custom birthday is written to the snap only once the resync succeeds, and
before the fresh wallet is swapped into state, so a failed resync never leaves
a birthday the old wallet never used (a birthday above the tip previously broke
auto-recovery with "block is not in the main chain"), and a failed snap write
leaves state, the snap and IndexedDB describing the same wallet.

This branch has not been deployed

No deployments
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