Skip to content

DPNS: is_valid_username rejects consecutive hyphens that the DPNS contract accepts #6236

Backlog

Description

@QuantumExplorer

Problem

is_valid_username (packages/dash-platform-queries/src/dpns_usernames.rs) rejects labels with consecutive hyphens (e.g. web--shop2). The DPNS v3 domain.label pattern ^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$ accepts them (both require at least 3 characters, so that rule agrees).

The narrower rule is applied inconsistently across Rust entry points:

  • dash_sdk_dpns_check_availability and packages/rs-sdk-ffi/src/dpns/register.rs apply it,
  • register_name_with_external_signer in packages/rs-platform-wallet/src/wallet/identity/network/dpns.rs does not.

Both example apps gate Register on the availability check, so neither can register such a label, although Platform would accept it.

The doc comment also says the no-consecutive-hyphens rule is "enforced by the pattern". The pattern does not enforce it.

Proposal

Either align is_valid_username with the active contract, or keep the narrower rule on purpose, document why, and apply it consistently across the query and registration APIs.

Found in review of #6225.

Activity

  1. added this to the v5.1.0 milestone on Nov 24, 2026
  2. QuantumExplorer commented on Nov 24, 2026

    @QuantumExplorer
    MemberAuthor

    An option raised in review of #6225: leave the exported is_valid_username unchanged and give the wallet registration flow its own Rust answer (the wallet builder already runs without that predicate). That answer would decide explicitly whether to reject xn---shaped labels without blocking an ordinary label such as web--shop2, and the example apps' availability gate would use it.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions