Skip to content

fix(sdk): report a dotNS name under a live reservation as unavailable - #493

Open
re-gius wants to merge 3 commits into
mainfrom
re-gius/dotns-reserved-availability
Open

re-gius wants to merge 3 commits into
mainfrom
re-gius/dotns-reserved-availability

Conversation

@re-gius

@re-gius re-gius commented Oct 23, 2026

Copy link
Copy Markdown

Problem

isDotNsAvailable reported a name reserved through the gateway as available. Registering it then failed with NameReserved.

From dotNS 1.1.0, a live reservation blocks public registration for every account, including the user who holds it (paritytech/dotns#348). Paseo Asset Hub and Polkadot Asset Hub run 1.0.0 until they are upgraded, so the SDK has to handle both.

Fix

isDotNsAvailable now also reads PopRules.isBaseNameReserved. When the name is reserved, it asks PopRules' price quote for the reservation's holder, and lets that answer decide:

Quote for the holder Release isDotNsAvailable
Not Reserved 1.0.0: the holder may still register true
Reserved 1.1.0: nobody may register false
Reverts (band closed to sale) either false
Fails any other way either RegistryCall error

prepareDotNsRegistration already refuses with NameReserved on the same quote, so registration needs no change.

Other changes

  • isBaseNameReserved added to the vendored PopRules ABI. It's the same on 1.0.0 and 1.1.0.
  • The NameReserved comment now covers reservations.

Testing

  • pnpm check
  • pnpm --filter "@parity/product-sdk" test: 208 tests, with new cases for each row of the table and for a failed reservation read.

if (!isReserved) return ok(true);
const quote = await popRules.priceWithoutCheck.query(label, reservationOwner, { origin });
if (!quote.success) {
if ((quote.value as { type?: unknown } | null)?.type === "ContractRevertedWithPayload") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

priceWithoutCheck is a view that returns a Reserved status rather than reverting, so this branch looks unreachable on a valid label and the band closed to sale comment doesnt match PopRules.sol. if you keep it worth reusing isEmptyRevert so it doesnt drift from the helper above. intended?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually reachable: _priceWithoutCheck calls _requireShortNamesOpen(baseLength) before reading the reservation, which reverts PopError("Short names are not for sale") for a base under 9 characters while shortNamesEnabled is off. It's off on both Polkadot Asset Hub and Paseo today, so a reserved 6 to 8 letter name lands here.

Reusing isEmptyRevert would miss this revert, because it carries a payload. To keep the checks from drifting, both now use a shared isRevert helper.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot to push the fix I was mentioning, it was only local to my laptop. Now pushed in 7102783

@TarikGul TarikGul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the abi against PopRules.sol, isBaseNameReserved matches the deployed shape and the reserved status read is right. 92 dotns tests green, changeset patch only. One note on the revert branch inline, not blocking.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

📦 Bundle size impact

Comparing 2026-10-23T15:35:31.760Z → 2026-10-23T15:35:58.709Z

Package Entry Bundled before Bundled after Δ Ship gzip Δ Shake ratio
🟢 @parity/product-sdk ./identity 125.3 KB 126.0 KB +746 B (+0.6%) +167 B 1% (was 1%)

Thresholds — 🟡 ≥10% or ≥5.0 KB · 🟠 ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB. Informational — this check never blocks merge.

@re-gius
re-gius enabled auto-merge (squash) October 23, 2026 15:26
@re-gius
re-gius disabled auto-merge October 23, 2026 15:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants