fix(cli): normalise lookup input through the chain TLD before deriving nodes - #277
Merged
Conversation
…g nodes performDomainLookup and performOwnerOfLookup hashed user input as-is, so a fully-qualified name (alice.paseo) derived the wrong node/tokenId, read as "not registered", and displayed a doubled suffix (alice.paseo.paseo) - while every write path (register, transfer, delegate, escrow, records) already normalised through normaliseName. Both lookup entry points now normalise the same way, and the lookup transfer subcommand normalises its display label. Fixes paritytech/dotns#257
CI Summary
Release - PassedTest this PR Download artifact (GitHub CLI required): gh run download 33599357147 -n cli-release-0.0.0-pr.277 -R paritytech/dotns-sdkInstall globally: npm install -g ./parity-dotns-cli-0.0.0-pr.277.tgzVerify: dotns --helpDeploy Example — FailedFailed at: Deploy — Deploy workflow failed — see run logs for upload/register/contenthash details
Labelspkg: cli, type: test, dependencies Test - Passed304 passed, 0 failed across 304 tests. |
re-gius
approved these changes
Sep 1, 2026
| expect(qualified.label).toBe("alice"); | ||
| expect(qualified.domain).toBe("alice.paseo"); | ||
| }); | ||
|
|
Contributor
There was a problem hiding this comment.
We should also check alice01.paseo --(normaliseName)--> alice01 --stripTrailingDigits--> alice
sphamjoli
approved these changes
Sep 1, 2026
sphamjoli
left a comment
Member
There was a problem hiding this comment.
We can fix the failing CI when we handle the UI at some point since it requires a bulletin allowance
Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
lookuphashed user input as-is, so a fully-qualified name (alice.paseo) derived the wrong node/tokenId, reported a registered name as "not registered", and displayed a doubled suffix (alice.paseo.paseo) — while every write path (register, transfer, delegate, escrow, records) already normalised input throughnormaliseName(chain-resolved TLD, from #261).This PR normalises both lookup entry points the same way:
performDomainLookup— normalises beforeformatDomainName/domainNode(also fixes the trailing-digit base-name check running on the suffixed string)performOwnerOfLookup— normalises instead of only trimminglookup transfer— normalises its display label and JSONlabeloutput (the underlyingtransferName/verifyDomainOwnershipalready normalised)Testing
How to test:
bun test packages/cli/tests/unit/lookup/— new tests pin thataliceandalice.<tld>derive the same node/tokenId against a mocked chain, and that a foreign suffix (alice.doton a.paseodeployment) is not stripped.bun run src/cli/index.ts lookup owner-of <name>.paseo --env paseo-v2— now printsDomain: <name>.paseo(was<name>.paseo.paseo) and reads the correct token. All 304 unit tests pass.Notes
Verified on paseo-v2 (previewnet's shared dev account currently has no balance/mapping after the chain relaunch, so it cannot serve as a live testbed until refunded).