Skip to content

refactor(dpns): use the SDK for name registration, lookups and the voting-key check - #1073

Merged
lklimek merged 28 commits into
v1.0-devfrom
refactor/dpns-use-sdk-helpers
Oct 12, 2026
Merged

lklimek merged 28 commits into
v1.0-devfrom
refactor/dpns-use-sdk-helpers

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: The app now uses the Dash SDK's own functions to register usernames, look names up and check a masternode's voting key, instead of keeping its own copies. One visible fix: a node whose voting key was replaced on the network is refused when you add it, not later when a vote fails.

User story

As a masternode owner, I want to be told right away that the voting key I entered is no longer active on my node, so that I do not find out only when my vote is refused.

As a user registering a username, I want registration to behave exactly as before, including never being invited to pay twice, and I want the new name to show the date the network confirmed it.

Scenario

Base flow

  1. Open Masternodes and add a node: enter its ProTxHash and a voting private key that was valid before the key was replaced on the network.
  2. Separately: open an identity, register a username, approve the cost and pay.

Actual behavior

  • The node is added and looks ready to vote. A later vote fails with a generic message.
  • A newly registered username gets its date from a second read of the identity's names, which can lag behind the registration.

Expected behavior

  • Adding the node is refused with: "This voting key is no longer active on the selected node. Enter that node's current voting private key and try again." Nothing is stored.
  • A newly registered username shows the date the network confirmed it.
  • Everything else about registering a username is unchanged: the cost approval, the check that the name is still free, and the handling of a failure after the first step was paid for.

Detailed discussion

What was done

Three areas move from hand-written code to SDK functions. No stored data changes and the dashpay/platform pin is unchanged.

Area Now uses
Username registration Sdk::register_dpns_name; the preorder and domain documents are no longer built in DET
Name → identity (load by name, DashPay contact requests) Sdk::resolve_dpns_name
DashPay user search by name prefix Sdk::search_dpns_names
DashPay contact names Sdk::get_dpns_usernames_by_identity
Voter identity id and voting-key match voter_identity_id, select_voting_key

Kept on DET's side, on purpose:

  • Double-payment guard. Sdk::register_dpns_name returns one error for both broadcasts. Its preorder_callback runs after the preorder is confirmed, so a flag set there sorts the failure into "first document not confirmed" (plain failure) or "name request failed after payment" (goes through resolve_failed_domain_broadcast, as before). The SDK call is passed in as a parameter of the private register_dpns_name_through, so tests can drive the real callback and the whole success path without a network.
  • Cost approval. classify_dpns_registration_outcome stays, but asks the network's DPNS contract (contested_vote_poll_for_document_properties) whether the label is contested, instead of classifying a document DET built.
  • Owned names with dates. The SDK reader drops document timestamps, which the UI shows as the registration date. The four copies of that query are folded into the existing fetch_owned_dpns_names.
  • Name validation, the availability re-check and finish_username_registration.

Behaviour changes:

  • New TaskError::MasternodeVotingKeyNotUsable: a voting key that is disabled on the voter identity is refused at node load. The match covers ECDSA_HASH160 keys only. The vote path itself is untouched.
  • Name resolution accepts an identity id stored as bytes. In DashPay, a name document without a readable identity record reports "name not found" instead of "invalid document".
  • Loading by name: a failed read of owned names reports DpnsFetchError, like the other paths. A document whose label is not text is skipped.
  • Profile search: a result without a label is skipped.
  • After registration the name and date come from the confirmed domain document; no second read. A registration accepted as sent after a second-step failure keeps the entry with the local time.

Line counts against the base (15 files, +991 −725):

net
Production −424
Tests +680
Changelog +10

Testing

  • Unit tests and Clippy run in CI. Locally, the registration module's 21 tests pass and cargo clippy --all-features --lib --tests -- -D warnings is clean.
  • 15 unit tests added. Proven red against the old code first: node_voting_key_disabled_on_the_network_is_refused, a_username_resolves_when_its_identity_arrives_as_bytes, loading_by_name_follows_the_identity_the_name_points_at. failure_after_the_sdk_confirms_the_first_document_is_the_paid_stage fails when the preorder_callback wiring is removed. registration_saves_the_date_of_the_confirmed_name_document runs the whole registration with a stand-in for the SDK call and fails when the confirmed document's date stops reaching the saved name. The rest cover the failure-stage sorting, the date taken from the confirmed document, and the contest rule read from the contract.
  • Live network: the new #[ignore] backend-e2e test test_register_dpns_name_funded_from_platform_addresses passed on testnet against this PR's production code. It funds a fresh identity from credits already held on the framework wallet's platform addresses (no Core funds), registers a non-contested name and finds the identity by that name. It is not part of CI.
  • Not verified live: a failure after the first document is paid for, which cannot be produced on demand; the unit tests above cover it. The older Core-funded test_register_dpns_name did not reach the registration step: its identity funding failed in the test harness, in code this PR does not touch.

Breaking changes

None.

Prior work

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

PR Hygiene · 44fcc5c

  • Bots — coderabbitai ✓ · thepastaclaw ✓
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (CHANGELOG.md, src/backend_task/dashpay/contact_requests.rs, src/backend_task/dashpay/contacts.rs and 12 more) — approved by lklimek

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • New Features
    • Newly registered usernames show the date their registration was confirmed on the network.
    • Username and name-based identity and DashPay contact searches reflect network name records, including transferred names.
  • Bug Fixes
    • Adding a masternode or evonode is refused when its supplied voting key is no longer enabled. The message asks for the node’s current voting private key.
    • Username registration reports outcomes based on network confirmation.

lklimek and others added 25 commits October 9, 2026 13:22
A contest refresh pass asked Platform for the contenders of every contest
the app had ever seen, finished ones included: one request per contest,
about a thousand on Testnet, 24 at a time. Since #901 that pass also runs on
arrival at Masternodes > Votes and from a background timer, so it fired
every few minutes. The SDK sends requests to five endpoints at a time and
each allows 150 a minute; one pass went past that, the endpoints answered
ResourceExhausted and were banned, and every other action shared the loss.

- A stored contest that already has its outcome (awarded or locked) is
  final: a refresh that lists it stamps it as current and no longer queues a
  contender query for it. A pass now costs the contest list plus the
  contests that are still open.
- Only one refresh pass runs at a time. The timer and a user refresh used to
  overlap and each walk the same unfilled cache.
- Contender queries of a pass start no closer than 125 ms apart, so the
  first load of a long history stays inside the request budget instead of
  arriving as one burst.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Pacing the contender queries made the first load of a long contest history
take about two minutes, with the contests that can still be voted on sitting
at a random alphabetical position in that queue.

- The pass now waits for the contest end times (a query it already made)
  before it starts the contender queries, and reads the contests whose end
  time is in the future first. The unread history is back-filled after them.
- The first 100 contender queries of a pass start at once; only the ones
  after them are paced. With 480 paced queries a minute that keeps a pass
  within 580 of the roughly 750 requests a minute the app has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
On a first load the voting choices and the Votes badge waited for the whole
paced back-fill, about two minutes for a thousand contests: both need each
node's proved votes, and the pass read those only after its last contender
query.

Reading them earlier was not safe as it stood. A listed contest nobody has
read yet has no end time and counts as open, so every unread finished
contest would have shown as waiting for a vote.

- While a pass runs, the names it has listed but not read, and has no end
  time to call open, are left out of the open contests. Each returns as soon
  as its contenders arrive, and whatever is left returns when the pass ends,
  however it ends. The set lives in memory only.
- When a pass has such unread history, it proves the nodes' votes right
  after the open contests are read and refreshes the screen, then
  back-fills. The proof at the end of the pass is kept.

A pass on a filled cache has nothing unread, takes neither step and sends
the same requests as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…tart

The names a first load had listed but not read were kept out of the open
contests by a set held in memory for the length of the pass. The early vote
proof, however, is stored. Quitting during a first load and starting again
within the proof's lifetime — or a pass that ended with names still unread —
left every unread name counted as an open contest the node had not voted
on: a badge in the hundreds and enabled choices on finished contests.

- A name that was only listed (never read, no end time, no contenders) is
  not an open contest, wherever the open contests are read. The rule lives
  on the contest itself, so it holds in a new process and after any pass.
  The in-memory set, its guard and its lock are gone.
- While a pass is running and unread names remain, To decide and Voted say
  the contests are still loading instead of saying none are open.

Tests that seeded such a bare name as an open contest now give it an end
time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…ntest data

The contest refresh pass reported progress with TaskResult::Refresh: per list page, after the end-time read, per contender read and after the early vote proof. AppState answers each one with refresh() on the visible screen, so since the pass also runs by itself on a timer, any screen the user was on was told to start over several times a second: lookups lost their spinner and result, typed search text was cleared, amount fields disappeared while their limit was re-checked.

The pass now sends TaskResult::DpnsContestsChanged. AppState merges it with adjacent cache notifications as it merges refreshes, and answers it with refresh() only when the visible screen is the Masternodes screen, the one screen that caches contest data. The badge, the attention chip and the identity home's pending-username indicator read live each frame, and the sender already requests the repaint they need.

Unchanged: the pass's requests, order and pacing, the early vote proof, what the voting screen does per notification, and every other TaskResult::Refresh sender.

Tests: a pass against a mock SDK sends the scoped notification and no TaskResult::Refresh; a withdrawal form on screen is not refreshed by it while a TaskResult::Refresh still refreshes it; an open Votes view shows a contest cached just before the notification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
The pace only spaced out the spawning of contender queries; each spawned
query then waited for one of the 24 slots on its own. While answers were
slow the pace kept spawning, so queries piled up behind the slots and all
started at once when the answers arrived, well above the request allowance.

The dispatcher now takes the slot first and waits for the pace second, so
a query starts as soon as it is spawned and no sooner than one pace after
the query before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…ld-load-early-vote-state

Brings in the fix that takes a query slot before waiting for the pace.
Both dispatch calls of this branch, for the open contests and for the
rest, now pass the shared slots and the contender query to start_in_order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
The first-load test sampled the vote state for a second and relied on the
paced back-fill outlasting that. A loaded machine could stretch the
sampling past the end of the pass and fail the test.

The pass now reports to a channel with room for one report, so it gets
only as far as the reports the test takes: the proof is awaited report by
report and the back-fill stays held while the vote state is checked.

A second test answers every contender read. It checks that the votes are
not proved before the read of the open contest has finished, and that
history read to its outcome does not show as waiting for a vote while the
rest is still unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…contest-refresh-notifies-voting-screens-only

Brings in the fix that takes a query slot before waiting for the pace and
the first-load tests that hold the back-fill by its reports. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…r the proof

The helper took reports until the stored proof became visible. Another
worker could publish the proof right after an earlier report was taken, so
the helper returned with a report still filling the one-slot channel. The
pass then stayed blocked on its proof report and never began the
back-fill, and the answered-history test failed with "no history was read".

A pass sends its reports in a fixed order. Both tests now take exactly the
reports up to and including the proof report, which puts the pass in the
back-fill whichever task ran first, and then check the vote state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…contest-refresh-notifies-voting-screens-only

Brings in the first-load tests that take a fixed number of pass reports
instead of polling for the proof. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Conflict in CHANGELOG.md: both entries kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…-early-vote-state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…-refresh-notifies-voting-screens-only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
* fix(dpns): let operators vote while a long contest history loads

On a first load the voting choices and the Votes badge waited for the whole
paced back-fill, about two minutes for a thousand contests: both need each
node's proved votes, and the pass read those only after its last contender
query.

Reading them earlier was not safe as it stood. A listed contest nobody has
read yet has no end time and counts as open, so every unread finished
contest would have shown as waiting for a vote.

- While a pass runs, the names it has listed but not read, and has no end
  time to call open, are left out of the open contests. Each returns as soon
  as its contenders arrive, and whatever is left returns when the pass ends,
  however it ends. The set lives in memory only.
- When a pass has such unread history, it proves the nodes' votes right
  after the open contests are read and refreshes the screen, then
  back-fills. The proof at the end of the pass is kept.

A pass on a filled cache has nothing unread, takes neither step and sends
the same requests as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* fix(dpns): keep unread contest names out of the open list after a restart

The names a first load had listed but not read were kept out of the open
contests by a set held in memory for the length of the pass. The early vote
proof, however, is stored. Quitting during a first load and starting again
within the proof's lifetime — or a pass that ended with names still unread —
left every unread name counted as an open contest the node had not voted
on: a badge in the hundreds and enabled choices on finished contests.

- A name that was only listed (never read, no end time, no contenders) is
  not an open contest, wherever the open contests are read. The rule lives
  on the contest itself, so it holds in a new process and after any pass.
  The in-memory set, its guard and its lock are gone.
- While a pass is running and unread names remain, To decide and Voted say
  the contests are still loading instead of saying none are open.

Tests that seeded such a bare name as an open contest now give it an end
time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(dpns): hold the contest back-fill by its reports instead of by time

The first-load test sampled the vote state for a second and relied on the
paced back-fill outlasting that. A loaded machine could stretch the
sampling past the end of the pass and fail the test.

The pass now reports to a channel with room for one report, so it gets
only as far as the reports the test takes: the proof is awaited report by
report and the back-fill stays held while the vote state is checked.

A second test answers every contender read. It checks that the votes are
not proved before the read of the open contest has finished, and that
history read to its outcome does not show as waiting for a vote while the
rest is still unread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

* test(dpns): take a fixed number of pass reports instead of polling for the proof

The helper took reports until the stored proof became visible. Another
worker could publish the proof right after an earlier report was taken, so
the helper returned with a report still filling the one-slot channel. The
pass then stayed blocked on its proof report and never began the
back-fill, and the answered-history test failed with "no history was read".

A pass sends its reports in a fixed order. Both tests now take exactly the
reports up to and including the proof report, which puts the pass in the
back-fill whichever task ran first, and then check the vote state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…x/contest-refresh-notifies-voting-screens-only

The squash commit's tree equals this branch's already-merged view of
#1067 on top of its parent, so it is recorded as merged without changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Conflict in CHANGELOG.md: both entries kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…-notifies-voting-screens-only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…voting-key helpers

Loading a masternode or evonode now uses `voter_identity_id` and
`select_voting_key` from the SDK instead of DET's own derivation and
key matching. The typed `ProTxHash` guards the byte-order trap the raw
derivation left open.

Behaviour change: a voting key the network has disabled (what replacing
the key leaves behind) is refused at load time with its own message.
Before, such a node loaded fine and only failed later, when voting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Name -> identity lookups (load identity by name, DashPay contact
requests), the DashPay prefix search and the per-contact username read
now call `Sdk::resolve_dpns_name`, `Sdk::search_dpns_names` and
`Sdk::get_dpns_usernames_by_identity` instead of hand-written DPNS
document queries. `extract_identity_id_from_dpns_document` loses its
last caller and goes.

Behaviour: a name whose record carries its identity as plain bytes now
resolves; a name document without a readable record is reported as
"name not found" rather than as an invalid document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
Four identity-loading paths (by id, by name, from a wallet, discovery)
each carried a copy of the `records.identity` name query and its
decoding. They now call the existing `fetch_owned_dpns_names`.

The SDK's owned-names reader was not used on purpose: it drops the
document timestamps DET shows as the registration date, and the
platform-wallet reader that keeps them needs a wallet handle a
masternode-only install does not have.

Behaviour: a failed name read while loading by name now carries the
same "could not look up names" message as the other loading paths, and
a name document whose label is not text is skipped instead of being
listed with an empty name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
`register_dpns_name` no longer builds the `preorder` and `domain`
documents or broadcasts them itself: `Sdk::register_dpns_name` does.
Every guard around the broadcast is unchanged: name validation, the
vote-fee approval, the availability re-check before paying, and
`resolve_failed_domain_broadcast` for a name request that failed after
the first document was paid for.

The SDK reports one error for both documents. Its `preorder_callback`
fires between them, once the first is confirmed, and that is what keeps
"nothing was sent" apart from "the name request failed and may have
been applied" - the distinction that stops a user paying twice.

The contest rule is asked of the network's DPNS contract through
Platform's own `contested_vote_poll_for_document_properties`, so the
approval check needs no document to classify.

A registered name and its date now come from the confirmed document
instead of a second read of the identity's names; a registration
accepted as sent after an error keeps the local-time entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…ent fixture

The contest rule is now asked about all four name fields of a `domain`
document, not only the two the current contract matches on, so a
contract that matches on another name field cannot read as "no vote"
while the approval check is deciding a fee.

Three test modules built their own DPNS name document; they share one
fixture now. The `model::dpns` module note no longer mentions the
document helper that was removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
The branch was cut from the pre-squash head of #1071, whose tree equals
f4962f0, so this records the base without changing any file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/dash-evo-tool/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa5e479e-84ff-42f0-b478-9dd6181f5809

📥 Commits

Reviewing files that changed from the base of the PR and between 112a4b4 and 44fcc5c.


📒 Files selected for processing (2)
  • src/backend_task/identity/register_dpns_name.rs
  • tests/backend-e2e/register_dpns.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough
📝 Walkthrough

Walkthrough

Masternode identity loading now rejects a voting key that is not usable on the selected node. Identity loading, DashPay searches, and username registration use Dash SDK name functions. Registration stores the network confirmation time when available.

Changes

Masternode voting key validation

Layer / File(s) Summary
Validate the node voting key
src/backend_task/identity/load_identity.rs, src/backend_task/identity/mod.rs, src/backend_task/error.rs, CHANGELOG.md
Identity loading selects a usable voting key that matches the node’s voting address. If no usable key matches, loading returns MasternodeVotingKeyNotUsable. Tests cover a disabled key and check that the stored voter association remains unchanged.

DPNS name workflows

Layer / File(s) Summary
Resolve identities and fetch owned names
src/backend_task/identity/discover_identities.rs, src/backend_task/identity/load_identity.rs, src/backend_task/identity/load_identity_by_dpns_name.rs, src/backend_task/identity/load_identity_from_wallet.rs, src/backend_task/identity/refresh_loaded_identities_dpns_names.rs, src/context/test_support.rs
Identity-loading paths use SDK helpers to resolve DPNS names or retrieve names owned by an identity. Name acquisition time uses the later creation or transfer timestamp.
Resolve and search DashPay names
src/backend_task/dashpay/contact_requests.rs, src/backend_task/dashpay/contacts.rs, src/backend_task/dashpay/profile.rs
Contact requests resolve usernames with the SDK. Contact enrichment retrieves a name by identity, and profile search uses SDK results’ identity references and full names.
Register and finalize DPNS names
src/model/dpns.rs, src/backend_task/identity/register_dpns_name.rs, tests/backend-e2e/register_dpns.rs, CHANGELOG.md
Registration classifies the input label and uses the SDK registration flow. Domain-stage failures are checked against network state. Finalization stores the confirmed acquisition time when available, or local time otherwise. An ignored end-to-end test registers an identity and DPNS name.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Registration as Username registration
  participant SDK as Dash SDK
  participant Network as Network state
  participant Identity as Local identity
  Registration->>SDK: Submit name registration
  SDK-->>Registration: Return confirmed document or broadcast error
  Registration->>Network: Check name after domain-stage error
  Network-->>Registration: Return name visibility
  Registration->>Identity: Save name and acquisition time
Loading

Suggested reviewers: lklimek


Merge Risk: ⚪ Minimal · up to 44fcc

No newly established issue prevents merging after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 13 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the main changes: SDK-based DPNS registration and lookups, plus the voting-key check.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 44fcc5c) · triage: critical · Phase 2 only (no Phase 1 for this repository)

@thepastaclaw thepastaclaw left a comment

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.

Final validation — Phase 2 only (no Phase 1 for this repository)

The production callback is correctly wired, and the pinned SDK invokes it after preorder confirmation and before submitting the domain document; no blocking issue was confirmed. The new tests leave that callback-to-failure-classification connection unexercised, so one non-blocking coverage suggestion remains. Validation was static only: the supplied CI snapshot shows Clippy passing and the Test Suite still running.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The cross-cutting refactor includes intricate changes in src/backend_task/identity/register_dpns_name.rs to paid registration broadcasts, fee-approval classification, and post-payment failure handling that prevents duplicate payments, directly changing a funds-movement surface.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/backend_task/identity/register_dpns_name.rs`:
- [SUGGESTION] src/backend_task/identity/register_dpns_name.rs:569-578: Exercise the actual preorder callback in the paid-stage failure test
  This test passes `true` directly to `BroadcastFailure::at_stage`, so it verifies the classifier but not the new callback wiring that records preorder confirmation. The adapter test at lines 582–601 exercises only failure before confirmation, while the reconciliation tests call `resolve_failed_domain_broadcast` directly. Removing `preorder_callback` or updating a different flag would therefore leave these tests green while incorrectly routing a post-preorder failure through the plain failure path instead of payment reconciliation. The production wiring and the pinned SDK's callback ordering are correct today, making this a non-blocking regression-coverage gap. Add a narrow injectable SDK invocation seam that receives the production `SdkRegistrationInput`, invokes its actual callback, and returns an SDK error; assert that the adapter returns `BroadcastFailure::Domain` rather than `Preorder`.

@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot removed the waiting-bots Waiting for the review bots to report on this head label Oct 12, 2026
lklimek and others added 2 commits October 12, 2026 09:32
Nothing checked that `broadcast_name_registration` hands the SDK a
callback that sets the flag it reads afterwards: dropping the callback
kept every test green while a failure after the paid first document
would have been reported as a plain failure.

The SDK call is now passed into `broadcast_name_registration_with`, so a
test can stand in for the SDK: invoke the real callback from the input
production code built, fail, and expect the paid stage. Production calls
the same function with `Sdk::register_dpns_name`; behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
…platform addresses

Adds `test_register_dpns_name_funded_from_platform_addresses` next to
the Core-funded test. It spends no Core funds: it reads the credits
already on the framework wallet's platform addresses, fails early with
needed vs available credits when one address cannot cover the run,
registers an identity from that address and then a 20+ character name,
and verifies the name by search.

The identity index is drawn from 1,000,000..2,000,000 and confirmed
unused by asking the network for every key derived at that index. The
amounts come from the app's fee estimator; the name allowance covers
4 KiB of stored data.

Passed on testnet against this branch: the creation fee was charged to
the credits left on the funding address, and the name cost 75,646,740
credits against an allowance of 112,510,400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YneRVSNLhVnGiedWDr3fw
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 12, 2026

@thepastaclaw thepastaclaw left a comment

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.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

Verified the complete diff at head 7faaacf and the relevant pinned SDK implementations; no blocking defects were found, and the prior preorder-callback coverage finding is fixed. One non-blocking coverage gap remains in the successful registration's confirmation-date wiring. This was a static review: the supplied exact-head CI snapshot reports successful Test Suite, Clippy, and Platform pin guard checks, with PR Hygiene pending; the ignored live-network test was not independently reproduced.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The cross-cutting refactor changes paid DPNS registration in src/backend_task/identity/register_dpns_name.rs, replacing document construction and broadcasts with an SDK call whose callback determines whether a failure occurred after payment and how double-payment protection applies.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/backend_task/identity/register_dpns_name.rs`:
- [SUGGESTION] src/backend_task/identity/register_dpns_name.rs:532-541: Exercise the successful registration’s confirmation-date wiring
  This test passes `Some(4_242)` directly to `finish_username_registration`, so it verifies persistence of a supplied date but bypasses extraction from the successful SDK response at line 207. Changing that success arm to `Ok(_) => None` would restore local-time dates without affecting this assertion. The new backend-e2e test also checks only the registration outcome and resolved identity, then loads the identity by name, which re-fetches and saves its names. Add a success-path test with a controlled confirmed document timestamp that reaches persistence through the production registration wiring. Alternatively, extend the live test to compare the locally saved date with the network document's timestamp immediately after registration, before `SearchIdentityByDpnsName` refreshes the owned names.

…ent's date

Nothing checked that the success arm of the registration broadcast feeds
the confirmed name document's date into what is saved: the only date
test handed a timestamp straight to `finish_username_registration`, so
`Ok(_) => None` would have brought local-time dates back unnoticed.

The SDK call is now passed into `register_dpns_name_through`, one level
above the previous seam, which `broadcast_name_registration` absorbs. A
test runs the whole registration with a stand-in that returns a name
document dated 4242 and expects that date on the saved name. Production
passes `Sdk::register_dpns_name`; behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@thepastaclaw thepastaclaw left a comment

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.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

Independently reviewed the complete diff at 44fcc5c against the pinned SDK implementation and found no actionable in-scope issues. Both prior coverage suggestions are fixed: the tests now exercise production preorder-callback wiring and confirmed-document date persistence. This was static verification only; the supplied CI snapshot shows Clippy and Test Suite still running, with Platform pin guard passing.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The substantial refactor in src/backend_task/identity/register_dpns_name.rs changes paid registration broadcasts, signer handoff, and callback-based failure classification that prevents repeat payment, meeting the intricate-change and funds-movement criteria.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: lklimek.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 12, 2026
@github-actions
github-actions Bot requested a review from lklimek October 12, 2026 10:55
@lklimek
lklimek enabled auto-merge (squash) October 12, 2026 11:38
@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot removed the ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. label Oct 12, 2026
@lklimek
lklimek merged commit fd1cac8 into v1.0-dev Oct 12, 2026
14 checks passed
@lklimek
lklimek deleted the refactor/dpns-use-sdk-helpers branch October 12, 2026 11:38
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.

3 participants