Repository navigation
feat(platform-wallet): delete or tombstone a DPNS name from the wallet and the iOS app - #6055
Conversation
Sdk::dpns_name_give_up_options reads a registered name and says whether the network accepts a delete, a tombstone, or either (a contested name can only be tombstoned). It refuses with ProtocolVersionNotActive when a verified answer shows the network below protocol version 15. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ity holds IdentityWallet::dpns_name_give_up_choices reports the ways the network accepts for a held name, and give_up_dpns_name performs one. The label and the name's marketplace row are dropped through the persister only after the network confirmed the name gone. Co-Authored-By: Claude Fable 5.2 <[email protected]>
platform_wallet_dpns_name_give_up_choices and platform_wallet_dpns_give_up_name marshal the wallet operations; the method crosses as a u8 (DPNS_NAME_GIVE_UP_METHOD_*), and an unknown value is refused before the wallet is touched. Co-Authored-By: Claude Fable 5.2 <[email protected]>
ManagedPlatformWallet.dpnsNameGiveUpChoices and giveUpDpnsName over the new FFI entry points. Co-Authored-By: Claude Fable 5.2 <[email protected]>
… screen A "Give Up Name…" swipe action opens a sheet that offers only the ways Rust reports, confirms each (the tombstone one states it is permanent), shows protocol version 14 networks as not available, and clears the main-name pick after a confirmed give-up. Adds TEST_PLAN rows DPNS-09..13. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
Walkthrough
Merge Risk:
|
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🔍 Review in progress (commit 6f0b57c) · live progress |
thepastaclaw
left a comment
There was a problem hiding this comment.
Preliminary review — Phase 1 blocker gate
The new wallet flow gates give-up before signing and waits for confirmation, but it can record the wrong document ID after a delete or leave a stale marketplace row after a partial persistence failure. The wallet tests exercise the cleanup helper directly, not a confirmed give-up through the public entry point. Rust workspace, JavaScript, Kotlin, and Swift schema checks passed; the Swift SDK build and tests are still pending.
Validated blockers were found by the Phase-1 review and confirmed by a fresh verifier. Phase 2 is deferred until a fresh same-head revalidation clears the blocker gate.
🔴 2 blocking | 🟡 2 suggestion(s) | 💬 2 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-gate-verifier, role: verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The diff adds a cross-layer client workflow that reuses existing DPNS transitions and key-selection logic without materially changing consensus, funds movement, or signing mechanics. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— verifier; agentsol-gate-verifier - Phase 2 reviewers: not run (deferred by blocker gate)
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:163-172: Bind the delete to the domain the wallet checked
The wallet checks ownership and saves `choices.document_id`, but `Sdk::delete_dpns_name` looks up the label again and builds the delete from that second document. If the same identity deletes and re-registers the name from another client between the reads, the second lookup can return a different ID and the delete can still succeed. The wallet discards the confirmed ID, then removes and reports the first ID, leaving the replacement's marketplace row untouched if present. The wallet-local operation gate cannot serialize another client. Build the delete for the preflight document, or require its expected ID in the SDK's second lookup and reject a mismatch before signing; a post-broadcast check alone would not prevent deleting the replacement.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:206-214: Keep confirmed give-up cleanup recoverable after a failed row write
`record_dpns_name_states` removes the row from memory and only logs a failed store. The new give-up path then separately persists the label removal and returns success. On a backend where the first write is rejected and the second succeeds, the durable marketplace row can still say `Owned` after the label is gone. Sync builds departure candidates from prior labels and in-memory rows, both now missing the name; it does not enumerate durable marketplace rows to find this orphan. The give-up path should commit both local changes together or retain a retryable cleanup record before dropping the label. Keep the confirmed network result distinct from local cleanup failure so the caller does not retry the broadcast.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs:322-341: Exercise a confirmed write through the public wallet API
The cleanup test constructs `DpnsNameGiveUpChoices` and calls `forget_given_up_dpns_name` directly. The public write tests stop before broadcast, including the signer-unavailable case. They would still pass if the public API dispatched to the wrong SDK method, lost the tombstone ID, or invoked cleanup too early. Add a mocked confirmation test through `give_up_dpns_name` that checks the returned IDs, verifies cleanup happens only after confirmation, and confirms that the persister retains the sibling names.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:249: Show an error if the wallet unloads before confirmation
The loaded phase stores the choices, not the wallet. If the manager no longer has that wallet when the user confirms, the dialog closes and `submit` returns without starting the operation or displaying an error. Set `submitError` in the missing-wallet branch, using the same message as the initial load.
In `packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs`:
- [NITPICK] packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs:939-943: Document the other version-refusal results on both FFI functions
Both typed-results sections list code 70, but `error.rs` maps a refusal with `pinned: true` to `ErrorSdkPinnedBelowProtocolVersion` (75) and an unpinned refusal with a failed version probe to `ErrorUnknown`. Document those mappings here and on `platform_wallet_dpns_name_give_up_choices` so callers can distinguish a verified older network from an SDK pin or a version probe that failed.
In `packages/rs-sdk/src/platform/dpns_usernames/give_up.rs`:
- [NITPICK] packages/rs-sdk/src/platform/dpns_usernames/give_up.rs:503-506: Name the contested flag in the shared lookup result
Both callers interpret the tuple's final `bool` as `is_contested`, but the return type does not convey that meaning. A small private result struct would put the contract, document, and contested flag names in the type without changing the public API.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Direct SDK delete path can broadcast below v15 without the new gate — The base already documents and implements network-side refusal for direct deletes below v15. This PR extracts the domain lookup and contested check unchanged; it does not move or alter the direct write's version-refusal behavior. The new wallet write already invokes the gated choices read before signing, so the mobile feature does not rely on that older behavior. Changing the direct SDK and WASM write behavior is outside this PR's scope.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…tore a give-up in one changeset Sdk::delete_dpns_domain deletes a domain document the caller already read, so the wallet's delete can not remove a name registered again meanwhile from another client. The confirmed give-up's label removal and marketplace-row removals now go to the backend in one changeset, applied in memory only once stored; on a refused store the label stays and the next marketplace sync removes the name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cument every version refusal Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The delete now targets the document checked by the wallet, but the confirmation sheet can still submit against a replacement registration, and an unresolved broadcast can be followed by another destructive write. The new paths also have wallet-lifecycle, ownership-refresh, protocol-gating, and FFI defects. This was a static review: the current checks showed no failed code check, the Kotlin emulator job was pending, and a linked iOS build was not verified.
🔴 9 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (2)
- 🔴 Blocking: Keep confirmed give-up cleanup recoverable after a failed row write —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:256-308(thread) - 🟡 Suggestion: Exercise a confirmed write through the public wallet API —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs:433-456(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change is substantial and cross-layer, but it adds a client workflow around existing protocol operations and signing-key selection rather than changing consensus, signature or key-handling rules, or storage schemas. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:190-191: Prevent an in-flight ownership refresh from restoring a released name
This gate orders give-up against marketplace sync, but not against `sync_dpns_names`, identity loading, or discovery. Those paths can read the label before confirmation and acquire the manager write lock after cleanup. `apply_fetched_dpns_names` merges labels for wallet-owned identities, so the late result adds the released label back and SwiftData marks it owned again. The manager lock orders the stores, not the observations behind them. Order the owned-name fetch-and-apply paths against give-up in Rust, or reject observations superseded by a confirmed removal. Test a refresh that reads the old ownership and resumes after cleanup.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:198-229: Bind publication and cleanup to the live wallet generation
Wallet removal takes the generation's lifecycle gate, not `dpns_operation_gate`. Removal can therefore complete while give-up waits for the external signer, and the old operation can still broadcast once the signer returns. If the wallet is recreated under the same ID, `forget_given_up_dpns_name` then looks up the replacement by ID alone and can persist changes to it. Use the post-signing generation guard pattern from `contact_requests.rs` to check liveness and order publication against teardown without blocking removal on host approval. Apply cleanup and the balance refresh only to the originating generation.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:256-308: Keep confirmed give-up cleanup recoverable after a failed row write
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4657893255)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:257-267: Preserve the reviewed registration through confirmation and reporting
The sheet loads `choices.documentId` but submits only the owner, label, and method. If the same identity replaces registration A with B while the sheet is open, the wallet's fresh lookup accepts B and the exact-document delete removes it. Pass the reviewed ID through Swift and C and reject a mismatch in the Rust wallet before signing. Keep the receipt honest about the limit of that check: a tombstone consumes by owner and normalized label at execution, so even after a matching preflight it can consume a replacement. `DpnsNameGivenUp.document_id` currently reports the preflight ID as the removed document in Rust, C, and Swift. Report the confirmed tombstone ID without claiming the consumed domain ID, or explicitly identify the latter as an observation from preflight.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:273-277: Do not allow another give-up while the first broadcast is unresolved
Rust preserves an ambiguous submission and the FFI maps it to `.transactionBroadcastUnconfirmed`, but this catch displays “Give-up failed” and re-enables both actions using the old choices. The first transition can still land; if a second preflight sees the domain, the second tap can sign a fresh transition and incur another fee or submit a permanent tombstone while a delete remains unresolved. Show an explicit unconfirmed state and have the Rust wallet reconcile the original submission before allowing another give-up of that name. A sheet-only guard is insufficient because reopening the sheet or using another wallet API caller bypasses it.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:287-295: Clear the matching main-name pick in the confirmed cleanup round
Only the sheet clears `mainDpnsName`, in a second save whose error it discards. If the app exits between the wallet commit and that save, or the save fails, the old preference remains on disk. `upsertDPNSNames` intentionally preserves an omitted pick, and its persistence tests show that owning the same label again makes the old pick active. Carry an explicit confirmed give-up in the Rust persistence delta and clear the matching preference in the same SwiftData round. Do not infer a give-up from an ordinary snapshot that omits a name.
In `packages/rs-sdk/src/platform/dpns_usernames/give_up.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/dpns_usernames/give_up.rs:492-508: Use the negotiated protocol and active contract for give-up
`network_proven_below(15)` answers only what the network runs. A v14-pinned SDK on a verified v15 network passes preflight and can advertise tombstoning instead of returning code 75; the write's `fetch_current_dpns_contract` later rejects the version mismatch. Use the pin-aware `establish_protocol_requirement` for the choices preflight and the new standalone `delete_dpns_domain`, which currently bypasses preflight and can submit a delete that PV14 rejects with a paid consensus error. Use the active DPNS contract for tombstone key selection too: the wallet's generic contract fetch can accept a still-fresh PV14 proof and reject the missing `tombstone` type before the SDK reaches its version-checked fetch. In Swift, route a pin refusal to an SDK-update explanation, not the generic Retry path or an old-network message.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DpnsMarketplace.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DpnsMarketplace.swift:795-811: Reject Swift inputs that cannot cross the give-up ABI unchanged
Both wrappers pass `name.withCString` to Rust's `CStr::from_ptr`. An embedded NUL silently changes the target to the prefix, so choices and submission can both act on a different owned name from the one supplied. Both wrappers also pass the public `Identifier` alias for `Data` to `withFFIBytes`, which traps if the byte count is not 32. Reject embedded NULs with the existing `KeyDerivation.requireNoNUL` helper and reject malformed identity IDs with `.invalidParameter` in both methods before FFI. These checks enforce the ABI representation, not DPNS naming policy.
In `packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs:991-1000: Release the wallet registry lock before calling the worker
`HandleStorage::with_item` holds the process-wide read lock until its closure returns. Here that includes waiting for synchronous host signer and persistence callbacks. A callback that destroys even an unrelated wallet alias needs a write lock on the same registry, so the callback and the export wait on each other. Clone the identity wallet under the registry guard and run `block_on_worker` after dropping it, as `platform_wallet_document_erase_and_observe` does. Shorten the guard in the choices export as well so an unrelated wallet teardown does not wait on its network read.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs:433-456: Exercise a confirmed write through the public wallet API
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4657893257)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
… shown, on the generation that sent it - The SDK gate also refuses a give-up an SDK pinned below protocol version 15 can not build, and Sdk::delete_dpns_domain runs the gate. - give_up_dpns_name takes the expected domain document id and refuses a name registered again since it was checked, before signing. - The host signs through the contact-request GatedSigner: a wallet removed while the host signed sends nothing, and the bookkeeping runs on the generation that sent the give-up. - Cleanup stores the row removal first, then the label, each applied in memory only once stored, so no step relies on an atomic backend. - The FFI releases the wallet registry lock before the worker runs, and platform_wallet_dpns_give_up_name takes expected_document_id. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fter an unconfirmed give-up The wrappers refuse a name with an embedded NUL and identifiers that are not 32 bytes, and pass the shown document id. The sheet shows a pinned SDK as needing an app update and an unconfirmed give-up as sent, not confirmed, with nothing more offered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head binds deletion to the reviewed document, guards publication against wallet removal during signing, and rejects SDK pins below protocol version 15. Two newly verified blockers concern key selection and a lock cycle with concurrent marketplace calls; one lower-priority suggestion was omitted under the comment budget. Kotlin SDK CI passed, review and hygiene checks are pending, and the available evidence does not establish a completed iOS link or test run.
🔴 6 blocking | 🟡 3 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Select a key authorized for the whole give-up transition
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace.rs:1005-1012
available_signing_key takes the first signer-accessible key at the required level without checking contract bounds or expiry. A DPNS/domain-only key is refused locally by sign_external_with_options when signing a tombstone, but the wallet never tries a usable key later in the list. A DPNS/tombstone-only key passes that local check and reaches Platform, where batch validation also checks the domain that the create consumes and returns a paid ContractBoundedKeyOutOfBoundsError. Use the wallet's usable_authentication_key policy, extended to cover the created and consumed types, and test that an earlier bounded key does not mask a later eligible one.
Raised on code unchanged since the last review, and confirmed by an independent pass: On protocol v15, a wallet that owns a registered name and can sign with both a lower-ID DPNS/domain-only authentication key and a higher-ID eligible unbound key cannot tombstone the name: the wallet selects the scoped key, local signing rejects it, and the wallet never tries the unbound key. If the first key is instead scoped to DPNS/tombstone, the SDK broadcasts the create, but Platform rejects it with ContractBoundedKeyOutOfBoundsError, a paid failure if included in a block; the name remains registered.
source: gpt-6.2-astra (phase2-reviewer: general)
Still open from earlier rounds (3)
- 🔴 Blocking: Keep confirmed give-up cleanup recoverable after a failed row write —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:300-312(thread) - 🔴 Blocking: Prevent an in-flight ownership refresh from restoring a released name —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:253-256(thread) - 🔴 Blocking: Clear the matching main-name pick in the confirmed cleanup round —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:321-328(thread)
Disputed — left to maintainers (1)
- 🟡 Suggestion: Exercise a confirmed write through the public wallet API —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs:322-341(thread)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The change is intricate and directly affects key selection and signature authorization:IdentityWallet::give_up_dpns_nameselects a key for the specific DPNS document type and binds submission to the wallet generation that authorized signing. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Code unchanged since the last final review (
978bd71c): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace.rs:1005-1012: Select a key authorized for the whole give-up transition
`available_signing_key` takes the first signer-accessible key at the required level without checking contract bounds or expiry. A `DPNS/domain`-only key is refused locally by `sign_external_with_options` when signing a tombstone, but the wallet never tries a usable key later in the list. A `DPNS/tombstone`-only key passes that local check and reaches Platform, where batch validation also checks the `domain` that the create consumes and returns a paid `ContractBoundedKeyOutOfBoundsError`. Use the wallet's `usable_authentication_key` policy, extended to cover the created and consumed types, and test that an earlier bounded key does not mask a later eligible one.
_Raised on code unchanged since the last review, and confirmed by an independent pass: On protocol v15, a wallet that owns a registered name and can sign with both a lower-ID DPNS/domain-only authentication key and a higher-ID eligible unbound key cannot tombstone the name: the wallet selects the scoped key, local signing rejects it, and the wallet never tries the unbound key. If the first key is instead scoped to DPNS/tombstone, the SDK broadcasts the create, but Platform rejects it with ContractBoundedKeyOutOfBoundsError, a paid failure if included in a block; the name remains registered._
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:230-249: Do not allow another give-up while the first broadcast is unresolved
The sheet now stops on code 20, but the Rust wallet returns the error and releases `dpns_operation_gate` without recording the submission. Before the first delete lands, a reopened sheet or another caller can read the same document ID and submit a tombstone. That second transition can permanently retire the name before the delete frees it. Even a second delete can incur a refusal fee: the same document ID does not make two separately signed transitions idempotent. Retain the unresolved submission in Rust and reconcile it before signing either method again. A proof that the domain still exists does not prove that the first transition failed.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:202-203: Release the registry guard in callers that wait behind a give-up
The new exports release their own registry guards, but a concurrent `platform_wallet_dpns_marketplace_sync` or `_sync_detailed` still waits for this same operation gate from inside `with_item`. If give-up is waiting for its host signer and that callback destroys a wallet alias, `platform_wallet_destroy` needs the registry write lock. Sync is holding the read lock until give-up releases the gate, and give-up cannot proceed until the callback returns. Move `block_on_worker` outside `with_item` in the sibling exports that can wait on this gate, including the trade writes.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:348-350: Use the negotiated protocol and active contract for give-up
The pin refusal, standalone delete preflight, and Swift code-75 route are fixed. Tombstone key selection still uses a generic `DataContract::fetch`, which can accept a fresh PV14 proof even after the SDK has verified PV15. That schema lacks `tombstone`, so the wallet returns a missing-type error before the SDK reaches its version-checked contract fetch. Retrying the ordinary fetch does not require a current answer. Use the SDK's active contract for both key selection and construction, and test an older proof followed by a current one. This path fails before signing; the remaining issue is availability, not a paid rejection.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:102-106: Preserve definitive consensus errors in the give-up result
The fallback converts structured errors to `InvalidIdentityData(String)`. For example, DPP's local signing check can return `ContractBoundedKeyOutOfBoundsError`; after stringification the FFI cannot populate `consensus_code` or `consensus_kind`, and Swift receives `.unknown` instead of `.consensusRejection`. Preserve SDK errors that expose a definite consensus verdict after the existing balance and signer handling. Keep unconfirmed submissions typed as unconfirmed, even when their diagnostic cause contains a rejection.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:300-312: Keep confirmed give-up cleanup recoverable after a failed row write
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4657893255)
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:253-256: Prevent an in-flight ownership refresh from restoring a released name
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4658071590)
In `packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs:912-914: Zero valid output buffers before rejecting a null name
Both exports promise a zeroed output on error, but `check_ptr!(name)` returns before initializing a valid output buffer. A C caller reusing a result can retain the previous choices or receipt. Initialize the output before checking `name` in both exports, and seed the null-name tests with nonzero values; the current choices test uses a buffer the preceding call already zeroed.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:321-328: Clear the matching main-name pick in the confirmed cleanup round
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4658071617)
…onfirmed - The DPNS operation gate also records give-ups sent but not confirmed; until a read shows the name gone or held by another identity, the choices and another give-up of it are refused as unconfirmed (code 20). - The tombstone key is selected by the contract the network stores now (Sdk::fetch_current_dpns_contract, made public), not an ordinary fetch. - A definite consensus verdict stays a typed SDK error. - When the row removal can not be stored, a row for the checked document is kept in memory so the next sync removes the durable row by its id. - Every DPNS marketplace export releases the wallet registry lock before its worker runs, and the give-up exports zero their outputs first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
At 4e05b96, trade writes now skip keys bound to the wrong contract, and marketplace sync no longer reports a discarded wallet generation as refreshed. The review also found that confirmed cleanup can remove a still-owned same-label row under a different parent and that the new give-up path rejects otherwise eligible HASH160 keys. Kotlin SDK build and tests passed in CI; no completed iOS link or simulator result was reported.
A pattern across this PR's review rounds
This is review round 10, and the PR has drawn 23 blocking findings so far. 13 of them share 2 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. The hold remembers the name, not the signed attempt (7 earlier finding(s))
delete_dpns_domain and tombstone_dpns_name sign, send, and wait inside the SDK, so DpnsOperationGate keeps a session counter rather than the signed transition that state_transition_outcome needs. HoldWhenSigned fixes when the hold starts, but an endpoint refusal or an ownership read can still clear it without settling the attempt, a paid refusal can leave it stuck, and reloading the wallet loses it. The success path has a related proof gap: dpns_name_document and DocumentDeleteResult::Deleted drop the heights needed to tell whether the delete's absence proof is newer than the ownership proof, which is tracked separately in #6076.
Already tracked: #6072
2. A confirmed departure has no durable record of its own (1 new in this round, 5 earlier finding(s))
departure_candidates uses ManagedIdentity.dpns_names as both the ownership list and the reminder to finish cleanup, so a failed store can lose the reminder, apply_fetched_dpns_names can merge a departed label back, and GiveUpNameView clears the main-name pick in a separate save. forget_given_up_dpns_name now commits row removal before dropping the label, but its cold-wallet repair looks up older rows by owner and normalized label alone. That fixes the missed older registration by broadening the cleanup key, which also makes the cleanup reach an unrelated same-label registration under another parent.
Already tracked: #5019
In this round: Match the parent domain before removing same-label registrations
Suggested decision (land the prerequisite first): Land a recoverable Rust wallet give-up operation on its own before exposing the FFI write or iOS action. It should retain the signed transition before dispatch, settle that attempt using state_transition_outcome and fresh evidence, and keep the confirmed departure recoverable for the correct parent and registration until local cleanup commits. The PR description and discussion defer that work while keeping both write surfaces available.
🔴 5 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (3)
- 🔴 Blocking: Recover durable Owned rows before dropping a cold wallet's label —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:511-518(thread) - 🔴 Blocking: Do not allow another give-up while the first broadcast is unresolved —
packages/rs-platform-wallet/src/wallet/platform_wallet.rs:876(thread) - 🔴 Blocking: Reconcile the signed give-up before clearing its hold —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:279-301(thread)
Follow-up candidates (optional) (3)
New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.
🟡 Suggestion: Apply the SDK's give-up gate to deletion by name as well as by document
packages/rs-sdk/src/platform/dpns_usernames/give_up.rs:642-652
delete_dpns_domain checks require_network_gives_up_names, but the refactored delete_dpns_name reaches the same delete implementation without that preflight. WASM's dpnsDeleteName uses the latter path. On a verified PV14 network, the DPNS v2 schema still has canBeDeleted: true; the node's data trigger is what refuses the transition. The by-name call can therefore prompt for a signature and broadcast an uncontested delete the SDK already knows cannot succeed. Run the same gate before lookup and cover both entry points with a PV14 refusal test that does not invoke the signer.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, platform-versioning, rust-quality, security-auditor)
🟡 Suggestion: Describe tombstoning as irreversible for the owner
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift:392-394
The confirmation promises that nobody can ever register the name again. The DPNS v3 schema reserves the possibility of redistribution by the DAO, and the Rust SDK already documents that distinction. Keep the strong confirmation, but state what the operation guarantees: the owner cannot undo it, and nobody can register the name while the tombstone exists. Use the same wording in the explanation and the Swift and C API docs, and pin the distinction in the presentation test.
source: gpt-6.2-astra (phase2-reviewer: general)
🟡 Suggestion: Document what code 20 and NotFound mean on the choices read
packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs:891-900
The choices call does not sign anything, but Rust can return code 20 for an earlier unresolved give-up; the example app already handles it. Also, an invalid wallet handle returns NotFound before any network read, as the FFI test asserts. Document both cases in C and Swift so a host knows to suppress another give-up on code 20 and does not treat a stale handle as proof that the name is gone.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, platform-versioning, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The intricate give-up flow in rs-platform-wallet’s dpns_marketplace/give_up.rs changes both signing-key selection across all document types touched by the transition and the wallet-generation checks that govern whether the signed transition is sent. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Code unchanged since the last final review (
66c3992f): 3 new suggestion(s) listed as follow-up candidates, not posted inline; 1 follow-up candidate(s) already listed by an earlier review, not repeated - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): The hold remembers the name, not the signed attempt; A confirmed departure has no durable record of its own. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a recoverable Rust wallet give-up operation on its own before exposing the FFI write or iOS action. It should retain the signed transition before dispatch, settle that attempt using `state_transition_outcome` and fresh evidence, and keep the confirmed departure recoverable for the correct parent and registration until local cleanup commits. The PR description and discussion defer that work while keeping both write surfaces available. If that decision is not yours to make, say so to the PR's author or maintainer.
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:497-501: Match the parent domain before removing same-label registrations
Give-up checks the registration under `dash`, but the in-memory filter and durable lookup match only the owner and label, and the identity snapshot drops the bare label unconditionally. The contract's unique key is `(normalizedParentDomainName, normalizedLabel)`, and the create trigger accepts subdomains of any registered top-level parent when its rules permit them. Marketplace sync queries `records.identity` without a parent filter and stores the parent on each row. If the identity owns that label under two parents, giving up the `.dash` registration therefore also removes the other registration's marketplace row and can drop its label entry. Match the checked parent in both row-selection paths and preserve any ownership entry still needed by the other registration. Cover a sibling row with a sale price in the cleanup test.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:625-632: Allow a signable ECDSA_HASH160 authentication key to give up a name
An owner whose only eligible authentication key is `ECDSA_HASH160` can load the choices but cannot execute either method: the selector excludes the key before asking `signer.can_sign_with`. The document-batch signature path supports HASH160, Swift's KeychainSigner can supply it, and the wallet already accepts it for DashPay profile document writes. Allow both ECDSA representations in the Rust DPNS selectors while retaining the existing security-level and contract-bounds checks. Add a wallet test in which a signable HASH160 authentication key is the only candidate and reaches the SDK write.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:86-89: Encode the confirmed tombstone ID in the receipt variant
The public Rust receipt permits `Tombstone` without a tombstone ID and `Delete` with one. The current producer pairs them correctly, but the FFI flattens the fields independently and Swift rejects either mismatch as unreadable after a write has already succeeded. Represent the confirmed result as `Deleted` or `Tombstoned { tombstone_id: Identifier }`, alongside the shared label and checked document ID. Leave the request method and C layout unchanged and derive the C fields from the result variant.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:511-518: Recover durable Owned rows before dropping a cold wallet's label
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4659134425)
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:279-301: Reconcile the signed give-up before clearing its hold
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4658617111)
In `packages/rs-platform-wallet/src/wallet/platform_wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/platform_wallet.rs:876: Do not allow another give-up while the first broadcast is unresolved
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4659025006)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…nd accept HASH160 keys - The give-up cleanup matches the parent domain as well as the label, asks durable storage for the name's Owned rows one at a time until none is left, and keeps the label while the identity still owns it under another parent. - The DPNS give-up and trade key selectors accept ECDSA_HASH160 keys, as DashPay profile writes do. - DpnsNameGivenUp carries a DpnsNameGiveUpOutcome (Deleted, or Tombstoned with its id) instead of a method and an optional id; the C fields are derived from it, unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Conflicts: TEST_PLAN.md tier and layer counts (both sides added rows: Thorough 41, Uncommon 33, Platform ~87) and the generated PARITY_SUMMARY.md (regenerated). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Conflicts: TEST_PLAN.md. Kept both sides' rows (the give-up rows DPNS-09..13 and the voting rows VOTE-08/09), the base's rewritten masternode voting key prerequisite, and recounted the tiers (Thorough 43, Uncommon 33, Platform ~89). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Conflict: the generated PARITY_SUMMARY.md, regenerated from the merged manifest. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
⚠️ DEGRADED — Re-review — Final validation — Phase 1 + Phase 2
⚠️ DEGRADED review. The primary review models were unavailable (gpt-6.2-astraunavailable: Request rejected (429) · All credentials for model gpt-6.2-astra are cooling down (last error: usage_limit_reached: The ), so this review ran on stand-in models:gpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor,gpt-6.1-sol→muse-spark-1.3-contributor,gpt-6.2-astra→muse-spark-1.3-contributor,gpt-6.2-sol→muse-spark-1.3-contributor. Both review phases and the independent verifiers still ran, but on weaker models, with Phase 1 capped athigheffort. Treat the verdict as provisional; a full-strength re-review will run on the next push once the primary models are back.
Client-only DPNS give-up stack is otherwise in place with session holds, generation-gated signing and ordered durable cleanup. One residual persistence defect remains where a sibling Owned row under another parent hides an older same-parent Owned row from the single-row lookup, and the SDK activation gate is inconsistent across delete entry points.
🔴 1 blocking
Still open from earlier rounds (1)
- 🔴 Blocking: Recover durable Owned rows before dropping a cold wallet's label —
packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:588-594(thread)
Follow-up candidates (optional) (1)
New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.
🟡 Suggestion: Use the SDK's positive activation check for both delete entry points
packages/rs-sdk/src/platform/dpns_usernames/give_up.rs:510-516
network_proven_below(15) == false does not mean PV15 was established: protocol_gate.rs:326-327 returns Ok(false) when there is no context provider or the mock gate is unenforced, which require_network_gives_up_names treats as allowed. delete_dpns_domain runs that gate but delete_dpns_name (636-653) does not call it at all, so a verified-PV14 name-based delete can proceed to signing while the document-based path refuses locally. Express this as a ProtocolRequirement via establish_protocol_requirement on the choices read and both public delete paths, and test a missing provider and a verified-PV14 name-based delete asserting neither reaches the document or nonce read.
source: gpt-6.2-astra (phase2-reviewer: architecture-layering)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (standing in for gpt-6.2-astra) (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (standing in for gpt-6.2-astra) (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: muse-spark-1.3-contributor (standing in for gpt-6.2-astra) (agent: phase2-reviewer, role: platform-versioning); reviewer 5: muse-spark-1.3-contributor (standing in for gpt-6.2-astra) (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (standing in for gpt-6.2-astra) (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: sol-verifier, role: final-verifier)
- Degraded mode:
gpt-6.2-astraunavailable: Request rejected (429) · All credentials for model gpt-6.2-astra are cooling down (last error: usage_limit_reached: The (detected by lane, since 2026-11-22T18:32:16Z); stand-insgpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor,gpt-6.1-sol→muse-spark-1.3-contributor,gpt-6.2-astra→muse-spark-1.3-contributor,gpt-6.2-sol→muse-spark-1.3-contributor; Phase 1 effort capped athigh - Triage:
criticalbygpt-6.2-sol(effort low) — The new wallet give-up flow in dpns_marketplace/give_up.rs changes authentication key selection and coordinates host signing, wallet generation checks, and broadcast for irreversible DPNS transitions. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Code unchanged since the last final review (
4e05b961): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — final-verifier; agentsol-verifier - Phase 2 reviewers:
muse-spark-1.3-contributor(standing in forgpt-6.2-astra) — general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-astra) — ffi-engineer (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-astra) — platform-versioning (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-astra) — rust-quality (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-astra) — security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rs:588-594: Recover durable Owned rows before dropping a cold wallet's label
(carried; thread: https://github.com/dashpay/platform/pull/6055#discussion_r4659134425)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Conflicts: - contact_requests.rs: both sides made GatedSigner shared; kept the base's public fields (used by key limits) beside this branch's constructor, and named the DPNS writes in its doc. - TEST_PLAN.md tier and layer counts (Thorough 44, Uncommon 33, Platform ~90). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Basic explanation
What this does: From protocol version 15 (#5994) the owner of a Dash username can give it up. There are two ways: delete it, which frees the name for anybody to register, or tombstone it, which removes the name for good so nobody can register it again. Until now only JavaScript (#5998) could do this. This PR adds the same feature for mobile: one wallet operation in Rust, a C FFI entry point, a thin Swift wrapper, and a "Give Up Name…" action on owned names in the iOS example app.
Value: iOS users can drop names they no longer want and get back what is left of the name's storage fee. The protocol rules live in Rust and the app only shows what Rust reports: a contested name can only be tombstoned, and a network still at protocol version 14 has no give-up. Kotlin can reuse the same FFI later.
Risks: Low to medium. Client only, no consensus change. A tombstone can not be undone, so the app asks for a separate confirmation that says it is permanent. A deleted name can be registered by someone else at once, and the delete confirmation says so. Nothing here has been run against a network yet (see "How Has This Been Tested?"). A give-up that is broadcast but never confirmed keeps the name in the wallet until the next marketplace sync.
Issue being fixed or feature implemented
#5994 added deleting and tombstoning DPNS names at protocol version 15 to the protocol and the Rust SDK, and #5998 brought it to JavaScript. The platform wallet, its FFI, the Swift SDK and SwiftExampleApp had no way to do it.
Before opening this I searched open PRs and issues on dashpay/platform (
dpns delete,tombstone,give up,swift dpns). Nothing open covers it. The closest are #5786 and #5800 (DPNS contest policy in dash-sdk-cxx and the other bindings), which are about something else.What was done?
rs-sdk:
Sdk::dpns_name_give_up_optionsA read that answers: which ways does the network accept for this name? It is built on the same lookup
delete_dpns_nameuses, anddelete_dpns_namenow shares that lookup. It refuses withError::ProtocolVersionNotActive(required 15), before the name is read, when the SDK is pinned below 15 (pinned: true), when a verified answer shows the network below 15, or when the network's version could not be learned.platform-wallet
IdentityWallet::dpns_name_give_up_choices(owner, name)returns the choices for a name the identity holds. It returnsDpnsNameNotFoundwhen the name is not registered andInvalidParameterwhen another identity holds it.IdentityWallet::give_up_dpns_name(owner, name, expected_document_id, method, signer):expected_document_id(the registration the user was shown), so a name deleted and registered again in the meantime is never given up unseen.WalletRemovedBeforeSend), and the bookkeeping runs on the generation that sent the give-up.ECDSA_SECP256K1andECDSA_HASH160authentication keys are accepted, as for DashPay profile writes.Sdk::fetch_current_dpns_contract, the same version-checked contract the tombstone is built against. It must be allowed every document type the transition touches. A tombstone also consumes every type the contract lists inconsumable_document_type_names(), the owner'sdomainfor DPNS v3, so its key needs a security level all of them accept and contract bounds covering all of them (newusable_authentication_key_for_types, built on the existing bounds-aware selector).(owner, name)when the host's signature returns, the last step before the transition can leave the wallet. It keeps the record while the SDK reports the result unconfirmed, and releases it on any other outcome. A call cancelled before signing holds nothing; one dropped while it waits for the result keeps the hold. Each hold carries the attempt that took it, and a read clears only the attempt it saw when it started. Until a read shows the name gone or held by another identity, the choices read and any further give-up of that name are refused as unconfirmed (code 20), so a tombstone can never follow a pending delete. The record lives for the session.tombstonetype's own security level.Sdk::delete_dpns_domainfor the verydomaindocument the check read, so it can not remove a name registered again meanwhile from another client. A tombstone goes throughSdk::tombstone_dpns_name.withdraw_durablyfor the rows,store_durablyfor the snapshot) before its in-memory state is dropped, so a write buffered and then lost by a concurrent flush can't leave anOwnedrow with nothing to find it by. The label goes last, because the marketplace sync classifies departures by it: if a store fails, the label stays and the next sync finds the name gone and finishes the removal. If the row store fails, the wallet keeps an in-memory row for the checked document (even on a wallet loaded cold), so that sync removes the durable row by its id. Before dropping the label it also asks durable storage, one row at a time, for any otherOwnedrow of the name (same label under the same parent), which a cold wallet holds only on disk, and removes them too. Rows are matched by parent domain as well as label. The label is kept if a lookup fails, or while the identity still owns the same label under another parent. Nothing relies on the backend committing atomically. The give-up is still reported as confirmed, so the caller does not broadcast again.PlatformWalletError::Sdk(ProtocolVersionNotActive), so the FFI maps it to code 70.platform-wallet-ffi
platform_wallet_dpns_name_give_up_choicesandplatform_wallet_dpns_give_up_name. The method crosses as au8(DPNS_NAME_GIVE_UP_METHOD_DELETE = 0,..._TOMBSTONE = 1). Any other value is refused withErrorInvalidParameterbefore the wallet is touched. Every export indpns_marketplace.rs, not only the two new ones, and the manager-wideplatform_wallet_manager_dpns_sync_sync_now, now release the registry lock before the operation runs, asplatform_wallet_document_erase_and_observedoes. An operation that waits on the DPNS operation gate behind a give-up waiting on the host's signer can then no longer deadlock against a host callback that tears down a wallet. Both give-up exports zero their outputs before any pointer check fails. Both result structs are plain data, so there is nothing to free.Swift SDK
ManagedPlatformWallet.dpnsNameGiveUpChoices(ownerIdentityId:name:)andgiveUpDpnsName(ownerIdentityId:name:expectedDocumentId:method:signer:), withDpnsNameGiveUpMethod,DpnsNameGiveUpChoicesandDpnsNameGivenUp. Both refuse a name with an embedded NUL and an identifier that is not 32 bytes before calling the FFI. A result whose method byte is unknown, or whose tombstone id does not match its method, is rejected rather than shown.SwiftExampleApp
IdentityDetailView: a "Give Up Name…" swipe action on each owned name, shown when the identity's wallet is loaded.GiveUpNameViewsheet:SelectMainNameViewmakes, so the deleted name can not silently become the main name again if it is registered later.@Queryon owned rows), never by the view removing it.The existing DPNS trade writes
set_dpns_name_price,delist_dpns_name,transfer_dpns_nameandpurchase_dpns_namenow sign through the same generation-gated signer. The FFI exports no longer hold the wallet registry lock across the operation, so without the gate a wallet removed mid-call could still have its write sent and recorded. The marketplace's label and row writes, and the reads they rely on, also look the wallet up by generation (current_wallet_info), so a sync pass or trade started before the wallet was removed and re-created under the same id writes nothing into the replacement. They also now pick their key with the contract-bounds-aware selector, so a key bound to another contract or type is skipped. A marketplace sync pass whose wallet was replaced returnsWalletNotFoundinstead of a summary of dropped writes. Behaviour change: these four can now returnPlatformWalletError::WalletRemovedBeforeSendwhen the wallet is removed or re-created while the host signs; nothing is sent then.Known limits, tracked as follow-ups
state_transition_outcomeand persisting it across restarts is platform-wallet: track a signed DPNS name give-up and reconcile it before allowing another #6072. The parity entry marks Swiftrestart: requireduntil then.document_delete, filed as sdk: a document delete's confirmation should be proved at a block after the one it was signed against #6076.Ownedon disk, with the label kept. This needs a multi-row lookup in the persistence trait; it is recorded on DPNS departure tracking is session-scoped, so username ownership and marketplace departure classification cannot both stay correct #5019.Docs
TEST_PLAN.mdgets rows DPNS-09 to DPNS-13: delete, tombstone, contested name (tombstone only), the main name, and a network at protocol version 14. Their prerequisites and the indexes are updated too.docs/sdk/sdk-parity-manifest.jsongetsdpns.give_up_name. Swift issdk: supported, example_app: partial, since the manual gates have not been run yet. Kotlin isunsupported: there is no JNI binding, wrapper or screen.PARITY_SUMMARY.mdis regenerated.Public interface changes
All additive; existing callers compile unchanged.
dash-sdk (
dash_sdk::platform::dpns_usernames)delete_dpns_domaindeletes adomaindocument the caller already read, without looking the name up again, so a name deleted and registered again meanwhile is not removed: the network refuses the delete of the stale document. A contested domain is refused before anything is signed.delete_dpns_namekeeps its signature and behaviour.platform-wallet (
platform_wallet::wallet::identity::network)platform-wallet-ffi (C ABI)
Result codes:
ErrorProtocolVersionNotActive): the network is below protocol version 15.NotFound: the name is not registered.ErrorUnknown: a refusal whose version probe failed; it may pass on a retry.ErrorInvalidParameter: another identity holds the name, it is no longerexpected_document_id, the network does not accept that method for it, or the method byte is unknown.ErrorTransactionBroadcastUnconfirmed): the transition may have been delivered, or an earlier give-up of this name is still unconfirmed. Do not offer another give-up until a read shows the name gone.SwiftDashSDK:
DpnsNameGiveUpMethod,DpnsNameGiveUpChoices,DpnsNameGivenUp,ManagedPlatformWallet.dpnsNameGiveUpChoices(ownerIdentityId:name:),ManagedPlatformWallet.giveUpDpnsName(ownerIdentityId:name:expectedDocumentId:method:signer:).Nothing changes in stored bytes, consensus, proofs or version tables.
How Has This Been Tested?
cargo test -p dash-sdk --lib dpns_usernames: 101 passed. New tests cover:delete_dpns_domainrefuses a contested domain before any read, and deletes a given one without reading the name again;pinned: true) for the read and for the delete.cargo test -p platform-wallet --lib -- dpns key_selection: 90 passed. The 28 new ones are indpns_marketplace.rs,dpns_marketplace/tests/give_up.rsandkey_selection.rs. They cover:give_up_dpns_name(they stop at the unanswered nonce) with nothing stored changed;domainor onlytombstonebeing skipped for a later key that covers both;tombstonefor the normalized name (read back from the mock's refusal) and no delete;Alice7.DASHsettling the hold;ECDSA_HASH160key.cargo test -p platform-wallet-ffi --lib dpns: 27 passed, 5 of them new. They cover the method byte mapping, flattening, an unknown method refused before the handle lookup, null pointers and an unknown handle.cargo clippy -p dash-sdk -p platform-wallet --all-targetsandcargo clippy -p platform-wallet-ffi --all-targets -- -D warnings: no findings in touched code. The only warnings are pre-existing dead-code warnings inasset_lock/.cargo fmt --all, andpython3 scripts/check_sdk_parity_manifest.py: "OK: 31 capabilities; summary current".build_ios.sh: an existingDashSDKFFI.xcframeworkwith the freshly generated platform-wallet-ffi header swapped in.build-for-testingof SwiftExampleApp compiled every Swift file of the app and ofSwiftExampleAppTests. Linking failed only on the two new symbols (_platform_wallet_dpns_give_up_name,_platform_wallet_dpns_name_give_up_choices), which the older static library does not have.DpnsMarketplaceDecodingTests, 6 inGiveUpNamePresentationTests) compiled but were not run.Not done yet: a full iOS framework build, and running DPNS-09 to DPNS-13 on a simulator against a network at protocol version 15 and one at 14. The contested-name case also needs a name a masternode vote already awarded.
Breaking Changes
None. Every change is an addition.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
6f0b57c/skip-botsproceeds without the ones not yet reported/self-reviewedsdk-parity— you own itkotlin-sdk(packages/kotlin-sdk/PARITY_SUMMARY.md) — HashEngineeringrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs,packages/rs-platform-wallet-ffi/src/dpns_sync.rs) — HashEngineering or ZocoLini or llbartekll or romchornyirs-platform-wallet(packages/rs-platform-wallet/src/wallet/identity/network/contact_requests.rs,packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace.rs,packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/give_up.rsand 5 more) — HashEngineering or ZocoLini or llbartekll or romchornyirust-sdk(packages/rs-sdk/src/platform/dpns_usernames/give_up.rs,packages/rs-sdk/src/platform/dpns_usernames/mod.rs,packages/rs-sdk/src/sdk/protocol_gate.rs) — lklimek or shumkovswift-sdk(packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DpnsMarketplace.swift,packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift,packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/IdentityDetailView.swiftand 3 more) — llbartekll or romchornyiWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit