Skip to content

feat(sdk): add Swift, JNI and Kotlin wrappers for shielded tips - #6192

Merged
QuantumExplorer merged 36 commits into
v5.1-devfrom
feat/sdk-shielded-tip-wrappers
Nov 24, 2026
Merged

QuantumExplorer merged 36 commits into
v5.1-devfrom
feat/sdk-shielded-tip-wrappers

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does. Adds the Swift SDK, JNI and Kotlin SDK wrappers for the shielded tip calls that #6191 adds to the wallet and its C FFI: parse an amount, review a recipient, send a tip, read an identity's shielded balance. #6191 is merged, so this now targets v5.1-dev directly and its diff is the wrappers only.

Value. SwiftExampleApp and KotlinExampleApp can build their tip screens on these calls. The screens show what Rust returns and decide nothing.

Risks.

  • Client only. The wrappers convert types and throw the typed error; nothing else.
  • Not run on a device or simulator yet (see "Not yet verified").

Issue being fixed or feature implemented

Shielded tips for 5.1, host SDK side. Part of the work that replaces #5288, #5709 and #5711 on v5.1-dev. The example app screens are not in this pull request.

What was done?

Swift (Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift, new):

public struct ShieldedTipRecipient: Sendable, Equatable { let identityId: Data; let address: Data }
public enum ShieldedTipRecipientChange: Sendable, Equatable { case new, unchanged, changed(previous: ShieldedTipRecipient) }
public struct ShieldedTipReview: Sendable, Equatable { let recipient; let change; let unresolved: Bool }
public enum ShieldedTipSource: Sendable, Equatable { case identity(Data), account(UInt32) }
public enum ShieldedIdentityBalance: Sendable, Equatable {
    case unverified, unavailable(account: UInt32), available(account: UInt32, credits: UInt64)
}

extension PlatformWalletManager {
    nonisolated public static func parseShieldedTipAmount(_ text: String) throws -> UInt64
    public func reviewShieldedTip(walletId: Data, username: String,
                                  contactIdentityId: Data? = nil) async throws -> ShieldedTipReview
    public func sendShieldedTip(walletId: Data, source: ShieldedTipSource, username: String,
                                expectedRecipient: ShieldedTipRecipient,
                                contactIdentityId: Data? = nil, amount: UInt64,
                                memo: String? = nil, resolver: MnemonicResolver) async throws
    public func shieldedIdentityBalance(walletId: Data, identityId: Data) async throws -> ShieldedIdentityBalance
}

The three manager calls are admitted and counted like the other native manager operations, so a shutdown waits for them.

Kotlin (wallet/ShieldedTip.kt, new; PlatformWalletManager.kt; ffi/FundingNative.kt):

class ShieldedTipRecipient(identityId: ByteArray, address: ByteArray)   // copies its bytes in and out; equality over the bytes
sealed interface ShieldedTipRecipientChange { New; Unchanged; Changed(previous) }
data class ShieldedTipReview(val recipient, val change, val unresolved: Boolean)
sealed interface ShieldedTipSource { Identity(identityId: ByteArray); Account(account: Int) }
sealed interface ShieldedIdentityBalance { Unverified; Unavailable(account: Int); Available(account: Int, credits: Long) }

// on PlatformWalletManager
fun parseShieldedTipAmount(text: String): Long
suspend fun reviewShieldedTip(walletId: ByteArray, username: String,
                              contactIdentityId: ByteArray? = null): ShieldedTipReview
suspend fun sendShieldedTip(walletId: ByteArray, source: ShieldedTipSource, username: String,
                            expectedRecipient: ShieldedTipRecipient, amount: Long, memo: String? = null,
                            contactIdentityId: ByteArray? = null)
suspend fun shieldedIdentityBalance(walletId: ByteArray, identityId: ByteArray): ShieldedIdentityBalance

The suspend calls run under the teardown gate, and the send uses the manager's own mnemonic resolver, as shieldedTransfer does. The send runs under opReturningCompletedResult, like the other calls that move funds: a caller cancelled while the native call runs still gets the outcome, so a sent tip never reads as cancelled.

JNI (packages/rs-unified-sdk-jni/src/funding.rs): four FundingNative bridges, one C call each. The review and the balance cross as packed big-endian byte arrays read with BlobReader, the convention this crate uses for small structs.

Docs. A "Shielded tips" section in the Swift PlatformWallet/README.md and in the Kotlin SDK README.md: parse, review, show the recipient and the change, send with the reviewed recipient, what each error means, and how to show an identity's balance.

How a screen uses it

let credits = try PlatformWalletManager.parseShieldedTipAmount(typed)
let review = try await manager.reviewShieldedTip(walletId: walletId, username: name)
// show review.recipient, review.change and review.unresolved, then on confirm:
try await manager.sendShieldedTip(walletId: walletId, source: .identity(identityId), username: name,
                                  expectedRecipient: review.recipient, amount: credits, resolver: resolver)

What the errors of the send mean, the same in both SDKs:

Swift / Kotlin Meaning
shieldedSpendUnconfirmed / ShieldedSpendUnconfirmed (also transactionBroadcastUnconfirmed) The tip may have left the wallet and may still execute. Never send it again. A shielded sync resolves it.
shieldedTipPending / ShieldedTipPending (native code 85) This call sent nothing. Another tip is being sent, or an earlier payment to the recipient is unresolved. That earlier payment may be the same tip and may pay the recipient: the refusal ends when it executed as well as when it cannot. Send again only once it is known to have failed, never because the refusal ended.
shieldedTipRecipientMismatch / ShieldedTipRecipientMismatch (native code 86) contactIdentityId was given and the name now belongs to another identity. Nothing sent. The review throws it too.
identityNotFound / DashSdkError.NotFound The wallet holds no such paying identity. Nothing sent.
anything else Not sent.

shieldedIdentityBalance is unverified until prepareShieldedIdentityAddress (already in both SDKs) has proved the identity's account in the session. It reads local state within a wait budget of 100 ms. shieldedBalanceBusy / ShieldedBalanceBusy (native code 87, #6201) means the read did not finish within it, because the wallet's state or its shielded store was held, or that a shielded Clear was running; it is the only error that means keep the last state and read again later; any other error is a failure to show.

Starting a tip from a saved contact

Pass the contact's identity id as contactIdentityId to the review and the send. Rust refuses when the contact's name now belongs to another identity (#6200), instead of showing that identity as a first tip to the contact. Leave it out when the user typed the name. The wrappers do not compare ids.

Differences between the two SDKs

  • Kotlin carries credits and account numbers as Long / Int, as its other shielded calls do. The JNI bridge refuses, before the C call, values the C types cannot carry: a negative amount or account, an id of the wrong length, a string that holds a NUL or an unpaired surrogate, and a parsed amount above Long.MAX_VALUE credits (about 92 million DASH). Everything else reaches Rust as given. The tip strings are read as UTF-16 and decoded strictly, so a memo is passed exactly or refused, never rewritten or dropped.
  • parseShieldedTipAmount is a static function in Swift and an instance function on the manager in Kotlin.
  • A refused amount surfaces in Kotlin as DashSdkError.PlatformWallet.Generic with native code 2, because Kotlin has no typed class for ErrorInvalidParameter.

Public interface changes

Additions only, listed above. No existing Swift, Kotlin or JNI signature changes. No Room schema change and no SwiftData model change. docs/sdk/sdk-parity-manifest.json is not changed: it lists capabilities that have a test or a device gate, and the tip screens that would give it one are not in this pull request.

How Has This Been Tested?

  • cargo clippy -p rs-unified-sdk-jni --all-targets --all-features --locked -- -D warnings: clean. cargo test -p rs-unified-sdk-jni --all-features --lib -- funding::tests: 2 passed (the byte layouts Kotlin decodes).
  • Kotlin: ./gradlew :sdk:compileDebugKotlin succeeds; ShieldedTipTest (11 tests: each change kind, each balance state, the previous recipient only when changed, malformed input) and DashSdkErrorTest (39 tests) pass.
  • Swift: the SDK target and its unit test target compile for the iOS simulator against the header generated from feat(platform-wallet): shielded tips to a DashPay username, decided by the wallet #6191 (compile check with a borrowed framework binary, no link against the new symbols). New ShieldedTipDecodingTests cover each recipient change and balance state, unknown discriminants, and text holding a NUL, which Swift refuses before the native call because a C string would carry only its prefix to Rust.

Not yet verified

  • build_ios.sh and build_android.sh, so no link of the new symbols into either app library.
  • Any run on a simulator, emulator or device, including a funded tip.
  • JNI symbol names and descriptors against a loaded .so: FfiSmokeTest.shieldedTipSymbolsBindAndRejectInvalidInput calls the four natives through the loaded library with inputs that fail before any network or proving work, and ShieldedTipFfiTest sends through a real offline wallet with distinct contact and reviewed identities and expects the typed mismatch, then expects exactly DashSdkError.NotFound from a balance read for an identity the wallet does not hold. Its wallet is left unbound, so a contact id dropped on the way would stop at the binding check instead of reaching a name lookup. Both compile locally and run in the emulator job on this pull request; neither has been run locally.
  • Swift unit tests: they compile, and have not been run on a simulator.

Breaking Changes

None.

Checklist:

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 8cd82e1

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Build running
  • Approvals
    • kotlin-sdk (packages/kotlin-sdk/README.md, packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/FfiSmokeTest.kt, packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt and 5 more) — HashEngineering
    • swift-sdk (packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift, packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md, packages/swift-sdk/SwiftTests/SwiftDashSDKTests/ShieldedTipDecodingTests.swift) — llbartekll or romchornyi

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

QuantumExplorer and others added 2 commits November 24, 2026 06:59
…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]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

@thepastaclaw

thepastaclaw commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress (commit 8cd82e1) · live progress

@QuantumExplorer QuantumExplorer changed the title feat(sdk): Swift, JNI and Kotlin wrappers for shielded tips feat(sdk): add Swift, JNI and Kotlin wrappers for shielded tips Nov 24, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Preliminary review — Phase 1 blocker gate

Changes requested: 1 blocker

  • Cancelling a Kotlin tip coroutine can hide a completed payment — packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:2441 (new)
    Impact: An Android user who leaves a payment screen while the tip is processing can have the payment complete without the caller seeing success, and a retry can send a second tip.

This PR adds Swift and Kotlin APIs for parsing shielded tip amounts, reviewing recipients, sending tips, and reading identity shielded balances, with JNI bridging Kotlin to the wallet’s existing C FFI. On the reviewed head, the Kotlin SDK emulator build and tests are pending, the PR-title check now passes, and no code check has reported a failure.

Validated blockers were found by the Phase-1 review and confirmed by a fresh verifier. Phase 2 is deferred until a fresh same-head revalidation clears the blocker gate.

🔴 1 blocking | 🟡 3 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-gate-verifier, role: verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff adds substantial Swift, JNI, and Kotlin marshalling, error mapping, and lifecycle handling, but leaves recipient validation, source selection, and transfer execution to the existing wallet implementation.
  • 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)
  • Fresh verifier: gpt-6.2-sol — verifier; agent sol-gate-verifier
  • Phase 2 reviewers: not run (deferred by blocker gate)
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt`:
- [BLOCKING] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:2441: Cancelling a Kotlin tip coroutine can hide a completed payment
  Impact: An Android user who leaves a payment screen while the tip is processing can have the payment complete without the caller seeing success, and a retry can send a second tip.
  An executed tip can look like it never completed. If the screen cancels its coroutine while `FundingNative.sendShieldedTip` is proving or submitting the transfer, the blocking JNI call keeps running. The wallet can prove execution and finalize the spend, but `teardownGate.op` returns through `withContext(Dispatchers.IO)`, whose prompt cancellation drops the successful result on the way back to the caller. That contradicts this method’s documented guarantee that other errors mean the tip was not sent. The wallet’s pending guard does not prevent a fresh payment once the first spend is settled. Use the existing `opReturningCompletedResult` helper, which preserves a completed native result without releasing the teardown gate early.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift:115-119: Swift accepts malformed tip amounts when an embedded NUL follows a valid prefix
  Impact: A Swift caller that passes an amount containing an embedded NUL receives credits for the prefix instead of the invalid-amount error Kotlin returns.
  For example, a Swift string containing `1`, a NUL, and `2` parses as one DASH rather than being rejected. `withCString` passes the bytes to `CStr::from_ptr`, which stops at the first NUL, so Rust never sees the suffix it would reject. The same C-string pattern exists elsewhere, but this PR introduces the affected amount parser, and its JNI counterpart already rejects embedded NULs. Reject strings that cannot be passed intact across the C boundary in the new Swift APIs; leave amount and memo rules in Rust.
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift:50-103: Swift tests do not cover unknown tip-review or balance states
  Impact: A future Swift decoder change could map an unknown native value to a valid recipient change or balance state without a unit test catching it.
  Both Swift initializers correctly throw a deserialization error for unrecognized discriminants, but neither initializer has unit coverage. Kotlin tests already pin its equivalent contract. Add Swift tests with typed C struct fixtures for each known case and for unknown discriminants, checking that the previous recipient is exposed only for `.changed` and that unavailable is never decoded as an available zero balance. Kotlin’s truncated and trailing blob cases do not apply to Swift’s fixed-size C structs.

In `packages/rs-unified-sdk-jni/src/funding.rs`:
- [SUGGESTION] packages/rs-unified-sdk-jni/src/funding.rs:1355-1375: New shielded-tip enum cases can reach Kotlin before the blob decoders support them
  Impact: If a new recipient-change or balance-state case starts reaching Android without a matching Kotlin update, callers get a serialization error or, if its discriminant truncates to an existing tag, the wrong state.
  The bridge will still compile if either C enum gains a variant, even though Kotlin only recognizes tags 0, 1, and 2. Both encoders narrow a `repr(C)` discriminant with `as u8`: an unsupported byte is rejected by Kotlin, but a discriminant outside the byte range can truncate to a recognized tag. The current mappings are correct and tested. Use exhaustive matches for the two byte tags so a new C enum case requires an explicit JNI encoding decision and a review of the Kotlin decoder.

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

@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

Changes requested: 1 blocker

  • Following the pending-tip retry instructions can pay the same tip twice — packages/kotlin-sdk/README.md:78-83 (new)
    Impact: A user whose app follows the documented retry flow after a duplicate submission or a lost result can pay the recipient a second time once the first tip settles.

New on this head: This PR adds Swift and Kotlin/JNI wrappers for shielded tips. The latest commit preserves completed Kotlin sends across cancellation, rejects embedded NULs in Swift, adds Swift decoder tests, and makes the JNI enum encodings exhaustive. The x86_64 Android build, unit tests, and existing emulator smoke suite passed on this head; Swift native linking and simulator execution remain unverified.

🔴 1 blocking | 🟡 4 suggestion(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-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 11: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 12: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff adds substantial cross-language marshalling and lifecycle handling, but delegates recipient checks, key use, and funds movement to the existing wallet FFI without changing those rules.
  • 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)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/kotlin-sdk/README.md`:
- [BLOCKING] packages/kotlin-sdk/README.md:78-83: Following the pending-tip retry instructions can pay the same tip twice
  Impact: A user whose app follows the documented retry flow after a duplicate submission or a lost result can pay the recipient a second time once the first tip settles.
  `ShieldedTipPending` means only that the latest call sent nothing. An overlapping call can receive it while the first call still holds the send lock, and a call after relaunch can receive it while the first transfer is still unresolved. A fresh review can show `unresolved == false` after sync confirms that the original payment executed, just as it can after sync establishes that the original cannot execute. Following the advice to “review and send again” at that point can spend fresh notes. Update both READMEs and the Kotlin send KDoc to say not to retry the same payment unless the original is known not to have executed and can no longer execute. A cleared hold is not that evidence. Keep documented unconfirmed outcomes, including `TransactionBroadcastUnconfirmed`, out of the guides’ “every other error means not sent” wording.

In `packages/rs-unified-sdk-jni/src/funding.rs`:
- [SUGGESTION] packages/rs-unified-sdk-jni/src/funding.rs:1522-1529: Android can send a tip with rewritten or missing memo text
  Impact: An Android caller who supplies memo text containing both an emoji and a NUL can send a payment with replacement characters in the memo instead of receiving an invalid-parameter error.
  The C send can receive different text from what the caller supplied. Android ART emits a four-byte UTF-8 sequence for supplementary characters but encodes NUL as `C0 80`. With both in one string, the decoder used by `jni` 0.21.1 falls back to lossy UTF-8, replacing the NUL bytes before `CString::new` checks for them. A short rewritten memo then passes Rust’s byte-length check. Separately, `read_cstring_opt` clears a JNI read exception and treats the supplied memo as absent. Read the new tip strings as UTF-16 and decode them strictly; reject unreadable strings, unpaired surrogates, and embedded NULs before calling C. Only a null argument should count as absent at the boundary; Rust can continue handling empty memos and the byte limit.

In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/ShieldedTip.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/ShieldedTip.kt:18-28: A Kotlin recipient review can change after the user sees it
  Impact: An Android integration that updates a reviewed address buffer in place can send to the updated address even though the user confirmed the earlier one.
  Passing the same review object back does not guarantee that it still contains the bytes shown to the user. The public `ByteArray` properties expose mutable backing storage, and `sendShieldedTip` reads them inside the dispatched operation. If shared app state overwrites the address with a refreshed profile address before JNI reads it, Rust compares against the refreshed bytes and accepts the send. Give the recipient type snapshot semantics by copying inputs at construction and not exposing its mutable backing arrays. Keep recipient resolution and comparison in Rust.
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/ShieldedTip.kt:31-40: A failed first tip can be mistaken for a prior payment
  Impact: After a first tip fails for lack of spendable notes, an app using the documented meaning of `New` can tell the user they have tipped the name before.
  The change tag compares confirmed recipients, not completed payments. `send_resolved_shielded_tip` saves the recipient before attempting the transfer, and the wallet test at `tip_payment_tests.rs:698–727` checks that the recipient stays recorded even when the spend finds no notes. A later review can therefore return `Unchanged` without any successful payment. Describe `New` and `.new` in both SDK types and READMEs as having no prior recipient confirmation for the name, and clarify that none of the change tags proves a tip was sent.

In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/FundingNative.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/FundingNative.kt:239-307: The Android smoke suite does not call the four new tip JNI methods
  Impact: An Android SDK consumer could be the first to encounter a missing symbol, argument mismatch, or error-marshaling regression even after the emulator check passes.
  The Rust tests call the blob encoders directly and the Kotlin tests decode hand-built arrays. Neither invokes the loaded JNI methods, and the Android build’s `--verify` checks for the presence of JNI exports generally, not these four specifically. Extend `FfiSmokeTest` to parse a known amount, assert an invalid-input error through the loaded library, and call review, send, and balance with inputs that fail locally before any network or proving work.

Comment thread packages/kotlin-sdk/README.md Resolved
QuantumExplorer and others added 5 commits November 24, 2026 08:01
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 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 update passes tip text through JNI without rewriting it, makes Kotlin recipient reviews immutable snapshots, and clarifies what a pending-tip refusal means. The Kotlin SDK build and Android emulator tests passed on this head; Swift linking and simulator execution remain unverified.

🟡 4 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: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The Swift, JNI, and Kotlin wrappers add substantial marshaling and lifecycle logic for a fund-moving call, but the diff does not change the wallet logic that selects or moves funds.
  • 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)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/kotlin-sdk/README.md`:
- [SUGGESTION] packages/kotlin-sdk/README.md:90-92: A failed activity row can be mistaken for the tip that triggered the refusal
  Impact: After a restart or a lost send result, an app can mistake an older failed transfer for the earlier tip and resend a payment that already succeeded.
  The new guidance correctly says a cleared refusal does not prove failure, but it does not say what to do when the app cannot identify the earlier payment's activity row. `sendShieldedTip` returns no activity ID, `ShieldedTipPending` carries none, and review reports only `unresolved`. Rust records each tip as an ordinary `Sent` transfer with an ID derived from its visible output commitments, so rows with the same account, recipient, amount, and memo can have different outcomes. In both READMEs and the Kotlin send KDoc, say to leave the outcome unknown and not retry if the exact attempt cannot be identified. If hosts later need to automate recovery, expose that correlation from `rs-platform-wallet` rather than asking them to infer it from row contents or ordering.

In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/ShieldedTip.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/ShieldedTip.kt:43-47: Logging a changed Kotlin tip review reveals the wallet's previous recipient
  Impact: An Android app that logs a changed tip review exposes the full identity ID and shielded address this wallet previously confirmed.
  Log readers can link the wallet to a prior recipient even if the individual address and identity fields are public. The snapshot refactor replaces the data class's generated byte-array rendering with explicit full hex, which the generated `ShieldedTipReview` and `Changed` string representations include. Redact the default representation and keep the explicit byte accessors for callers that need to display or compare the recipient.

In `packages/rs-unified-sdk-jni/src/funding.rs`:
- [SUGGESTION] packages/rs-unified-sdk-jni/src/funding.rs:1337-1338: The exact string reader accepts null in safe Rust but passes it to JNI unchecked
  Impact: A future caller that passes a null `JString` directly to this private helper can cause a JVM fault instead of receiving an input error.
  The two current call sites check for null, so this is not reachable through the shipped tip calls. The new safe helper nevertheless accepts a nullable `JString` and passes its raw value to `GetStringLength`, whose JNI contract requires a non-null Java string. Keep the check at the raw call boundary, or make the helper `unsafe` with a contract requiring a live, non-null Java string so future callers must justify that assumption.

In `packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/FfiSmokeTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/FfiSmokeTest.kt:599-603: The Android smoke test passes even if JNI rejects every emoji
  Impact: Android users could lose support for emoji in otherwise valid tip memos without the JNI smoke test catching the regression.
  The new test checks malformed UTF-16 and NUL rejection, but every valid surrogate pair in the fixtures is accompanied by a NUL and must be rejected anyway. The amount parser uses the same JNI reader as the memo path and needs no network or wallet. Pass an emoji on its own and assert both that Rust rejects it as an amount with code 1002 and that the diagnostic contains the original character.

Comment thread packages/kotlin-sdk/README.md Resolved
Comment thread packages/kotlin-sdk/README.md Resolved
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]>
@QuantumExplorer QuantumExplorer added this to the v5.1.0 milestone Nov 24, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

New on this head: This revision adds an Android smoke assertion that a valid emoji crosses JNI unchanged, moves the JNI null guard into the string reader, redacts Kotlin tip recipients in logs, and tells Swift and Kotlin callers not to resend a tip whose earlier attempt they cannot identify. The Android x86_64 emulator build and instrumented tests passed on the reviewed head; Swift simulator execution and a funded end-to-end tip remain unverified.

🔴 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-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff adds substantial cross-language marshaling and lifecycle handling, but delegates funds movement to the existing native wallet implementation without changing transaction logic or coin selection.
  • 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)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

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

Comment thread packages/kotlin-sdk/README.md Resolved
QuantumExplorer and others added 7 commits November 24, 2026 08:45
…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]>
…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
… claimed

From review:
- The transfer runs a check right after it reserves its notes, before
  anything is built or sent. A tip uses it to prove its source again:
  the wait for the store can be as long as a scan, and an identity can
  be removed meanwhile. A source that no longer stands releases the
  notes and nothing is sent.
- The first bind after a restart is refused without the account an
  unresolved note spend was paid from, and a bind that drops an account
  is refused while a damaged spend record is kept unloaded.
- A review and an identity balance hold the coordinator's operation
  admission for their local read, so a Clear cannot run between the
  binding check and the read.
- The recipients of saved transfers are read in one pass with the
  commitments their record id is checked against.
- The tip send keeps ErrorInvalidParameter (2) typed, as documented for
  a tip to the account it is paid from.

The tip result codes move to 85 (ShieldedTipPending) and 86
(ShieldedTipRecipientMismatch): v5.1-dev took 84 for the shielded Clear
refusal.

Co-Authored-By: Claude Fable 5.2 <[email protected]>

@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 2 only (queue backlog)

Changes requested: 1 blocker

  • Following the pending-tip retry instructions can pay the same tip twice — packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift:332-337 (carried)
    Impact: A Swift app that follows the public code-84 guidance after two overlapping submissions can pay the recipient a second time after the first tip succeeds.

New on this head: This update passes the saved contact’s identity through Swift and Kotlin/JNI to the Rust wallet, separately from the recipient the user reviewed. The Kotlin x86_64 emulator build and tests are pending; no Swift native-link or simulator result is available for this head.

🔴 1 blocking | 🟡 2 suggestion(s)

1 finding(s) not shown inline (the lines are not part of this PR's diff)

🔴 Blocking: Following the pending-tip retry instructions can pay the same tip twice
Impact: A Swift app that follows the public code-84 guidance after two overlapping submissions can pay the recipient a second time after the first tip succeeds.
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift:332-337

A single intended tip can become two payments. If a double tap starts two sendShieldedTip calls, Rust’s admit_shielded_tip can refuse the second with code 84 while the first is still sending. This result-code comment tells the integrator to sync, then “review and send again.” Once the first send finishes and sync settles it as executed, neither the in-flight lock nor the unresolved-recipient check in send_resolved_shielded_tip prevents a fresh transfer using other spendable notes. Align this comment with the Swift send documentation: retry only if the exact earlier attempt is known not to have executed and can no longer execute.

    /// This shielded tip was refused before anything was sent: another tip
    /// is being sent, or an earlier payment to the recipient is unresolved.
    /// A shielded sync can clear the refusal because the earlier payment
    /// succeeded. Retry only if the exact earlier attempt is known not to
    /// have executed and can no longer execute. If its outcome is unknown,
    /// do not retry. Not `errorShieldedSpendUnconfirmed` (18).
    case errorShieldedTipPending = 84

source: gpt-6.2-sol (phase2-reviewer: general)

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: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The Swift, JNI, and Kotlin wrappers add substantial marshalling and lifecycle handling, but the diff does not change the wallet’s funds-movement rules, coin selection, or signing logic.
  • Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletResult.swift:332-337: Following the pending-tip retry instructions can pay the same tip twice
  Impact: A Swift app that follows the public code-84 guidance after two overlapping submissions can pay the recipient a second time after the first tip succeeds.
  A single intended tip can become two payments. If a double tap starts two `sendShieldedTip` calls, Rust’s `admit_shielded_tip` can refuse the second with code 84 while the first is still sending. This result-code comment tells the integrator to sync, then “review and send again.” Once the first send finishes and sync settles it as executed, neither the in-flight lock nor the unresolved-recipient check in `send_resolved_shielded_tip` prevents a fresh transfer using other spendable notes. Align this comment with the Swift send documentation: retry only if the exact earlier attempt is known not to have executed and can no longer execute.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift:179-183: A moved contact name can return a generic error instead of the documented recipient mismatch
  Impact: A Swift or Kotlin app that handles only the typed mismatch can miss its recipient-picker prompt when the name’s new owner has no shielded address or takes over after review.
  Both paths refuse the tip, but neither returns the documented code 85. On review, `review_shielded_tip` calls `resolve_shielded_tip` before comparing the contact ID, so a proved new owner with no valid shielded address triggers `InvalidIdentityData` first. On send, if the contact and reviewed recipient both identify A, the initial check passes; if the fresh lookup then returns B, the full recipient comparison returns `InvalidIdentityData` before the transfer. Both errors cross C as `ErrorWalletOperation`. Narrow the review docs, the Swift send docs, and both mobile guides to describe when the typed error actually occurs, as the Kotlin send KDoc already does. If both paths are intended to return code 85, check the contact ID immediately after the proof-verified name lookup in the Rust wallet and retain the full comparison for address changes.

In `packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/FfiSmokeTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/FfiSmokeTest.kt:639-648: The Android smoke test passes even if JNI drops a valid saved contact ID
  Impact: A JNI regression that skips the saved-contact check for Android callers would go undetected by the emulator smoke test.
  None of the new assertions depends on the valid contact ID reaching the wallet. The review stops at an unknown manager, and the send stops at a null resolver; the send fixture also uses identical bytes for the contact and reviewed recipient. The test would still pass if JNI validated the ID’s length and then forwarded null. Add an offline case with a registered local wallet, a configured shielded coordinator, and a resolver that supplies the test seed. Pass distinct contact and reviewed IDs and assert native code 1085. The mismatch runs before the wallet-binding check, recipient lookup, and proof generation, so the fixture can leave the wallet unbound and fail locally even if JNI drops the ID.
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.

  • The default recipient-mismatch message exposes saved-contact identity IDs — The wallet error renders both full identity IDs, and C, Swift, and Kotlin preserve the message. If an app records the exception in user-linked telemetry, the diagnostic can reveal which saved contact the user tried to tip. The message originates in the stacked wallet change; the wrappers do not log it.
    • Follow-up: In #6191 or a separate wallet follow-up, omit the raw IDs from the default mismatch message while retaining the typed error and the instruction to pick the recipient again.

Comment thread packages/kotlin-sdk/README.md Resolved
QuantumExplorer and others added 2 commits November 24, 2026 09:00
v5.1-dev took 84 for the shielded Clear refusal, so ShieldedTipPending
is 85 and ShieldedTipRecipientMismatch is 86.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…own code

platform_wallet_manager_shielded_identity_balance reported a store held
by a scan as ErrorWalletOperation (6), the same code as an unknown wallet
or a missing coordinator, so a host told to "keep the last state and read
again" retried permanent failures too.

The timeout now returns ErrorShieldedBalanceBusy (87), mirrored in Swift
(shieldedBalanceBusy) and Kotlin (ShieldedBalanceBusy, retryable). It is
the only code of the read that means read again; every other code is a
failure to show.

Closes #6201

Co-Authored-By: Claude Fable 5.2 <[email protected]>

@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 revision adds a wallet-backed Android test for the saved-contact tip refusal, adopts the Rust check for names that move after review, and exposes a distinct retryable result for shielded balance timeouts. It also clarifies that a cleared pending-tip refusal is not a reason to resend. The Kotlin SDK build and x86_64 emulator tests passed on this exact head; the review check is pending, and Swift linking and simulator execution remain unverified.

🟡 3 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.

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Kotlin send docs omit the typed refusal when a saved contact’s name moves after review
Impact: An Android app following the send KDoc can miss its recipient-picker prompt when a saved contact’s name changes owners between review and send.
packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:2488-2493

A caller can expect WalletOperation for a recipient change after review, but a moved saved-contact name now returns ShieldedTipRecipientMismatch. Before ff3a1092d9, the send’s fresh lookup compared only the full reviewed recipient after loading the profile. It now checks the resolved owner against the supplied contact ID before loading the profile, so code 86 reaches Kotlin even when the review originally matched the contact. Document both triggers for the typed error and use an address-only change as the generic-error example.

     * - [DashSdkError.PlatformWallet.ShieldedTipRecipientMismatch]:
     *   [contactIdentityId] was given and either the reviewed recipient or
     *   the owner resolved at send time is another identity. Nothing was sent.
     * - any other error: this call sent nothing (for example
     *   [DashSdkError.PlatformWallet.WalletOperation] when the same identity
     *   publishes a different shielded address after the review).

source: gpt-6.2-sol (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The Swift, Kotlin, and JNI changes add substantial cross-language plumbing and lifecycle handling, but delegate recipient checks and funds movement to the wallet implementation in the base branch.
  • 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)
  • New since the last final review (cc7de2d3): 1 suggestion(s) on unchanged code listed as follow-up candidates
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift:294-298: A balance timeout can blame the shielded store before the read reaches it
  Impact: A mobile caller whose balance read times out behind Shielded Clear can be told that a scan or spend holds the store even though the read never reached it.
  Code 87 identifies a timeout, not which operation caused it. The C export wraps the entire `wallet.shielded_identity_balance` future in the 100 ms timeout. Since `ff3a1092d9`, that future first waits for `operation_guard()`, which Clear holds exclusively while it drains sync and wipes state; it also reads identity state before reaching the store. Keep the retry guidance, but describe code 87 in both SDKs and the native error message as the local balance read exceeding its wait budget, without attributing it to a scan or spend.

In `packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt:66: The offline tip test can query testnet if JNI drops the contact ID
  Impact: If JNI stops forwarding the saved-contact ID, Android CI can wait on a real DPNS lookup instead of failing locally.
  The test catches the forwarding regression, but the regression path depends on testnet. If JNI forwards null, the wallet skips the early identity comparison, the bound fixture passes `ensure_shielded_bound_on`, and account 0 proceeds to the DPNS lookup for `alice`. Leave the coordinator configured but the wallet unbound: the registered wallet and resolver are enough to reach the typed mismatch with correct forwarding, and the binding guard stops the dropped-ID path before the lookup. The missing-identity balance assertion also runs before any binding check.
- [SUGGESTION] packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt:92-98: The Android balance test passes when an unknown identity returns a generic wallet error
  Impact: Android CI can stay green if callers lose the documented `DashSdkError.NotFound` result for an identity the wallet does not hold.
  The catch accepts any non-retryable `DashSdkError` other than `ShieldedBalanceBusy`, including `WalletOperation` and `InvalidHandle`. The C export deliberately preserves `ErrorIdentityNotFound` (7), JNI shifts it to 1007, and Kotlin maps it to the top-level `DashSdkError.NotFound`. Catch that exact type and keep the non-retryable assertion so the test checks the result across both native boundaries.

QuantumExplorer and others added 5 commits November 24, 2026 10:04
…ance read waits

From a local code review:
- A tip review and an identity balance read took the coordinator's
  operation admission and kept it while they waited for the store, which
  a scan can hold for minutes: a Clear requested meanwhile was refused.
  They now wait without it and check after the read that no Clear is in
  progress and the binding (or the preparation) still stands.
- The busy outcome of the balance read is the wallet's: the bounded read
  shielded_identity_balance_now returns ShieldedBalanceBusy after
  SHIELDED_IDENTITY_BALANCE_WAIT, and the C export only maps it.
- A bind does not purge a dropped account that a spend saved a record
  for after the bind's check: the record stays, and what reads it fails
  closed until the account is bound again.
- A tip from an account that is not bound, or whose key the seed does
  not derive, is refused before its recipient is recorded as confirmed.
- A review reads the bound keys after its lookups.
- Items used only by shielded code are gated on the feature, so the
  default-feature build has no dead code.
- Test randomness is seeded; the wrong-seed assertion runs against an
  intact record; the registry rows state the Kotlin mirrors.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…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]>

@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 2 only (queue backlog)

New on this head: The latest merge moves the shielded identity balance deadline into the Rust wallet and lets Clear proceed while a tip review or balance read is waiting, while still refusing Clear during a tip send. The Kotlin SDK build and x86_64 emulator tests passed on this head; Swift linking and simulator execution remain unverified.

🟡 3 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.

Still open from earlier rounds (3)

  • 🟡 Suggestion: The Android balance test passes when an unknown identity returns a generic wallet error — packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt:92-98 (thread)
  • 🟡 Suggestion: The offline tip test can query testnet if JNI drops the contact ID — packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt:66 (thread)
  • 🟡 Suggestion: A balance timeout can blame the shielded store before the read reaches it — packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift:294-298 (thread)
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: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The cross-language wrappers add substantial marshaling and lifecycle logic, but they delegate funds movement to the existing wallet FFI without changing transaction construction, coin selection, or spending rules.
  • Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt:92-98: The Android balance test passes when an unknown identity returns a generic wallet error
  (carried; thread: https://github.com/dashpay/platform/pull/6192#discussion_r4674914263)
- [SUGGESTION] packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/ShieldedTipFfiTest.kt:66: The offline tip test can query testnet if JNI drops the contact ID
  (carried; thread: https://github.com/dashpay/platform/pull/6192#discussion_r4674914259)

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedTips.swift:294-298: A balance timeout can blame the shielded store before the read reaches it
  (carried; thread: https://github.com/dashpay/platform/pull/6192#discussion_r4674914248)
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 can discard recovery records for unresolved payments — In the stacked wallet base, Clear refuses a send that is still running, but it can proceed after the send returns unconfirmed. clear_admitted calls purge_all_subwallets, which deletes shielded_pending_spends, including the local record the wallet uses to reconcile the payment and guard against a repeat. The mobile wrappers do not change that reset path.
    • Follow-up: Open a wallet follow-up to preserve unresolved spend records across Clear or refuse Clear until those spends are resolved.

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

@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 2 only (queue backlog)

New on this head: This revision leaves the Android shielded-tip fixture unbound so a dropped contact ID fails locally, requires the exact missing-identity error, and updates the Swift and Kotlin API comments to describe the balance read’s wait budget. The Android emulator build and tests are still pending, no code check has failed, and Swift linking against the new native symbols and simulator execution remain unverified.

🟡 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: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff adds substantial Swift, JNI, and Kotlin bindings, including lifecycle and cancellation handling, but delegates tip execution to the existing wallet FFI without changing funds-movement rules, coin selection, or signing.
  • Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/README.md:717-720: A balance timeout can blame the shielded store before the read reaches it
  Impact: An integrator following either mobile guide can misdiagnose a timeout waiting for wallet identity state as contention in the shielded store.
  The Swift guide and `packages/kotlin-sdk/README.md:111–113` still describe the 100 ms budget as a wait for the shielded store. The revised API comments describe it as a budget for the whole local read, which matches `shielded_identity_balance_now`: it wraps `shielded_identity_balance`, whose first step waits for the wallet-manager read lock in `ensure_wallet_identity`, before it reaches the store. Apply the same wording to both guides and keep the advice to retain the last state and read again later.

QuantumExplorer and others added 5 commits November 24, 2026 10:44
…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]>
…ead's proof check

A Clear that wiped the ledger just read and finished between the proof
check and the admission check was seen by neither, so the read returned
the wiped ledger's balance. The admission is now sampled first: a Clear
that finished fails the proof check, and one still admitted is busy.

The test of that read bounds its wait, so a read that came to wait for
the Clear fails instead of hanging.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Base automatically changed from feat/platform-wallet-shielded-tips to v5.1-dev November 24, 2026 04:05
@github-actions

Copy link
Copy Markdown
Contributor

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

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

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

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

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

@QuantumExplorer
QuantumExplorer merged commit 02ff8f7 into v5.1-dev Nov 24, 2026
25 of 27 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/sdk-shielded-tip-wrappers branch November 24, 2026 04:10
HashEngineering added a commit that referenced this pull request Nov 25, 2026
…boundary

`env.get_string(..).into()` in jni 0.21.1 falls back to lossy decoding
when Java's modified UTF-8 does not decode, so a string with an unpaired
surrogate reached Rust as different text (U+FFFD in its place). A paid
memo or token note could reach the recipient as text the caller never
supplied.

Every string argument now goes through `support::read_jstring`. It
copies the UTF-16 code units with `GetStringRegion`, validates them
before decoding into an exactly sized buffer, and zeroes the copy (one
argument is a mnemonic). An unpaired surrogate is an error and
supplementary characters cross intact. After a failed read it makes no
further JNI call, so CheckJNI cannot abort on a pending exception; the
mnemonic signer now short-circuits its two reads for the same reason.
`funding.rs::read_cstring_exact` (#6192) uses it instead of its own
decoder.

Helpers that treated an unreadable string as absent now throw code 1
naming the field and the reason: token notes and memos, the wallet
manager's user agent and devnet name, query filters and cursors, SDK
config strings, the vote contender id and the DPNS search prefix. Their
interior-NUL cases throw too rather than dropping the argument. A
malformed peer entry fails `spvStart` like an unreadable one.

`ManagedPlatformWallet.signMessage` no longer scans for unpaired
surrogates in Kotlin: the native boundary rejects them, as
`DashSdkError.InvalidParameter`.

Fixes #6154.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HashEngineering added a commit that referenced this pull request Nov 26, 2026
…boundary

`env.get_string(..).into()` in jni 0.21.1 falls back to lossy decoding
when Java's modified UTF-8 does not decode, so a string with an unpaired
surrogate reached Rust as different text (U+FFFD in its place). A paid
memo or token note could reach the recipient as text the caller never
supplied.

Every string argument now goes through `support::read_jstring`. It
copies the UTF-16 code units with `GetStringRegion`, validates them
before decoding into an exactly sized buffer, and zeroes the copy (one
argument is a mnemonic). An unpaired surrogate is an error and
supplementary characters cross intact. After a failed read it makes no
further JNI call, so CheckJNI cannot abort on a pending exception; the
mnemonic signer now short-circuits its two reads for the same reason.
`funding.rs::read_cstring_exact` (#6192) and the private-document
reader (#6169) use it instead of their own decoders, and it covers the
TXO classification batch and test-hook reads #5767 added.

Helpers that treated an unreadable string as absent now throw code 1
naming the field and the reason: token notes and memos, the wallet
manager's user agent and devnet name, query filters and cursors, SDK
config strings, the vote contender id and the DPNS search prefix. Their
interior-NUL cases throw too rather than dropping the argument. A
malformed peer entry fails `spvStart` like an unreadable one.

`ManagedPlatformWallet.signMessage` no longer scans for unpaired
surrogates in Kotlin: the native boundary rejects them, as
`DashSdkError.InvalidParameter`.

Fixes #6154.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HashEngineering added a commit that referenced this pull request Nov 27, 2026
…boundary

`env.get_string(..).into()` in jni 0.21.1 falls back to lossy decoding
when Java's modified UTF-8 does not decode, so a string with an unpaired
surrogate reached Rust as different text (U+FFFD in its place). A paid
memo or token note could reach the recipient as text the caller never
supplied.

Every string argument now goes through `support::read_jstring`. It
copies the UTF-16 code units with `GetStringRegion`, validates them
before decoding into an exactly sized buffer, and zeroes the copy (one
argument is a mnemonic). An unpaired surrogate is an error and
supplementary characters cross intact. After a failed read it makes no
further JNI call, so CheckJNI cannot abort on a pending exception; the
mnemonic signer now short-circuits its two reads for the same reason.
`funding.rs::read_cstring_exact` (#6192) and the private-document
reader (#6169) use it instead of their own decoders, and it covers the
TXO classification batch and test-hook reads #5767 added.

Helpers that treated an unreadable string as absent now throw code 1
naming the field and the reason: token notes and memos, the wallet
manager's user agent and devnet name, query filters and cursors, SDK
config strings, the vote contender id and the DPNS search prefix. Their
interior-NUL cases throw too rather than dropping the argument. A
malformed peer entry fails `spvStart` like an unreadable one.

`ManagedPlatformWallet.signMessage` no longer scans for unpaired
surrogates in Kotlin: the native boundary rejects them, as
`DashSdkError.InvalidParameter`.

Fixes #6154.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HashEngineering added a commit that referenced this pull request Dec 1, 2026
…boundary

`env.get_string(..).into()` in jni 0.21.1 falls back to lossy decoding
when Java's modified UTF-8 does not decode, so a string with an unpaired
surrogate reached Rust as different text (U+FFFD in its place). A paid
memo or token note could reach the recipient as text the caller never
supplied.

Every string argument now goes through `support::read_jstring`. It
copies the UTF-16 code units with `GetStringRegion`, validates them
before decoding into an exactly sized buffer, and zeroes the copy (one
argument is a mnemonic). An unpaired surrogate is an error and
supplementary characters cross intact. After a failed read it makes no
further JNI call, so CheckJNI cannot abort on a pending exception; the
mnemonic signer now short-circuits its two reads for the same reason.
`funding.rs::read_cstring_exact` (#6192) and the private-document
reader (#6169) use it instead of their own decoders, and it covers the
TXO classification batch and test-hook reads #5767 added.

Helpers that treated an unreadable string as absent now throw code 1
naming the field and the reason: token notes and memos, the wallet
manager's user agent and devnet name, query filters and cursors, SDK
config strings, the vote contender id and the DPNS search prefix. Their
interior-NUL cases throw too rather than dropping the argument. A
malformed peer entry fails `spvStart` like an unreadable one.

`ManagedPlatformWallet.signMessage` no longer scans for unpaired
surrogates in Kotlin: the native boundary rejects them, as
`DashSdkError.InvalidParameter`.

Fixes #6154.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants