Repository navigation
feat(payments): External Send from any balance in Advanced mode - #1680
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 2
Please check the settings in the CodeRabbit UI or the
|
|
⛔ Final review complete — 1 blocking finding(s) (commit 3698d2b) |
Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ry-rows Picks up cac4f5c (phase-1 through #1675, #1677/#1678/#1680, int37 pin). Conflicts resolved by keeping both sides: - AppDatabaseMigrations: our 22->23 tx_display_cache.source migration plus the base's data-only removeCrowdNodeCacheRows callback (base stays at v22, so AppDatabase is v23 with 23.json unchanged). - PlatformSyncService: both shieldedHistoryRowSync and transparentUsernameCreation constructor params; the six platform tests and IdentityConditionalWriteTest pass both. - DatabaseMigrationTest: our migrate22to23 plus the base's crowdnode cache tests; its migrations array now includes migration22to23. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pre-review findings on #1680: - Platform, Identity and Shielded -> Core withdrawals now withdraw the amount plus the 190-duff Core fee, which Platform takes out of the withdrawn amount, so the recipient receives exactly what was confirmed. Limits and input selection use the gross amount; a Shielded -> Core Max shows the recipient amount net of the fee. - A Core -> own identity send that only resumed an earlier unfinished top-up is now Not sent (EARLIER_TOP_UP_COMPLETED) instead of Sent. - The confirm sheet's details scroll inside a weighted region, so the Cancel/Confirm row keeps its height on short screens or large text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
In the identity → external shielded flow ( // rs-platform-wallet/src/wallet/shielded/operations.rs:1117-1122
let nonce = sdk
.get_identity_nonce(identity_id, true, None)
.await
.map_err(|e| {
PlatformWalletError::ShieldedBuildError(format!("fetch identity nonce: {e}"))
})?;If that fetch fails, for example on a network blip or an unreachable DAPI node, the FFI returns code 6 (WalletOperation) with a message containing Suggested fix: add a specific match to the existing pre-broadcast shielded build-input arm. Match this message only, not the general // rs-platform-wallet shield_from_identity fetches the identity nonce before
// building, persisting or broadcasting anything (shielded/operations.rs), so
// this failure is always pre-broadcast and retry-safe.
m.contains("fetch identity nonce") ||Plus a unit test that a It doesn't lose funds; it only marks a retry-safe failure as uncertain. Found while reviewing dashpay/platform#5863 / #5896, which provide the binding this flow calls. |
|
Two items from our local pre-review that are deliberate. No code change for either: Completion-unconfirmed Core → Platform fundings have no retry path ( Core → third-party Shielded shows as an internal shield after a restart. 🤖 Generated with Claude Code |
Pre-review findings on #1680: - Platform, Identity and Shielded -> Core withdrawals now withdraw the amount plus the 190-duff Core fee, which Platform takes out of the withdrawn amount, so the recipient receives exactly what was confirmed. Limits and input selection use the gross amount; a Shielded -> Core Max shows the recipient amount net of the fee. - A Core -> own identity send that only resumed an earlier unfinished top-up is now Not sent (EARLIER_TOP_UP_COMPLETED) instead of Sent. - The confirm sheet's details scroll inside a weighted region, so the Cancel/Confirm row keeps its height on short screens or large text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
c6f6b77 to
102274b
Compare
Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…121) The Advanced payments Send tab gets its own Compose page: send to a username (Core, as today), to a typed/pasted/scanned destination, or by scanning a Dash QR. The external send flow detects the destination type from the whole address (Core, Platform dash1k/dash1s, Shielded dash1z, identity ID) and rejects wrong-network or malformed input, then reuses AmountEntryPage with From/To cards, a source picker, a confirm sheet and PIN before every send. ExternalSendService routes each source/destination pair to the SDK with the SdkWriteResult rules (only provably pre-broadcast failures are retryable, the bound wallet is captured and re-checked before submit). Supported: Core->Core/Shielded/own Identity, Shielded->all, Platform->Platform/Identity, Identity->Core/Platform/Identity. The rest need SDK changes and are shown as not available yet. Basic mode is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Core->Shielded locks amount + pool fee so the recipient gets the confirmed amount; fee, Max and Total agree. - Core Max refuses when the balance changed since confirm; the confirm sheet shows a Max send as fee-inclusive, like Basic send-all. - The SDK wallet is captured at confirm and checked before every write. - An in-flight marker survives process death and restores the terminal "may have gone through" state instead of the editable form. - dash: URIs for Shielded/Platform/Identity amount requests parse. - The exact amount is pinned across a currency switch. - AddressUtils/WifKey reject an empty Base58Check payload instead of crashing; destination detection never throws. - Advanced scan keeps BIP70, AnyPay and serialized requests on the Basic invoice path. - Live identity/shielded reads recover after a transient error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Keep the in-flight marker after a Sent until the user acknowledges it, so a process kill before the result is seen warns instead of reopening the form. - Claim an acknowledgement atomically (new Acknowledging state) before clearing the marker, so a duplicate acknowledgement cannot clear a later send's marker. - Core→Core: size the fee reserve by UTXO count and turn Max off when the balance does not exceed it, so the recipient amount is always positive. - Core→Shielded Max now comes from the confirmed balance an asset lock can spend, with the L1 fee reserved up front; the Max retry is gone. The Core Max drain is still uncapped by the confirmed amount (finding 1); it is left for device testing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
On the two findings in the 75fcc01 review that aren't on diff lines: 🔴 A stale Platform-address balance turns a pre-broadcast refusal into an ambiguous payment. Fixed in 00c8638.
A refusal that may still have been accepted comes back as
🟡 An identity-funded shield that cannot cover its fee is reported as may have gone through. The arm is added in 00c8638, as suggested: |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 3 blockers
dash-sdk.dbcannot be opened after installing this build over an int42 wallet —build.gradle:18(new)
Impact: Users upgrading from the base build after it has created an int42 SDK database cannot load the persisted SDK wallet, including when they only use Basic mode.- Pre-v14 withdrawals send 190 duffs more than the amount confirmed —
wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:228-234(new)
Impact: A user on a protocol-13 network who confirms a 0.01 DASH Platform-to-Core or Identity-to-Core withdrawal can pay the recipient 0.01000190 DASH instead. - A Core Max payment can send funds that were not on the confirmation sheet —
wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:1882-1890(new)
Impact: If another output becomes spendable after the user confirms Core-to-Core Max, that incoming deposit can be sent to the recipient in addition to the confirmed balance.
New on this head: This head adds the Advanced-mode external-send flow across Core, Shielded, Platform, and Identity balances, including the revised pre-broadcast failure classification and recovery handling. The build and check CI jobs succeeded for the exact head, CodeRabbit completed successfully, and the PastaClaw review check remains queued.
🔴 3 blocking | 🟡 3 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: A timed-out identity lookup writes the prospective payee's identity to the wallet log
Impact: A user who enters an identity and cancels or never confirms the send can disclose that identity later when application logs are shared with support.
wallet/src/de/schildbach/wallet/service/platform/sdk/SdkUsernameQueries.kt:414-415
The identity ID is interpolated into the boundedSdkPlatformQuery label, and the timeout handler logs that label both when the query times out and when the abandoned native query finally settles. ExternalSendServiceImpl.resolveIdentity performs this lookup before confirmation, so the prospective payee is recorded even when no payment is sent. Use a static operation label here and keep failure logging free of recipient-bearing SDK text.
boundedSdkPlatformQuery("dpns.usernames") {
source: gpt-6.2-astra (phase2-reviewer: general, security-auditor)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This large, intricate diff changes funds movement and coin selection across Core, Shielded, Platform, and Identity balances, including transaction construction, asset locks, signing, fees, and durable in-flight recovery in ExternalSendServiceImpl.kt, ShieldedBalanceServiceImpl.kt, ExternalPlatformFunding.kt, and ExternalSendExecutor.kt. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (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 `build.gradle`:
- [BLOCKING] build.gradle:18: `dash-sdk.db` cannot be opened after installing this build over an int42 wallet
Impact: Users upgrading from the base build after it has created an int42 SDK database cannot load the persisted SDK wallet, including when they only use Basic mode.
The downgrade in this line can leave an existing wallet unavailable before External Send is reached. The base branch uses int42, whose `DashDatabase` is Room schema 17, while int39 supports migrations only through schema 16 and has no downgrade path for the shared `dash-sdk.db`; `DashSdkServiceImpl` creates and activates that database during startup. Use an SDK built on the int42-or-later schema that also contains the required bindings, or add and verify a non-destructive migration path; deleting the database is not a safe upgrade.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt`:
- [BLOCKING] wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:228-234: Pre-v14 withdrawals send 190 duffs more than the amount confirmed
Impact: A user on a protocol-13 network who confirms a 0.01 DASH Platform-to-Core or Identity-to-Core withdrawal can pay the recipient 0.01000190 DASH instead.
The helper always adds `WITHDRAWAL_CORE_FEE_DUFFS` to the confirmed recipient amount. That matches protocol 14, where DPP carves the Core fee out of the withdrawal amount, but protocol 13's `try_into_asset_unlock_base_transaction_info_v0` puts the full withdrawal document amount in the Core output and records the fee separately. Platform and Identity withdrawals call this helper, and the non-Max Shielded-to-Core path adds the same fee at line 1966, so these paths overpay on the still-supported protocol-13 mainnet. Resolve the active protocol accounting rule through `DashSdkService.currentProtocolVersion()` consistently for quoting, Max calculation, and submission, and refuse or requote when it cannot be established.
- [BLOCKING] wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:1882-1890: A Core Max payment can send funds that were not on the confirmation sheet
Impact: If another output becomes spendable after the user confirms Core-to-Core Max, that incoming deposit can be sent to the recipient in addition to the confirmed balance.
The equality check only compares the UI's cached max-sendable value with the confirmed amount; it does not reserve that amount or impose an upper bound. The subsequent `emptyWallet = true` call uses the SDK drain, whose amount is a floor and whose selection reads spendable funds again, so an output that arrives between the check and transaction construction is included. Use an exact-amount transaction with a bounded total, reserve the confirmed transaction before showing the result, or disable this Max flow until the SDK provides a capped drain.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendModels.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendModels.kt:218-223: An oversized pasted address can freeze the wallet before validation rejects it
Impact: An Advanced Send user who pastes a very long Base58 token, including through Show clipboard, can trigger an application-not-responding dialog without confirming a payment.
Address validation runs synchronously on the UI thread. `detectCoreAddress` calls `AddressUtils.decode`, whose Base58 conversion repeatedly performs long division and only checks the decoded payload length afterward; if that fails, `detectPlainDestination` can perform another Base58 conversion in `decodeIdentityId`. `onAddressChanged` invokes this for pasted input and every edit, while `onClipboardRead` validates every whitespace token before applying `.take(MAX_CLIPBOARD_ENTRIES)`. Reject impossible encoded lengths before either Base58 decoder, including the address component of a `dash:` URI, and bound clipboard text or tokens before splitting and validating them.
In `wallet/src/de/schildbach/wallet/ui/payments/send/ExternalSendFragment.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/ui/payments/send/ExternalSendFragment.kt:171: Show clipboard can block on another app's content provider
Impact: If the clipboard item is a content URI rather than literal text, tapping Show clipboard can block the wallet's main thread while the provider supplies text.
`coerceToText` is allowed to dereference a URI through the content provider and read its contents, but this feature only needs literal address text. Read `Item.text` directly and ignore URI-only clipboard items so an untrusted provider cannot stall the send screen.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/SdkUsernameQueries.kt`:
- [SUGGESTION] wallet/src/de/schildbach/wallet/service/platform/sdk/SdkUsernameQueries.kt:414-415: A timed-out identity lookup writes the prospective payee's identity to the wallet log
Impact: A user who enters an identity and cancels or never confirms the send can disclose that identity later when application logs are shared with support.
The identity ID is interpolated into the `boundedSdkPlatformQuery` label, and the timeout handler logs that label both when the query times out and when the abandoned native query finally settles. `ExternalSendServiceImpl.resolveIdentity` performs this lookup before confirmation, so the prospective payee is recorded even when no payment is sent. Use a static operation label here and keep failure logging free of recipient-bearing SDK text.
| // first int4x build that includes them. int39 = int38 plus the #5860 binding; int38: | ||
| // HashEngineering/platform integration/5.1.0-int38 @ c45221249f (int37's bindings: | ||
| // #5830 partial Platform-address withdrawal, the third-party shields) on v5.1-dev. | ||
| dashSdkVersion = '5.1.0-int39-20261113.161202-1' |
There was a problem hiding this comment.
✅ Resolved at
ecd430d7; see the replies below.
🔴 Blocking: dash-sdk.db cannot be opened after installing this build over an int42 wallet
Impact: Users upgrading from the base build after it has created an int42 SDK database cannot load the persisted SDK wallet, including when they only use Basic mode.
The downgrade in this line can leave an existing wallet unavailable before External Send is reached. The base branch uses int42, whose DashDatabase is Room schema 17, while int39 supports migrations only through schema 16 and has no downgrade path for the shared dash-sdk.db; DashSdkServiceImpl creates and activates that database during startup. Use an SDK built on the int42-or-later schema that also contains the required bindings, or add and verify a non-destructive migration path; deleting the database is not a safe upgrade.
source: gpt-6.2-astra (phase2-reviewer: general, security-auditor)
There was a problem hiding this comment.
Agreed that int39 can't open an int42 (schema 17) dash-sdk.db. This PR keeps int39 only because int42 lacks the bindings External Send calls (platform#5860, #5873, #5896). The move to int42 or later, with those bindings, comes in a separate PR before this stack reaches a release, and that removes the downgrade. No database delete or migration is added here.
There was a problem hiding this comment.
Deferred (re-reviewed at 69d6f669): This moves to a follow-up: I filed #1775 to track it, so it no longer blocks this pull request.
There was a problem hiding this comment.
Fixed in ecd430d: the Kotlin SDK pin moved from int39 to 5.2.0-int01-20261201.012447-1 (v5.2-dev plus the int42/int43 carry). v5.2-dev includes the bindings External Send calls (#5860, #5873, #5896), and its dash-sdk.db is Room 21, so an int42 database (17) migrates by migration instead of failing to open. The only API change needed was the rename topUpExternalIdentityFromAddresses → topUpIdentityFromAddresses (same signature). The follow-up issue filed for this can be closed once this lands.
There was a problem hiding this comment.
Resolved (re-reviewed at ecd430d7): Confirmed that the published int42 source defines schema 17 and that the published 5.2.0-int01 source registers every migration from 17 through 21. The new pin removes the downgrade without deleting dash-sdk.db.
| internal fun coreWithdrawalCreditsOrNull(recipientCredits: Long): Long? { | ||
| val gross = try { | ||
| Math.addExact(recipientCredits, WITHDRAWAL_CORE_FEE_CREDITS) | ||
| } catch (e: ArithmeticException) { | ||
| return null | ||
| } | ||
| return gross.takeIf { it in PLATFORM_MIN_WITHDRAWAL_CREDITS..PLATFORM_MAX_WITHDRAWAL_CREDITS } |
There was a problem hiding this comment.
✅ Withdrawn at
69d6f669; see the replies below.
🔴 Blocking: Pre-v14 withdrawals send 190 duffs more than the amount confirmed
Impact: A user on a protocol-13 network who confirms a 0.01 DASH Platform-to-Core or Identity-to-Core withdrawal can pay the recipient 0.01000190 DASH instead.
The helper always adds WITHDRAWAL_CORE_FEE_DUFFS to the confirmed recipient amount. That matches protocol 14, where DPP carves the Core fee out of the withdrawal amount, but protocol 13's try_into_asset_unlock_base_transaction_info_v0 puts the full withdrawal document amount in the Core output and records the fee separately. Platform and Identity withdrawals call this helper, and the non-Max Shielded-to-Core path adds the same fee at line 1966, so these paths overpay on the still-supported protocol-13 mainnet. Resolve the active protocol accounting rule through DashSdkService.currentProtocolVersion() consistently for quoting, Max calculation, and submission, and refuse or requote when it cannot be established.
source: gpt-6.2-astra (phase2-reviewer: general, security-auditor)
There was a problem hiding this comment.
Checked against DPP: this doesn't apply on any live network. The v0/v1 split is real. try_into_asset_unlock_base_transaction_info v0 puts the full document AMOUNT in the Core output, and v1 subtracts the fee from it (rs-dpp/src/withdrawal/document_try_into_asset_unlock_base_transaction_info/{v0,v1}/mod.rs). v1 comes with DOCUMENT_VERSIONS_V4, which PLATFORM_V14 selects (rs-platform-version/src/version/v14.rs). But mainnet already runs protocol 14 (drive 5.0.3, current: 14) and testnet runs 15, so adding the fee on top is what makes the recipient get the confirmed amount. Only a devnet still on protocol 13 would overpay, by 190 duffs. Leaving as is.
There was a problem hiding this comment.
Withdrawn (re-reviewed at 69d6f669): The supported production flavors do not reach the protocol-13 accounting case: mainnet uses protocol 14 and testnet uses protocol 15, where the withdrawal fee is carved out so the recipient receives the confirmed amount.
| if (maxNow != amount.duffs) { | ||
| return notSent(pair, NotSentReason.BALANCE_CHANGED, "the balance changed since the Max was confirmed") | ||
| } | ||
| } | ||
| // Not under [submitUnderWipeBarrier]: the Core send funnel takes the wipe barrier itself | ||
| // around its broadcast (SendCoinsTaskRunner), and [coreSession] pins it to this wallet. | ||
| if (!stillBound(pair, walletIdHex)) return ExternalSendResult.NotSent(NotSentReason.GENERIC) | ||
| return try { | ||
| val txId = this.source.sendCore(destination.address, amount, emptyWallet = isMax, session = coreSession) |
There was a problem hiding this comment.
✅ Resolved at
501cc705; see the replies below.
🔴 Blocking: A Core Max payment can send funds that were not on the confirmation sheet
Impact: If another output becomes spendable after the user confirms Core-to-Core Max, that incoming deposit can be sent to the recipient in addition to the confirmed balance.
The equality check only compares the UI's cached max-sendable value with the confirmed amount; it does not reserve that amount or impose an upper bound. The subsequent emptyWallet = true call uses the SDK drain, whose amount is a floor and whose selection reads spendable funds again, so an output that arrives between the check and transaction construction is included. Use an exact-amount transaction with a bounded total, reserve the confirmed transaction before showing the result, or disable this Max flow until the SDK provides a capped drain.
source: gpt-6.2-astra (phase2-reviewer: general, security-auditor)
There was a problem hiding this comment.
Deferred, as listed under Open items in the PR description ("Core Max drain"). Capping the drain needs either an SDK send-all with an upper bound, or an exact-amount build that leaves no change. The SDK has neither at this pin, and reserving the confirmed transaction before the result is shown would change the Core send funnel this PR reuses. I'll link a tracking issue here.
There was a problem hiding this comment.
Tracking issue: #1774. This needs a capped send-all in the SDK, or pinned inputs in the Core send funnel, so it is deferred out of this PR.
There was a problem hiding this comment.
Still applies (re-reviewed at 69d6f669): The equality check and subsequent emptyWallet drain are unchanged: funds that become spendable after the check can still be included in the transaction, so the tracked SDK work in #1774 has not removed this current funds-handling defect.
There was a problem hiding this comment.
Fixed in 501cc70. External Send no longer uses the send-all. A Core → Core Max is now an ordinary payment of exactly the recipient amount the confirm sheet showed: the confirmed Max minus the fee the sheet showed. That fee is carried with the request (ExternalSendRequest.coreMaxFee), so the bound doesn't depend on recomputing the fee at send time.
- A deposit that arrives after the check comes back as change, so the recipient never gets more than the sheet showed.
- If the build comes up short, the funnel refuses it before broadcast, and it ends as Not sent.
- A Max whose fee is missing or out of range is refused without a call.
- The send-all's app-locked (CrowdNode) output refusal is kept as an explicit check, which fails closed when unreadable.
The other Core Max paths (Core → Platform, Core → Shielded) already lock a fixed amount, and Core → Identity has no Max. Tests are in ExternalSendServiceImplTest and ExternalSendViewModelTest. #1774 stays open for a capped SDK drain, should we want the send-all back.
There was a problem hiding this comment.
Resolved (re-reviewed at 501cc705): 501cc70 removes the SDK send-all from Core-to-Core Max and sends the fixed recipient amount captured by the confirmation sheet, with shortfalls refused before broadcast and later deposits returned as change.
| private fun detectCoreAddress(input: String, network: AddressNetwork): DestinationParse? { | ||
| val decoded = try { | ||
| AddressUtils.decode(input) | ||
| } catch (e: AddressFormatException) { | ||
| return null | ||
| } |
There was a problem hiding this comment.
✅ Resolved at
69d6f669; see the replies below.
🟡 Suggestion: An oversized pasted address can freeze the wallet before validation rejects it
Impact: An Advanced Send user who pastes a very long Base58 token, including through Show clipboard, can trigger an application-not-responding dialog without confirming a payment.
Address validation runs synchronously on the UI thread. detectCoreAddress calls AddressUtils.decode, whose Base58 conversion repeatedly performs long division and only checks the decoded payload length afterward; if that fails, detectPlainDestination can perform another Base58 conversion in decodeIdentityId. onAddressChanged invokes this for pasted input and every edit, while onClipboardRead validates every whitespace token before applying .take(MAX_CLIPBOARD_ENTRIES). Reject impossible encoded lengths before either Base58 decoder, including the address component of a dash: URI, and bound clipboard text or tokens before splitting and validating them.
source: gpt-6.2-astra (phase2-reviewer: security-auditor)
There was a problem hiding this comment.
Fixed in 17bb262. Base58 input is now rejected before decoding when it is longer than any real encoding: 35 chars for a Core address (25 bytes) and 44 for an identity ID (32 bytes). decodeIdentityId and detectCoreAddress check this, and since the address part of a dash: URI goes through them it is covered too. Show clipboard bounds the text (4096 chars) and the token count (64) before validating. Bech32m decoding is linear, so it is not bounded. Tests: ExternalSendModelsTest (a 200k-char token is rejected within the timeout) and ExternalSendViewModelTest (clipboard bounds).
There was a problem hiding this comment.
Resolved (re-reviewed at 69d6f669): The parser now rejects overlong Core and identity Base58 inputs before decoding, and clipboard text and token counts are bounded before destination validation.
| val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager | ||
| val clip = clipboard?.primaryClip | ||
| val text = if (clip != null && clip.itemCount > 0) { | ||
| clip.getItemAt(0).coerceToText(requireContext())?.toString() |
There was a problem hiding this comment.
✅ Resolved at
69d6f669; see the replies below.
🟡 Suggestion: Show clipboard can block on another app's content provider
Impact: If the clipboard item is a content URI rather than literal text, tapping Show clipboard can block the wallet's main thread while the provider supplies text.
coerceToText is allowed to dereference a URI through the content provider and read its contents, but this feature only needs literal address text. Read Item.text directly and ignore URI-only clipboard items so an untrusted provider cannot stall the send screen.
| clip.getItemAt(0).coerceToText(requireContext())?.toString() | |
| clip.getItemAt(0).text?.toString() |
source: gpt-6.2-astra (phase2-reviewer: security-auditor)
There was a problem hiding this comment.
Fixed in 17bb262. Show clipboard now reads ClipData.Item.text, so a URI-only item gives null and no content provider is called.
There was a problem hiding this comment.
Resolved (re-reviewed at 69d6f669): showClipboard now reads ClipData.Item.text directly, so URI-only clipboard entries are ignored without dereferencing another app's content provider.
| this.source.fundPlatformExternal(record) { outPointHex -> | ||
| // SDK thread, before broadcast: short, no SDK calls, never throws. | ||
| builtOutPoint.set(outPointHex) | ||
| try { | ||
| platformFundingStore.writeBlocking(record.withOutPoint(outPointHex)) | ||
| } catch (e: Exception) { | ||
| // Accepted risk: if the process also dies before | ||
| // ensureOutPointRecorded, a no-outpoint record remains. The sweep | ||
| // keeps it (unknown ≠ unbuilt), and it blocks new Core → Platform | ||
| // sends until resolved. Two failures in a row; rare. | ||
| log.error("external send {}: could not record the lock outpoint, retried after the call ({})", pair, safeErrorSummary(e)) |
There was a problem hiding this comment.
Deferred (re-reviewed at 00c86384): This moves to a follow-up: I filed #1771 to track it, so it no longer blocks this pull request.
| m.contains("platform address network mismatch") || | ||
| m.contains("invalid core address") || | ||
| m.contains("core address network mismatch") || | ||
| m.contains("overflows u64") | ||
| m.contains("overflows u64") || | ||
| // A third-party shield (Type 15 / Type 21 to a recipient) whose recipient | ||
| // this wallet's own shielded account recognizes: rs-platform-wallet | ||
| // `resolve_shield_recipient` refuses it before building anything. | ||
| m.contains("recipient belongs to this shielded account") | ||
| } == true -> | ||
| SdkWriteResult.NotBroadcast("pre-broadcast shielded build-input validation failure", t) |
There was a problem hiding this comment.
Resolved (re-reviewed at 00c86384): The classifier now matches only fetch identity nonce in the pre-broadcast shielded build-input arm, and the added test verifies it remains NotBroadcast with a static reason.
- Reject Base58 text longer than any real encoding before decoding it: 35 chars for a Core address (25 bytes), 44 for an identity id (32 bytes). The Base58 decode is quadratic, so a huge pasted token could stall the UI thread. Bech32m decoding is linear and is left unbounded. - Show clipboard: bound the text (4096 chars) and the number of tokens (64) before validating them, and read only an item's literal text. coerceToText could block on another app's content provider for a URI-only clip. Co-Authored-By: Claude Opus 5.5 <[email protected]>
boundedSdkPlatformQuery logs its label when a query times out and again when the abandoned native call settles. Several labels interpolated an identity id, a username or search text (the DPNS username lookup that External Send runs before confirmation, among them). Use static operation names instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
On the finding in the 00c8638 review that isn't on a diff line: 🟡 A timed-out identity lookup writes the prospective payee's identity to the wallet log ( |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- A Core Max payment can send funds that were not on the confirmation sheet —
wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:1882-1890(thread, carried)
Impact: A user who confirms Core-to-Core Max can have a newly spendable output sent to the recipient in addition to the balance shown at confirmation.
New on this head: This head bounds External Send address and clipboard inputs and removes user-controlled identity data from platform-query timeout labels. The build and check jobs passed on the exact head; the PastaClaw review check is still queued.
🔴 1 blocking
Still open from earlier rounds (1)
- 🔴 Blocking: A Core Max payment can send funds that were not on the confirmation sheet —
wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:1882-1890(thread)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This large, intricate diff changes funds movement and coin selection across Core, Shielded, Platform, and Identity paths in ExternalSendServiceImpl, ExternalPlatformFunding, and ShieldedBalanceServiceImpl. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (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 `wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt`:
- [BLOCKING] wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:1882-1890: A Core Max payment can send funds that were not on the confirmation sheet
(carried; thread: https://github.com/dashpay/dash-wallet/pull/1680#discussion_r4745872458)
| this.source.fundPlatformExternal(record) { outPointHex -> | ||
| // SDK thread, before broadcast: short, no SDK calls, never throws. | ||
| builtOutPoint.set(outPointHex) | ||
| try { | ||
| platformFundingStore.writeBlocking(record.withOutPoint(outPointHex)) | ||
| } catch (e: Exception) { | ||
| // Accepted risk: if the process also dies before | ||
| // ensureOutPointRecorded, a no-outpoint record remains. The sweep | ||
| // keeps it (unknown ≠ unbuilt), and it blocks new Core → Platform | ||
| // sends until resolved. Two failures in a row; rare. | ||
| log.error("external send {}: could not record the lock outpoint, retried after the call ({})", pair, safeErrorSummary(e)) |
There was a problem hiding this comment.
Deferred (re-reviewed at 69d6f669): The callback outpoint write can still fail before the later repair, but the required durable SDK funding checkpoint is explicitly deferred to the tracked follow-up in #1773.
| // first int4x build that includes them. int39 = int38 plus the #5860 binding; int38: | ||
| // HashEngineering/platform integration/5.1.0-int38 @ c45221249f (int37's bindings: | ||
| // #5830 partial Platform-address withdrawal, the third-party shields) on v5.1-dev. | ||
| dashSdkVersion = '5.1.0-int39-20261113.161202-1' |
There was a problem hiding this comment.
Deferred (re-reviewed at 69d6f669): This moves to a follow-up: I filed #1775 to track it, so it no longer blocks this pull request.
| internal fun coreWithdrawalCreditsOrNull(recipientCredits: Long): Long? { | ||
| val gross = try { | ||
| Math.addExact(recipientCredits, WITHDRAWAL_CORE_FEE_CREDITS) | ||
| } catch (e: ArithmeticException) { | ||
| return null | ||
| } | ||
| return gross.takeIf { it in PLATFORM_MIN_WITHDRAWAL_CREDITS..PLATFORM_MAX_WITHDRAWAL_CREDITS } |
There was a problem hiding this comment.
Withdrawn (re-reviewed at 69d6f669): The supported production flavors do not reach the protocol-13 accounting case: mainnet uses protocol 14 and testnet uses protocol 15, where the withdrawal fee is carved out so the recipient receives the confirmed amount.
| if (maxNow != amount.duffs) { | ||
| return notSent(pair, NotSentReason.BALANCE_CHANGED, "the balance changed since the Max was confirmed") | ||
| } | ||
| } | ||
| // Not under [submitUnderWipeBarrier]: the Core send funnel takes the wipe barrier itself | ||
| // around its broadcast (SendCoinsTaskRunner), and [coreSession] pins it to this wallet. | ||
| if (!stillBound(pair, walletIdHex)) return ExternalSendResult.NotSent(NotSentReason.GENERIC) | ||
| return try { | ||
| val txId = this.source.sendCore(destination.address, amount, emptyWallet = isMax, session = coreSession) |
There was a problem hiding this comment.
Still applies (re-reviewed at 69d6f669): The equality check and subsequent emptyWallet drain are unchanged: funds that become spendable after the check can still be included in the transaction, so the tracked SDK work in #1774 has not removed this current funds-handling defect.
| private fun detectCoreAddress(input: String, network: AddressNetwork): DestinationParse? { | ||
| val decoded = try { | ||
| AddressUtils.decode(input) | ||
| } catch (e: AddressFormatException) { | ||
| return null | ||
| } |
There was a problem hiding this comment.
Resolved (re-reviewed at 69d6f669): The parser now rejects overlong Core and identity Base58 inputs before decoding, and clipboard text and token counts are bounded before destination validation.
| val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager | ||
| val clip = clipboard?.primaryClip | ||
| val text = if (clip != null && clip.itemCount > 0) { | ||
| clip.getItemAt(0).coerceToText(requireContext())?.toString() |
There was a problem hiding this comment.
Resolved (re-reviewed at 69d6f669): showClipboard now reads ClipData.Item.text directly, so URI-only clipboard entries are ignored without dereferencing another app's content provider.
The Max went through the SDK send-all, whose amount is only a floor: coin selection runs again at build time, so an output that became spendable after the Max re-check was swept to the recipient on top of the confirmed balance (#1774). A Core -> Core Max is now an ordinary payment of exactly what the confirm sheet showed the recipient: the confirmed amount minus the fee the sheet showed. That fee travels with the request (ExternalSendRequest.coreMaxFee). A Confirm tapped before the fee arrived is refused and must be tapped again, and the service refuses a Max whose fee is missing or out of range. A deposit that arrives in between comes back as change; a build that comes up short is refused before broadcast as Not sent. The fee reserve is always at least the real fee, so an unchanged Max still funds (a remainder at or below dust goes to the fee). The send-all refused to spend app-locked (CrowdNode) outputs; the payment keeps that guard and refuses the Max, failing closed, when the check can't be read. External Send no longer calls the send-all at all. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. 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: The latest commit changes Core-to-Core Max from an unbounded SDK drain to a fixed-amount payment using the fee captured on the confirmation sheet, with balance, protected-output, and pre-broadcast shortfall checks. The build, check, and CodeRabbit CI jobs succeeded; only the PastaClaw review check remains queued.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This large diff changes funds movement and coin selection across Core, Shielded, Platform, and Identity balances, including transaction construction, asset locks, withdrawals, shielding, recipient handling, and durable in-flight recovery in ExternalSendServiceImpl, ShieldedBalanceServiceImpl, and ExternalPlatformFunding. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
| if (maxNow != amount.duffs) { | ||
| return notSent(pair, NotSentReason.BALANCE_CHANGED, "the balance changed since the Max was confirmed") | ||
| } | ||
| } | ||
| // Not under [submitUnderWipeBarrier]: the Core send funnel takes the wipe barrier itself | ||
| // around its broadcast (SendCoinsTaskRunner), and [coreSession] pins it to this wallet. | ||
| if (!stillBound(pair, walletIdHex)) return ExternalSendResult.NotSent(NotSentReason.GENERIC) | ||
| return try { | ||
| val txId = this.source.sendCore(destination.address, amount, emptyWallet = isMax, session = coreSession) |
There was a problem hiding this comment.
Resolved (re-reviewed at 501cc705): 501cc70 removes the SDK send-all from Core-to-Core Max and sends the fixed recipient amount captured by the confirmation sheet, with shortfalls refused before broadcast and later deposits returned as change.
5.2.0-int01 is v5.2-dev plus the int42/int43 carry. v5.2-dev already has the bindings External Send needs (#5860, #5873, #5896), so the int39 pin is no longer needed. Its dash-sdk.db is Room 21, so an int42 database (17) migrates instead of failing to open. #5860 merged the external top-up as topUpIdentityFromAddresses, so the call is renamed. The InsufficientIdentityCredits comment now lists the sources at v5.2-dev. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. 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
Changes requested: 2 blockers
- An interrupted payment to someone else’s Shielded address leaves the sender’s Core funds locked —
wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt:2793(new; not shown inline, see below)
Impact: If the app stops after broadcasting the Core asset lock but before submitting the Shielded payment, the recipient remains unpaid and the wallet cannot complete the payment on restart or retry. - A Shielded withdrawal below the minimum is reported as possibly paid —
wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt:224-227(new; not shown inline, see below)
Impact: A user who confirms a small Shielded-to-Core payment is told not to send it again and is taken out of the editable form, even though nothing was submitted.
New on this head: This round updates External Send from Kotlin SDK 5.1.0-int39 to 5.2.0-int01, adopts the renamed address-funded identity top-up binding, and brings in Room migrations from the base branch’s schema 17 to schema 21. On this head, build and check passed; PastaClaw review is pending, and CodeRabbit skipped review for this base branch.
🔴 2 blocking
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: An interrupted payment to someone else’s Shielded address leaves the sender’s Core funds locked
Impact: If the app stops after broadcasting the Core asset lock but before submitting the Shielded payment, the recipient remains unpaid and the wallet cannot complete the payment on restart or retry.
wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt:2793
The funds stay locked if a user confirms a Core-to-Shielded payment to another wallet and the app stops between the Core broadcast and the Platform submission. The new 5.2.0-int01 SDK persists the original Orchard recipient before dispatch, but walletShieldLocks drops shieldedRecipientRaw43 when it maps the Room row. The automatic sweep and the user-requested retry both reach this call with the sender’s default address, so the SDK’s resume_recipient returns AssetLockRecipientMismatch before it submits anything. Carry the stored recipient into the pending-lock model and use it for recovery; look up the wallet default only for a legacy row with no stored recipient. Update InterruptedFundsReturnToShielded and its copy as well: recovering a lock to its recorded payee does not return the funds to the sender.
Raised on code unchanged since the last review, and confirmed by an independent pass: A user confirms an Advanced Send payment from Core to another wallet’s Shielded address, and Android stops the app after the Core asset lock is broadcast but before the Platform payment is submitted. On restart, the recovery sweep passes the sender’s default Shielded address, so the SDK rejects the recipient mismatch before submission; the payee is not paid, and the sender’s funds remain locked with no recovery path in the app.
source: gpt-6.2-astra (phase2-reviewer: general, security-auditor)
🔴 Blocking: A Shielded withdrawal below the minimum is reported as possibly paid
Impact: A user who confirms a small Shielded-to-Core payment is told not to send it again and is taken out of the editable form, even though nothing was submitted.
wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt:224-227
A user with a funded Shielded balance can enter and authenticate a non-Max payment of 0.000005 DASH to a valid Core address: canContinueAmount checks positivity and the upper limit, not the withdrawal floor. sendFromShielded adds the 190-duff Core fee and passes the resulting 690 duffs to the SDK. The new 5.2 SDK refuses that gross amount before reserving notes or building a transaction, returning ShieldedWithdrawalAmountOutOfRange (code 79). No classifier arm matches it, so mapWrite turns the refusal into MayHaveGoneThrough instead of NotSent, which would leave the form open for editing. After the unconfirmed-outcome guard, map this typed refusal and the SDK’s other definite pre-submission refusals ShieldedSpendTooManyNotes and ShieldedMerkleWitnessUnavailable to NotBroadcast, without relying on message text or a generic retryable flag.
Raised on code unchanged since the last review, and confirmed by an independent pass: A user with sufficient Shielded balance can confirm and authenticate a non-Max Advanced Send of 0.000005 DASH to a valid Core address because the form does not check the withdrawal minimum. The app passes 690 duffs including the Core fee, and the SDK refuses it before reserving notes or building a transaction, but the wallet says the payment may have gone through and returns the user Home on dismissal instead of leaving the form open to correct the amount.
source: gpt-6.2-astra (phase2-reviewer: general)
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: Platform-funded identity top-ups are refused when the managed-identity list is unreadable
Impact: A user with enough Platform credits and a valid recipient can get a generic Not sent result because a local identity-list read failed.
wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:1403-1409
The send exits before signing when the managed-identity snapshot is unreadable, even though the recipient’s ownership is not needed for this payment. This gate exists only to choose between the managed and external SDK calls. In 5.2.0-int01, the newly adopted topUpIdentityFromAddresses accepts either recipient and updates the cached balance for a managed identity; the SDK deprecates topUpFromAddresses in its favor. Use the unified call for Platform-funded top-ups and remove that routing prerequisite for this pair. Keep the ownership checks for Core-funded top-ups and identities that sign a payment.
source: gpt-6.2-astra (phase2-reviewer: general, security-auditor)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This large, intricate diff directly changes funds movement and coin selection across Core, Shielded, Platform, and Identity balances, including transaction construction, asset locks, withdrawals, shielding, fees, and durable in-flight recovery in ExternalSendServiceImpl.kt, ExternalPlatformFunding.kt, and ShieldedBalanceServiceImpl.kt. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- New since the last final review (
501cc705): 2 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 2 confirmed; 1 suggestion(s) on unchanged code listed as follow-up candidates - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— 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 `wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt`:
- [BLOCKING] wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt:2793: An interrupted payment to someone else’s Shielded address leaves the sender’s Core funds locked
Impact: If the app stops after broadcasting the Core asset lock but before submitting the Shielded payment, the recipient remains unpaid and the wallet cannot complete the payment on restart or retry.
The funds stay locked if a user confirms a Core-to-Shielded payment to another wallet and the app stops between the Core broadcast and the Platform submission. The new 5.2.0-int01 SDK persists the original Orchard recipient before dispatch, but `walletShieldLocks` drops `shieldedRecipientRaw43` when it maps the Room row. The automatic sweep and the user-requested retry both reach this call with the sender’s default address, so the SDK’s `resume_recipient` returns `AssetLockRecipientMismatch` before it submits anything. Carry the stored recipient into the pending-lock model and use it for recovery; look up the wallet default only for a legacy row with no stored recipient. Update `InterruptedFundsReturnToShielded` and its copy as well: recovering a lock to its recorded payee does not return the funds to the sender.
_Raised on code unchanged since the last review, and confirmed by an independent pass: A user confirms an Advanced Send payment from Core to another wallet’s Shielded address, and Android stops the app after the Core asset lock is broadcast but before the Platform payment is submitted. On restart, the recovery sweep passes the sender’s default Shielded address, so the SDK rejects the recipient mismatch before submission; the payee is not paid, and the sender’s funds remain locked with no recovery path in the app._
In `wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt`:
- [BLOCKING] wallet/src/de/schildbach/wallet/service/platform/sdk/SdkDashPayWrites.kt:224-227: A Shielded withdrawal below the minimum is reported as possibly paid
Impact: A user who confirms a small Shielded-to-Core payment is told not to send it again and is taken out of the editable form, even though nothing was submitted.
A user with a funded Shielded balance can enter and authenticate a non-Max payment of 0.000005 DASH to a valid Core address: `canContinueAmount` checks positivity and the upper limit, not the withdrawal floor. `sendFromShielded` adds the 190-duff Core fee and passes the resulting 690 duffs to the SDK. The new 5.2 SDK refuses that gross amount before reserving notes or building a transaction, returning `ShieldedWithdrawalAmountOutOfRange` (code 79). No classifier arm matches it, so `mapWrite` turns the refusal into `MayHaveGoneThrough` instead of `NotSent`, which would leave the form open for editing. After the unconfirmed-outcome guard, map this typed refusal and the SDK’s other definite pre-submission refusals `ShieldedSpendTooManyNotes` and `ShieldedMerkleWitnessUnavailable` to `NotBroadcast`, without relying on message text or a generic retryable flag.
_Raised on code unchanged since the last review, and confirmed by an independent pass: A user with sufficient Shielded balance can confirm and authenticate a non-Max Advanced Send of 0.000005 DASH to a valid Core address because the form does not check the withdrawal minimum. The app passes 690 duffs including the Core fee, and the SDK refuses it before reserving notes or building a transaction, but the wallet says the payment may have gone through and returns the user Home on dismissal instead of leaving the form open to correct the amount._
| // first int4x build that includes them. int39 = int38 plus the #5860 binding; int38: | ||
| // HashEngineering/platform integration/5.1.0-int38 @ c45221249f (int37's bindings: | ||
| // #5830 partial Platform-address withdrawal, the third-party shields) on v5.1-dev. | ||
| dashSdkVersion = '5.1.0-int39-20261113.161202-1' |
There was a problem hiding this comment.
Resolved (re-reviewed at ecd430d7): Confirmed that the published int42 source defines schema 17 and that the published 5.2.0-int01 source registers every migration from 17 through 21. The new pin removes the downgrade without deleting dash-sdk.db.
…assify int01 shielded refusals With SDK 5.2.0-int01 the asset-lock row records the Orchard recipient before dispatch, and resume refuses any other recipient (AssetLockRecipientMismatch). walletShieldLocks dropped that field, so the sweep and the user retry resumed an interrupted Core -> third-party Shielded payment to the sender's default address and were refused, leaving the funds locked. PendingWalletShieldLock now carries shieldedRecipientRaw43 (kept out of toString), and the sweep resumes to it. The default address is used only for legacy rows with no recorded recipient. Only locks that paid this wallet's own pool are announced as "shielded balance updated". InterruptedFundsReturnToShielded is renamed InterruptedCompletesAutomatically, and its copy now says the payment finishes on its own. classifyBroadcastFailure maps three typed int01 refusals that are raised only before submission to NotBroadcast, after the unconfirmed-outcome check: ShieldedWithdrawalAmountOutOfRange, ShieldedSpendTooManyNotes and ShieldedMerkleWitnessUnavailable. A below-minimum Shielded -> Core send now shows "not sent" with the form still editable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
On the two findings in the ecd430d review that aren't on diff lines, both fixed in 3698d2b: 🔴 An interrupted payment to someone else's Shielded address leaves the sender's Core funds locked. 🔴 A Shielded withdrawal below the minimum is reported as possibly paid.
The first two show "Nothing was sent" with the form editable, and the witness case shows the not-synced message. No message matching. Tests cover each type and confirm that an unconfirmed outcome still wins in either wrapping order. |
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Updated after discussion: 1 finding(s) of this review were settled in the inline threads; 1 blocking finding(s) still stand.
- ⏭️ Deferred (maintainer decision): 🟡 Shielded payments rejected because of the amount give no hint what to change (tracked in #1778)
Changes requested: 1 blocker
- Restoring from seed can redirect an interrupted Shielded payment to the sender —
wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt:2830-2835(new)
Impact: A user who restores from seed after the Core lock goes out but before the Shielded payment completes can have the lock credited to their own pool, leaving the confirmed payee unpaid.
New on this head: This head resumes interrupted Core-to-Shielded sends to the payee recorded by the SDK and classifies three pre-broadcast Shielded refusals as Not sent without changing how unconfirmed submissions are handled. The build and check jobs passed on the reviewed head; the PastaClaw review check is pending.
A pattern across this PR's review rounds
This is review round 6, and the PR has drawn 7 blocking findings so far. 4 of them share 2 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. Recovery loses the authoritative shielded recipient (1 new in this round, 1 earlier finding(s))
The recovery design treats a missing recorded recipient as a legacy self-shield and falls back to the wallet's default address. That is unsafe after seed restoration, where SDK reconstruction can produce a pending lock without recipient provenance, so the wallet cannot distinguish an interrupted third-party payment from an interrupted self-shield. The recent recipient-carrying fix closes the normal database path but leaves this second reconstruction path exposed.
In this round: Restoring from seed can redirect an interrupted Shielded payment to the sender
2. Write failures are classified through lossy layers (1 new in this round, 2 earlier finding(s))
External Send converts heterogeneous SDK failures into string-based service reasons and then maps those reasons into a smaller UI enum. Each newly discovered pre-broadcast refusal therefore needs another classifier match, while distinct actionable reasons can still collapse into a generic dialog. The stale-balance and shielded-refusal fixes improved individual cases without establishing a typed outcome contract through to the UI.
In this round: Shielded payments rejected because of the amount give no hint what to change
Suggested decision (redesign the component): Redesign the External Send write and recovery boundary before adding more local fallbacks or classifier cases. Every pending operation must retain an authoritative destination, or be quarantined when the destination is unknown rather than defaulted to the sender, and pre-broadcast refusals must remain typed through the service into an actionable UI reason. This is the end-to-end contract the component needs in place before the remaining recovery and error-handling patches can converge.
🔴 1 blocking | 🟡 1 0 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — ExternalSendServiceImpl.kt and ExternalPlatformFunding.kt introduce intricate funds-movement logic across balance types, including withdrawal input selection, fee reserves, and recovery of interrupted asset locks with persisted recipients. - 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(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- New since the last final review (
ecd430d7): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): Recovery loses the authoritative shielded recipient; Write failures are classified through lossy layers. When you fix the findings below, fix the cause, not only the reported case. The review suggests (redesign the component): Redesign the External Send write and recovery boundary before adding more local fallbacks or classifier cases. Every pending operation must retain an authoritative destination, or be quarantined when the destination is unknown rather than defaulted to the sender, and pre-broadcast refusals must remain typed through the service into an actionable UI reason. This is the end-to-end contract the component needs in place before the remaining recovery and error-handling patches can converge. If that decision is not yours to make, say so to the PR's author or maintainer.
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt`:
- [BLOCKING] wallet/src/de/schildbach/wallet/service/platform/sdk/ShieldedBalanceServiceImpl.kt:2830-2835: Restoring from seed can redirect an interrupted Shielded payment to the sender
Impact: A user who restores from seed after the Core lock goes out but before the Shielded payment completes can have the lock credited to their own pool, leaving the confirmed payee unpaid.
The recovery sweep can consume the only outpoint that could complete the original payment, paying the sender instead. On a seed restore without the original SDK database, the Core scan reconstructs the pending `AssetLockShieldedAddressTopUp` with `shielded_recipient: None` (`asset_lock/sync/reconstruction.rs`, `reconstruct_candidates`). Once the restored wallet's shielded runtime is ready, `ensureShieldedReady` can sweep that unconsumed row. This branch treats the missing recipient as evidence of a legacy self-shield and submits the wallet's default address. The SDK's `resume_recipient` accepts the supplied address when the recorded recipient is `None`, so an unspent lock can be consumed into the sender's pool. Only fall back to the default with independent evidence that the lock was a self-shield; otherwise leave it pending for explicit recipient recovery. Checking only for `RecoveredFromChain` is insufficient because the SDK also reconstructs non-final locks as `Broadcast` or `InstantSendLocked`.
_Confirmed by an independent pass: If a device is lost after an Advanced External Send broadcasts the Core asset lock for someone else's Shielded address but before Platform consumes it, restoring the seed on a new device reconstructs the lock without its payee. Opening the Shielded receive screen after Core sync triggers the recovery sweep, which submits the same outpoint with the sender's default Shielded address. Platform can consume the lock and credit the sender, leaving the intended recipient unpaid and making that outpoint unusable to complete the original payment._
In `wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt`:
- [SUGGESTION → DEFERRED by a maintainer; not blocking, do not fix in this PR] wallet/src/de/schildbach/wallet/service/platform/sdk/ExternalSendServiceImpl.kt:114-125: Shielded payments rejected because of the amount give no hint what to change
Impact: A user whose Shielded withdrawal is outside the allowed range or whose payment needs too many notes gets an editable form but no explanation that changing the amount can help.
Retrying the unchanged amount under the same conditions hits the same refusal. The new classifier produces distinct static reasons for an out-of-range withdrawal and an over-limit note selection, but `notSentReasonFor` maps both to `GENERIC`, so the dialog only says the payment could not be sent. Map the two reasons to localized messages that identify the allowed-range problem or suggest a smaller payment that may fit within the note limit, without exposing the SDK diagnostic.
| // The recipient the SDK recorded when it built the lock (an External Send's payee, | ||
| // or this wallet's own address); only a lock tracked before recipients were | ||
| // recorded falls back to the wallet's default address. | ||
| val recipient = lock.shieldedRecipientRaw43 ?: defaultAddress() | ||
| if (recipient == null) { | ||
| log.warn("pending wallet-shield lock {} not resumed: no shielded address to resume to", lock.outPointHex) |
There was a problem hiding this comment.
🔴 Blocking: Restoring from seed can redirect an interrupted Shielded payment to the sender
Impact: A user who restores from seed after the Core lock goes out but before the Shielded payment completes can have the lock credited to their own pool, leaving the confirmed payee unpaid.
The recovery sweep can consume the only outpoint that could complete the original payment, paying the sender instead. On a seed restore without the original SDK database, the Core scan reconstructs the pending AssetLockShieldedAddressTopUp with shielded_recipient: None (asset_lock/sync/reconstruction.rs, reconstruct_candidates). Once the restored wallet's shielded runtime is ready, ensureShieldedReady can sweep that unconsumed row. This branch treats the missing recipient as evidence of a legacy self-shield and submits the wallet's default address. The SDK's resume_recipient accepts the supplied address when the recorded recipient is None, so an unspent lock can be consumed into the sender's pool. Only fall back to the default with independent evidence that the lock was a self-shield; otherwise leave it pending for explicit recipient recovery. Checking only for RecoveredFromChain is insufficient because the SDK also reconstructs non-final locks as Broadcast or InstantSendLocked.
Confirmed by an independent pass: If a device is lost after an Advanced External Send broadcasts the Core asset lock for someone else's Shielded address but before Platform consumes it, restoring the seed on a new device reconstructs the lock without its payee. Opening the Shielded receive screen after Core sync triggers the recovery sweep, which submits the same outpoint with the sender's default Shielded address. Platform can consume the lock and credit the sender, leaving the intended recipient unpaid and making that outpoint unusable to complete the original payment.
source: gpt-6.2-astra (phase2-reviewer: general)
There was a problem hiding this comment.
Declining this one, intentionally.
- No funds are lost. In the case described, the lock is credited to the sender's own Shielded pool, which the same seed controls. The sender keeps the funds and can pay the recipient again. The outcome is a refund, not a loss.
- Quarantine is worse. Leaving every recipient-less pending lock unresumed would strand the funds with no recovery path in the app. That would hit the restore case and also every int42 → int01 upgrade with an interrupted self-shield (int42 does not record recipients). Those are self-shields, and today they complete correctly.
- The wallet can't tell the difference. After a seed restore there is no local record left, and a lock rebuilt from the chain does not commit to its Orchard recipient. No independent evidence exists for the wallet to check. The authoritative fix belongs in the SDK: reconstruction would need the recipient (or a "recipient unknown, third-party" marker) to survive the restore. A wallet-side fallback can't supply it.
- The window is narrow. It needs both the device lost and a seed restore between the asset-lock broadcast and the Platform submission, normally a few seconds.
We'll take the recipient-provenance question to the SDK separately.
There was a problem hiding this comment.
I agree that the seed still controls the credited funds and that quarantining every recipient-less lock would break legacy self-shield recovery. But a pre-submit failure can leave the lock pending well beyond the normal send window, and when recovery credits the sender, the notification says “Shielded transfer completed” rather than telling them the payee was never paid. If the SDK can't preserve the payee across restore yet, I'd leave legacy recovery intact and disable just third-party Core → Shielded sends until the wallet can either honor the original recipient or ask the user how to recover the lock.
There was a problem hiding this comment.
Deferred to #1779. The fallback stays as it is for this PR, matching dashwallet-ios, which also finishes a lock with no recorded recipient to the wallet's own Shielded address. #1779 tracks three follow-ups: iOS's "Funds added to your Shielded balance … no record of the address" copy for that case, resuming such locks only on a user action, and optionally letting the user choose the recipient.
There was a problem hiding this comment.
I checked the iOS comparison: its “Finish now” path requires a recovery action and explicitly says when the funds went to the user’s own balance because the recipient was unknown. On Android, opening Shielded Receive can launch the sweep and consume the lock without any recovery action. The fallback predates this PR, but this PR is what lets it consume a lock meant for someone else, so I’d bring the user-initiated recovery from #1779 into this PR before enabling that route.
Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
56b2220
into
feat/advanced-send-receive
Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ode (MO-1125) (#1683) * feat(payments): Internal transfers between own balances in Advanced mode (MO-1125) The Advanced payments Internal tab is now an internal-transfer screen (Figma DashPay iOS 3333:10699): pick From and To among Core, Shielded, Platform and Identity, enter an amount (DASH or fiat, Max), and confirm through the same confirm/sending/result UI as External Send. No address is entered: the transfer pays the wallet's own destination for the To balance; transfers to Core use an unadvertised internal-chain address. Supported now: Core->Shielded (self-shield), Core->Identity, Shielded->Core/Platform/Identity, Platform->Shielded (self-shield), Platform->Identity, Identity->Core/Platform. Core->Platform, Platform->Core and Identity->Shielded show as not available yet (no app wrapper / SDK support). History entry (AC14) is deferred. - InternalTransferModels/Service/ServiceImpl: pair matrix, own destination resolution (fail closed), wallet-id pinning, routes. - InternalTransferExecutor: application-scoped with its own durable in-flight marker, sibling of ExternalSendExecutor. - Shared confirm components moved out of ExternalSendScreen. - Internal tab always shown in Advanced mode; basic mode unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): address pre-review round 1 on Internal transfers (MO-1125) - Identity -> Platform resolves the wallet's own Platform address through a wallet-pinned SDK address-store read that does not need the shielded runtime, so the pair works with the shielded flag off. - A chosen or restored pair is dropped only on confirmed absence (hasIdentity == false / shielded flag == false); an unreadable shielded flag is now null (unknown), not false. - Focused InternalTransferExecutor tests for the durable in-flight marker. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): address pre-review round 2 on Internal transfers (MO-1125) - Gate the Internal tab's BackHandler on the page being RESUMED, so Back on another Advanced Payments tab no longer closes a hidden sheet. - Confirm validates the captured request (pair, wallet, balance/limit) instead of the live fiat-derived form; a refusal closes the sheet with a visible message, and submit re-checks after authentication. - Re-render the fiat text of a Max or pinned amount when the exchange rate changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(payments): enable Platform → Core internal transfers (MO-1125) Route the Internal Platform → Core pair through the External Send's partial Platform withdrawal (#1680) to the wallet's own unadvertised Core address, pinned to the confirmed wallet, like Shielded → Core and Identity → Core. No pre-send fee or Max, as in External Send. Core → Platform and Identity → Shielded stay unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): show the Internal transfer sheets above the bottom navigation (MO-1125) The Internal tab is a pager page of AdvancedPaymentsFragment, whose destination keeps MainActivity's bottom navigation drawn over the bottom of the nav host, so the "Transfer from/to" picker, the confirm sheet and the sending card were partly hidden under it. Host them in their own full-screen window (selected page only), as the app's other sheets over the bottom navigation are. External Send, which has no bottom navigation, is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): keep the Internal tab clear of the bars (MO-1125) - The overlay window now covers the screen and pads itself by the system bars, so the scrim meets the status bar with no undimmed strip. - The Internal page leaves the bottom navigation's height free, so the keypad's Continue is no longer drawn under it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(payments): hide the Internal tab on the basic Payments screen Basic (non-Advanced) Payments shows only Receive | Send; Internal transfers live in Advanced mode. A saved Internal tab opens Receive. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): return Home after a finished Internal transfer Closing a Sent, "may have gone through" (including the one shown after a process restart) or other terminal outcome now pops back to Home, the way the External Send does since 5610dfc. Not sent stays on the Internal tab so the user can retry. The outcome is read before acknowledging, only the selected pager page navigates, and it falls back to a single pop when Home is not on the back stack. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): close Internal transfer overlays when the lock screen appears The From/To picker, the confirm sheet, the sending overlay and the outcome dialog are drawn in their own windows, which stayed above the lock screen (dismissDialogsForLockScreen only dismisses DialogFragments). InternalTransferFragment is now LockScreenAware: on lock the picker and the confirm sheet close (the amount is kept), and the sending overlay and the outcome are withheld, not acknowledged, until LockScreenActivity.walletLocked turns false. A running transfer continues on the app scope. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): bottom navigation on Receive only; Internal sheets in place The Advanced payments screen now shows MainActivity's bottom navigation on the Receive tab only; Internal and Send hide it, re-applied after the destination listener when the screen becomes current again. Without the bar, the Internal transfer's picker, confirm sheet and sending overlay are drawn in place in the screen, as the External Send does, and AboveBottomNavigation (a separate dialog window) and the 60dp bottom padding are gone. The lock screen now covers those overlays, so on lock only the outcome dialog (its own window) is withheld until unlock. Verified on a testnet emulator: bar per tab, return from External Send, picker Back, confirm sheet above the system navigation. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): forget Internal Transfer state on Reset Wallet InternalTransferExecutor now mirrors ExternalSendExecutor's wipe handling: a wallet-wipe listener plus a generation counter, so a finished, restarted or late-completing transfer of the wiped wallet is never shown to, and never touches the in-flight marker of, the next wallet. InternalTransferServiceImpl's own routes (Core -> Shielded, Shielded -> Platform, Platform -> Shielded) now submit under FundingSelectionLock.withSharedSubmission with the bound-wallet check inside the hold; delegated routes already take it in ExternalSendService.send. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): keep screen Back handlers above the activity after a restart LockScreenActivity registered its Back callback with the activity as LifecycleOwner. Such a callback is removed at ON_STOP and re-added at ON_START, which the activity reaches after its fragments, so after any screen-off it sat above every fragment and Compose BackHandler and took Back from them (Advanced Payments: Back left the screen instead of closing the balance picker or confirm sheet, and skipped acknowledging an outcome). The activity's Back is now added once without a LifecycleOwner, so it stays the lowest priority, and removed in onDestroy. A second callback, enabled only while the lock screen is displayed and re-added on top when it comes up, keeps Back from reaching the screens it covers. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(payments): allow Core -> Platform as an Internal Transfer External Send (#1680) now funds a Platform address from Core (fundFromAssetLockExternal), so the Internal pair matrix allows Core -> Platform. The route already delegated to External Send with the wallet's own Platform address; fee (paid on top), Max, pending-funding resume and the wipe barrier all come from External Send. Identity -> Shielded is now the only pair not supported yet. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(payments): allow Identity -> Shielded as an Internal Transfer External Send supports Identity -> Shielded (identityShieldTo, Type 21), so the Internal pair matrix now allows every pair of two different balances; NOT_SUPPORTED_YET and internalTransferPairSupported are gone. The Shielded-destination routing used to send every non-Core source to the Platform-credits self-shield. Identity now delegates to External Send with the wallet's own default shielded address, read by the new ShieldedBalanceService.ownShieldedAddressOf, which is pinned to the confirmed wallet and fails closed (Not sent, nothing called). Platform -> Shielded keeps its self route. As in External Send, an identity source has no fee estimate and no Max. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): Internal Identity -> Shielded uses the identity self-shield The SDK refuses shieldedShieldFromIdentityToRecipient when the recipient belongs to the wallet's own shielded account ("use the self-shield entry point"), so the External Send delegate added in the previous commit was Not sent on a device. Wrap shieldedShieldFromIdentity (Type 21, no recipient) as ShieldedBalanceService.shieldFromIdentity, mirroring shieldFromIdentityToAddress through runShieldedWrite, and route Internal Identity -> Shielded to it as a self route under the wipe barrier, with the own identity checked as SDK-managed first. ownShieldedAddressOf is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): keep SDK messages out of Internal Transfer logs As d4a6e58 did for External Send: every Throwable-passing log in InternalTransferExecutor and InternalTransferServiceImpl now logs only safeErrorSummary (error class names and a native code), never an exception message or stack trace, which can name a recipient or identity. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): show the Internal Shielded -> Core Max as received A Shielded -> Core Max withdraws the Max itself and the asset unlock's Core fee comes out of it, so the own Core balance receives the Max minus WITHDRAWAL_CORE_FEE_DUFFS. Internal's confirm sheet showed the full Max as received and a total of Max + fee (the Core fee counted twice). It now uses External Send's rule, shared as withdrawalCoreFeeIncluded / amountAfterWithdrawalCoreFee: amount shown = Max - Core fee, total = that + fee. The send was already right and is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): never credit self-payments to the advertised Platform address Internal transfers to Platform (Core, Identity and Shielded -> Platform), the self-unshield and the Core -> Platform asset-lock remainder picked the lowest-index unused Platform address: the one Receive shows to payers. They now use unadvertisedOwnRowOrNull, which never returns the row Receive advertises (computed over all the wallet's rows, as Receive does): the next unused row, else an own used one. None is still Not sent before anything is submitted. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): Internal top-ups only to an identity the pinned wallet manages Core, Shielded and Platform -> Identity trusted the stored identity id alone. In the restored-but-undiscovered state the bound SDK wallet does not manage it, and Platform -> Identity then fell through to the External Send's top-up of someone else's identity. The id must now be in the pinned wallet's non-watched managed set (the check the Identity -> Shielded self-shield already made, now shared); absent, malformed or unreadable is Not sent, and nothing reaches the External Send. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): a stale Internal transfer never clears the next wallet's marker When Reset Wallet ran while a transfer's in-flight marker was being written, the stale transfer cleared the marker afterwards, which by then could be the replacement wallet's own transfer's. It now leaves the marker alone, as the External Send's executor does: at worst one spurious "interrupted" warning, never a dropped restart protection. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): bound a typed Shielded -> Core amount by Max minus the Core fee The Shielded -> Core Max is the gross withdrawal (the Core fee comes out of it), but a typed amount has the Core fee withdrawn on top. A typed amount equal to Max passed Continue and confirm, and then the write refused it. maxAmountBound gives a typed amount Max minus the Core fee and a Max the Max itself; the Internal Transfer's confirm re-check uses the captured request's isMax. The External Send's amount page had the same bound and uses it too. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): read Internal Transfer balances only while the tab is on show The From balance and Max reads (the identity and Platform balances poll every 15 s) ran in viewModelScope while the Internal tab was offscreen or the activity stopped. The fragment now reports the page's RESUMED state (ViewPager2 resumes only the selected page) and the reads run only while it is visible; the last values are kept while hidden and re-read when the page shows again. The transfer itself stays app-scoped. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(payments): call a Core -> Core Max by its name in the confirm sheet The base no longer pays a Core -> Core Max as a drain (501cc70), so the moved confirm sheet's comments follow its wording. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(payments): follow External Send's coreMaxFee parameter in the Internal fake Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): never credit a self-payment to a used Platform address A used address was advertised and paid before, so a payer who had it could link the self-payment to the wallet. unadvertisedOwnRowOrNull now returns only an unused row Receive does not advertise; with none, every caller is Not sent before anything is submitted. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): drop Internal Transfer balance and Max while the tab is hidden Continue and Max wait for the re-read when the page shows again, so a value read before the page was hidden is never acted on. An open confirm sheet keeps them: authentication can pause the page and submit re-validates on return. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): never show a Platform address a pending funding will credit While a Core -> Platform funding is pending (or its completion unconfirmed), paying the advertised address could move Receive onto the stored destination or remainder before the sweep credits it. Receive and the self-payment picker now share one rule that skips those reserved addresses; an unreadable funding store shows no address and refuses the self-payment. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): drop retained Internal balance and Max when the sheet closes Values kept for an authenticated submit are dropped when the sheet closes before the re-read lands, so Continue and Max wait for current values. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): hold a self-unshield's Platform destination while it proves The user can leave a Shielded -> Platform transfer during its ~30 s proof and open Receive; if a payment marks the advertised address used meanwhile, Receive could advance onto the unshield's destination. The destination is now picked and held in memory in one locked step, and Receive and every own-row pick skip held rows. It is released only when nothing was submitted. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): hold an Internal transfer's Platform destination while it runs Identity -> Platform and Core -> Platform now pick and hold their destination the way the self-unshield does, so Receive cannot advance onto it while the transfer is in flight. The hold is released only when the transfer was Not sent; ownPlatformAddressOf (a pick without a hold) is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): never release a self-payment's held Platform destination A self-unshield or an Internal Identity/Core -> Platform transfer holds its own Platform destination from Receive while it runs. Releasing that hold after a refusal that submitted nothing let Receive fall back to the held row, so a retry could pick the next row, which Receive may have shown to a payer during the proof. Keep every hold for the process lifetime, whatever the outcome; the cost is one skipped unused row per refused attempt, until restart. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(payments): hold a Core -> Platform remainder; reuse a held unshield destination on retry The Core -> Platform funding's remainder row was protected only by its durable record. Once a sweep cleared that record, Receive could fall back to it, making a row already shown to a payer eligible for the next self-payment. Pick and hold the remainder under the self-payment selection lock, for the process lifetime, like the payment's own destination. Now that holds are never released, a fee-adjusted retry of a shielded Max (Internal Shielded -> Platform, the invite overage top-up) would hold a second row, or fail when only one eligible row is left. Run both attempts in one withSelfUnshieldDestination scope so the retry reuses the first attempt's held, wallet-pinned destination. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Issue being fixed or feature implemented
MO-1121: External Send in Advanced mode. The Advanced Payments Send tab now opens a new Compose flow that sends from any of the wallet's balances (Core, Shielded, Platform or Identity) to a Dash address, a shielded address, a Platform address or an identity. Basic mode is unchanged.
Stacked on #1678 (
AmountEntryPage); the amount step reuses that page.What was done?
Flow (
ui/payments/send/): Send menu (username, Dash address, Scan QR), then the address page (empty, clipboard and filled states), then the amount page with From/To cards, Max and the source sheet, then the confirm sheet, then PIN/biometric, then the send.AdvancedSendFragmentis the tab page.ExternalSendFragment,ExternalSendScreenandExternalSendViewModelhold the flow, with a singleUIStateStateFlow and Hilt.ExternalSendExecutoris an@Singletonthat runs the send on the application scope, so leaving the screen doesn't cancel it.DashPayConfig.EXTERNAL_SEND_IN_FLIGHT) means that, after process death, the next launch shows "may have gone through" instead of the editable form.Service (
service/platform/sdk/ExternalSendService*,ExternalSendModels):dash1z…, Platformdash1k…/dash1s…, a Base58 identity ID, anddash:URIs.SdkWriteResultas Sent, Not sent, or "may have gone through", which is never retried.ShieldedBalanceServicegains external-recipient writes: transfer, withdraw to Core, unshield to a Platform address, identity top-up, shield from the wallet to an address, and (SDK int37) shield from Platform addresses or an identity to a third-party Orchard address. Each write takes the expected wallet ID.SDK:
5.1.0-int37-20261108.041023-1, pinned to the timestamped build.ManagedPlatformWallet.fundFromAssetLockExternal(Core → third-party Platform address).withdrawCredits(partial Platform-address withdrawal),shieldedShieldToRecipientandshieldedShieldFromIdentityToRecipient.Core → Platform address (
ExternalPlatformFunding.kt):amount + 62 000 duffspays the payee exactlyamount; the rest goes to the wallet's own Platform address, which pays the Platform fee. 62 000 duffs is the DPP admission floor for this transition, not a measured fee; what the fee doesn't use stays on the wallet's address.onAssetLockBuilt. At app start (and when the flow opens) a sweep resumes an interrupted lock with exactly those recipients. Once a lock is built, a failure is "may have gone through", never Not sent.dash1s…(P2SH) destination is refused before anything is built.Platform → Core: the wallet selects the Platform addresses to draw from: never more than an address's balance, at most 16, fewest first, and the first-sorting address (which the SDK charges the fee to) keeps the fee reserve. Amounts below 0.0119 DASH (
min_withdrawal_amountplus the Core fee) or above 500 DASH are refused before signing. The recipient receives the amount minus the Core fee (190 duffs), as with Identity → Core.Platform address sync:
PlatformAddressSyncServicestarts the SDK's Platform-address balance sync once the cutover is committed and the SDK wallet is bound, and stops it with the other SDK engines, so Platform credits received from another wallet show up.History: a Core → Platform lock reads "Platform" with the sent arrow. A received withdrawal that the wallet's own shielded pool did not make reads "Withdrawal" (was "Unshielded Withdrawal"): the Core transaction does not say whether it came from a Platform address, an identity or someone's shielded pool. The shielded identity-debit-pending error and a send to the wallet's own shielded address are classified as Not sent, since Rust builds nothing.
Supported pairs
Still unavailable, shown as disabled in the source sheet:
Fees:
Figma (section 6860:47472):
ModalDialog.How Has This Been Tested?
Unit tests:
ExternalSendModelsTestExternalSendServiceImplTestExternalSendViewModelTestShieldedBalanceServiceTestSdkDashPayWritesTestCutoverUiDataServiceTestPlatformAddressSyncServiceTestPlatformSyncEngineRestartTest/TeardownTestAddressParserTest,WifKeyTestTestnet emulators, between two wallets:
Returning Home after a finished send was checked on device.
Not yet run on a device: the other pairs, the resume sweep after a killed Core → Platform send, and the refusal paths.
Open items
AssetLockAlreadyConsumedmoves the record to a "completion unconfirmed" set (as dashwallet-ios does) so it no longer auto-resumes or blocks new Core → Platform sends. There is no manual-retry screen for it yet, and platform#5823's proven outcome does not cover address funding.dash-sdk.dbrebuilds the pending lock from the chain with no recipient: the Core transaction does not commit to the Orchard address. The wallet can't tell that lock from a legacy self-shield (int42 rows also have no recipient), so the sweep resumes it to the sender's own Shielded address. No funds are lost, since the same seed controls them, but the payee is not paid and the notification reads "Shielded transfer completed". Quarantining recipient-less locks would strand legacy self-shields, and the payee can't be recovered after a restore without a protocol change (an encrypted recipient in the asset-lock transaction). Accepted as is here, as in dashwallet-ios. Seed restore: an interrupted Core → third-party Shielded payment is finished to the sender #1779 tracks iOS's "no record of the address" copy, a user-initiated resume for such locks, and an optional recipient choice.5.2.0-int01-20261201.012447-1(v5.2-dev plus the int42/int43 carry), which includes the bindings External Send uses (feat(platform-wallet)!: top up an identity the wallet does not manage from Platform addresses platform#5860, #5873, #5896). Itsdash-sdk.dbis Room 21, so an int42 database (17) from the base migrates. dashj-platform 5.1.0-dev.3 and dashj 24.0.0 are unchanged from the base.topUpFromAddressesonly finds managed identities; paying someone else's identity from Platform addresses needs a Kotlin binding of feat(platform-wallet)!: top up an identity the wallet does not manage from Platform addresses platform#5860.AddressUtils.decodeandWifKeyin common now reject an empty payload instead of throwing.Breaking Changes
None. Advanced mode only; Basic mode's send screen is unchanged.
Checklist:
🤖 Generated with Claude Code