Skip to content

Example apps: identity registration and invitation claims need a shared identity-slot reservation #5917

Open

Description

@romchornyi

Expected Behavior

In both example apps, a normal identity registration and a DashPay invitation claim cannot take the same identity index on one wallet. Each one holds its slot through a single shared reservation before it derives keys. The reservation:

  • is taken at the moment the index is chosen and is stored durably, so it survives an app exit;
  • covers every slot, including indices past the derived address lookahead;
  • records who holds the slot. An invitation claim retried after a lost result has to return to its own slot, where the landed claim's keys are, to be recognized as this wallet's claim (code 64). A normal registration must skip that slot.

Current Behavior

SwiftExampleApp. CreateIdentityView skips indices that have an identity row or an isUsed identity-registration address (#L1030, #L2149), but it does not read RegistrationCoordinator. After #5536, the invitation claim sheet skips coordinator-held slots and sets isUsed on its own slot before deriving keys, then saves it. The limits are:

  • isUsed does not record who holds the slot. For that reason the claim's own selector ignores it, so it can still pick a slot that only an unconfirmed normal registration from before a restart holds through isUsed.
  • Nothing is written for a slot past the lookahead, both here and in CreateIdentityView.

KotlinExampleApp. CreateIdentityScreen starts the index field at "0" (#L96) and submits any number that parses (#L204, #L482). It checks neither recorded identities, nor coordinator slots, nor a claim's slot. The claim sheets skip coordinator-held slots (ClaimInvitationSheet.kt#L138) but reserve nothing, because the form reads nothing.

In both apps, when two flows take the same slot they derive the same keys. Platform refuses the second one on duplicate key hashes (40207), after its separate funding is spent.

Possible Solution

Add a slot lease to each app's RegistrationCoordinator, persisted per (walletId, identityIndex) with its holder (registration or a claim keyed by the invitation outpoint). Both the registration picker and the claim sheets acquire the lease before they derive keys, skip slots held by another holder, and let a claim re-enter its own lease. In Kotlin, CreateIdentityScreen also needs the used-index picker that Swift has.

Steps to Reproduce (for bugs)

  1. KotlinExampleApp: register an identity on a wallet (it lands at index 0).
  2. Open Create Identity again on the same wallet: the index field shows 0.
  3. Submit. The wallet derives the same keys at index 0, and Platform refuses them as already registered (40207) after the funding is spent.
  4. In either app, the same collision is possible between a normal registration and an invitation claim in the cases listed above.

Context

Found in the review of #5536 (invitation claim preflight), which closes the cheap cases in Swift and defers the shared reservation here.

Your Environment

Activity

  1. changed the title [-]KotlinExampleApp: identity registration form does not check which indices are already taken[/-] [+]Example apps: identity registration and invitation claims need a shared identity-slot reservation[/+] on Nov 13, 2026
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions