Skip to content

chore(cli): Quality of lite improvement in preparation for paseo v2#148

Merged
sphamjoli merged 8 commits into
mainfrom
spha/sdk-qof-fixes
May 29, 2026
Merged

chore(cli): Quality of lite improvement in preparation for paseo v2#148
sphamjoli merged 8 commits into
mainfrom
spha/sdk-qof-fixes

Conversation

@sphamjoli
Copy link
Copy Markdown
Member

Description

Brings the dotns CLI up to date with the upcoming paseo-v2 contract release. The shipped CLI was diverging from the deployed contracts in small but real ways, and the new deposit lifecycle had no command surface at all. This PR closes both gaps.

What changes for users:

  • Names with a single trailing digit are rejected up front. A name's digit suffix must be zero digits or exactly two; one digit (or three or more) is no longer accepted. The CLI now catches this before submission instead of relying on the on-chain revert.
  • Downward transfers no longer fail. When you move a name to a wallet at a lower verification tier, the CLI now asks the contracts what the friction fee is and pays it as part of the transfer. Previously the CLI sent zero value and the transfer reverted; same-tier and upward transfers still cost nothing.
  • New escrow command. There is now a dotns escrow group covering the full deposit lifecycle: check the status of a name's escrow position, release the name into escrow, withdraw after the cooldown, drain any overpayment held in the legacy pull ledger, and list, claim, or batch-claim entries from the new time-locked refund ledger. Before this PR none of these flows existed in the CLI; users had to interact with the escrow contract by hand.
  • Bundled contract addresses and ABIs refreshed. The CLI ships with a new contract address slot for the name escrow, plus regenerated ABIs across the board so encoded calls match what the contracts actually expose today. The drift was non-trivial in places (for example the reverse resolver had renamed entry points).

Tests have been added to lock the new behaviour: the trailing-digit rule, the new escrow help text and output formatting, a small JSON-output change that lets bigint fields serialise safely, and a live-chain integration test that walks through register, status, release, status. A few redundant assertions in the environment tests have been removed since they were each checking the same hardcoded deployment address; they had nothing to do with what the test was about, and the suite now makes no assumption about which addresses are deployed.

Type

  • Chore

Package

  • @parity/dotns-cli

Related Issues

n/a

Fixes

n/a

Checklist

Code

  • Follows project style
  • bun run lint passes — let CI verify
  • bun run format passes — let CI verify
  • bun run typecheck passes

Documentation

  • README updated if needed — the new commands are discoverable through the built-in help, so the package readme does not need editing
  • Types updated if needed

Breaking Changes

  • No breaking changes

Breaking changes: n/a

Testing

How to test:

  1. Run the type checker. It passes on both packages.
  2. Run the unit suite. Every assertion passes, including the new validation, escrow help, and escrow formatter tests.
  3. Open the CLI's help screen and confirm escrow is listed; then look at escrow --help and escrow refunds --help to see the new subcommands.
  4. Against a live paseo-v2 deployment, run the new escrow integration suite. It registers a name, checks the escrow position, releases the name, and verifies the position has flipped to released with a cooldown timestamp in place. The post-cooldown half is intentionally not exercised because the cooldown runs for days on the live chain.

Notes

The integration tests do not hardcode any contract address. They drive the CLI surface and let the bundled environment configuration resolve which addresses to use, so they continue to work whenever a fresh deployment is recorded. The decision to regenerate every ABI rather than patch only the escrow one was deliberate: piecemeal patching is how drift accumulated in the first place.

@sphamjoli sphamjoli marked this pull request as draft May 24, 2026 20:18
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

CI Summary

Check Result
Lint Passed
Lint (UI) Passed
Format Passed
Format (UI) Passed
Typecheck Passed
Typecheck (UI) Passed
Build Passed
Build (UI) Passed
Release Passed
Deploy UI Failed
Deploy Example Failed
Benchmark UI Failed
PR Title Passed
Labels Passed
Test Passed - 191 passed, 0 failed

Release - Passed

Test this PR

Download artifact (GitHub CLI required):

gh run download 26647606100 -n cli-release-0.0.0-pr.148 -R paritytech/dotns-sdk

Install globally:

npm install -g ./parity-dotns-cli-0.0.0-pr.148.tgz

Verify:

dotns --help
Deploy UI — Failed

Failed at: Deploy — Deploy workflow failed — see run logs for upload/register/contenthash details

Stage Status
✓ Build Build succeeded
✗ Deploy Deploy workflow failed — see run logs for upload/register/contenthash details

View run

Deploy Example — Failed

Failed at: Deploy — Deploy workflow failed — see run logs for upload/register/contenthash details

Stage Status
✓ Site validation Site validated
✗ Deploy Deploy workflow failed — see run logs for upload/register/contenthash details

View run

Benchmark UI - Failed (0s)
Property Value
Duration 0s
Domain n/a
CID n/a
Workflow view
Labels

pkg: cli, scope: bulletin, type: test, dependencies, pkg: ui

Test - Passed

191 passed, 0 failed across 191 tests.

View run

$ bun test tests/unit/
bun test v1.2.6 (8ebd5d53)

::group::tests/unit/utils/formatting.test.ts:
(pass) native balance formatting uses DOT/PAS 10 decimals > defaults to 10 native decimals and 18 EVM decimals [1.00ms]
(pass) native balance formatting uses DOT/PAS 10 decimals > formatNativeBalance renders 5000 PAS from 5000 * 10^10 units
(pass) native balance formatting uses DOT/PAS 10 decimals > formatNativeBalance renders fractional 0.1 PAS as 10^9 units
(pass) native balance formatting uses DOT/PAS 10 decimals > formatNativeBalance renders zero balance
(pass) native balance formatting uses DOT/PAS 10 decimals > parseNativeBalance inverts formatNativeBalance
(pass) native balance formatting uses DOT/PAS 10 decimals > parseNativeBalance('0.1') is 10^9

::endgroup::

::group::tests/unit/utils/contractInteractions.test.ts:
(pass) isRevertFlag matches the EVM revert bit > flags=0n → false
(pass) isRevertFlag matches the EVM revert bit > flags=1n → true
(pass) isRevertFlag matches the EVM revert bit > flags=2n → false
(pass) isRevertFlag matches the EVM revert bit > flags=3n → true
(pass) buildRevertError > empty data returns the unmapped-origin hint
(pass) buildRevertError > known ABI selector decodes to the named error [7.00ms]
(pass) buildRevertError > unknown selector falls back to raw hex [1.00ms]

::endgroup::

::group::tests/unit/utils/validation.test.ts:
(pass) countTrailingDigits > returns 0 for a label with no trailing digits [1.00ms]
(pass) countTrailingDigits > returns the digit run length for a label with trailing digits
(pass) countTrailingDigits > does not count interior digits
(pass) stripTrailingDigits > returns the label unchanged when there are no trailing digits
(pass) stripTrailingDigits > strips the trailing digit run
(pass) validateDomainLabel digit-suffix rule > accepts labels with no trailing digits
(pass) validateDomainLabel digit-suffix rule > accepts labels with exactly two trailing digits
(pass) validateDomainLabel digit-suffix rule > rejects labels with exactly one trailing digit
(pass) validateDomainLabel digit-suffix rule > rejects labels with three or more trailing digits
(pass) validateDomainLabel digit-suffix rule > rejects labels shorter than three characters
(pass) validateDomainLabel digit-suffix rule > rejects labels with uppercase characters
(pass) validateDomainLabel digit-suffix rule > rejects labels with leading or trailing hyphen
(pass) validateGovernanceLabel stem-length rule > accepts stems of five characters or fewer [1.00ms]
(pass) validateGovernanceLabel stem-length rule > rejects stems longer than five characters
(pass) validateGovernanceLabel stem-length rule > inherits the digit-suffix rule from validateDomainLabel

::endgroup::

::group::tests/unit/lookup/lookupHelp.test.ts:
(pass) lookup --help lists subcommands and auth options [15.00ms]
(pass) lookup name --help shows label argument and options [4.00ms]
(pass) lookup owner-of --help shows label argument and options [3.00ms]
(pass) lookup transfer --help shows label argument and destination option [3.00ms]
(pass) lookup transfer parses destination at transfer level [4.00ms]
(pass) lookup transfer parses auth options at lookup level [2.00ms]

::endgroup::

::group::tests/unit/account/accountHelp.test.ts:
(pass) account --help lists subcommands including is-mapped, is-whitelisted, whitelist [4.00ms]
(pass) account is-mapped --help shows address argument and --json [2.00ms]
(pass) account is-whitelisted --help shows address argument and --json [3.00ms]
(pass) account whitelist --help shows address argument, --remove, and --json [2.00ms]
(pass) account is alias works for is-mapped [3.00ms]
(pass) account iw alias works for is-whitelisted [2.00ms]

::endgroup::

::group::tests/unit/content/contentJson.test.ts:
(pass) content view --help shows --json option [4.00ms]
(pass) content set --help shows --json option [2.00ms]
(pass) content set --json emits JSON error when both mnemonic and key-uri provided [2.00ms]

::endgroup::

::group::tests/unit/content/contentHelp.test.ts:
result:  {
  exitCode: 0,
  standardOutput: "Usage: dotns content [options] [command]\n\nManage domain content hashes\n\nOptions:\n  --env <environment>         DotNS environment: paseo-v2 (env: DOTNS_ENV)\n  --network <environment>     Alias for --env\n  --rpc <wsUrl>               WebSocket RPC endpoint (env: DOTNS_RPC)\n  --keystore-path <path>      Keystore path (env: DOTNS_KEYSTORE_PATH)\n  --min-balance <pas>         Minimum balance in PAS (env:\n                              DOTNS_MIN_BALANCE_PAS)\n  --account <name>            Keystore account name (default: keystore default)\n  --password <pw>             Keystore password (env: DOTNS_KEYSTORE_PASSWORD)\n  -m, --mnemonic <phrase>     BIP39 mnemonic phrase (env: DOTNS_MNEMONIC)\n  -k, --key-uri <uri>         Substrate key URI (env: DOTNS_KEY_URI)\n  -h, --help                  display help for command\n\nCommands:\n  view [options] <name>       View domain content hash\n  set [options] <name> <cid>  Set domain content hash (IPFS CID)\n  help [command]              display help for command\n",
  standardError: "",
  combinedOutput: "Usage: dotns content [options] [command]\n\nManage domain content hashes\n\nOptions:\n  --env <environment>         DotNS environment: paseo-v2 (env: DOTNS_ENV)\n  --network <environment>     Alias for --env\n  --rpc <wsUrl>               WebSocket RPC endpoint (env: DOTNS_RPC)\n  --keystore-path <path>      Keystore path (env: DOTNS_KEYSTORE_PATH)\n  --min-balance <pas>         Minimum balance in PAS (env:\n                              DOTNS_MIN_BALANCE_PAS)\n  --account <name>            Keystore account name (default: keystore default)\n  --password <pw>             Keystore password (env: DOTNS_KEYSTORE_PASSWORD)\n  -m, --mnemonic <phrase>     BIP39 mnemonic phrase (env: DOTNS_MNEMONIC)\n  -k, --key-uri <uri>         Substrate key URI (env: DOTNS_KEY_URI)\n  -h, --help                  display help for command\n\nCommands:\n  view [options] <name>       View domain content hash\n  set [options] <name> <cid>  Set domain content hash (IPFS CID)\n  help [command]              display help for command\n",
}
(pass) content --help lists subcommands and auth options [2.00ms]
(pass) content view --help shows name argument and options [3.00ms]
(pass) content set --help shows name and cid arguments [2.00ms]

::endgroup::

::group::tests/unit/cli/environment.test.ts:
(pass) defaults to paseo-v2 [1.00ms]
(pass) accepts friendly paseo-v2 aliases
(pass) DOTNS_ENV selects rpc and contract set
(pass) --env takes precedence over DOTNS_ENV while --rpc only overrides endpoint

::endgroup::

::group::tests/unit/cli/bulletinRpc.test.ts:
(pass) paseo-v2 default resolves to the existing bulletin RPC
(pass) explicit argument wins over env var and active env
(pass) env var wins over active env config when no explicit argument
(pass) falls back to active env's bulletin RPC
(pass) throws when nothing is configured (synthetic case)

::endgroup::

::group::tests/unit/cli/reporter.test.ts:
(pass) cli reporter > stream reporter emits durable progress lines
(pass) cli reporter > withConsoleToStderr redirects console and stdout writes [1.00ms]

::endgroup::

::group::tests/unit/text/textHelp.test.ts:
(pass) text --help lists subcommands and auth options [3.00ms]
(pass) text view --help shows name and key arguments [1.00ms]
(pass) text set --help shows name, key, and value arguments [3.00ms]

::endgroup::

::group::tests/unit/text/textJson.test.ts:
(pass) text view --help shows --json option [2.00ms]
(pass) text set --help shows --json option [2.00ms]
(pass) text set --json emits JSON error when both mnemonic and key-uri provided [2.00ms]

::endgroup::

::group::tests/unit/store/storeHelp.test.ts:
(pass) store --help lists subcommands [2.00ms]
(pass) store info --help shows auth options [2.00ms]
(pass) store list --help shows options [2.00ms]
(pass) store get --help shows key argument [2.00ms]
(pass) store set --help shows key and value arguments with auth [1.00ms]
(pass) store delete --help shows key argument with auth [2.00ms]
(pass) store check --help shows address argument [1.00ms]
(pass) store authorize --help shows address argument with auth [3.00ms]
(pass) store unauthorize --help shows address argument [2.00ms]
(pass) store authorize-controller --help shows address argument [2.00ms]
(pass) store unauthorize-controller --help shows address argument [1.00ms]
(pass) store ensure-auth --help shows description and auth options [3.00ms]

::endgroup::

::group::tests/unit/bulletin/uploadProfiling.test.ts:
(pass) upload profiler > writes schema-complete profile report with peak aggregation [12.00ms]
(pass) upload profiler > default profile path is deterministic for a given fingerprint

::endgroup::

::group::tests/unit/bulletin/bulletinHelp.test.ts:
(pass) root help lists bulletin command [2.00ms]
(pass) bulletin help shows commands and description [1.00ms]
(pass) bulletin upload help shows all options [2.00ms]
(pass) bulletin upload help shows default values [1.00ms]
(pass) bulletin authorize help shows all options [2.00ms]
(pass) bulletin authorize help shows default values [1.00ms]
(pass) bulletin history help shows options [1.00ms]
(pass) bulletin history:remove help shows usage [1.00ms]
(pass) bulletin history:clear help shows description [1.00ms]
(pass) bulletin help command shows bulletin help [1.00ms]
(pass) bulletin help upload shows upload help [1.00ms]
(pass) bulletin help authorize shows authorize help [2.00ms]
(pass) bulletin status help shows all options [1.00ms]
(pass) bulletin help status shows status help [2.00ms]
(pass) bulletin list alias works [2.00ms]
(pass) bulletin verify help shows usage [2.00ms]
(pass) bulletin help verify shows verify help [3.00ms]

::endgroup::

::group::tests/unit/bulletin/uploadManifest.test.ts:
(pass) upload manifest resume behavior > returns stale manifest when fingerprint does not match [3.00ms]
(pass) upload manifest resume behavior > deduplicates completed blocks by index [1.00ms]

::endgroup::

::group::tests/unit/escrow/escrowHelp.test.ts:
(pass) root help lists escrow command [3.00ms]
(pass) escrow help shows the subcommand description and subcommands [2.00ms]
(pass) escrow status help describes the read-only position lookup [2.00ms]
(pass) escrow release help describes the approve-and-release sequence [2.00ms]
(pass) escrow withdraw help describes the post-cooldown step [3.00ms]
(pass) escrow claim-withdrawal help describes the overpayment ledger [2.00ms]
(pass) escrow refunds help lists list/claim/claim-batch [3.00ms]
(pass) escrow refunds list help exposes pagination options [1.00ms]
(pass) escrow refunds claim help requires an entry id positional [2.00ms]
(pass) escrow refunds claim-batch help accepts variadic ids [2.00ms]

::endgroup::

::group::tests/unit/escrow/escrowFormatting.test.ts:
(pass) formatRefundEntryLine > marks entries past their cooldown as claimable [2.00ms]
(pass) formatRefundEntryLine > marks entries inside their cooldown window with remaining seconds
(pass) formatRefundEntryLine > renders the amount as a PAS decimal string
(pass) formatRefundEntryLine > truncates large tokenIds for terminal display

::endgroup::

::group::tests/unit/auth/authHelp.test.ts:
(pass) root help lists auth command [2.00ms]
(pass) auth help shows options and subcommands [2.00ms]
(pass) auth set help shows all options [1.00ms]
(pass) auth list help shows options [1.00ms]
(pass) auth use help shows options [1.00ms]
(pass) auth remove help shows options [1.00ms]
(pass) auth clear help shows options [1.00ms]
(pass) auth parses keystore-path option [2.00ms]
(pass) auth parses password option [1.00ms]
(pass) auth set parses account option [1.00ms]
(pass) auth set parses mnemonic option [2.00ms]
(pass) auth set parses key-uri option [1.00ms]
(pass) auth help command shows help [1.00ms]
(pass) auth help set shows set command help [1.00ms]
(pass) auth help list shows list command help [2.00ms]
(pass) auth help use shows use command help [1.00ms]
(pass) auth help remove shows remove command help [2.00ms]
(pass) auth help clear shows clear command help [1.00ms]

::endgroup::

::group::tests/unit/auth/auth.test.ts:
(pass) auth set creates keystore and stores multiple accounts [288.00ms]
(pass) auth set accepts account names with special characters [413.00ms]
(pass) auth list reports missing keystore [4.00ms]
(pass) auth list shows all accounts and auth types [275.01ms]
(pass) auth use switches default account [405.01ms]
(pass) auth remove last account clears default [69.00ms]
(pass) auth remove preserves remaining accounts and reassigns default [207.01ms]
(pass) auth clear deletes all accounts [81.00ms]

::endgroup::

::group::tests/unit/auth/resolveAuthSourceReadOnly.test.ts:
(pass) resolveAuthSourceReadOnly honours environment variables > $label
(pass) resolveAuthSourceReadOnly honours environment variables > $label
(pass) resolveAuthSourceReadOnly honours environment variables > $label
(pass) resolveAuthSourceReadOnly honours environment variables > $label
(pass) resolveAuthSourceReadOnly honours environment variables > $label

::endgroup::

::group::tests/unit/auth/authRevert.test.ts:
(pass) auth set rejects account name with forward slash [2.00ms]
(pass) auth set rejects account name with backslash [2.00ms]
(pass) auth set rejects account name that is just a dot [1.00ms]
(pass) auth set rejects account name that is double dots [2.00ms]
(pass) auth set rejects account name starting with dot [2.00ms]
(pass) auth set rejects account name ending with dot [1.00ms]
(pass) auth set rejects account name with special characters [8.00ms]
(pass) auth set rejects account name that is too long [2.00ms]
(pass) auth use rejects non-existent account [67.00ms]
(pass) auth remove rejects non-existent account [70.00ms]

::endgroup::

::group::tests/unit/register/registerJson.test.ts:
(pass) register domain --help shows --json option [2.00ms]
(pass) register subname --help shows --json option [1.00ms]
(pass) register domain --json emits JSON error when --transfer without --to [2.00ms]

::endgroup::

::group::tests/unit/register/registerOwnerConflicts.test.ts:
(pass) register domain rejects --owner with --transfer [3.00ms]
(pass) register domain rejects --owner with --reverse [2.00ms]
(pass) register domain rejects --owner with --governance [1.00ms]

::endgroup::

::group::tests/unit/register/registerHelp.test.ts:
(pass) root help lists register command [2.00ms]
(pass) register help shows subcommands [1.00ms]
(pass) register domain help shows options [1.00ms]
(pass) register subname help shows options [2.00ms]
(pass) register domain parses reverse flag [1.00ms]
(pass) register domain parses governance flag [1.00ms]
(pass) register domain parses owner option [2.00ms]
(pass) register domain parses transfer with destination [1.00ms]
(pass) register domain parses account option [1.00ms]
(pass) register domain parses keystore-path option [1.00ms]
(pass) register domain parses password option [2.00ms]
(pass) register domain parses mnemonic option [1.00ms]
(pass) register domain parses key-uri option [2.00ms]
(pass) register domain parses commitment-buffer option [2.00ms]
(pass) register domain parses commitment-buffer alias --cb [3.00ms]
(pass) register subname parses name and parent [2.00ms]
(pass) register subname parses owner option [3.00ms]
(pass) getCommitmentBufferSeconds defaults to 6 when env is not set
(pass) getCommitmentBufferSeconds reads from DOTNS_COMMITMENT_BUFFER env variable
(pass) COMMITMENT_POLL_INTERVAL_MS is 2000
(pass) COMMITMENT_POLL_TIMEOUT_MS is 30000

::endgroup::

::group::tests/unit/pop/setPopHelp.test.ts:
(pass) root help lists pop command [5.00ms]
(pass) pop help shows commands and description [2.00ms]
(pass) pop help shows auth options [2.00ms]
(pass) pop info help shows description [2.00ms]
(pass) pop status help shows description [2.00ms]
(pass) pop info help shows auth options [3.00ms]
(pass) pop info parses auth options at pop level [2.00ms]
(pass) pop info parses auth options at info level [2.00ms]
(pass) pop help command shows pop help [2.00ms]
(pass) pop help status shows info help [3.00ms]
(pass) pop help info shows info help [2.00ms]

::endgroup::

::group::tests/unit/pop/popJson.test.ts:
(pass) pop info --help shows --json option [2.00ms]
(pass) pop status --help shows --json option [1.00ms]

::endgroup::

 191 pass
 0 fail
 643 expect() calls
Ran 191 tests across 27 files. [2.60s]

Comment thread packages/cli/src/utils/constants.ts Outdated
DOTNS_CONTENT_RESOLVER: "0x2c9FF5D9136DBE5814C7B4FDbeDC15273a776663" as Address,
STORE_FACTORY: "0x0DE5De70d61cc6b44B45d6595afDe8dB9b55bc31" as Address,
DOTNS_RULES: "0x2002C1c15b88632Ad01c7770f6EbE1Ca05c8472E" as Address,
DOTNS_REGISTRAR: "0x0000000000000000000000000000000000000000" as Address,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reminder to update all of these before I merge

@andrew-ifrita
Copy link
Copy Markdown
Collaborator

@andrew-ifrita andrew-ifrita marked this pull request as ready for review May 28, 2026 12:59
@github-actions github-actions Bot requested a review from andrew-ifrita May 28, 2026 12:59
@mordamax mordamax self-requested a review May 29, 2026 16:18
@sphamjoli sphamjoli merged commit 3a1ea00 into main May 29, 2026
27 of 30 checks passed
@sphamjoli sphamjoli deleted the spha/sdk-qof-fixes branch May 29, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants