You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SwiftExampleApp: Load Identity on a wallet-held identity rebuilds its key rows without signing metadata #6074
Found while reviewing #6054. Pre-existing; #6054 does not change LoadIdentityView.
Problem: in SwiftExampleApp, Identities → Load Identity accepts the id of an identity a wallet already holds. LoadIdentityView.loadIdentity() keeps the existing PersistentIdentity (and its wallet), unlinks its key rows with publicKeys.removeAll() without deleting them, and attaches new rows built from the fetched JSON. The new rows:
carry no walletId or identityDerivationPath, so a mnemonic-only signer can no longer sign with those keys;
carry no contract bounds;
are tagged with the hex identity id, while the wallet's persister tags rows with Base58;
leave the old rows in the store, unlinked.
Since #6054 the wallet's persister finds a key row through its parent identity first, so later wallet upserts reach the attached row. But the metadata the rebuild dropped is not restored until a wallet upsert carries it, and the orphans stay.
Fix: for an identity a wallet holds, Load Identity should refuse, or route through the wallet's proved refresh (ManagedPlatformWallet.refreshIdentity), as IdentityKeyRefresher does since #6054. Rows for identities no wallet holds can keep the current rebuild.
Same hazard in a second caller: the no-wallet branch of IdentityKeyRefresher.refreshBalanceAndKeys (SwiftExampleApp) rebuilds key rows on the main-actor context. Wallet discovery can claim the identity and commit its rows from the persister's background context, off the main actor, between that refresh's fetch and its save. #6054 re-checks identity.wallet after the fetch, which narrows the window but does not close it.
Fix for both callers: run the plain rebuild through the persistence handler's serial queue, with the wallet-ownership check and the row replacement in one onQueue block. Test: a claim committed between fetch and write leaves the wallet's rows, and their walletId and identityDerivationPath, intact.
Activity
QuantumExplorer commentedon Nov 22, 2026
Same hazard in a second caller: the no-wallet branch of
IdentityKeyRefresher.refreshBalanceAndKeys(SwiftExampleApp) rebuilds key rows on the main-actor context. Wallet discovery can claim the identity and commit its rows from the persister's background context, off the main actor, between that refresh's fetch and its save. #6054 re-checksidentity.walletafter the fetch, which narrows the window but does not close it.Fix for both callers: run the plain rebuild through the persistence handler's serial queue, with the wallet-ownership check and the row replacement in one
onQueueblock. Test: a claim committed between fetch and write leaves the wallet's rows, and theirwalletIdandidentityDerivationPath, intact.