Skip to content

Username registration: the final ownership check and the paid DPNS registration are not atomic #1663

Open

Description

@HashEngineering

Follow-up from #1626. thepastaclaw raised this as blocking at 6132ea75a (existing thread: #1626 (comment)). It is deferred here because the wallet can't close it on its own.

Problem

Before a replacement or retry registration, SdkTransparentUsernameCreation re-reads who owns the label (ownershipRecheck()) and then calls source.registerDpnsName() as a separate step. Within one app process the per-identity lock prevents a duplicate submission, but nothing makes the read and the registration one operation.

How it goes wrong:

  1. Another wallet instance with the same identity registers or contests the label between the read and the registration, or a lagging but successful DAPI response reports the label as available.
  2. The wallet submits the paid registration.
  3. Platform rejects it only after the attempt, which can consume identity credits, contested-name prefunding or fees.

This needs two wallet instances on the same identity, or a stale DAPI reply, in a narrow window.

Proposed fix

Close the race in the SDK or Platform: a conditional registration ("register only if the label is unowned, or owned by this identity") or an idempotent one that returns success without charging when this identity already holds the label. The wallet then drops its separate recheck and relies on that result.

Review: #1626 (thepastaclaw, final review of 6132ea75a)

🤖 Generated with Claude Code

Activity

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