Skip to content

feat(registry): subname registration under parent namesΒ #4

Open

Description

@Meet-hybrid

πŸ’  Sidera β€” Stellar Name Service. Contribute via Drips Wave / GrantFox. Comment with your approach and wait for assignment before starting.

Description

Every payment app on Stellar could issue names to its users (bob.qiuckex.sid) instead of making them compete for top-level names. The registry stores bare names only β€” there is no hierarchy. Subnames turn every registrant into a distribution channel and are the adoption engine for the whole protocol.

Desired outcome: a name owner can register subnames under their name (register_subname(parent, sub, owner, address, memo)), bounded by a per-parent cap to keep storage bounded; subnames resolve like top-level names via their full dotted key.

Scope

  • Crate/module: crates/registry, src/lib.rs
  • API: register_subname(parent, sub, owner, address, memo), set_subname_address(parent, sub, ...), unset_subname(parent, sub); resolve accepts dotted input (bob.parent.sid β†’ key bob.parent)
  • Storage: subnames stored as full-string keys ("bob.parent") in the same DataKey::Name namespace β€” no new key shape; parent gains a SubCount instance key
  • Tests: owner-auth on parent for all three entrypoints; cap enforcement (MAX_SUBNAMES_PER_PARENT); sub of missing parent β†’ NotFound; subname resolves via dotted resolve; validate_name extended (dots only as separators, no empty labels); subname cannot itself be a parent (one level only β€” documented)
  • Docs: subname section + updated validation rules

Non-goals

  • Multi-level nesting (a.b.c.sid) β€” one level only for this tranche
  • Subname fees (inheritance of pricing is a later design decision)
  • Subname transfer independent of parent
  • Off-chain subnames (L2/merkle approaches)

What "done" looks like

  • register_subname requires parent-owner auth; stores key "{sub}.{parent}"
  • Parent SubCount enforced against a documented MAX_SUBNAMES_PER_PARENT constant; exceeding β†’ new SubnameCapReached error (next free code)
  • resolve("bob.parent") (and dotted resolve input with .sid stripped) returns the subname record
  • unset_subname deletes the record and decrements the count; owner-auth required
  • Existing names unaffected; validate_name rejects malformed dotted input (empty labels, leading/trailing dots)
  • New tests: cap, auth, dotted resolution, validation matrix
  • All gates pass

Implementation guidelines

  • Keep subnames in the SAME DataKey::Name(String) map β€” dotted keys make resolve uniform and avoid a second storage class
  • total_names semantics decision: count only top-level names (document it) β€” subnames get sub_count(parent)
  • Dot-handling belongs in validate_name's caller: split input into labels, validate each with the existing 3–32/charset rule except the LAST label (sub label may be shorter? β€” document your choice, min 1–2 chars is defensible)
  • TTL: subname writes extend their own keys; parent-owner check reads the parent's Owner key (existing TTL rules apply)

Verification

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test -p sidera-registry --all-targets --locked

PR guidelines

  • Get assigned before starting; do not start work on a reserved issue.
  • Work in a fork; branch off upstream/main; open the PR against Sidera-Protocol/sidera-contracts:main.
  • PR description must include Closes #4.
  • All CI checks must pass; human maintainer review required.

Metadata

  • Affected crates/files: contracts/registry/src/lib.rs, docs/
  • Complexity label: complexity: medium (150 base points)
  • Type labels: enhancement

Activity

  1. Rodrigoue9 commented on Oct 7, 2026

    @Rodrigoue9

    Hi @maintainer! I would like to take on issue #4 to enable hierarchical subname registration under parent domain records (e.g. user.app.sid).

    Technical Implementation Plan:

    1. Hierarchical Storage Model:
      • Implement compound storage keys DataKey::Subname(String, String) representing (parent, sublabel).
      • Ensure parent records maintain subname management authority while allowing delegated resolution.
    2. Access Control & Authorization:
      • Enforce parent_owner.require_auth() during subname creation and administrative revocations.
      • Allow parent owners to grant resolution ownership of subnames to distinct target addresses.
    3. Resolution Logic:
      • Extend resolve to recursively or deterministically resolve dot-separated labels, maintaining backward compatibility with bare names.
    4. Testing & Invariants:
      • Unit tests covering subname creation, authorization rejection for non-parent owners, and resolution roundtrips.
      • Verify TTL extensions apply correctly to subname storage entries.
    5. Quality Gates:
      • Run cargo fmt, cargo clippy -D warnings, and cargo test -p sidera-registry.

    Track Record

    Recently delivered and merged Soroban smart contract contributions:

    Ready to implement upon assignment. Could you please assign this issue to me?

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

    complexity: mediumStandard features or involved bug fixes (150 pts)enhancementNew feature or requestexternal-contributorsSuitable for contributors outside the maintainer team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions