Skip to content

fix(storage): use unique local provider identities - #83

Merged
sirdeggen merged 1 commit into
masterfrom
codex/local-storage-sync-state
Sep 24, 2026
Merged

sirdeggen merged 1 commit into
masterfrom
codex/local-storage-sync-state

Conversation

@BraydenLangley

Copy link
Copy Markdown
Collaborator

Summary

  • give every local SQLite wallet database a durable, unique storage-provider identity instead of reusing the wallet owner's identity key
  • migrate legacy local databases atomically without moving or rewriting wallet records
  • deduplicate concurrent Electron storage initialization so migrations and provider setup run once per wallet
  • update to the current published @bsv/sdk 2.4.1 and wallet-toolbox/client 2.10.2 APIs

Root cause

BSV Desktop used the wallet identity as the local storage provider identity. Remote storage keys sync checkpoints by provider identity, so another app or database using that same wallet identity could create multiple sync-state rows for one provider key. A later processSyncChunk lookup then failed with Result must exist and be unique.

The migration replaces only the local database's provider identity and any local active-storage pointer that still references the legacy value. The remote provider remains primary for remote-first wallets.

The complementary server/protocol hardening is in bsv-blockchain/ts-stack#486.

Compatibility

  • already-unique local provider identities remain unchanged
  • existing wallet data stays in the same database
  • generated identities use a valid compressed secp256k1 public-key encoding
  • imports were updated to the public wallet-toolbox-client package surface required by 2.10.2

Validation

  • npm test: 15 passed
  • focused storage-identity tests: 3 passed
  • npm run build: passed
  • npm run build:electron: passed
  • live remote-to-local registration reached repeated processSyncChunk calls without reproducing the ambiguous-result error or HTTP 413
  • a local profile durably received 692 transactions and 1,899 outputs during the live audit

This remains a draft pending review and completion of broader large-wallet UX/performance validation.

@sirdeggen
sirdeggen merged commit eac8491 into master Sep 24, 2026
5 checks passed
sirdeggen added a commit that referenced this pull request Sep 24, 2026
#83 (codex/local-storage-sync-state), brought up
to date with master: the PR's older dependency pins and lockfile were
dropped in favour of master's, and end-to-end tests were added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants