Skip to content

SwiftExampleApp: replacing a network's wallet manager ignores a non-clean shutdown and a failed wallet restore #5816

Open

Description

@shumkov

When WalletManagerStore.activate replaces a network's cached manager because the SDK was rebuilt (revisiting a network, a devnet edit, the Docker toggle):

  1. Non-clean shutdown. PlatformWalletManager.shutdown() reports workers that missed their join budget (all_clean() in Rust), but platform_wallet_manager_destroy returns success, and the store restores and publishes the replacement anyway. The old workers keep their persistence callbacks, so they and the new manager can touch the same persisted wallet state. Before feat(swift-sdk): use SPV-synced quorums for Platform proof verification #3417 the replaced manager was not shut down at all.
  2. Failed restore. A loadFromPersistor() error is caught as non-fatal, so the replacement is published empty and nothing retries it. The wallets vanish from the active manager until restart. restorableWalletIds() also swallows a SwiftData fetch failure with try?, so a load can "succeed" with zero wallets.

KotlinExampleApp's store has the same gaps. A draft fix for (1) was written during #3417: destroy returns ErrorShutdownIncomplete, Swift exposes allWorkersStopped, and the store refuses the replacement and quarantines the network until restart.

Activity

  1. shumkov commented on Nov 10, 2026

    @shumkov
    CollaboratorAuthor

    Further limits of the manager handover, left out of #3417 (which refuses a second activate for a network while one is in flight, 04cceb8). They all need one gate around the whole SDK-rebuild transaction rather than around activate alone:

    • Docker toggle from two windows: a refused rebuild rolls the Docker setting back to the value it captured when tapped, so with two windows toggling at once the setting can disagree with the SDK the other window publishes.
    • bootstrap() runs in every window (also on v5.1-dev): a window opened while another window's bootstrap is still replacing the manager publishes its own SDK, then has its activate refused, so the manager stays on the earlier SDK.
    • Different networks can still interleave across the shutdown await.
    • A shutdown that never completes keeps its network refused until relaunch.
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