Skip to content

Allow 1-2 character subnames (align with ENS subdomain policy) #366

@arbuthnot-eth

Description

@arbuthnot-eth

Summary

The current SubDomainConfig enforces a minimum label size of 3 characters for subnames (MIN_LABEL_SIZE: u8 = 3 in packages/subdomains/sources/config.move). This means the shortest possible subname is abc.example.sui — 3 characters plus the parent.

This should be lowered to 1, allowing subnames like a.example.sui or zk.example.sui.

Rationale (ENS precedent)

ENS explicitly separates the character minimum for second-level .eth registrations from subnames:

  • EIP-137 (the ENS protocol spec) states: "Labels and domains may be of any length" — no minimum is imposed at the protocol level.
    Source: EIP-137: Ethereum Domain Name Service - Specification

  • The .eth Registrar imposes a 3-character minimum on second-level domains (2LDs) only. This is a registrar policy, not a protocol constraint.

  • ENS official documentation on the Name Wrapper states: "By default there is no character limit on subnames, but your contract could have its own rules and fee structure or whatever you want."
    Source: Name Wrapper Use-Cases | ENS Docs

The logic is straightforward: since the parent domain (2LD) already enforces a 3-character minimum at registration time, a subname like a.example.sui is already 4+ characters in total (plus the TLD). The short-name scarcity concern that motivates the 3-character minimum for 2LDs doesn't apply to subnames — they exist within a namespace controlled by the parent owner.

Current behavior

  • domain.move already allows 1-character labels at the parsing layer (MIN_LABEL_LENGTH = 1)
  • SubDomainConfig.min_label_size defaults to 3, rejecting valid 1-2 character subname labels
  • The config::new() constructor already accepts a custom min_label_size, so the enforcement path is flexible

Proposed change

Set MIN_LABEL_SIZE from 3 to 1 in packages/subdomains/sources/config.move. This is a one-line constant change plus test updates.

Branch with the fix: feat/subname-min-label-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions