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
swift-sdk: Platform query methods run blocking FFI calls on the main actor #5145
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
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 (or dpnsContestVoteState) 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)
Activity
fix(swift-sdk): run blocking Platform queries off the caller's actor