fix(cli): bind maxPrice and pricingVersion into the registration commitment - #280
Conversation
CI Summary
Release - PassedTest this PR Download artifact (GitHub CLI required): gh run download 33801154269 -n cli-release-0.0.0-pr.280 -R paritytech/dotns-sdkInstall globally: npm install -g ./parity-dotns-cli-0.0.0-pr.280.tgzVerify: dotns --helpDeploy UI — Passed
Deploy Example — Passed
Benchmark UI - Failed (0s)
Labelspkg: cli, type: test, dependencies, scope: benchmark Test - Passed306 passed, 0 failed across 306 tests. |
re-gius
left a comment
There was a problem hiding this comment.
Improve error handling and avoid catching errors unintentionally - a few comments
| @@ -829,6 +861,7 @@ type ClearSummary = { | |||
There was a problem hiding this comment.
| ok: boolean; |
We could use this to store the outcome of summary.ok, otherwise a partial failure won't be reported. Then, inside packages/cli/src/cli/commands/registerCommand.ts:161, add the check process.exit(result.ok ? 0 : 1);. WDYT?
| ); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Here we can then check on the summary:
if (summary.failed.length > 0) {
summary.ok = false;
console.warn(
chalk.yellow(
` ⚠ ${summary.failed.length} of ${pending.length} could not be resumed: ${summary.failed.join(", ")}`,
),
);
}| await resumeRegistration(context, record, credential, options.commitmentBuffer); | ||
| summary.resumed.push(record.label); | ||
| } catch (error) { | ||
| summary.failed.push(record.label); |
There was a problem hiding this comment.
Add if (!(error instanceof UnrevealableCommitmentError)) throw error; so that we don't catch unexpected errors unintentionally
| # are checked. | ||
|
|
||
| SEPARATOR_PATTERN='^[[:space:]]*(//+|/\*|\*|#)[[:space:]]*[-=*_~#]{6,}|^[[:space:]]*/{6,}[[:space:]]*$' | ||
| TRAILING_PATTERN="^[[:space:]]*[^/*[:space:]].*[^:/'\"\\\\]//([^/]|\$)" |
There was a problem hiding this comment.
A // inside a string is indistinguishable from a trailing comment, so this gives us false positives
| } | ||
| const releases = await fetchGitHubJson(`https://api.github.com/repos/${REPO}/releases?per_page=30`); | ||
| if (!Array.isArray(releases)) throw new Error("releases endpoint did not return a list"); | ||
| const newest = releases.find((release) => !release.draft && release.tag_name); |
There was a problem hiding this comment.
A DOTNS_TAG with explicit bumps may be better to have control on this, but it can be a follow up - not a blocker
Description
The deployed
DotnsRegistrarControllergained two fields on itsRegistrationstruct,maxPriceandpricingVersion, somakeCommitment,registerandregisterReservedchanged selector. The CLI, whose ABIs synced from an older stable release, kept calling the old selectors, so every registration reverted with empty data at the "Generating commitment" step.buildRevertErrorreported that empty-data revert as an unmapped origin, so a mapped account saw a misleading "rundotns account map" message.The deployment runs an unreleased release candidate (
v0.5.8-rc1) that carries the new struct, ahead of the latest stable tag (v0.5.5). This PR:sync-abisfollow the newest release including prereleases, and syncs the real generated ABIs, so no ABI is hand-edited.maxPriceandpricingVersioninto the commitment.commit()stamps the live cost-model version andregister()rejects a reveal whosepricingVersiondiffers from that stamp, so the CLI readscurrentVersion()from the cost-model registry at commit time, quotesmaxPriceoff the name price, and persists both in the retry cache so a resumed reveal reproduces the same commitment.clear --registergoing when one legacy record cannot be revealed.packages/cliandscripts.Type
Package
@parity/dotns-cliRelated Issues
Fixes
N/A. The deployment ran unreleased contracts, so no SDK issue tracked the struct drift.
Checklist
Code
bun run lintpassesbun run formatpassesbun run typecheckpassesDocumentation
Breaking Changes
Breaking changes:
DomainRegistrationtype gains two required fields,maxPriceandpricingVersion. Consumers that construct it directly must supply both.Registrationstruct.dotns register retryandclear --registerreport this and ask the user to discard it withdotns register clear <name> --discardand register again.Testing
How to test:
bun testinpackages/cli(305 unit tests pass, including the manifest round-trip for the two new fields and the reworded revert-message assertions).dotns register domain -n <label>. The commit-reveal completes and the name mints to the caller.dotns register domain -n <label> --owner <evm>. The caller pays and the name mints to--owner.Notes
scripts/sync-abis.mjs, not hand-edited..abis-versionis gitignored, so a fresh install picks upv0.5.8-rc1through the updated script.opusnostatuscheck.paseo) and cross-payer registration (opuscrosspayercheck.paseo, minted to0x75DC5E954D4Ad2c29890a5A167b6A11846469f09) both completed on-chain, withownerOfconfirming the expected holder in each case.