Skip to content

Re-enable disabled wallets whose party matches a signing provider again - #2338

Open
ayushsingh82 wants to merge 1 commit into
canton-network:mainfrom
ayushsingh82:ayush/resync-disabled-wallets-2206
Open

Re-enable disabled wallets whose party matches a signing provider again#2338
ayushsingh82 wants to merge 1 commit into
canton-network:mainfrom
ayushsingh82:ayush/resync-disabled-wallets-2206

Conversation

@ayushsingh82

Copy link
Copy Markdown
Contributor

Summary

  • syncWallets() (wallet-gateway/remote/src/ledger/wallet-sync-service.ts) treated a disabled wallet as still "existing" when computing which parties on the ledger are new. A party whose wallet got disabled (e.g. no signing provider matched at the time) was therefore never re-checked on later syncs and stayed disabled forever, even once its signing provider became resolvable.
  • Excluding disabled wallets from that check isn't enough by itself: store.addWallet() throws on a duplicate (partyId, networkId). handlePartiesWithoutWallet() now looks up whether a wallet row already exists for the party and calls updateWallet() to re-enable it in place instead of addWallet().
  • Extended UpdateWallet (core/wallet-store, core/wallet-store-sql) with signingProviderId/publicKey so the freshly re-resolved signing provider can actually be persisted when a wallet is re-enabled (previously updateWallet only supported disabled/reason/rights/etc.).
  • Also excluded disabled wallets from the separate rights-update pass (handleRightsUpdates), since handlePartiesWithoutWallet already sets fresh rights as part of re-enabling them — otherwise the same wallet could get reported in both the updated and disabled buckets of the sync result.

Fixes #2206

Test plan

  • Added a regression test: a disabled wallet whose party regains a matching signing provider gets re-enabled via updateWallet (not a duplicate addWallet throw), and shows up in result.updated.
  • npx vitest run --project node src/ledger/wallet-sync-service.test.ts — 22/22 passing (one pre-existing, unrelated SQLite-migration failure in a different describe block was confirmed present on main too, before this change).
  • npx vitest run on core/wallet-store-inmemory — 21/21 passing.
  • eslint and prettier --check clean on all 4 changed files.
  • tsc --noEmit clean on wallet-gateway/remote, core/wallet-store, and core/wallet-store-sql.

syncWallets() treated a disabled wallet as still "existing" when
computing which parties are new, so a party whose wallet got disabled
(e.g. no signing provider matched at the time) was never re-checked
on subsequent syncs and stayed disabled forever, even after its
signing provider became resolvable.

Excluding disabled wallets from that check isn't enough on its own:
store.addWallet() throws on a duplicate (partyId, networkId), so
handlePartiesWithoutWallet() now looks up whether a wallet row already
exists and calls updateWallet() to re-enable it instead of addWallet().
Extended UpdateWallet (core-wallet-store, core-wallet-store-sql) with
signingProviderId/publicKey so the re-resolved signing provider can
actually be persisted on re-enable.

Also excluded disabled wallets from the separate rights-update pass,
since handlePartiesWithoutWallet already sets fresh rights as part of
re-enabling them -- otherwise the same wallet could get reported in
both the "updated" and "disabled" result buckets.

Fixes canton-network#2206

Signed-off-by: ayushsingh82 <ayushsinghmi711@gmail.com>
@ayushsingh82

Copy link
Copy Markdown
Contributor Author

@alexmatson-da whenever you have a chance, would appreciate a look at this one.

@mjuchli-da

Copy link
Copy Markdown
Contributor

@pawelstepien-da to review

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.

Refresh parties doesn’t refresh the disabled=1 entries

3 participants