Repository navigation
Description
Expected Behavior
A Platform query called from app UI (document search, DPNS availability, contest vote state) does
its network round trip off the main thread, so a slow evonode never freezes the interface.
Current Behavior
The query helpers are declared in @MainActor extension SDK blocks and call synchronous FFI entry
points that block on the network inside Rust (runtime.block_on):
documentList(…)→dash_sdk_data_contract_fetch+dash_sdk_document_search, and
dpnsCheckAvailability(name:), in
platform/packages/swift-sdk/Sources/SwiftDashSDK/FFI/PlatformQueryExtensions.swift
Lines 129 to 130 in 67340ad
@MainActor extension SDK {
(documentListat L557,dpnsCheckAvailabilityat L1108)dpnsContestVoteState(…)→dash_sdk_contested_resource_get_vote_state, and
dpnsContestIsOpen(normalizedLabel:), in
platform/packages/swift-sdk/Sources/SwiftDashSDK/Voting/SDK+DPNSContests.swift
Lines 60 to 61 in 67340ad
@MainActor extension SDK {
Because the methods are main-actor isolated, a caller cannot move the work off the main thread:
Task.detached { try await sdk.documentList(…) } still hops back to the main actor for the call
(@unchecked Sendable on SDK lets the reference cross, but does not change the method's
isolation). The whole network round trip then runs on the main thread.
Possible Solution
Give these queries a non-main-actor boundary inside the SDK: nonisolated async methods that run
the FFI call on a dedicated executor / background queue, keeping the handle and argument lifetimes
valid for the call and copying and freeing the results there, then return plain Swift values. The
existing main-actor methods can forward to them for source compatibility.
Steps to Reproduce (for bugs)
- From a SwiftUI screen, call
documentList(ordpnsContestVoteState) against a slow or
unreachable evonode. - The UI stops responding until the call returns or times out.
Context
Seen in Dash Wallet iOS (dashpay/dashwallet-ios#1141): proof-link lookups in contender details, DPNS
availability checks while typing a username, and contest-state reads. The app cannot fix this on its
side; an app-level detach does not help. Raised by the automated review there.
Your Environment
- Version used:
v4.3-dev@67340ad824 - Environment name and version: SwiftDashSDK (swift-sdk package)
- Operating System and version: iOS / macOS, any
Activity
fix(swift-sdk): run blocking Platform queries off the caller's actor