Skip to content

platform-wallet: a concurrent identity debit can leave an identity shield's redrive record armed #5918

Open

Description

@romchornyi

Problem

A shield funded by an identity (shield_from_identity_to) runs under the wallet's shield_guard, but ordinary identity-credit debits such as transfer_credits_with_external_signer do not take that guard. A transfer can therefore debit the identity between the shield's proved balance read and its broadcast. If the remaining credits no longer cover the shield, CheckTx refuses it and its identity nonce stays unused.

settle_identity_shield_failure treats an unused nonce as possibly still executable and keeps the redrive record. Until it is resolved, every later identity shield is refused with ShieldedIdentityDebitPending, and after a later top-up the stored signed shield can execute without a new request from the user.

The redrive behaviour predates #5863; the balance read added there narrows the window (a shield the identity cannot cover is refused before anything is armed) but cannot close it against a concurrent debit.

Fix direction

Either serialize identity-credit debits with the identity shield in the identity-operation layer (one guard for every debit of the same identity), or classify a CheckTx refusal for insufficient identity balance as definitive in settle_identity_shield_failure and drop the redrive record for it.

Found in the review of #5863.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions