Repository navigation
feat(kotlin-example-app): send shielded tips to a DashPay username - #6197
Conversation
…y the wallet A tip is a shielded transfer to the shielded address a DashPay profile publishes. The wallet now owns what a payment screen would otherwise decide: the typed amount (parse_shielded_tip_amount), whom a name pays and whether that changed since the wallet last paid it (review_shielded_tip), which account pays (ShieldedTipSource, proved with the seed for an identity), whether the tip may be sent (send_shielded_tip), and whether an identity's shielded balance is known (shielded_identity_balance). A tip is refused with ShieldedTipPending while another tip is being sent and while an earlier transfer to the recipient may still execute. The recipient of a saved transfer is read back from its signed transition with the paying account's outgoing viewing key, so the refusal rests on the record every shielded spend already saves before its first dispatch and survives a restart. C exports: platform_wallet_parse_shielded_tip_amount, platform_wallet_manager_review_shielded_tip, platform_wallet_manager_send_shielded_tip and platform_wallet_manager_shielded_identity_balance. Result code 84 (ErrorShieldedTipPending), mirrored in Swift and Kotlin. Rebuilt on v5.1-dev from the design of #5288 and #5709. Co-authored-by: pasta <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
Swift (PlatformWalletManagerShieldedTips.swift) and Kotlin (PlatformWalletManager, ShieldedTip.kt, through the JNI bridge in funding.rs) wrappers over the four shielded tip exports: parseShieldedTipAmount, reviewShieldedTip, sendShieldedTip and shieldedIdentityBalance. They convert types and throw the typed error; the wallet decides everything. Rebuilt on v5.1-dev from the design of #5288 and #5709. Co-authored-by: pasta <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
- Kotlin `sendShieldedTip` runs under `opReturningCompletedResult`, as the other calls that move funds do: native code cannot see a coroutine's cancellation, so a tip sent after it must not read as cancelled. - Swift refuses text holding a NUL before the native call (amount, username, memo): a C string ends at its first NUL, so Rust would judge only the prefix. The JNI bridge already refuses it. - The JNI blob encoders match the two C enums in full, so a new case does not compile until it has a tag and a Kotlin decoder branch. - Swift tests for the review and balance decoders and the NUL refusal. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Adds a Send Shielded Tip screen, opened from the DashPay tab and from a contact (its DPNS name filled in). The wallet parses the amount, reviews the name and decides whether the tip may be sent; the screen shows the recipient, its change since the last tip and an unresolved earlier payment, then sends the reviewed recipient from the identity's own shielded account or account 0. The send runs on the app-scoped ShieldedIdentityPaymentCoordinator (new SHIELDED_TIP kind), so a rotation or tab switch cannot drop its outcome or send twice. TEST_PLAN rows DP-33 to DP-38 and the dashpay.shielded_tips parity entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Finishing Touches
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. |
|
⏹️ Not reviewed — PR is closed (merged) (commit 3db3232) |
From review: - A bind that would drop or re-key the account an unresolved note spend was paid from is refused, as it was for an identity-funded shield: dropping the account dropped the spend's record, and with it the refusal of a second tip to the same recipient. - A tip is admitted before its seed is resolved (PlatformWallet::admit_shielded_tip, passed to send_shielded_tip), so a second request cannot wait in a slow mnemonic lookup and pay again. - The outputs read back from a saved transfer must hash to the id it was saved under: a payment that no longer opens while its change does now blocks instead of reading as "pays nobody". - A tip to an address of the account it is paid from is refused. - The paying account is settled again after the network lookups. - A review and an identity balance are read on the coordinator the wallet is bound on. - The three exports that block on the runtime refuse a call made from a callback the library invokes, instead of panicking there. - The shielded sync requested after an unconfirmed tip is requested by the manager (ShieldedTipSender), not by the C export. A test builds and proves a real transfer and reads its recipient back from the saved record. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…gain ShieldedTipPending says the call sent nothing, not what became of the earlier payment: the refusal ends when that payment executed as well as when it can no longer execute. The docs no longer tell a host to review and send again. A review's change is about confirmed recipients, not paid tips. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…actly From review: - The READMEs and the send docs no longer say to review and send again after ShieldedTipPending: the refusal ends when the earlier payment executed as well as when it cannot, so a host resends only once that payment is known to have failed. Unconfirmed outcomes are named apart from "sent nothing". - The JNI bridge reads tip strings as UTF-16 and decodes them strictly: a NUL beside a supplementary character is refused instead of rewritten by the lossy modified UTF-8 fallback, and a supplied memo that does not read is refused instead of sent as no memo. - Kotlin's ShieldedTipRecipient copies its bytes in and out, so a send passes what the review returned. - A review's change is about confirmed recipients, not paid tips. - FfiSmokeTest calls the four tip natives through the loaded library. Co-Authored-By: Claude Fable 5.2 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (queue backlog)
Changes requested: 2 blockers
- A tip opened from a saved contact can pay the new owner of the contact’s old username —
packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt:262-270(new)
Impact: A sender tipping a saved contact after its cached username changes hands can irreversibly pay the new owner instead of the selected contact. - A tip to the paying account’s own address can be sent again while the first is unresolved —
packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/SendShieldedTipScreen.kt:88-94(new)
Impact: A sender who tips their own published address from the same funded account can reopen the form after an uncertain result and pay a second fee before the first transfer is resolved.
This PR adds shielded tips to the Kotlin example app from the DashPay tab and saved contacts, with recipient resolution and spending delegated to the Rust wallet. CI passed the native and app builds and unit tests; the first emulator attempt failed in the unchanged MasternodeVotingKeySigningTest with User not authenticated. The emulator rerun is pending.
🔴 2 blocking | 🟡 3 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The diff adds a substantial Android review-and-submit flow, but it delegates payment execution and account selection logic to the existing wallet API rather than changing those critical mechanisms. - Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
- Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt`:
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt:262-270: A tip opened from a saved contact can pay the new owner of the contact’s old username
Impact: A sender tipping a saved contact after its cached username changes hands can irreversibly pay the new owner instead of the selected contact.
A sender can open a saved contact, confirm the familiar username, and pay a different identity. This shortcut passes only `dpnsHint`, a display label cached when the contact was added, and drops `contactIdHex`. DPNS transfers update `records.identity`, so the wallet correctly resolves the name and profile to the new owner. On the first tip to that name, the review shows “First tip” with no mismatch warning; the send-time check confirms only that the name and address still match that review. Carry the selected contact ID through the route and have Rust refuse a contact-mode review if the resolved identity differs. Keep the free-form username flow unchanged and test a name that changed hands before the first contact tip.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/SendShieldedTipScreen.kt`:
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/SendShieldedTipScreen.kt:88-94: A tip to the paying account’s own address can be sent again while the first is unresolved
Impact: A sender who tips their own published address from the same funded account can reopen the form after an uncertain result and pay a second fee before the first transfer is resolved.
On this head, the wallet does not enforce the repeat-payment guard this screen relies on for a same-account tip. The transfer path accepts the account’s own address, but `unresolved_transfer_recipients` in `tip_payment.rs:276–280` drops every recovered output owned by the paying account, including the actual tip. After relaunch, review and send therefore miss the pending payment. The saved reservation protects only the first transfer’s inputs, so a second transfer can use other spendable notes. Bring in the Rust fix from #6191 (`60f6b8e1b9`), which already refuses same-account tips before spending and is present on the newer target branch but not on this reviewed head. No Kotlin-only guard is needed.
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/SendShieldedTipScreen.kt:179-189: Editing the username or amount during lookup can bring back the old review
Impact: A sender who edits either field during a slow lookup can see the corrected form alongside a Send button for the earlier recipient or amount.
The form can show one payment while Send uses another. Both fields remain editable during review, and their edit handlers clear `reviewed`, but the suspended lookup can write the old result back to `reviewed` or open `changedReview` for the old inputs. The confirmation does display the amount and recipient that will actually be sent, but it should not revive a review that an edit invalidated. Lock those fields during lookup or discard both kinds of result when the draft has changed, including during an automatic re-review after sync. Test an edit before a delayed response returns.
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/SendShieldedTipScreen.kt:201-205: A sync can make the same draft sendable after the earlier tip already landed
Impact: A sender checking an uncertain payment can mistake the newly enabled Send tip button for a way to finish the original payment when it would actually create a new one.
The recovery screen does not distinguish a new tip from the draft the sender entered while checking the earlier one. It automatically re-reviews that draft on sync and enables Send when `unresolved` becomes false, but the flag clears both when the old transfer executed and when it can no longer execute. Keep the automatic status refresh, but explain that the cleared hold does not mean the earlier payment failed, and make starting a new tip a separate action.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipPresentation.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipPresentation.kt:98-104: The review describes a failed payment attempt as the last tip
Impact: A sender who reviews again after an insufficient-funds failure can be told it is the same recipient as their last tip even though they have never paid that username.
The copy describes payment history, but the wallet tracks confirmation history. `tip_payment.rs:488–505` records the confirmed recipient before attempting the transfer and keeps it regardless of the result. Use “last confirmed recipient” in the review and change dialog so a prior confirmation is not presented as proof of payment.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Shielded Clear removes unresolved tip records — The existing Clear path deletes
shielded_pending_spends, so an explicit Clear followed by rebinding can remove the repeat-payment guard while the original transfer may still execute. This PR does not change that reset path, and #6191 already documents the limitation.- Follow-up: Track the note-spend case alongside the related identity-debit issue #6011 and address it in a wallet PR that refuses Clear while a spend is unresolved or preserves the guard until settlement.
…into feat/kotlin-example-shielded-tips
…r re-offer a resolved one From review: - The name and amount are locked while the wallet reviews them, and a result for a draft edited meanwhile is dropped, as is a pending changed-recipient dialog. - When a re-check finds an earlier payment's hold ended, the review is dropped with a notice that the payment either executed or can no longer execute; another tip starts from a new review instead of an enabled Send. - The code 84 text no longer says to review and send again. - The change line and dialog speak of the recipient last confirmed for the name, not of the last tip: a confirmation is recorded before anything is built. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From review: - The docs say to leave a pending tip's outcome unknown, and not resend, when the exact earlier attempt cannot be identified: the send returns no activity id, and look-alike entries can have other outcomes. - Kotlin's ShieldedTipRecipient prints redacted, so logging a changed review does not tie the wallet to its previous recipient. - The exact JNI string reader checks for null itself, at the raw call. - The smoke test passes an emoji on its own: it must cross intact and be refused by Rust as an amount. Co-Authored-By: Claude Fable 5.2 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- A tip opened from a saved contact can pay the new owner of the contact’s old username —
packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt:262-270(thread, carried)
Impact: A sender making a first tip from a saved contact after its cached username changes hands can irreversibly pay the new owner instead of the selected contact.
New on this head: This revision ties each Kotlin tip review to its draft, requires a fresh review when a sync recheck no longer reports a hold, and picks up the wallet’s same-account tip guard. The exact-head Kotlin CI build, SDK and app unit tests, and emulator FFI smoke tests passed; they did not exercise a funded tip or restart recovery.
🔴 1 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (1)
- 🔴 Blocking: A tip opened from a saved contact can pay the new owner of the contact’s old username —
packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt:262-270(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change adds a substantial Android payment UI and lifecycle flow, but delegates transaction execution, account validation, and persistent duplicate-send protection to the unchanged SDK and wallet. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipPresentation.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ShieldedTipPresentation.kt:109-113: A profile address change can make a pending transfer look resolved
Impact: A sender checking a pending shielded transfer can be told it has settled after the recipient changes their published address, even though the transfer can still execute.
The new notice reports a final outcome for a payment the wallet has not necessarily settled. A direct shielded transfer to a profile’s published address can remain pending without recording a confirmed tip recipient for that username. The first tip review sees the transfer at the published address. If the profile replaces that address before a recheck and the transfer is still pending, `tip_payment.rs:324–330,407–413` checks only the new address and any last-confirmed tip address, so the review returns `unresolved = false` even though the old transfer remains pending. Keep dropping the old review, but say only that the refreshed review no longer reports a hold and direct the sender to Shielded Activity to check the earlier payment. Update the wording test to match; a definitive outcome would need to come from the wallet for that specific payment.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt`:
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/dashpay/ContactDetailScreen.kt:262-270: A tip opened from a saved contact can pay the new owner of the contact’s old username
(carried; thread: https://github.com/dashpay/platform/pull/6197#discussion_r4674205077)
…into feat/kotlin-example-shielded-tips
…cks the name; claim nothing when a hold ends From review: - The contact detail shortcut is removed, with the route's contact name: a contact's saved DPNS name can have moved to another identity, and the check that it still pays the contact belongs in the wallet (#6200). - When a re-check no longer reports a hold, the notice says only that the refreshed review shows none and that this says nothing about the earlier payment: the review answers for the recipient as it is now. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This update removes the saved-contact shortcut for shielded tips, keeps username tips available from the DashPay tab, and clarifies that a refreshed review no longer reporting a hold does not establish the earlier payment’s outcome. The Kotlin SDK build and x86_64 emulator tests are still pending in CI; this was a static review.
🔴 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: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The Compose screen and coordinator add substantial review, submission, and recovery logic, but the diff delegates funds movement and account selection rules to unchanged wallet APIs. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— 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.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- A username review cannot report the status of a specific earlier transfer — The wallet matches pending transfers against the profile’s current address and the last address confirmed for the username. If a direct transfer paid an address that is now neither, the review can stop reporting a hold while that transfer is still pending. The app now leaves the earlier payment’s outcome unknown.
- Follow-up: Follow up in #6191 or a separate wallet issue to expose the status of the exact earlier transfer.
…ther identity A tip started from a saved contact passed only the contact's DPNS name. If the name had since moved to another identity, the first review showed the new owner as a new recipient with no warning. review_shielded_tip and send_shielded_tip take an optional expected identity (the contact's id) and refuse another one with ShieldedTipRecipientMismatch, FFI code 85, mirrored in Swift and Kotlin. The C exports take it as a nullable contact_identity_id. Nothing is passed when the user typed the name. Also documented: a pending tip's outcome is unknown when its exact earlier attempt cannot be identified, and the unresolved check does not count a transfer to an address the wallet never confirmed for the name. Closes #6200 Co-Authored-By: Claude Fable 5.2 <[email protected]>
reviewShieldedTip and sendShieldedTip take an optional contactIdentityId in Swift and Kotlin (defaulted, so existing callers compile), carried by the JNI bridge to the C exports. Rust refuses a name that now belongs to another identity; the wrappers do not compare ids. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ther identity A tip started from a saved contact passed only the contact's DPNS name. If the name had since moved to another identity, the first review showed the new owner as a new recipient with no warning. review_shielded_tip and send_shielded_tip take an optional expected identity (the contact's id) and refuse another one with ShieldedTipRecipientMismatch, FFI code 85, mirrored in Swift and Kotlin. The C exports take it as a nullable contact_identity_id. Nothing is passed when the user typed the name. Also documented: a pending tip's outcome is unknown when its exact earlier attempt cannot be identified, and the unresolved check does not count a transfer to an address the wallet never confirmed for the name. Closes #6200 Co-Authored-By: Claude Fable 5.2 <[email protected]>
…into feat/kotlin-example-shielded-tips
…ng its name The wallet now takes the saved contact's identity with a tip review and send and refuses a name that moved to another identity (#6200, code 85). The contact detail shortcut is back: it fixes the contact's saved DPNS name and passes the contact's identity through; the app compares no ids. A refusal reads "nothing was sent" and points to tipping the name from the DashPay tab. TEST_PLAN DP-39. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…let-shielded-tips # Conflicts: # packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/errors/DashSdkError.kt # packages/kotlin-sdk/sdk/src/test/kotlin/org/dashfoundation/dashsdk/errors/DashSdkErrorTest.kt # packages/rs-platform-wallet-ffi/ERROR_CODE_REGISTRY.md # packages/rs-platform-wallet-ffi/src/error.rs # packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift # packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ErrorHandlingTests.swift
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
New on this head: This revision restores the Kotlin example app’s contact-tip shortcut and passes the saved contact identity to the Rust wallet for both review and send. The Kotlin SDK build and x86_64 emulator tests were still pending, with no failed checks reported; no tests were run locally.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — SendShieldedTipScreen.kt adds a substantial payment review and submission flow, but the diff changes app-side orchestration rather than the wallet logic that moves funds, selects coins, or signs transactions. - Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md:347: A contact name that moves after review sends the user back to the locked username
Impact: A sender whose saved contact’s username changes hands between review and send is safely refused, but gets a prompt to review again instead of the contact-specific explanation promised by DP-39.
No funds are sent, but the sender is told to review the same locked username again without being told that it no longer belongs to the contact. The restored shortcut passes the saved contact ID to both calls. At send, `tip_payment.rs:522–525` checks that ID against the earlier review, which still matches; the fresh lookup at lines 552–556 then rejects a different owner with a valid shielded address using `InvalidIdentityData`, whose message asks the sender to review again. If the new owner has no valid shielded address, profile lookup returns the missing-address error before the identity check, even at review. The Kotlin test injects code 85 directly, so it verifies the wording but not which error the wallet returns. Either document the actual outcomes in DP-39 and the parity manifest, or make the wallet check the freshly resolved DPNS identity before profile lookup in both paths and add a regression test under #6200. Keep the separate reviewed-recipient check for shielded-address changes.
…let-shielded-tips # Conflicts: # packages/rs-platform-wallet/src/wallet/platform_wallet.rs
…ts note list From review: - The store loader treats a note-spend transition with no nullifier listed as a damaged note-spend row: it is retained without being loaded, so it is not listed as an identity-funded debit and tips fail closed on it. - ShieldedBalanceBusy (87) is described as what it is: the bounded read did not finish in time because the wallet's state or its shielded store was held. It no longer says a scan or a spend holds the store, which the timeout does not establish. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…test on an unbound wallet The busy code of the identity balance read means the read did not finish within its wait budget, because the wallet's state or its shielded store was held. The Swift and Kotlin docs named a scan or a spend only. ShieldedTipFfiTest leaves the wallet unbound, so a contact id dropped on the way stops at the binding check instead of reaching a name lookup, and it expects exactly NotFound for an identity the wallet does not hold. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…into feat/kotlin-example-shielded-tips
…ail closed on an undecodable spend A balance read that overlaps an admitted Clear returned Unverified, also when that Clear gave up without wiping anything and the identity's proof still stood. It now returns ShieldedBalanceBusy, and Unverified only once the proof no longer stands. Asking whether a Clear is admitted took a shared permit of the operation admission for an instant, which could refuse a Clear requested in that instant. The coordinator now keeps a flag for it. Also: - a saved spend that lists no notes and does not decode blocks tips instead of reading as an identity-funded shield; - a tip review on a wallet removed during its lookups is refused instead of reading the purged recipients as none; - a re-keyed account is purged as before when a spend saved its record during the registration: only a dropped account keeps its state; - a tip derives its spend keys once; - the README shows the review's third argument, lists FFI code 20 beside 18, and says a Clear ends an identity's proof. Tests: the balance read during and after a Clear, a numbered slot an identity holds at the claim, the u64 fraction boundary of the amount. Co-Authored-By: Claude Fable 5.2 <[email protected]>
… and during a Clear The Swift and Kotlin guides still said the read waits at most 100 ms for the shielded store. The budget covers the whole local read. The busy error is also what the read returns while a shielded Clear is running. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…into feat/kotlin-example-shielded-tips
…ity balance Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This revision updates KotlinExampleApp’s shielded-tip test plan to note that refreshing the paying identity’s balance can return Busy during a shielded Clear. The Kotlin SDK build and x86_64 emulator tests passed on this head; no code checks failed.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The new Kotlin screen and coordinator integration add substantial review and submission logic, but the diff leaves transaction construction, account validation, and funds-movement rules in the existing wallet SDK. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md:350: DP-37 misses the Busy result when a Clear is running and the store is readable
Impact: A tester can pass DP-37 without checking that the tip form keeps the last balance when a refresh reads the store successfully but a Clear is still running.
DP-37 can miss a regression in what the form shows during a Clear. The updated row describes code 87 as a read that finds the store busy, but `tip_payment.rs:783–806` can return it after a successful store read if a Clear is still in progress. The Rust regression test explicitly releases the store lock before asserting Busy (`tip_payment_tests.rs:962–972`). Describe code 87 as either an expired read budget or a Clear still in progress. Add pass criteria for both states of the Clear: keep the previous display on code 87, then show Unverified on the next successful refresh after a completed Clear ends the preparation.
| | DP-34 | Tip recipient changed since the last tip | Shielded | Uncommon | ✅ | | Mirrors the Swift tip row for a changed recipient. After `DP-33`, have the recipient publish another shielded address (`DP-20`), or point the name at another identity, then review a tip to the same name again. The wallet reports the recipient as changed: the **Tip recipient changed** dialog shows the previous and the new identity and address, with **Review new recipient** (`dashpay.tip.changed.review`) and **Cancel** (`dashpay.tip.changed.cancel`). Only **Review new recipient** shows the review, whose change line reads "Differs from the recipient last confirmed for this username…"; Send then pays the new recipient. A change between review and send is refused by the wallet with nothing sent (its message in the **Tip not sent** dialog). Not yet driven on an emulator. Unit tests: `ShieldedTipPresentationTest` (`should word each recipient change as a confirmation, never as a paid tip`, `should show a first review, asking first when the recipient changed`). | | ||
| | DP-35 | Tip that may have gone through (code 18 / 20) | Shielded | Uncommon | ✅ | | Mirrors the Swift tip row for an unconfirmed tip. Interrupt a `DP-33` send after it is signed (cut the emulator's network while it broadcasts) so Rust reports `ShieldedSpendUnconfirmed` (18) or `TransactionBroadcastUnconfirmed` (20). Result: **May have gone through**, "…Do not send it again. A shielded sync resolves it; until then the wallet refuses another tip to this recipient.", with **Sync shielded now** (`dashpay.tip.outcome.syncNow`) and **Done**; no send button. Pass: reviewing a tip to the same name then shows `DP-36`'s unresolved state until a shielded sync sees the spend or proves it cannot execute. Not yet driven on an emulator. Unit tests: `ShieldedTipPresentationTest` (`should not offer a resend for a tip that may have gone through`). | | ||
| | DP-36 | Earlier tip to the recipient unresolved (code 85), also after a relaunch | Shielded | Uncommon | ✅ | restart | Mirrors the Swift tip row for a pending tip. Reach it from `DP-35`, or by sending a second tip to the same name before the first is seen by a shielded sync. Review: `dashpay.tip.unresolved` "An earlier payment from this wallet to this recipient is not resolved yet…", **Send tip** disabled, **Sync shielded now** (`dashpay.tip.syncNow`). A send that meets the hold anyway (`ErrorShieldedTipPending`, 85) shows **Tip not sent**: "This attempt sent nothing. Another tip from this wallet is being sent, or an earlier payment to this recipient may still execute… check Shielded Activity before you tip again.". Restart: kill the app (`adb shell am force-stop org.dashfoundation.example`) while the tip is unresolved, relaunch and review the same name: still unresolved (the wallet reads it from the saved spend record). Pass: after each shielded sync the review is read again on its own; once it no longer reports the hold the review is dropped and `dashpay.tip.holdEnded` reads "The refreshed review no longer reports a hold on this recipient. That does not say what became of the earlier payment: check it in Shielded Activity…", with **Send tip** not offered until **Review tip** is tapped again as a new tip; no relaunch needed, nothing is sent twice. Not yet driven on an emulator. Unit tests: `ShieldedTipPresentationTest` (`should word a tip the wallet refused as pending, with nothing sent`, `should not turn a cleared hold into an enabled send`, `should drop a review whose draft was edited while the wallet looked it up`); the Rust tests listed in #6191. | | ||
| | DP-37 | Tip from the identity's own shielded account | Shielded | Uncommon | ✅ | | Mirrors the Swift tip row for the identity account. **Pay from: This identity** shows the identity's shielded balance as the wallet reports it (`dashpay.tip.identityBalance`, `platform_wallet_manager_shielded_identity_balance`): "Not known until this identity's shielded account is prepared in this session" (with **Prepare this identity's shielded account**, `dashpay.tip.prepareIdentityAccount`, which calls `prepareShieldedIdentityAddress`), "Not known until a shielded sync restores account N", or the exact amount; unknown is never shown as 0. A read that finds the store busy (`ShieldedBalanceBusy`, 87, during a scan, a spend or a shielded Clear) keeps the last state and reads again on the next resume or sync; any other read failure shows "Could not read: <reason>". **Main shielded** shows account 0's balance (`dashpay.tip.mainBalance`). A send pays from the account the wallet proves is the identity's; a wallet that does not hold the identity is refused with "This wallet does not hold the paying identity. Nothing was sent." Pass: after a tip from **This identity**, only that identity's balance drops; account 0 is unchanged. Not yet driven on an emulator. Unit tests: `ShieldedTipPresentationTest` (`should never show an unknown identity balance as zero`, `should keep the last identity balance only for a busy read and show any other failure`, `should word an identity the wallet does not hold, and keep a removed wallet's own message`). | |
There was a problem hiding this comment.
🟡 Suggestion: DP-37 misses the Busy result when a Clear is running and the store is readable
Impact: A tester can pass DP-37 without checking that the tip form keeps the last balance when a refresh reads the store successfully but a Clear is still running.
DP-37 can miss a regression in what the form shows during a Clear. The updated row describes code 87 as a read that finds the store busy, but tip_payment.rs:783–806 can return it after a successful store read if a Clear is still in progress. The Rust regression test explicitly releases the store lock before asserting Busy (tip_payment_tests.rs:962–972). Describe code 87 as either an expired read budget or a Clear still in progress. Add pass criteria for both states of the Clear: keep the previous display on code 87, then show Unverified on the next successful refresh after a completed Clear ends the preparation.
source: gpt-6.2-sol (phase2-reviewer: general, architecture-layering, security-auditor)
|
Bots are done — your move: post |
|
Bots are done — your move: post |
|
Bots are done — your move: post |
|
Bots are done — your move: post |
…le-shielded-tips # Conflicts: # packages/rs-platform-wallet/src/wallet/shielded/tip_payment.rs # packages/rs-platform-wallet/src/wallet/shielded/tip_payment_tests.rs
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…ftExampleApp The Kotlin tip rows DP-33 to DP-38 now mirror Swift DP-33 to DP-38 (#6198) id for id; DP-39 (rotation or tab switch while sending) is Kotlin only. Test tags use Swift's accessibility ids where the flow is the same (dashpay.tip.contactEntry, .review.error, .recipient.identity, .sync, .busy, .balance, .outcome.submitted, .done and the rest). 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 |
…le-shielded-tips # Conflicts: # docs/sdk/sdk-parity-manifest.json # packages/kotlin-sdk/PARITY_SUMMARY.md
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Basic explanation
What this does. Adds a Send Shielded Tip screen to KotlinExampleApp. A user pays a DashPay username, or a contact, from the shielded pool, to the shielded address that person's DashPay profile publishes. Built on #6191 (wallet and FFI) and #6192 (SDK wrappers), both merged.
Value. Android users can tip by username. The wallet makes every decision; the screen only shows what it returned. A rotation or a tab switch while the tip is being proved cannot lose the result or pay twice, and after a relaunch the wallet itself refuses a repeat until a shielded sync resolves the first tip.
Risks.
Issue being fixed or feature implemented
Shielded tips for 5.1, Android app part. This replaces the Kotlin half of #5711 on
v5.1-dev, built on the API of #6191 / #6192. Covers both items of #5674 on the app side:ShieldedIdentityPaymentCoordinator. After a relaunch, the wallet reports the earlier tip as unresolved on review and refuses a send with code 85.ShieldedTipSource.Identity(id), and the wallet proves that account with the seed during the send.What was done?
ui/dashpay/SendShieldedTipScreen.kt(new, routeDashPaySendShieldedTip):parseShieldedTipAmountparses the amount, thenreviewShieldedTipreviews the name. The review shows the name, the recipient's identity id and shielded address, the parsed amount, the paying account and how the recipient compares with the last tip.sendShieldedTipgets the reviewed recipient and amount back unchanged. It runs on the coordinator, keyed by wallet and sending identity. The screen adds no retry on cancellation: the SDK already keeps a result that completed after its caller was cancelled.shieldedIdentityBalancereports it, never showing unknown as 0. While it is unverified, Prepare this identity's shielded account callsprepareShieldedIdentityAddress. Account 0 shows the balance Rust announces.ui/dashpay/ShieldedTipPresentation.kt(new): wording and outcome mapping (ShieldedTipMessages), the source choice, the reviewed tip.dashpay.sendShieldedTip).dashpay.detail.sendShieldedTip), with the contact's saved DPNS name filled in and fixed. The contact's identity goes to the wallet with the review and the send (contactIdentityId), so Rust refuses a name that moved to another identity (code 86,ShieldedTipRecipientMismatch, Shielded tip from a contact: check that the username still belongs to that contact #6200); the app compares no ids. Disabled with an explanation when no name is saved for the contact.ShieldedIdentityPaymentCoordinator: newKind.SHIELDED_TIP.DP-33..DP-39.DP-33..DP-38mirror SwiftDP-33..DP-38(feat(swift-example-app): shielded tips to a DashPay contact or username #6198) id for id; KotlinDP-37covers SwiftDP-37's contact-mismatch case andDP-33its amount and review refusals.DP-39(rotation or tab switch while sending) is Kotlin-only. Tier and layer counts updated by hand: Common +1, Uncommon +5, Thorough +1, Shielded +7.DP-35added to the restart tag.dashpay.shielded_tips, with the four FFI symbols declared, andPARITY_SUMMARY.mdregenerated. On this base Swift is SDK partial and example app unsupported; the Swift tip screens PR fills in its side.Before and after
Before: the DashPay tab had no way to tip. The only shielded payment to a person was a generic shielded transfer, where you paste an address.
After:
Public interface changes
All in the example app. No SDK, JNI, FFI or Room interface changes.
DashPaySendShieldedTip(identityIdHex: String, contactIdHex: String? = null, contactUsername: String? = null), composableSendShieldedTipScreen(identityIdHex, contact: ShieldedTipContact?, navController)anddata class ShieldedTipContact(identityIdHex: String, username: String).ShieldedIdentityPaymentCoordinator.KindgainsSHIELDED_TIP. Existing kinds and their keys are unchanged.dashpay.tip.contactEntry,.contactNoUsername,.username,.amount,.memo,.review,.review.error,.review.amount,.recipient.identity,.recipient.address,.change,.change.previous.identity,.change.previous.address,.unresolved,.sync,.send,.busy,.balance,.balance.prepare,.outcome.submitted,.outcome.mayHaveGoneThrough,.done. Kotlin-only, for flows Swift does not have:dashpay.sendShieldedTip(the DashPay tab entry; Swift's is on the profile,dashpay.tip.profileEntry),dashpay.tip.source.identity/.source.mainand.mainBalance(Swift pays only from the identity's account),.reviewed,.outcome,.changed.review/.changed.cancel(Kotlin confirms a changed recipient in a dialog; Swift warns on the review),.holdEnded.docs/sdk/sdk-parity-manifest.json: new capabilitydashpay.shielded_tipsand shared symbolsplatform_wallet_parse_shielded_tip_amount,platform_wallet_manager_review_shielded_tip,platform_wallet_manager_send_shielded_tip,platform_wallet_manager_shielded_identity_balance.How Has This Been Tested?
./gradlew :app:testDebugUnitTest --tests '…ShieldedTipPresentationTest' --tests '…services.shielded.*' --tests '…ui.shielded.*'(Homebrew openjdk@17):ShieldedTipPresentationTest10/10 (new),ShieldedIdentityPaymentCoordinatorTest4/4,ShieldedIdentityFlowsTest14/14. The app module compiles with the new screens.python3 scripts/check_sdk_parity_manifest.py --write-summary: OK, 52 capabilities.Not yet verified
build_android.sh, so the new JNI symbols are not linked into the app library yet.DP-33..DP-39, including a funded tip, a relaunch with a tip unresolved, and a rotation during a send.Breaking Changes
None.
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 ·
3db3232/skip-botsproceeds without the ones not yet reported/self-reviewedsdk-parity— you own itkotlin-sdk(packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md,packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/di/AppContainer.kt,packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/navigation/AppNavHost.ktand 8 more) — HashEngineeringWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.