Skip to content

feat(platform-wallet): delete or tombstone a DPNS name from the wallet and the iOS app - #6055

Merged
QuantumExplorer merged 31 commits into
v5.1-devfrom
feat/swift-example-dpns-delete-name
Nov 22, 2026
Merged

QuantumExplorer merged 31 commits into
v5.1-devfrom
feat/swift-example-dpns-delete-name

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

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_options

A read that answers: which ways does the network accept for this name? It is built on the same lookup delete_dpns_name uses, and delete_dpns_name now shares that lookup. It refuses with Error::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.

dpns_name_give_up_options("quantum7")  -> Some { can_delete: true,  can_tombstone: true }
dpns_name_give_up_options("quantum")   -> Some { can_delete: false, can_tombstone: true }   (contested)
dpns_name_give_up_options("unused42")  -> None
on a network proven at 14              -> Err(ProtocolVersionNotActive { required: 15, network: 14, .. })

platform-wallet

  • IdentityWallet::dpns_name_give_up_choices(owner, name) returns the choices for a name the identity holds. It returns DpnsNameNotFound when the name is not registered and InvalidParameter when another identity holds it.
  • IdentityWallet::give_up_dpns_name(owner, name, expected_document_id, method, signer):
    • It runs under the DPNS operation gate and re-reads the choices. Before anything is signed it refuses a method the network does not accept, and a name that is no longer expected_document_id (the registration the user was shown), so a name deleted and registered again in the meantime is never given up unseen.
    • The host signs through the wallet's generation-gated signer (the one contact requests use): a wallet removed or re-created while the host signed sends nothing (WalletRemovedBeforeSend), and the bookkeeping runs on the generation that sent the give-up.
    • Both ECDSA_SECP256K1 and ECDSA_HASH160 authentication keys are accepted, as for DashPay profile writes.
    • The signing key is selected against 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 in consumable_document_type_names(), the owner's domain for DPNS v3, so its key needs a security level all of them accept and contract bounds covering all of them (new usable_authentication_key_for_types, built on the existing bounds-aware selector).
    • An unconfirmed give-up blocks another one. The wallet records (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.
    • A definite consensus rejection stays a typed SDK error, so the FFI reports its consensus code and kind.
    • It selects the key the same way the other DPNS writes do, now also for the tombstone type's own security level.
    • A delete goes through Sdk::delete_dpns_domain for the very domain document the check read, so it can not remove a name registered again meanwhile from another client. A tombstone goes through Sdk::tombstone_dpns_name.
    • Only after the network confirmed the name gone, it stores the removal of the name's marketplace rows, then the identity snapshot without the label, applying each in memory only once stored, and refreshes the owner's balance for the storage refund. Each step is committed durably (withdraw_durably for the rows, store_durably for the snapshot) before its in-memory state is dropped, so a write buffered and then lost by a concurrent flush can't leave an Owned row 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 other Owned row 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.
    • On any error nothing stored changes. A protocol version refusal stays PlatformWalletError::Sdk(ProtocolVersionNotActive), so the FFI maps it to code 70.

platform-wallet-ffi

platform_wallet_dpns_name_give_up_choices and platform_wallet_dpns_give_up_name. The method crosses as a u8 (DPNS_NAME_GIVE_UP_METHOD_DELETE = 0, ..._TOMBSTONE = 1). Any other value is refused with ErrorInvalidParameter before the wallet is touched. Every export in dpns_marketplace.rs, not only the two new ones, and the manager-wide platform_wallet_manager_dpns_sync_sync_now, now release the registry lock before the operation runs, as platform_wallet_document_erase_and_observe does. 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:) and giveUpDpnsName(ownerIdentityId:name:expectedDocumentId:method:signer:), with DpnsNameGiveUpMethod, DpnsNameGiveUpChoices and DpnsNameGivenUp. 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.
  • New GiveUpNameView sheet:
    • It loads the choices and shows one button per allowed way. When only a tombstone is allowed it says so; the app never checks whether a name is contested itself.
    • Delete asks for confirmation in a confirmation dialog. Tombstone uses a stronger alert that starts with "This is permanent."
    • On code 70 the sheet shows "Not available on this network yet" and offers no action. On code 75 (SDK pinned below 15) it says the app needs an update. On code 20, whether from its own give-up or when reopened while an earlier one is unresolved, it shows "Sent, not confirmed yet" and offers nothing.
    • It submits the document id it showed. An unconfirmed result moves it to "Sent, not confirmed yet" and offers nothing more, so a second paid or permanent change can't follow an unresolved one.
    • If the name is the identity's selected main name, the sheet says so. After a confirmed give-up it clears that pick, the same write SelectMainNameView makes, so the deleted name can not silently become the main name again if it is registered later.
    • The row leaves the list through persistence (@Query on owned rows), never by the view removing it.
Before: an owned name row in Identity → DPNS had no action to give the name up.
After:  swipe → Give Up Name… → Delete Name / Tombstone Name (only what the network accepts) → confirm
        → the row disappears once Platform confirms; on protocol version 14: "Not available on this network yet".

The existing DPNS trade writes

set_dpns_name_price, delist_dpns_name, transfer_dpns_name and purchase_dpns_name now 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 returns WalletNotFound instead of a summary of dropped writes. Behaviour change: these four can now return PlatformWalletError::WalletRemovedBeforeSend when the wallet is removed or re-created while the host signs; nothing is sent then.

Known limits, tracked as follow-ups

Docs

  • TEST_PLAN.md gets 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.json gets dpns.give_up_name. Swift is sdk: supported, example_app: partial, since the manual gates have not been run yet. Kotlin is unsupported: there is no JNI binding, wrapper or screen. PARITY_SUMMARY.md is regenerated.

Public interface changes

All additive; existing callers compile unchanged.

dash-sdk (dash_sdk::platform::dpns_usernames)

pub struct DpnsNameGiveUpOptions { pub domain: Document, pub can_delete: bool, pub can_tombstone: bool }
impl Sdk {
    pub async fn dpns_name_give_up_options(&self, name: &str) -> Result<Option<DpnsNameGiveUpOptions>, Error>;
    pub async fn delete_dpns_domain<S: Signer<IdentityPublicKey>>(&self, domain: Document, identity_public_key: &IdentityPublicKey, signer: &S) -> Result<DocumentDeleteResult, Error>;
    pub async fn fetch_current_dpns_contract(&self) -> Result<DataContract, Error>; // was private, now public
}
pub fn normalize_dpns_label(input: &str) -> String; // was private, now public

delete_dpns_domain deletes a domain document 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_name keeps its signature and behaviour.

platform-wallet (platform_wallet::wallet::identity::network)

pub enum DpnsNameGiveUpMethod { Delete, Tombstone }
pub struct DpnsNameGiveUpChoices { pub document_id: Identifier, pub label: String, pub can_delete: bool, pub can_tombstone: bool }
pub struct DpnsNameGivenUp { pub document_id: Identifier, pub label: String, pub outcome: DpnsNameGiveUpOutcome }
pub enum DpnsNameGiveUpOutcome { Deleted, Tombstoned { tombstone_id: Identifier } } // with fn method(&self) -> DpnsNameGiveUpMethod
impl IdentityWallet {
    pub async fn dpns_name_give_up_choices(&self, owner_identity_id: &Identifier, name: &str) -> Result<DpnsNameGiveUpChoices, PlatformWalletError>;
    pub async fn give_up_dpns_name<S: Signer<IdentityPublicKey> + Send + Sync>(&self, owner_identity_id: &Identifier, name: &str, expected_document_id: &Identifier, method: DpnsNameGiveUpMethod, signer: &S) -> Result<DpnsNameGivenUp, PlatformWalletError>;
}

platform-wallet-ffi (C ABI)

#define DPNS_NAME_GIVE_UP_METHOD_DELETE 0
#define DPNS_NAME_GIVE_UP_METHOD_TOMBSTONE 1
typedef struct { uint8_t document_id[32]; bool can_delete; bool can_tombstone; } DpnsNameGiveUpChoicesFFI;
typedef struct { uint8_t document_id[32]; uint8_t method; bool has_tombstone; uint8_t tombstone_id[32]; } DpnsNameGivenUpFFI;
PlatformWalletFFIResult platform_wallet_dpns_name_give_up_choices(Handle wallet, const uint8_t *owner_identity_id, const char *name, DpnsNameGiveUpChoicesFFI *out_choices);
PlatformWalletFFIResult platform_wallet_dpns_give_up_name(Handle wallet, const uint8_t *owner_identity_id, const char *name, const uint8_t *expected_document_id, uint8_t method, SignerHandle *signer, DpnsNameGivenUpFFI *out_given_up);

Result codes:

  • 70 (ErrorProtocolVersionNotActive): the network is below protocol version 15.
  • 75: the SDK is pinned below 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 longer expected_document_id, the network does not accept that method for it, or the method byte is unknown.
  • 20 (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.
  • 31: the signing key is unavailable.

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:
    • a name that is not contested offers both ways;
    • a contested name offers only a tombstone;
    • an unregistered name offers nothing;
    • a network proven at 14 is refused before any read;
    • version 15 is the first one whose DPNS contract has tombstones;
    • delete_dpns_domain refuses a contested domain before any read, and deletes a given one without reading the name again;
    • an SDK pinned below 15 is refused (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 in dpns_marketplace.rs, dpns_marketplace/tests/give_up.rs and key_selection.rs. They cover:
    • the choices, including another holder and a name that is not registered;
    • the refusal below 15, for the read and for both write methods, with the name kept;
    • a contested delete refused before signing;
    • a give-up the network did not accept (no signing key) changing nothing stored;
    • both methods sent to the network through give_up_dpns_name (they stop at the unanswered nonce) with nothing stored changed;
    • a registration other than the one shown refused before signing, for both methods;
    • a confirmed give-up removing the rows first, then the label, and keeping the identity's other names;
    • a refused row store keeping the label, and on a cold wallet a row for the checked document, for the next sync;
    • an unconfirmed give-up refusing the choices and both write methods, and being settled once the name is gone;
    • a definite pre-send failure leaving no hold;
    • a key bound to only domain or only tombstone being skipped for a later key that covers both;
    • the hold starting only once a signature returns, and a read clearing only the attempt it saw;
    • the cleanup storing rows before the label, keeping both when the row removal is not committed, and keeping the label when the snapshot without it is not stored;
    • with the nonce answered and a fixed-signature signer, a delete sending exactly the delete of the checked document at the next nonce, and a tombstone sending exactly one document create of type tombstone for the normalized name (read back from the mock's refusal) and no delete;
    • an absent name asked for as Alice7.DASH settling the hold;
    • a handle whose wallet was removed and re-created under the same id writing nothing into the replacement, and its sync pass reported as discarded;
    • an older registration's row held only in durable storage being removed with the given-up one, and the label kept when that lookup fails;
    • a trade write skipping a key bound to another contract;
    • a registration of the same label under another parent left alone, and a give-up signed with an ECDSA_HASH160 key.
  • 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-targets and cargo clippy -p platform-wallet-ffi --all-targets -- -D warnings: no findings in touched code. The only warnings are pre-existing dead-code warnings in asset_lock/.
  • cargo fmt --all, and python3 scripts/check_sdk_parity_manifest.py: "OK: 31 capabilities; summary current".
  • Swift was compile-checked without build_ios.sh: an existing DashSDKFFI.xcframework with the freshly generated platform-wallet-ffi header swapped in.
    • The SwiftDashSDK package built.
    • build-for-testing of SwiftExampleApp compiled every Swift file of the app and of SwiftExampleAppTests. 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.
    • The new Swift unit tests (4 in DpnsMarketplaceDecodingTests, 6 in GiveUpNamePresentationTests) 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:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 6f0b57c

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Reviewer requests paused — your 5 review slots are occupied; this PR is excluded from reviewers' queues. Required approvals still count without a slot.
  • Build running
  • Approvals
    • sdk-parity — you own it
    • kotlin-sdk (packages/kotlin-sdk/PARITY_SUMMARY.md) — HashEngineering
    • rs-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 romchornyi
    • rs-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.rs and 5 more) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • rust-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 shumkov
    • swift-sdk (packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DpnsMarketplace.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/IdentityDetailView.swift and 3 more) — llbartekll or romchornyi

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
    • Added support for checking available ways to give up a registered DPNS name and choosing deletion or permanent tombstoning where available.
    • Added a Swift example-app flow to review and confirm the action. Owned names now include a “Give Up Name” option.
    • Give-up actions require protocol version 15. The app reports unavailable or unconfirmed operations and updates the displayed name after confirmation.
  • Documentation
    • Added Swift example-app test scenarios for deletion, tombstoning, contested names, main names, and protocol-version restrictions.

QuantumExplorer and others added 6 commits November 22, 2026 17:52
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]>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 92300b4 and b84fa7f.

Files selected for processing: 21

  • docs/sdk/sdk-parity-manifest.json
  • packages/kotlin-sdk/PARITY_SUMMARY.md
  • packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs
  • packages/rs-platform-wallet-ffi/src/dpns_sync.rs
  • 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.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/dpns_marketplace/tests/give_up.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/identity_handle.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/key_selection.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/mod.rs
  • packages/rs-platform-wallet/src/wallet/platform_wallet.rs
  • 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
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DpnsMarketplace.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/GiveUpNameView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/IdentityDetailView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/GiveUpNamePresentationTests.swift
  • packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DpnsMarketplaceDecodingTests.swift
Walkthrough

The change adds protocol-version-15 DPNS name give-up operations with delete and tombstone methods. It exposes choice and execution APIs through the wallet FFI and Swift SDK, adds a Swift example-app flow, and records SDK parity status.

Changes: DPNS Name Give-Up

Layer / File(s) Summary
Protocol-gated SDK operations
packages/rs-sdk/src/platform/dpns_usernames/*, packages/rs-sdk/src/sdk/protocol_gate.rs
The SDK adds protocol-version gating, give-up options, and shared deletion logic. Tests cover protocol boundaries, contested names, and supplied-domain deletion.
Wallet give-up execution and cleanup
packages/rs-platform-wallet/src/wallet/identity/network/*
The wallet adds delete and tombstone choices and execution. It checks current registration, document ID, method availability, and signing-key eligibility. Confirmed operations update stored names; unresolved operations remain tracked. Tests cover these paths and persistence failures.
FFI exports and registry lock handling
packages/rs-platform-wallet-ffi/src/dpns_marketplace.rs, packages/rs-platform-wallet-ffi/src/dpns_sync.rs
The FFI adds choice and execution exports with caller-owned results. Marketplace and sync operations retrieve handles before asynchronous work. Tests cover conversions, invalid inputs, and unknown handles.
Swift wallet API and FFI decoding
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/DpnsMarketplace.swift, packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DpnsMarketplaceDecodingTests.swift
The Swift SDK adds give-up types and methods, validates inputs, and rejects inconsistent FFI results. Tests cover method mapping and result decoding.
Example app flow and parity records
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/*, packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/GiveUpNamePresentationTests.swift, packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md, docs/sdk/sdk-parity-manifest.json, packages/kotlin-sdk/PARITY_SUMMARY.md
The example app adds a give-up action and confirmation sheet, with presentation tests and test-plan cases. The parity records mark Swift as supported with partial app coverage and Kotlin as unsupported.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant IdentityDetailView
  participant GiveUpNameView
  participant ManagedPlatformWallet
  participant PlatformWalletFFI
  participant IdentityWallet
  participant Platform
  participant Persister
  IdentityDetailView->>GiveUpNameView: Present the selected name
  GiveUpNameView->>ManagedPlatformWallet: Request accepted give-up choices
  ManagedPlatformWallet->>PlatformWalletFFI: Call choices export
  PlatformWalletFFI->>IdentityWallet: Resolve choices
  IdentityWallet->>Platform: Read registered name and available methods
  Platform-->>IdentityWallet: Return name and method availability
  GiveUpNameView->>ManagedPlatformWallet: Submit method and expected document ID
  ManagedPlatformWallet->>PlatformWalletFFI: Call give-up export
  PlatformWalletFFI->>IdentityWallet: Execute selected method
  IdentityWallet->>Platform: Submit give-up operation
  Platform-->>IdentityWallet: Confirm operation
  IdentityWallet->>Persister: Remove confirmed name rows
Loading

Possibly related issues

  • dashpay/platform#6072: The issue describes remaining gaps in the session-scoped give-up hold added by this change, including a hold that can remain after a refused attempt.

Suggested labels: Client Only

Suggested reviewers: thepastaclaw, bfoss765, shumkov

Merge Risk: Moderate · previous review 92300

Giving up a DPNS name is new and partly irreversible. In narrow timing windows, a tombstone can permanently consume a replacement registration the user never confirmed. A second give-up can also proceed while the first is unresolved, and given-up labels can reappear locally. These should be resolved or explicitly accepted before merge, particularly because network and device testing have not been done.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding wallet and iOS app support for giving up a DPNS name by deleting or tombstoning it. The changeset adds wallet give-up logic, FFI exports, Swift SDK methods, the…
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.
Full details: Title check

Explanation

The title names the main change: adding wallet and iOS app support for giving up a DPNS name by deleting or tombstoning it. The changeset adds wallet give-up logic, FFI exports, Swift SDK methods, the iOS GiveUpNameView, and SDK options for deletion and tombstoning, so the title matches the primary change. The title's 'feat(platform-wallet)' scope covers only the wallet crate, while the changes also span the SDK, FFI, and Swift layers, which makes the title somewhat narrower than the full change but still accurate.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • 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

@github-actions github-actions Bot added this to the v5.1.0 milestone Nov 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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 Nov 22, 2026
@thepastaclaw

thepastaclaw commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress (commit 6f0b57c) · live progress

@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.

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: normal by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-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.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
QuantumExplorer and others added 2 commits November 22, 2026 18:34
…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]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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 waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 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 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: normal by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-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)

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
QuantumExplorer and others added 2 commits November 22, 2026 19:34
… 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]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
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 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: critical by gpt-6.2-sol (effort low) — The change is intricate and directly affects key selection and signature authorization: IdentityWallet::give_up_dpns_name selects 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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-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]>
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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 waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 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 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: critical by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-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)

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
…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]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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 waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026
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]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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.

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]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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.

Conflict: the generated PARITY_SUMMARY.md, regenerated from the merged
manifest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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.

⚠️ DEGRADED — Re-review — Final validation — Phase 1 + Phase 2

⚠️ DEGRADED review. The primary review models were unavailable (gpt-6.2-astra unavailable: 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 at high effort. 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-astra unavailable: 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-ins 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; Phase 1 effort capped at high
  • Triage: critical by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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 for gpt-6.2-sol) — final-verifier; agent sol-verifier
  • Phase 2 reviewers: muse-spark-1.3-contributor (standing in for gpt-6.2-astra) — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, muse-spark-1.3-contributor (standing in for gpt-6.2-astra) — ffi-engineer (completed, effort high); agent phase2-reviewer, muse-spark-1.3-contributor (standing in for gpt-6.2-astra) — platform-versioning (completed, effort high); agent phase2-reviewer, muse-spark-1.3-contributor (standing in for gpt-6.2-astra) — rust-quality (completed, effort high); agent phase2-reviewer, muse-spark-1.3-contributor (standing in for gpt-6.2-astra) — security-auditor (completed, effort high); agent phase2-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)

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — 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 waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026
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]>
@QuantumExplorer
QuantumExplorer merged commit 4db0d2e into v5.1-dev Nov 22, 2026
4 of 5 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/swift-example-dpns-delete-name branch November 22, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants