Skip to content

fix!: check a DashPay invitation claim against Platform before broadcasting it - #5536

Merged
romchornyi merged 32 commits into
v5.2-devfrom
feat/invitation-claim-preflight
Nov 25, 2026
Merged

romchornyi merged 32 commits into
v5.2-devfrom
feat/invitation-claim-preflight

Conversation

@romchornyi

@romchornyi romchornyi commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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 with DuplicatedIdentityPublicKeyIdStateError (40207, or 10501 before protocol v11) and charges the voucher through PartiallyUseAssetLockAction (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)

  • A preflight runs after the funding proof is rebuilt and before anything is signed or broadcast. It fetches the identity at the invitation's derived id, and the identity under the hash of every submitted key, concurrently. Drive's v0/v1 check works the same way: it hashes every key against the unique-key index. The outcomes, none of which broadcast:
    • 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 is Sdk.
    • Precedence: the invitation's identity first, whether the lookup by id or any key-hash lookup found it, whatever the other key hashes found. Lookups can reach different nodes. Then a taken key. Then a failed lookup, with NotReady preferred.
  • Backstop after the broadcast (when a node that lagged behind missed the identity): 40207/10501 become KeysAlreadyRegistered { identity_id: None, rejection }, which keeps Platform's refusal; the FFI reports it in consensus_code/consensus_kind beside code 63. Other refusals that charge the voucher (contract bounds and similar) are not mapped.
  • adopt_already_landed_claim still 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 now AlreadyClaimed instead of the raw rejection.
  • preflight_keys_map refuses 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 now NotReady (FFI 65, previously 99), as in the claim.

rs-platform-wallet

  • New PlatformWalletError variants: InvitationClaimedByThisWallet, InvitationAlreadyClaimed, InvitationKeysAlreadyRegistered, InvitationNotReady.
  • Whose claim it is has one rule, shared by the claim and the status: the invitation's identity is this wallet's only when the wallet records it in one of its registration slots (an identity it only observed does not count, and a handle whose wallet was re-created does not read the replacement's identities). No key decides it.
  • claim_invitation reports AlreadyClaimed for such an identity as InvitationClaimedByThisWallet, and any other as InvitationAlreadyClaimed.
  • IdentityWallet::invitation_claim_status_for_identity(invitation) returns the status plus claimed_by_this_wallet: Option<bool>: Some(true) for a recorded identity, Some(false) when unclaimed, None (unknown) otherwise.

rs-platform-wallet-ffi

Swift / Kotlin

  • Swift: typed PlatformWalletError cases and PlatformWalletResultCode raw cases with their init(ffi:) arms. InvitationClaimStatus.claimedByThisWallet: Bool?. A new invitationClaimStatusForThisWallet(uri:); the old invitationClaimStatus(uri:) is kept.
  • Kotlin: typed PlatformWallet.InvitationKeysAlreadyRegistered / InvitationClaimedByThisWallet / InvitationNotReady / AssetLockNotChainLocked (the last two retryable).
  • On code 64 both example apps continue with the identity the error names when the wallet already lists it, as after a successful claim. Otherwise they show its id and point to the identity re-scan screen; they load nothing themselves. Recording a claimed identity automatically, and reserving the claim's slot against a concurrent registration, need a wallet-owned slot operation and are left to Identity registration and invitation claims need a wallet-owned identity-slot lease #5917.
  • Parity: the JNI has no claim-status binding (it never had one for the old status either). This is recorded as a Kotlin gap in 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:
    • preflight outcomes and precedence: the invitation's identity found by id or only by a key hash (claimed even when it carries every submitted key), taken keys, failed and unverifiable lookups;
    • that a refused preflight never reaches the submission;
    • Sdk::claim_invitation against 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;
    • the 40207/10501 backstop, and a contract-bounds refusal that is not mapped;
    • adopt-arm classification, and adoption only through a full key (key-set fixtures pass DPP's structure check);
    • a recorded identity counted as ours, at another index, by both the claim and the status;
    • an unrecorded identity holding the wallet's own master key: claim 24, status unknown;
    • an identity the wallet only observed (no registration slot, even under this wallet's id), and a stale handle, not counted as ours;
    • FFI code pins, JSON details and the tri-state encoding.
  • 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:

  • A repeated claim after an earlier claim landed no longer succeeds by adopting the identity. It returns InvitationClaimedByThisWallet (64) when the wallet records that identity, and AssetLockAlreadyConsumed (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).
  • AssetLockNotChainLocked now arrives as code 66 instead of 99.
  • ABI: InvitationClaimStatusFFI gains claimed_by_this_wallet: u8, so platform_wallet_invitation_claim_status writes 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 _v2 entry point is added. Hosts rebuild against the generated header.
  • InvitationError gains variants (AlreadyClaimed, KeysAlreadyRegistered, NotReady), and preflight_keys_map refuses a key whose id differs from its map slot. InvitationError and the invitation variants of PlatformWalletError are also unreleased (absent from v5.0.0-rc.8).
  • Rust source compatibility: PlatformWalletError itself 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 exhaustive match on it. Add arms for them (or a wildcard arm). The other hosts need the same update:
    • Swift PlatformWalletError gains invitationClaimedByThisWallet, invitationKeysAlreadyRegistered, invitationNotReady and assetLockNotChainLocked; PlatformWalletResultCode gains codes 63-66 (errorInvitationKeysAlreadyRegistered, errorInvitationClaimedByThisWallet, errorInvitationNotReady, errorAssetLockNotChainLocked). Update exhaustive switch statements over either.
    • Kotlin's sealed DashSdkError.PlatformWallet gains InvitationKeysAlreadyRegistered, InvitationClaimedByThisWallet, InvitationNotReady and AssetLockNotChainLocked. Update exhaustive when expressions over it.
  • A claim whose keys the network's protocol version cannot decode (a version 1 key or a contract-group-bound key before protocol version 14) is now refused with InvitationError::Invalid before the signer is asked, instead of being signed and dropped undecoded by the node.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · f737ed9

  • Bots — thepastaclaw ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals
    • sdk-parity — you own it
    • kotlin-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.kt and 1 more) — HashEngineering
    • rs-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 llbartekll
    • rs-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.rs and 1 more) — HashEngineering or ZocoLini or llbartekll
    • rust-sdk (packages/rs-sdk/src/mock/sdk.rs, packages/rs-sdk/src/platform/dashpay/invitation.rs) — approved by lklimek
    • swift-sdk — you own it

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

    • Invitation claim status can indicate whether an invitation was claimed by the current wallet, with identity-specific checks available in Swift.
    • SDKs provide clearer outcomes for invitation claims, including when keys are already registered, a claim is not ready, or an asset lock is not yet confirmed on-chain.
    • Wallets can load an identity at a selected index.
  • Bug Fixes

    • Invitation claim flows in the example apps can recover from certain registration conflicts by checking for a matching identity, and provide guidance when a retry or rescan is needed.

…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]>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

Invitation claims now check identity and key ownership before submission and report typed outcomes for claim conflicts. Wallet-aware claim status is available through the FFI and Swift SDK. The Kotlin SDK adds identity loading by index, and both example apps handle selected claim conflicts.

Changes: Invitation Claim Behavior

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
Loading

Possibly related issues

Possibly related PRs

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: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "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 Plat…
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.

Share

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

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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 /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

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

thepastaclaw commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit f737ed9) · triage: critical

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 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: critical by gpt-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); 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)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

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

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 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: critical by gpt-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); 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)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

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

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

@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

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: critical by gpt-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); 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)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — platform-versioning (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `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.

@romchornyi

Copy link
Copy Markdown
Contributor Author

/skip-bots

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 22, 2026
@romchornyi

Copy link
Copy Markdown
Contributor Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

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.
Full checklist in the description.

@github-actions github-actions Bot added too-many-open-prs Beyond the author's 5 open PRs; waits for one to merge before a human is asked. and removed waiting-self-review Waiting for the author to post /self-reviewed labels Oct 22, 2026
@llbartekll

Copy link
Copy Markdown
Contributor

Reviewed at 5be60e7c. I checked the preflight against Drive and it asks the same question Drive does:

  • validate_unique_identity_public_key_hashes_not_in_state (v0 and v1) checks every submitted key's hash against the unique-key index.
  • When that check fails, identity-create state validation v1 returns PartiallyUseAssetLockAction, charging unique_key_already_present plus the processing fee.
  • 40207 replaced 10501 at protocol v11 (DRIVE_ABCI_VALIDATION_VERSIONS_V7).

No blockers from me. CI is green and all bot threads are resolved.

Non-blocking:

  1. After code 64, nothing loads the identity in either example app. The message says "It appears once identities are refreshed", but both apps only discover identities from the manual "Search wallets for identities" screen. nextUnusedIdentityIndex() counts only recorded identities. So a retry after the app was killed picks the same index and gets 64 again, while before this PR that retry adopted the identity and recorded it. Suggestion: on 64, load the identity from identityId (or run discovery) in the example apps, or at least tell the user where to look. The same holds for 63 when the key owner is this wallet's own unrecorded identity.
    Question: the preflight has already shown that the identity holds the master key at identity_index. Why not record it at the wallet layer, as the adopt path did, and fetch its names separately? Is dashwallet-ios ready to handle 64 there?

  2. No test covers how claim_invitation wires in the preflight. The preflight decisions are well covered through the seams, and claim_unless_refused proves that a refused preflight never submits. But nothing checks that Sdk::claim_invitation passes prospective_identity_id, keys_map[0] and every key hash into preflight_claim, or that it submits through claim_unless_refused. A refactor that broadcasts first, or fetches the wrong id, would still pass. A mock-SDK test of claim_invitation would pin the actual fix: the lookup by id or by PublicKeyHash returns an identity, and nothing is broadcast.

  3. ABI note: InvitationClaimStatusFFI gains claimed_by_this_wallet: u8, so platform_wallet_invitation_claim_status now writes a larger struct. That is fine for hosts that rebuild against the generated header, but it is worth a line under Breaking Changes next to codes 64 and 66.

  4. Nit: in adopt_already_landed_claim, submitted_keys.get(&0) cannot be None, because preflight_keys_map and claim_invitation both require key 0. The None => Err(InvitationError::Sdk(error)) arm is unreachable.

A trade-off to be aware of, not a request: the preflight fails closed. A lookup failure that is not a quorum error (InvitationError::Sdk) now stops a claim that would have been broadcast before. Given what the voucher costs, that looks right.

llbartekll
llbartekll previously approved these changes Oct 23, 2026

@llbartekll llbartekll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@romchornyi

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Addressed in b96690e:

  1. Code 64 in the example apps. On 64 both apps now continue with the identity the error names, as after a successful claim. They use it directly when the wallet already records it. Otherwise they load it the way they load any identity of the wallet (Swift loadIdentity(atIndex:), Kotlin discoverIdentities) and accept only that id. When it cannot be loaded, they show its id and point to the re-scan screen. A retry after the app was killed therefore ends with the identity loaded, not with 64 again.
    Why not record it at the wallet layer: claim-side adoption recorded only the identity and its keys. Loading it the way the host loads any of its own identities also fetches its DPNS names, which is what dashwallet-ios needs. The dashwallet-ios side handles 64 that way in the app PR that follows this one. The adopt path stays for a node that lags behind, where the broadcast is the only signal we get.
  2. Wiring test. Added claim_through_the_sdk tests that run Sdk::claim_invitation against a mock SDK. Our identity found by id, and a taken key found by the hash of the last submitted key, both end the claim before anything is signed. With nothing registered, the claim reaches the signer. Turning the preflight into a no-op makes the first two tests fail with the signer's error.
  3. ABI note. Added under Breaking Changes.
  4. Unreachable arm. Removed. adopt_already_landed_claim now takes the master key from its caller.

On fail-closed: agreed, that is intended, given what the voucher costs.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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 /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Bots are done — your move: address lklimek left a review thread unresolved, then post /self-reviewed.
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 24, 2026

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

github-actions Bot commented Nov 25, 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 25, 2026
@github-actions

github-actions Bot commented Nov 25, 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.

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: critical by gpt-6.2-sol (effort low) — In packages/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); 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 (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; 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. Verify the current code and confirm that no unresolved issues remain.

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

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
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 25, 2026
@romchornyi

Copy link
Copy Markdown
Contributor Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — kotlin-sdk: HashEngineering · rs-platform-wallet-ffi: HashEngineering or ZocoLini or llbartekll · rs-platform-wallet: HashEngineering or ZocoLini or llbartekll.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 25, 2026
@romchornyi
romchornyi merged commit c191e7a into v5.2-dev Nov 25, 2026
28 of 29 checks passed
@romchornyi
romchornyi deleted the feat/invitation-claim-preflight branch November 25, 2026 15:15
romchornyi added a commit that referenced this pull request Nov 25, 2026
…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]>
HashEngineering added a commit that referenced this pull request Nov 25, 2026
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]>
llbartekll added a commit to dashpay/dashwallet-ios that referenced this pull request Nov 26, 2026
…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]>
llbartekll added a commit to dashpay/dashwallet-ios that referenced this pull request Nov 26, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants