Skip to content

swift-sdk: run the remaining blocking query wrappers off the main actor #5867

Open

Description

@romchornyi

Problem

The query wrappers in packages/swift-sdk/Sources/SwiftDashSDK/FFI/PlatformQueryExtensions.swift live in an @MainActor extension of SDK and call synchronous FFI exports that runtime.block_on the network fetch. A caller that awaits one of them from UI code freezes the main thread for the whole round trip, including slow-network timeouts.

#5862 fixed identityGet and dpnsGetUsername. These still have the same shape:

  • identityGetKeys
  • identityGetNonce
  • identityGetContractNonce
  • identityGetBalance
  • identityGetBalanceAndRevision
  • identityGetByPublicKeyHash
  • identityGetByNonUniquePublicKeyHash
  • dataContractGet
  • dataContractGetHistory
  • documentGet
  • dpnsResolve
  • dpnsSearch

Fix direction

The pattern documentList and (after #5862) identityGet / dpnsGetUsername use: make the method nonisolated and run the blocking export through performBlockingQuery, returning sending values; signatures stay async throws. A regression test per method in the style of PlatformQueryOffMainTests (hold the main thread, assert the call returns, and fail if the call never reached the FFI).

Activity

  1. romchornyi commented on Nov 12, 2026

    @romchornyi
    ContributorAuthor

    Please include SDK.fetchKeysRemainingBudgets(identityId:keyIds:) in this: it is in the @MainActor extension and calls dash_sdk_identity_fetch_keys_remaining_budgets synchronously, which blocks on the network. dashpay/dashwallet-ios#1399 carries an app-side copy that runs it on its own queue until the SDK does (through performBlockingQuery or an …OffMain variant).

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