Repository navigation
fix!: check a DashPay invitation claim against Platform before broadcasting it - #5536
Conversation
…re broadcasting it The claim used to broadcast blindly. When a submitted key was already registered to another identity, Platform refused it with 40207/10501 and charged the voucher on every attempt. Hosts also could not tell their own landed claim from someone else's. - rs-sdk: before signing, look up the identity at the invitation's id and under every submitted key hash, and return ClaimedByThisWallet / AlreadyClaimed / KeysAlreadyRegistered / NotReady without broadcasting. Map 40207/10501 after a broadcast to KeysAlreadyRegistered, and classify a consumed-outpoint refusal by whose identity is there. One shared identity_holds_master_key predicate. - rs-platform-wallet: typed error variants; invitation_claim_status_for_identity with a claimed_by_this_wallet tri-state, resolving the master key only when the invitation was claimed; an identity the wallet already records counts as its own. - FFI: codes 63-66 (JSON detail on 63/64), AlreadyClaimed -> 24, and platform_wallet_invitation_claim_status_for_identity. - Swift/Kotlin mirrors, example-app message for 64, parity manifest gap for the missing Kotlin status binding. Refs dashpay/dashwallet-ios#1224 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Claim preflight and classification packages/rs-sdk/src/platform/dashpay/invitation.rs, packages/rs-sdk/src/platform/dashpay/mod.rs, packages/rs-sdk/src/mock/sdk.rs |
The SDK checks the prospective identity and submitted key owners before submission. It classifies existing claims and duplicate-key refusals, and adds tests for preflight and consumed-claim outcomes. |
Wallet ownership and status resolution packages/rs-platform-wallet/src/error.rs, packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs, packages/rs-sdk/src/platform/dashpay/invitation.rs |
The platform wallet determines whether a claimed identity belongs to the wallet and maps claim errors. The status query returns claim status with an optional ownership result. |
FFI result codes and status API packages/rs-platform-wallet-ffi/src/error.rs, packages/rs-platform-wallet-ffi/src/invitation.rs, packages/rs-platform-wallet-ffi/ERROR_CODE_REGISTRY.md |
The FFI adds claim result codes and identity details, plus a tri-state ownership field and wallet-aware status call. Tests cover mappings and status values. |
Swift and Kotlin error and status bindings packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/*, packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ErrorHandlingTests.swift, packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/errors/DashSdkError.kt, packages/kotlin-sdk/sdk/src/test/kotlin/org/dashfoundation/dashsdk/errors/InvitationClaimErrorTest.kt, docs/sdk/sdk-parity-manifest.json, packages/kotlin-sdk/PARITY_SUMMARY.md |
The SDKs map invitation result codes to typed errors. Swift adds wallet-aware claim status. The parity records list the capability and platform support. |
Kotlin identity loading by index packages/rs-unified-sdk-jni/src/identity.rs, packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/IdentityNative.kt, packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityRegistration.kt, packages/kotlin-sdk/sdk/src/test/kotlin/org/dashfoundation/dashsdk/identity/IdentityLoadAtIndexTest.kt |
The Kotlin SDK loads and records an identity at an index, returns its ID when present, and validates negative indexes. |
Example-app claim recovery packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DashPay/ClaimInvitationSheet.swift, packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ClaimInvitationSheet.kt |
The claim sheets check recorded or loaded identities for selected conflicts and display corresponding recovery guidance. |
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant ClaimInvitationSheet
participant IdentityWallet
participant Sdk
participant DAPI
ClaimInvitationSheet->>IdentityWallet: submit invitation claim
IdentityWallet->>Sdk: run claim preflight
Sdk->>DAPI: look up prospective identity and submitted key owners
DAPI-->>Sdk: return lookup results
Sdk->>DAPI: submit claim after successful preflight
DAPI-->>Sdk: return claim result
Sdk-->>IdentityWallet: return typed claim outcome
IdentityWallet-->>ClaimInvitationSheet: return claim result
Possibly related issues
- Wallet-aware invitation claim status reports a BLS-backed claim of this wallet as not ours #5543: The issue reports an incorrect wallet-ownership result for BLS-backed claims, which is within the changed wallet-aware status behavior.
- rs-sdk: put_to_platform_and_wait_* fails with AlreadyExists when a timed-out broadcast was already accepted #4998: The changes classify invitation-claim submission and consumed-outpoint outcomes, which may address the reported
AlreadyExistspath. - rs-sdk: let invitation claims use a master key with any id #5592: The changes add key-map validation in the same invitation-claim preflight path discussed by this issue.
Possibly related PRs
- dashpay/platform#5645: Both changes modify the invitation-claim FFI path and key validation.
- dashpay/platform#5471: This PR extends invitation-claim behavior implemented in
rs-sdk. - dashpay/platform#5786: Both changes affect invitation claim submission and its ChainLock fallback behavior.
Suggested reviewers: thepastaclaw, shumkov, quantumexplorer
Merge Risk: 
Minimal · previous review 415f5
-
The invitation claim preflight and its typed error handling look ready to merge. One open question remains about example-app recovery in an unusual case. The app shows a recovery message there rather than failing, so it does not block the merge.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "fix!: check a DashPay invitation claim against Platform before broadcasting it" matches the main change. The PR adds a preflight that checks invitation identities and submitted keys on Platform before signing or broadcasting a claim. The changeset also covers error codes, claim-status reporting, and Swift and Kotlin updates, which the title does not name, but it is still specific and accurate about the primary change. The title is a single sentence and states the core behavior without noise.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw requested changes — dismiss the review or push a fix, 1 thread unresolved — resolve it. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit f737ed9) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The PR's preflight and typed error plumbing are generally sound, and the available Rust, Swift, Kotlin, and relevant JavaScript checks pass; PR Hygiene is still pending. One blocking classification bug remains for valid BLS master keys, while the mixed-key precedence, consensus-error preservation, lock scope, and protocol-version comments need correction.
🔴 1 blocking | 🟡 4 suggestion(s) | 💬 1 nitpick(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The substantial changes to Sdk::claim_invitation in packages/rs-sdk/src/platform/dashpay/invitation.rs alter key-ownership validation and the decision to broadcast a voucher-consuming identity creation, directly affecting key handling and funds movement. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-sdk/src/platform/dashpay/invitation.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/dashpay/invitation.rs:1077-1081: Recognize landed claims made with a BLS master key
`preflight_keys_map` accepts any MASTER/AUTHENTICATION key, and identity-create signing and Platform validation support BLS12_381 keys with proof of possession. However, `identity_holds_master_key` returns false unless the submitted master key is ECDSA_SECP256K1. If a valid BLS-backed claim lands and its result is lost, a retry finds the invitation identity but classifies it as `AlreadyClaimed` instead of `ClaimedByThisWallet`; the same predicate also prevents the wallet-aware status path from recognizing that claim. This tells the caller that another party claimed the voucher and blocks the intended recovery classification.
- [SUGGESTION] packages/rs-sdk/src/platform/dashpay/invitation.rs:1129-1140: Check all key-hash results for the invitation identity before reporting taken keys
When the lookup by invitation id is absent or fails, the loop returns the first successful key-hash identity. Because `join_all` preserves `key_hashes` order, a foreign identity found for an earlier hash can produce `KeysAlreadyRegistered` before a later hash identifies `prospective_identity_id`. The documented precedence requires the invitation identity to win regardless of submitted-key order, so retain the first foreign owner, continue scanning all results, and return the foreign-key outcome only after every successful result has been checked for the prospective identity.
- [SUGGESTION] packages/rs-sdk/src/platform/dashpay/invitation.rs:1184-1186: Correct the duplicate-key refusal version threshold
The comment says Basic error 10501 applies before protocol v7, but the version tables select validation generation V5 for protocol v7 and V6 for protocol v10, both of which still return the Basic error. Validation generation V7 is first selected by protocol v11 and changes the result to State error 40207. The same incorrect threshold appears in the `preflight_keys_map` comment near line 757 and in the PR description. The behavior is unaffected, but the documentation gives future version-gated changes the wrong activation point.
- [SUGGESTION] packages/rs-sdk/src/platform/dashpay/invitation.rs:1194-1197: Preserve the consensus rejection when mapping taken keys
`keys_taken_on_broadcast` converts the original `InvitationError::Sdk(error)` into `KeysAlreadyRegistered { identity_id: None }` and discards the consensus error. As a result, native callers lose the duplicate-key details, and the FFI conversion reports `consensus_code = 0` and `consensus_kind = None` even when Platform rejected the broadcast with 40207 or 10501. Preserve the original error as optional source metadata on this outcome and carry that metadata through the wallet and FFI conversions while retaining the typed invitation result code.
In `packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs:494-517: Do not hold the wallet-manager read guard during key derivation
`claimant_master_public_key` keeps the `wallet_manager.read()` guard alive while deriving the keypair. The derivation is synchronous CPU work and does not need the manager lock for the master-key path, so it unnecessarily extends the critical section and can delay writers such as identity recording. Extract the required network and wallet-derived inputs before derivation, or otherwise scope the manager guard to the minimum access needed; retain the lock only where the resident-wallet derivation genuinely requires the wallet object.
- [NITPICK] packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs:491-500: Remove the redundant Unavailable match arm
The early `matches!` check returns `Ok(None)` for `InvitationClaimantKey::Unavailable`, so the identical arm inside the following exhaustive match can never execute. Keep the exhaustive match arm and remove the separate early return, or remove the match arm and structure the branches so the case is handled only once.
- Recognize a landed claim whose master key is BLS: Platform signs BLS keys into an identity like ECDSA ones. - Check every key-hash result for the invitation's identity before reporting a taken key, whatever order the keys were submitted in. - Keep Platform's 40207/10501 refusal on KeysAlreadyRegistered and stamp its consensus code on FFI code 63. - Classify an unverifiable claim-status lookup as NotReady, as the claim does. - Release the wallet storage before the claim's network round, and the wallet-manager guard before deriving from a resolved master key. - Correct the protocol version the duplicate-key refusal changed in (v11), narrow the wallet-internal claimant API to pub(crate), fix doc placement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓, 1 thread unresolved — resolve it. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Static verification of the complete diff at 7863d1f confirms that all six prior findings are fixed, with no remaining blockers identified. One nonblocking issue remains: Swift's new typed invitation error discards the consensus metadata preserved by Rust and FFI. Current CI shows successful JavaScript build/tests and Swift frozen-schema validation, while Rust workspace tests and Kotlin SDK build/tests remain pending; no local builds or tests were run.
🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The intricate changes to Sdk::claim_invitation in packages/rs-sdk/src/platform/dashpay/invitation.rs alter key-ownership validation and the decision to sign and broadcast voucher-funded identity creation, directly affecting key handling and voucher expenditure. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift:977-979: Preserve consensus metadata in Swift's typed invitation error
A broadcast rejection for duplicate keys now retains Platform's original error through rs-sdk and rs-platform-wallet, and FFI returns code 63 alongside consensus metadata such as 40207/State or 10501/Basic. `init(result:)` reads that metadata, but this conversion constructs a case containing only `identityId`; the public `consensusError` getter consequently returns nil. Although the existing Swift adapter deliberately exposes consensus metadata only for catch-all errors, this new typed outcome drops information explicitly preserved by the Rust implementation, and the same rejection previously reached Swift through `.consensusRejection`. Claim safety is unaffected, but Swift callers lose the authoritative rejection code for diagnostics. Retain an optional `PlatformConsensusError` alongside the typed invitation case and expose it through `consensusError`, without replacing the invitation classification. Add conversion tests for both rejection codes and a preflight outcome without consensus metadata.
…tered Code 63 refused after the broadcast now carries Platform's 40207/10501 consensus verdict; the typed Swift case keeps it beside the classification and `consensusError` returns it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Reviewed the complete diff at 5be60e7 and independently verified all seven prior findings as fixed. One non-blocking correctness issue remains in wallet-aware status recognition for unrecorded BLS claims; the proposed non-unique-index blocker does not establish the claimed voucher-consuming failure. This was a static review: current CI passes Rust workspace tests, Kotlin tests, JS builds/tests, and the Swift frozen-schema check; Swift build/tests remain pending.
🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a large cross-language change that alters invitation claims involving voucher charging and identity key handling, including protocol-version-specific consensus error behavior in packages/rs-sdk/src/platform/dashpay/invitation.rs and packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs:530-537: Wallet-aware status reports BLS-owned invitation claims as not ours
Both derivation branches produce an ECDSA key, and this construction always labels it ECDSA_SECP256K1. The claim API also accepts BLS master keys, so an earlier claim made with this wallet's BLS key can land without being recorded locally. When that identity has no matching ECDSA signing key, the new wallet-aware status returns Some(false), which reaches Swift as claimedByThisWallet == false, even though retrying the claim with the original BLS keys correctly returns ClaimedByThisWallet. The shared predicate's BLS support does not fix this because it never receives a BLS candidate here. Derive and compare the supported master-key types in the Rust owner, or return None when an unsupported derivation prevents a definitive ownership answer. Add a regression test for a landed, unrecorded BLS-backed claim.
|
/skip-bots |
|
Bots are done — your move: post |
|
/self-reviewed |
|
Missing human approval. Automatic reviewer requests are paused and this PR is excluded from reviewers' queues. Merge, close, or draft another active PR by this author to free a review slot. Required human review can be satisfied without a slot; once all merge requirements are met, PR Hygiene passes. |
|
Reviewed at
No blockers from me. CI is green and all bot threads are resolved. Non-blocking:
A trade-off to be aware of, not a request: the preflight fails closed. A lookup failure that is not a quorum error ( |
llbartekll
left a comment
There was a problem hiding this comment.
LGTM. Non-blocking notes in #5536 (comment)
…on code 64 - Test `Sdk::claim_invitation` against a mock SDK: our identity found by id and a taken key found by the last key's hash both end the claim before signing; with nothing registered it reaches the signer. `MockDashPlatformSdk::expect_request` (test-only) answers the Core funding-transaction request. - `adopt_already_landed_claim` takes the master key from its caller, dropping an arm that could not be reached. - Both example apps continue with the identity a code 64 names: the one the wallet records, or the one loaded from Platform when its id matches; otherwise they show its id and point to the re-scan screen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the review. Addressed in b96690e:
On fail-closed: agreed, that is intended, given what the voucher costs. |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw requested changes — dismiss the review or push a fix, 1 thread unresolved — resolve it. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: address lklimek left a review thread unresolved, then post |
HashEngineering
left a comment
There was a problem hiding this comment.
Re-approving at 97875d1. Deciding the claimant only from the wallet's record, and adopting only on a signed-key match, is the right call. Two notes from the kotlin-sdk / dash-wallet side:
- Please carry the consensus code on Kotlin's
InvitationKeysAlreadyRegistered, as Swift does. Code 63 with and without a consensus error now mean different things (Platform refused the broadcast, so the voucher may have been charged, versus nothing broadcast), and Android hosts can't tell them apart without it. - For hosts: an own claim that landed but wasn't recorded now comes back as 24 with a rescan hint, not 64. dash-wallet will need to handle 24 (rescan), 64 (load) and 65/66 (retry later) when it moves to the 5.2 SDK. Today it treats them all as an unknown outcome.
…laim-preflight # Conflicts: # docs/sdk/sdk-parity-manifest.json # packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ClaimInvitationSheet.kt # packages/kotlin-sdk/PARITY_SUMMARY.md # packages/rs-platform-wallet-ffi/ERROR_CODE_REGISTRY.md # packages/rs-platform-wallet/src/wallet/identity/network/invitation.rs
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…ge_of Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This head merges v5.2-dev, keeps the originating-wallet generation check around the shared identity recorder, and updates the FFI rescan-hint test to use message_of(&result) without changing its assertions. The Rust workspace and wasm32 tests and the Swift and Kotlin build-and-test checks passed; PR Hygiene and PastaClaw review were still pending.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 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); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — Inpackages/rs-sdk/src/platform/dashpay/invitation.rs, the intricate preflight changes which submitted keys can proceed to signing and broadcasting a voucher-funded identity claim, and the recovery path changes which keys are sufficient to adopt an identity. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane 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)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
Bots are done — your move: post |
|
/self-reviewed |
|
Ready for review — |
…let-payment-delivery Brings in #5949 (tokio 1.54.1) and #5536 (invitation claim preflight). #5536's new PlatformWalletError variants get a payment class: - InvitationNotReady: NotSent, retryable (the preflight lookups could not be verified yet; nothing was broadcast). - InvitationKeysAlreadyRegistered: NotSent when the preflight found the owner (no rejection), MaybeSent when it carries Platform's refusal of the broadcast claim; never retryable. - InvitationAlreadyClaimed, InvitationClaimedByThisWallet: MaybeSent, not retryable: usually found before the broadcast, but also reported from Platform's refusal of a claim a lagging node let through. AssetLockNotChainLocked keeps its class (MaybeSent) under its new code 66. The FFI invitation export keeps the base's wait outside the registry guard and the asset-lock handle the voucher handoff class needs. Swift's new cases (codes 63-66) carry `payment`; Kotlin's overrides on 65 and 66 go, since `isRetryable` is the native answer. Registry rows 63-66 state the class. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the conflicts with #5536, #6143, #5282, #5923, #5951 and the v5.1-dev merge: - Durable writes use v5.2-dev's `store_and_commit` (#6143) in place of this branch's `commit_durably`, which did the same; the recipient assignment stays counted in the flush ledger. - An abandoned unsent lock's row is removed through `withdraw_durably`. A shielded funding whose removal is durable releases its inputs and hands its funding index back, so a retry rebuilds the same lock. - The identity-recipient migration is renumbered V023 -> V024 after v5.2-dev's V021-V023; schema fingerprints updated. - The SQLite asset-lock funding pool restore uses `AddressPool::insert` and `mark_used` after the rust-dashcore bump made the pool fields private. - `on_dispatch` runs after the generation check, right before the send. - Error codes 81 and 82 kept; the registry lists 83-87 from v5.2-dev. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a retry With the new platform pin a repeated invitation claim no longer returns the identity an earlier claim created (dashpay/platform#5536). It is refused as claimed by this wallet, or as consumed when the wallet does not record the identity, which includes this wallet's own claim whose result was lost before the identity was stored. The retry then ended in "This invitation couldn't be used" although the identity existed. On either refusal the coordinator now probes the wallet's pinned identity slot and, when an identity is there, continues as an existing-identity recovery. The invitation is retired only when the wallet's own record says the voucher was its claim; otherwise the Home card's status query decides, as before. With no identity at the slot the claim error is reported unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Moves .platform-ref to dashpay/platform 673de9d2bd (tip of v5.2-dev, 2026-11-26; contains v5.1.0-rc.1), so the SDK reads the protocol version 15 contract format testnet runs since 2026-11-25. - The DashConnect response delete stops passing signingKeyId: the SDK picks the signing key in Rust (dashpay/platform#6228). - A refused repeated invitation claim (dashpay/platform#5536) now probes the wallet's pinned identity slot and continues as an existing-identity recovery when an identity is there. A store written by a build from the previous pin (schema version 5, changed in place) does not open with this one; "Reset wallet data and rescan" recovers it. App Store stores are schema version 4 and migrate. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Issue being fixed or feature implemented
Part of dashpay/dashwallet-ios#1224 (item 8): a DashPay invitation claim can end up on an identity the voucher did not fund, or burn the inviter's voucher for nothing.
Sdk::claim_invitation(moved into rs-sdk by #5471) broadcasts the claim without looking at Platform first. When one of the submitted keys is already registered to another identity (typically an identity this wallet registered before at the same index), Drive refuses the IdentityCreate withDuplicatedIdentityPublicKeyIdStateError(40207, or 10501 before protocol v11) and charges the voucher throughPartiallyUseAssetLockAction(10M credits plus the fee) on every attempt. The inviter pays, and the invitee gets an opaque consensus error.Hosts also cannot tell an invitation claimed by someone else from one whose identity their wallet already holds. The pre-claim status only says "an identity exists".
What was done?
rs-sdk (
platform/dashpay/invitation.rs)AlreadyClaimed { identity_id }: an identity is already there. The SDK does not decide whose: no submitted key proves it (a key shared with that identity, such as a delegated application key, does not show the claimant controls its master). The preflight does not adopt or record it.KeysAlreadyRegistered { identity_id }: another identity holds a submitted key.NotReady: a lookup could not be verified yet (Error::is_quorum_source_unavailable). Any other lookup failure isSdk.NotReadypreferred.KeysAlreadyRegistered { identity_id: None, rejection }, which keeps Platform's refusal; the FFI reports it inconsensus_code/consensus_kindbeside code 63. Other refusals that charge the voucher (contract bounds and similar) are not mapped.adopt_already_landed_claimstill adopts an identity that carries exactly the submitted keys, now only when at least one of them is a full ECDSA or BLS key (a hash-only set anyone could copy never adopts). Any other identity behind a consumed outpoint is nowAlreadyClaimedinstead of the raw rejection.preflight_keys_maprefuses a key filed under another id's slot. Two keys with one id would otherwise be refused by Platform with 10501, which the backstop reads as "taken".invitation_claim_status: a lookup the quorum source cannot verify yet is nowNotReady(FFI 65, previously 99), as in the claim.rs-platform-wallet
PlatformWalletErrorvariants:InvitationClaimedByThisWallet,InvitationAlreadyClaimed,InvitationKeysAlreadyRegistered,InvitationNotReady.claim_invitationreportsAlreadyClaimedfor such an identity asInvitationClaimedByThisWallet, and any other asInvitationAlreadyClaimed.IdentityWallet::invitation_claim_status_for_identity(invitation)returns the status plusclaimed_by_this_wallet: Option<bool>:Some(true)for a recorded identity,Some(false)when unclaimed,None(unknown) otherwise.rs-platform-wallet-ffi
ERROR_CODE_REGISTRY.md(61/62 are held by feat(platform-wallet): spend only final coins and report funds waiting on the network #5395/fix(platform-wallet): keep the cached identity in step with the chain around updates #5487):ErrorInvitationKeysAlreadyRegistered(63) andErrorInvitationClaimedByThisWallet(64), each with a JSON detail{"identityId": ...};ErrorInvitationNotReady(65);ErrorAssetLockNotChainLocked(66), which used to flatten to 99;InvitationAlreadyClaimedmaps to 24.platform_wallet_invitation_claim_status_for_identity(wallet, uri, out)forwards to the wallet method.InvitationClaimStatusFFIgains aclaimed_by_this_wallettri-state (INVITATION_CLAIMED_BY_THIS_WALLET_NO/YES/UNKNOWN). The out-param is zeroed to UNKNOWN before any fallible work.Swift / Kotlin
PlatformWalletErrorcases andPlatformWalletResultCoderaw cases with theirinit(ffi:)arms.InvitationClaimStatus.claimedByThisWallet: Bool?. A newinvitationClaimStatusForThisWallet(uri:); the oldinvitationClaimStatus(uri:)is kept.PlatformWallet.InvitationKeysAlreadyRegistered/InvitationClaimedByThisWallet/InvitationNotReady/AssetLockNotChainLocked(the last two retryable).sdk-parity-manifest.json/PARITY_SUMMARY.md.How Has This Been Tested?
cargo test -p dash-sdk -p platform-wallet -p platform-wallet-ffi --all-features: all green. New tests cover:Sdk::claim_invitationagainst a mock SDK. An identity found by id ends the claim before anything is signed. So does a taken key found by the hash of the last submitted key. With nothing registered, the claim reaches the submission;cargo clippy -p dash-sdk -p platform-wallet -p platform-wallet-ffi --all-features --all-targets -- -D warnings: clean../build_ios.sh --target sim(SwiftDashSDK with-warnings-as-errors, plus SwiftExampleApp).xcodebuild test -only-testing:SwiftDashSDKTests/ErrorHandlingTests: green../gradlew :sdk:testDebugUnitTest(InvitationClaimErrorTest,DashSdkErrorTest,DpnsMarketplaceErrorTest) and:app:compileDebugKotlin: green.python3 scripts/check_sdk_parity_manifest.py: OK.Breaking Changes
No consensus change.
Host-visible behaviour changes:
InvitationClaimedByThisWallet(64) when the wallet records that identity, andAssetLockAlreadyConsumed(24, "claimed, whose is unknown") otherwise, including an earlier claim of this wallet whose result was lost before it was recorded: a rescan records it. Nothing is recorded. Only a node that lags behind and lets the retry through still reaches the old adopt path (exact key set).AssetLockNotChainLockednow arrives as code 66 instead of 99.InvitationClaimStatusFFIgainsclaimed_by_this_wallet: u8, soplatform_wallet_invitation_claim_statuswrites a larger struct. The struct and the function exist only on v5.1-dev (no tag up to v5.0.0-rc.8 carries them), so no released binary uses the old layout and no_v2entry point is added. Hosts rebuild against the generated header.InvitationErrorgains variants (AlreadyClaimed,KeysAlreadyRegistered,NotReady), andpreflight_keys_maprefuses a key whose id differs from its map slot.InvitationErrorand the invitation variants ofPlatformWalletErrorare also unreleased (absent from v5.0.0-rc.8).PlatformWalletErroritself is released (v5.0.0-rc.8) and has no#[non_exhaustive], so the four invitation variants this PR adds (InvitationClaimedByThisWallet,InvitationAlreadyClaimed,InvitationKeysAlreadyRegistered,InvitationNotReady) break a downstream exhaustivematchon it. Add arms for them (or a wildcard arm). The other hosts need the same update:PlatformWalletErrorgainsinvitationClaimedByThisWallet,invitationKeysAlreadyRegistered,invitationNotReadyandassetLockNotChainLocked;PlatformWalletResultCodegains codes 63-66 (errorInvitationKeysAlreadyRegistered,errorInvitationClaimedByThisWallet,errorInvitationNotReady,errorAssetLockNotChainLocked). Update exhaustiveswitchstatements over either.DashSdkError.PlatformWalletgainsInvitationKeysAlreadyRegistered,InvitationClaimedByThisWallet,InvitationNotReadyandAssetLockNotChainLocked. Update exhaustivewhenexpressions over it.InvitationError::Invalidbefore the signer is asked, instead of being signed and dropped undecoded by the node.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
f737ed9sdk-parity— you own itkotlin-sdk(packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ClaimInvitationSheet.kt,packages/kotlin-sdk/PARITY_SUMMARY.md,packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/errors/DashSdkError.ktand 1 more) — HashEngineeringrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/ERROR_CODE_REGISTRY.md,packages/rs-platform-wallet-ffi/src/error.rs,packages/rs-platform-wallet-ffi/src/invitation.rs) — HashEngineering or ZocoLini or llbartekllrs-platform-wallet(packages/rs-platform-wallet/src/error.rs,packages/rs-platform-wallet/src/wallet/identity/network/identity_handle.rs,packages/rs-platform-wallet/src/wallet/identity/network/invitation.rsand 1 more) — HashEngineering or ZocoLini or llbartekllrust-sdk(packages/rs-sdk/src/mock/sdk.rs,packages/rs-sdk/src/platform/dashpay/invitation.rs) — approved by lklimekswift-sdk— you own itWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit
New Features
Bug Fixes