Skip to content

platform-wallet: a bind that drops an account can purge the saved transition of that account's shielded spend in flight #6196

Backlog

Description

@QuantumExplorer

What happens

bind_shielded replaces a wallet's registered shielded account list. A client can bind [0, 1], start a transfer (or unshield, withdraw, identity create) from account 1, then bind [0] while the transfer waits for its result ([0] is the Swift SDK's default list).

The transfer has already saved its signed transition for a redrive and handed over its note reservation before it awaits the network (save_spend_then_broadcast in wallet/shielded/operations.rs). The bind and the transfer hold compatible read guards (the wallet generation's lifecycle gate, the coordinator's operation admission), and a credit pool spend does not hold shielded_config_lock or shield_guard while it broadcasts. register_locked skips recovery records with nonempty nullifiers when it checks for displaced owners, then purges account 1 (coordinator.rs), and purge_subwallet deletes its durable record (file_store.rs). If the result wait then fails, settlement reports ShieldedSpendUnconfirmed without the record that would let the wallet redrive or resolve it.

This is on v5.1-dev as it stands: the credit pool spends never held the configuration lock. The token pool spends do hold it through settlement, so they are not affected.

Why #6178 did not fix it

#6178 briefly held shielded_config_lock through each credit pool spend, which closes this, and backed it out: every bind of the wallet, an unchanged re-bind included (synchronous on the main actor on iOS), then waited for the proof and the result, and one wallet's transfers ran one at a time.

Suggested fix

Keep identical and additive binds fast, and make the install refuse a bind that would drop an account with an unresolved spend record (or a spend currently admitted for that account) before it changes the registration or purges anything, with a typed error. The same question for the token pool spends would let them stop holding the configuration lock through settlement.

Raised in the review of #6178 (thread).

Activity

  1. QuantumExplorer commented on Nov 24, 2026

    @QuantumExplorer
    MemberAuthor

    #6191 (shielded tips) implements part of the suggested fix here, for saved records: register_locked now refuses a registration that drops or re-keys the account an unresolved note spend was paid from (any spend kind, ShieldedRecoveryKeysRequired), refuses the first registration after a restart that leaves that account out, and refuses dropping an account while a damaged note-spend record is kept unloaded. Tips needed it because their "earlier payment unresolved" refusal reads those records.

    Not covered there, and still open here: a spend that saves its record between that check and the purge within one bind (the credit pool spends do not hold shielded_config_lock), and a spend admitted but not yet saved. Same for #6159.

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