Skip to content

swift-sdk: shieldedIdentityDebitRecoveryRecords parks a thread with no deadline, and token pool watch/unwatch are not admitted #6177

Backlog

Description

@QuantumExplorer

Carried over from #6060 so that issue can close with the spend wrappers.

1. shieldedIdentityDebitRecoveryRecords waits for the store lock with no deadline

PlatformWalletManager.shieldedIdentityDebitRecoveryRecords(walletId:) (PlatformWalletManagerShieldedRecovery.swift) runs its FFI call from Task.detached. The export's block_on_worker parks that thread while the coordinator waits for the shielded store lock, and a scan holds the write lock across its network batches. Reopening or refreshing a screen that reads the records during a slow scan can stack parked threads. SwiftExampleApp coalesces these reads (#6051), which limits it but does not remove it.

localShieldedBalanceSnapshot already does both halves of the fix: its native lock wait is bounded (100 ms) and it is admitted as a native operation. The recovery read should do the same. The bound belongs in Rust (the coordinator read behind platform_wallet_manager_shielded_identity_debit_recovery_records), not in Swift.

Admitting the read without the bound would be worse than today: shutdown() would then wait for a read parked behind a scan, and deleteWallet would be refused for as long. That is why the spend wrapper change left it alone.

2. shieldedTokenPoolWatch and shieldedTokenPoolUnwatch are not admitted

Both change durable wallet state (the set of token pools a wallet scans) from Task.detached without admitNativeOp / finishNativeOp, so shutdown() does not wait for them and deleteWallet is not refused while one runs. They are not payments, so they were left out of the spend wrapper change. PlatformWalletNativeShieldedSpendCalls and ShieldedSpendAdmissionTests give the pattern and the test harness.

syncShieldedNow and syncShieldedWalletNow are also unadmitted; #6004 owns that decision.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions