Conversation
…eApp, with restart recovery The Core to shielded screen gets a Max toggle. It replaces the amount field with the estimate from shieldedWalletDrainPreview (swept amount and input count, Core network fee, shielded pool fee, amount received) and runs shieldedFundFromWalletDrain through the existing shielded funding coordinator, so progress and single-flight are the sibling flow's. The operation UUID is written to a file before the call. The app reads shieldedWalletDrainStatus at launch and when the wallet screen opens, lists an unfinished transfer there, and resumes it with the same UUID and recipient so Rust continues the same asset lock. A marker is forgotten only when Rust reports completed, or not sent with no attempt overlapping the read. A lock that has a marker is not also offered in the generic resumable list. Rust supplies every amount, fee and input choice. "Stays in Core" is the one figure the preview does not carry: it is the balance card's Core total minus the preview's swept balance, for display only. The CoinJoin drain is not exposed: the app has no flow that starts from a CoinJoin balance. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ample app partial in the parity manifest SH-19 is the restart row. The manifest keeps the Swift example app at partial: only its unit tests have run, not the funded testnet run or the process-death run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🔍 Review in progress (commit b3cc8bc) · live progress |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Request changes: Resume can initiate a fresh sweep, and Shield Max can submit to a stale recipient, sweep an account other than the one quoted, or send newly eligible funds to an external recipient without a spend limit. The recovery UI can also lose its Resume action or show the wrong lock’s progress, and the preview can understate what stays in Core. Static review of e84483f: the Swift frozen-schema and Kotlin build/test checks passed, Swift build/tests were pending, and the funded restart flow has not been exercised in SwiftExampleApp.
🔴 8 blocking | 🟡 2 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The Swift app adds substantial preview and restart-recovery logic, but the existing SDK still determines the amounts, fees, and inputs and executes the transfer. - 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) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:207-229: Make Resume incapable of starting a fresh Max sweep
A saved UUID does not establish that an asset lock exists. If the app exits after saving the marker but before Rust checkpoints a lock, a failed status read on relaunch retains the row and leaves Resume enabled without an outpoint. A failed marker removal after a confirmed `notSent` can expose the same action. Resume calls the same SDK method as Shield Max: if Rust finds `NotSent` and no other pending drain, `begin_wallet_drain` returns `Ok(None)` and the caller builds a new lock, sweeping the current balance to the saved recipient without a fresh preview. Keep unknown and cleanup-failed rows visible with a status retry, not a spend action. For an actionable lock, use exact-outpoint recovery or a Rust resume-only operation that cannot build under the existing shield guard.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:791-798: Do not submit Max to a cached recipient after an invalid edit
`applyRecipientOverride` leaves `recipientRaw43` unchanged when the visible input is the wrong length or contains invalid hex. After entering a valid external address and replacing it with a malformed address, the Max gate still accepts the cached address and `submitDrainMax` persists and sends to it. Rust receives a valid address and cannot tell it differs from the current input. If Max retains editable recipients, require a valid current destination both when enabling the action and when submitting; a malformed nonempty field must not fall back to a previous address or to self.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:791-798: Restrict new Max transfers to self until the SDK can enforce a spend limit
Even with a valid external recipient, the displayed estimate does not constrain the payment. The form does not refresh the quote when inputs become spendable, and the SDK call carries neither the previewed inputs nor an amount ceiling. The native builder selects all eligible inputs at execution, so an incoming payment that becomes final while the form is open can also be sent to the third party. A last-minute refresh would narrow but not close the race. Limit new Max transfers to the wallet’s own Orchard address until the native bound tracked in #5607 is available; keep fixed-amount external payments and recovery of already-bound locks separate.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:931-935: Require the quote to match the account being swept
The picker changes `drainFundingAccountIndex` immediately, but the old unkeyed `drainPreview` is cleared only when the replacement preview task starts running. Until then, the form can show account A’s ready quote and enable Shield Max while `submitDrainMax` reads account B’s index. Rust’s estimate disclaimer covers changing inputs within a scope, not switching scopes. Carry the wallet ID and account index with the preview and require a match when rendering it, enabling the button, and accepting the tap.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:250-295: Label Max and populate its picker for the scope it actually sweeps
“Entire Core balance” overstates the sweep: Rust selects BIP44 and BIP32 at one index, plus DashPay receiving accounts, leaving standard funds at other indices untouched. The reused fixed-amount picker lists only indices with confirmed BIP44 funds, so a nonzero index funded only through BIP32 cannot be selected. Label Max for the selected scope, update SH-18 to account for other indices, and source any expanded list of applicable scopes from the Rust wallet’s funding resolver rather than duplicating eligibility in Swift.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/WalletDrainPreviewSection.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/WalletDrainPreviewSection.swift:130-138: Do not show a retained Core balance derived from the balance card
Key-wallet puts locked UTXOs in a separate `locked` bucket and excludes them from drain candidates. The card’s `WalletCoreBalance.total` omits that bucket, so 1 DASH eligible and 0.5 DASH locked can be displayed as 0 DASH staying in Core. The separate `accountBalances(for:)` read can also see a different snapshot or return `[]` on error, which this calculation turns into zero. Omit the row until the Rust preview can report the estimated remainder from the same snapshot as its candidates.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PendingPlatformFundFromAssetLocksList.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PendingPlatformFundFromAssetLocksList.swift:152-154: Use the lock’s recorded recipient in markerless recovery
The generic list preserves the exact-outpoint fallback, but the resume sheet initializes the recipient to the wallet’s own address and never reads `PersistentAssetLock.shieldedRecipientRaw43`. Rust rejects a resume whose requested recipient differs from the recorded one. When the marker for an externally addressed lock is missing or unreadable, the offered recovery fails unless the user can independently recover and re-enter the exact address already stored in SwiftData. Pass that recorded recipient unchanged and display it read-only; leave the recipient editable only for legacy locks with no binding.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift:107-123: Observe the controller so failed attempts become resumable
The row chooses between In progress and Resume using the child controller’s `phase`, but observes only the funding coordinator. That coordinator publishes map mutations and does not forward controller phase changes. The drain body publishes its reconciliation result before it throws and the controller sets `.failed`. If the list renders before that phase change, it can keep showing In progress after the attempt ended, with no guaranteed update to restore Resume because failed controllers are retained. Observe the matched controller in the row or forward its change notifications, and test a pending attempt that fails after the progress sheet is dismissed.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift:26-29: Show broadcast and proof progress for this Max operation
The reused progress section filters asset locks only by wallet and funding type, then takes the most recently updated row. An unrelated locked shield can make a fresh Max show proof generation before it has built a lock, and a refused second Max can borrow the first Max’s broadcast progress. That also makes SH-19’s instruction to terminate at step 2 or later unreliable. Match the persisted `PersistentAssetLock.operationId` to the drain UUID for fresh and resumed Max, or match the exact outpoint when known. Until a matching row exists, do not infer broadcast or finality.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainOperationStore.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainOperationStore.swift:47-51: Remove app-owned drain markers on explicit wallet deletion
The Application Support file stores the wallet ID and raw Orchard recipient outside the Rust, SwiftData, and Keychain stores covered by `deleteWallet`. Reconciliation skips wallets that are not loaded, so deletion can leave this payment metadata indefinitely and a later restore of the same wallet can encounter the stale marker. Include wallet-and-network-scoped file and cache cleanup in the explicit deletion flow, surface cleanup failure, and do not infer deletion from a failed or skipped wallet load.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Require authenticated settlement before recording a drain as complete — The unchanged Rust settlement path can write
DrainCompletedon an exact-outpointalready consumederror without a verified consumption proof. The app appropriately reads the native terminal state; keeping a Swift marker would not make a Rust-terminal operation recoverable.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
… only to the wallet's own address Review fixes for the Max (wallet drain) flow: - Resume calls shieldedResumeFundFromAssetLock with the outpoint the last status read named, so it can never build a new lock. A row without an outpoint only offers "Check again", which re-reads the status. - A new Max pays the wallet's own shielded address, read at submit, until the SDK can cap the swept amount (#5607). The override field is hidden in Max mode, so a stale or half-edited recipient cannot be paid. - The estimate carries the wallet and account index it was read for; submit requires a match and uses the quoted index. - The "Stays in Core" row is removed: it was not from the preview's snapshot and missed locked coins. - A resumed lock with a recorded recipient pays that recipient, shown read-only. - Each unfinished-transfer row observes its controller, so a failed attempt turns back into Resume. - Progress follows the operation's own lock (by drain id or resumed outpoint) instead of the wallet's newest shielded lock. - The toggle reads "Max (everything at this account index)". - Deleting a wallet removes its Max markers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Max recovery can still strand a retained checkpoint, miss a markerless Built lock, or race wallet deletion; a same-network SDK rebuild can also stop the SPV service that a running Max is waiting on. New mainnet Max transfers should stay disabled until the SDK can authenticate a report that the asset lock was already consumed. The Kotlin CI check passed, but no completed Swift app check was reported and the funded SwiftExampleApp restart scenario has not been run.
🔴 6 blocking | 🟡 4 suggestion(s)
Still open from earlier rounds (1)
- 🟡 Suggestion: Label Max and populate its picker for the scope it actually sweeps —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:294-300(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: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: 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) — WalletDrainCoordinator.swift adds intricate funds-movement logic that initiates a whole-wallet sweep and uses persisted operation IDs to resume that same transfer after restart, even though the SDK still controls coin selection and fees. - 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— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:271-279: Resume the retained checkpoint even when the lock is not tracked
A pending outpoint is not proof that the lock is in `tracked_asset_locks`. The Rust test `should_retry_rolled_back_drain_checkpoint_without_rebuilding` shows that a failed persistence write retains the original signed transaction and fences its inputs, but generic outpoint resume returns `AssetLockNotTracked` and a second UUID is refused. Once storage is writable again, this button still repeats the same lookup. Expose a resume-only operation in `rs-platform-wallet` that checks the UUID and expected outpoint under the shield guard, hydrates the original checkpoint, and never enters the fresh-build branch. Test recovery through that entry point after a failed write.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:233-239: Keep SPV running while Max is waiting for Core finality
Dismissing this sheet does not stop the admitted drain worker. The Docker toggle and devnet edits can rebuild the SDK on the same network: `rebuildSdkAndMoveWalletManager` stops SPV first, then `WalletManagerStore.activate` awaits the old manager's `shutdown()`. Shutdown waits for the admitted drain, which can be in `wait_for_chain_lock` with no deadline. If SPV stops before observing the required ChainLock, the replacement never becomes active. Make funding admission and reconfiguration mutually exclusive before SPV is stopped, or suspend funding at its durable checkpoint before teardown. Guard the shared rebuild path, not just the network picker.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:272-279: Count exact-outpoint recovery as an active manager operation
`shieldedResumeFundFromAssetLock` captures the handle and awaits a detached FFI worker without balancing `admitNativeOp` and `finishNativeOp`. After the progress sheet is dismissed, `deleteWallet` can pass its `activeNativeOpCount == 0` check while recovery is still proving, submitting, or settling the lock. The worker's retained wallet reference does not prevent removal of the wallet's live registration. Manager replacement also does not wait for this worker before loading the next snapshot. Give the recovery wrapper the same admission scope as fresh Max, including result delivery, and test that deletion is refused while recovery is active.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:889-895: Do not enable new mainnet Max transfers until completion is authenticated
This submit path enables new Max transfers on mainnet. In Rust, `settle_asset_lock_submit_result` writes `DrainCompleted` when `is_asset_lock_already_consumed` matches the submitted outpoint in a node-supplied error, without a verified state proof. A false report can make the app show success and discard the recovery marker while the funds remain in an unconsumed asset lock. Shielding to self does not fix that. Until the SDK issue tracked in dashpay/platform#5580 is fixed, block new mainnet Max at both the form and submit boundaries without disabling recovery of existing locks.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:897-898: Observe the controller in the fresh Max terminal controls
The new Max path assigns an `ObservableObject` controller to an `@State` reference. The step view observes the controller, but the parent reads `phase` for both the terminal section and the toolbar's Cancel gate without subscribing to it. The steps can finish while Done or Dismiss stays absent and Cancel stays disabled until an unrelated redraw. Put the phase-driven controls in an observing view, as the recovery sheet already does.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:294-300: Label Max and populate its picker for the scope it actually sweeps
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4657907013)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PendingPlatformFundFromAssetLocksList.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PendingPlatformFundFromAssetLocksList.swift:141-148: Include checkpointed Built drains in markerless recovery
Rust durably stores the drain as `Built` before dispatch and can resume that state by exact outpoint, rebroadcasting the original transaction if needed. On relaunch with no readable marker, the Max list has no entry, and this fallback rejects `Built` in `isResumableTopUp` before checking marker ownership. A drain that has not advanced past `Built` is therefore hidden in both lists, even though `begin_wallet_drain` refuses a replacement. Include operation-tagged shielded drains that the wallet can still resume and test the full list predicate with a markerless `Built` row.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:168-179: Show broadcast and proof progress for this Max operation
The new UUID match prevents a Max from borrowing another lock's progress. The step-1 fallback only applies while `.inFlight`: after failure, no match still returns step 5. A second Max refused as `notSent` before building anything therefore shows broadcast and both finality steps as done. Leave those steps unconfirmed when there is no matching lock, and test the failed-before-build step state as well as the lock matcher.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletDetailView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletDetailView.swift:1009-1015: Remove app-owned drain markers on explicit wallet deletion
Successful deletion now removes the markers. If `forgetWallet` throws, it has not pruned the cache, and the log-only catch lets the deletion appear complete even though the wallet ID and raw Orchard recipient can remain on disk. Keep dismissing the deleted SwiftData row, but hand the cleanup error and wallet ID to the surviving wallet-list view so it can report the partial wipe and retry without reopening the deleted wallet.
In `packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md:282: Give SH-20 spendable funds for the second Max attempt
Once the wallet reflects SH-19's broadcast, a fixture with just one funded scope and no other eligible inputs has nothing left for a second quote. `canSubmit` hides Shield Max on `insufficientFunds`, so the tester never reaches the Rust pending-drain refusal. Leave the first drain pending and use a second funded selectable index or confirm a new input. Require a ready quote before testing that Rust refuses the second UUID and preserves the first.
…ing by outpoint shieldedResumeFundFromAssetLock ran its detached FFI worker outside the manager's native-operation admission, so deleteWallet and shutdown did not wait for it. It now runs inside the same admission scope as the wallet-drain wrappers, through withAdmittedNativeOperation (the drain helper, renamed and moved next to admitNativeOp). A test shows deleteWallet is refused while an admitted operation is in flight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n checkpoints - New Max transfers are blocked on mainnet, at the toggle and at submit, until a drain's completion is proof-backed (#5580). Recovering an existing Max transfer stays available on every network. - A drain lock stored as Built with no marker is offered in the generic resumable list; ordinary Built rows stay hidden. - A failed attempt with no lock of its own shows step 1 failed instead of broadcast and finality as done. - The form re-renders when the active attempt's phase changes, so Done/Dismiss appear and Cancel re-enables. - SH-20 gives the second Max spendable funds; SH-18 notes the mainnet block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head blocks new Max transfers on mainnet, restores markerless Built recovery, and keeps exact-outpoint resume admitted until the native call returns. Static review found additional gaps in legacy-drain visibility, progress reporting, and the restart test plan; the funded SwiftExampleApp restart scenario has not been run. Kotlin SDK build and tests passed, and PR Hygiene remains pending.
🔴 3 blocking | 🟡 4 suggestion(s)
Still open from earlier rounds (3)
- 🔴 Blocking: Resume the retained checkpoint even when the lock is not tracked —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:271-279(thread) - 🟡 Suggestion: Remove app-owned drain markers on explicit wallet deletion —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletDetailView.swift:1009-1015(thread) - 🟡 Suggestion: Label Max and populate its picker for the scope it actually sweeps —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:309-315(thread)
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: Let the funding coordinator report whether it started the body
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:331-345
startFunding returns .started both when it schedules a body and when it only re-presents an existing controller. A legitimate attempt can reuse a failed controller, so testing object identity plus lastSubmittedAt misclassifies an accepted attempt if the wall clock returns an equal value. That decrements runningCounts before the scheduled body finishes, weakening the overlap check that protects the marker from a notSent read. Return an explicit started-versus-represented result from the coordinator instead of using a display timestamp as an admission token.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: 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) — WalletDrainCoordinator.swift and ShieldedFundFromAssetLockView.swift directly control a new whole-account funds movement path, with intricate logic for binding the preview to the submitted account, choosing the recipient, and recovering the exact asset lock after a restart. - 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)
- Code unchanged since the last final review (
fe3f2469): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:325-328: Keep SPV running while Max is waiting for Core finality
The shared ChainLock dependency is not the regression; the new shutdown dependency is. New Max and exact-outpoint resume hold manager admission, whereas a fresh fixed-amount shield does not. A same-network Docker or devnet rebuild stops SPV before `WalletManagerStore.activate` awaits `stale.shutdown()`. Shutdown clears the public handle and waits for admission to drain, but a funding call that still needs a later ChainLock has no deadline and cannot obtain that finality from the stopped client. Keep the admission guard and make the shared rebuild reserve reconfiguration before stopping SPV, excluding both funding already in flight and new funding during the stop-to-activate gap.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PendingPlatformFundFromAssetLocksList.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PendingPlatformFundFromAssetLocksList.swift:169-175: Surface the unresolved legacy drain that blocks every new Max
A restored, operation-tagged `Consumed` lock with no app marker is absent from both recovery lists: the Max list needs a marker, and this fallback excludes status 4. Swift persistence still loads that status and its operation ID, and `should_keep_a_consumed_legacy_drain_row_pending_and_refuse_generic_consumption` verifies that Rust reports it as pending after restart. `begin_wallet_drain` then refuses every new UUID and tells the user to resume an operation they cannot see. Do not add status 4 to the generic Resume predicate: that path rejects consumed locks. Surface the wallet's reconciliation-needed state separately from resumable locks, with an explanation instead of a spend button.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:195-206: Show recovered and completed locks without inventing a finality lane
`RecoveredFromChain` (5) is offered for resume, but the progress switch sends it to “Building asset-lock transaction” even when the worker already has a ChainLock proof and is shielding. `DrainCompleted` (6) also falls back to building if the receipt reaches the view before the controller's awaited reconciliation finishes. Once the controller completes, `stepState` treats any non-2 status as evidence for the ChainLock lane, even though `complete_wallet_drain` clears the proof and an InstantSend-funded drain can produce the same receipt. Handle recovered and completed rows explicitly, show neutral finality when the proof kind is unavailable, and cover both statuses in the step tests.
In `packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md:281: Distinguish both step-1 crash outcomes in SH-19
Step 1 covers both the absence of a matching row and a durably stored `Built` row. Terminating the app based only on that display can therefore correctly leave an unfinished transfer with a resumable outpoint, contrary to the final assertion. Use a controlled stop before checkpoint persistence to test `notSent`, or document both outcomes: no row before the checkpoint and exact-outpoint recovery once `Built` is durable.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:271-279: Resume the retained checkpoint even when the lock is not tracked
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658018459)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletDetailView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletDetailView.swift:1009-1015: Remove app-owned drain markers on explicit wallet deletion
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658018483)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:309-315: Label Max and populate its picker for the scope it actually sweeps
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4657907013)
…ding is in flight Max and exact-outpoint resume hold the wallet manager's admission, so a rebuild that stops SPV and then waits for the old manager's shutdown could wait forever on a funding that needs a ChainLock from the stopped client. The shared rebuild now checks for in-flight shields, top-ups and identity registrations before it stops SPV and refuses with a new `.fundingInFlight` outcome; Max and Resume refuse to start while a rebuild runs. Also: - progress maps RecoveredFromChain to the shield step and DrainCompleted to done, and marks a finality lane skipped only when the proof kind says which one was used; - a Resume that finds no tracked lock explains that nothing was sent and that an app restart releases the coins; - SH-19 covers both outcomes of a kill during step 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head adds a pre-stop funding check, corrects the recovered and completed progress steps, and documents both step-1 restart outcomes. The new recovery message incorrectly treats a missing live lock as proof that nothing was sent and that restarting will free the coins. Kotlin build and tests passed; PR Hygiene and review are pending, and the funded SwiftExampleApp process-death scenario remains unrun.
A pattern across this PR's review rounds
This is review round 4, and the PR has drawn 17 blocking findings so far. 11 of them share 3 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. No wallet-owned recovery decision for Max (1 new in this round, 5 earlier finding(s))
shieldedWalletDrainStatus can name an outpoint from a retained checkpoint or durable row that shieldedResumeFundFromAssetLock cannot find in live tracking; the UUID-based drain call can recover the checkpoint, but it can also start a fresh sweep. Without a wallet API that distinguishes resumable from unresolved, Swift has to infer what to offer from its marker file, PersistentAssetLock rows, and now AssetLockNotTracked, which says nothing about what a restart will restore. The same recovery decision needs trustworthy completion evidence: DrainCompleted can currently come from an unverified already-consumed reply, which the linked issue tracks.
Already tracked: #5580
In this round: Do not promise that restarting releases an untracked lock's inputs
2. Manager admission and SPV teardown are separate (3 earlier finding(s))
PlatformWalletManager counts admitted native calls, but rebuildSdkAndMoveWalletManager controls the SPV client those calls may still need for a ChainLock. Adding admission to exact-outpoint resume made wallet deletion wait correctly, but it also made SDK rebuild wait for a worker after stopping the client that could let it finish; the app then had to coordinate the two separately.
Already tracked: #4238
3. Progress inferred from stored lock rows (4 earlier finding(s))
ShieldedFundFromAssetLockProgressSection reconstructs progress from the controller phase and PersistentAssetLock rows rather than receiving milestones for the operation from the wallet. Matching by UUID stops one transfer from borrowing another's progress, but a missing row, a durable Built checkpoint, and a recovered lock still convey different facts that the five-step display and restart test have to infer.
Already tracked: #5539
Suggested decision (land the prerequisite first): Land a wallet-owned Max recovery API in rs-platform-wallet, exposed through the Swift SDK, before enabling Max in the example app. It must identify the operation blocking a new sweep even without an app marker, report whether it can be resumed or only rechecked, and resume only its original asset lock without ever building a replacement. If that prerequisite does not land first, drop Max from this PR rather than asking Swift to infer another recovery outcome.
🔴 3 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (1)
- 🟡 Suggestion: Show recovered and completed locks without inventing a finality lane —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:267-275(thread)
Disputed — left to maintainers (1)
- 🟡 Suggestion: Remove app-owned drain markers on explicit wallet deletion —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletDetailView.swift:1009-1015(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: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: 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) — WalletDrainCoordinator.swift and ShieldedFundFromAssetLockView.swift implement an intricate funds-movement flow that starts a full-account sweep, binds it to the wallet’s own recipient, and resumes the exact asset lock after restart. - 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— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (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): No wallet-owned recovery decision for Max; Manager admission and SPV teardown are separate; Progress inferred from stored lock rows. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a wallet-owned Max recovery API in `rs-platform-wallet`, exposed through the Swift SDK, before enabling Max in the example app. It must identify the operation blocking a new sweep even without an app marker, report whether it can be resumed or only rechecked, and resume only its original asset lock without ever building a replacement. If that prerequisite does not land first, drop Max from this PR rather than asking Swift to infer another recovery outcome. 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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockView.swift:807-814: Keep SPV running while Max is waiting for Core finality
The rebuild reservation blocks fresh Max and marker-backed Resume, but a type-5 lock opened from Pending Platform Top Ups sets `resumeFromLock`, so `isDrainMax` is false and `submit()` bypasses both guards. A second window can submit after the rebuild's funding check has passed, while `stopSpv()` is suspended and before the old manager revokes its handle. This path acquires the same native admission at line 841. If a stored InstantSend proof needs upgrading, the FFI passes `cl_wait: None` to the ChainLock fallback, so same-network activation can wait indefinitely for an admitted worker whose SPV client has stopped. Apply the reservation at the shared shielded-funding entry point and test generic Resume while the rebuild is suspended in the stop step.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-696: Keep SPV running while Max is waiting for Core finality
The pre-stop check scans the presentation map rather than tracking workers through completion. Leave a completed self-shield sheet open in one window, then start Max for the same wallet and recipient in another. `startFunding` replaces the completed controller, but Done on the old sheet removes the slot by wallet and recipient alone. That removes the new controller without cancelling its admitted worker. A same-network rebuild can now pass this check, stop SPV, and wait indefinitely in shutdown if Max still needs a ChainLock. Keep the worker's reservation independent of presentation, or require dismissal to match the current terminal controller. Cover the old-Done/new-Max ordering using the actual coordinator.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:95-105: Do not promise that restarting releases an untracked lock's inputs
`AssetLockNotTracked` reports that the outpoint is missing from the live map, not whether its transaction was stored or sent. `should_release_rejected_drain_only_when_removal_committed` shows that a failed removal write leaves a durable `Built` row and a pending operation even though the live map is empty. Restart restores that row, and `catchUpStuckAssetLocks` can rebroadcast the original transaction rather than free its inputs. Likewise, `remove_tracked_asset_locks_for_swept` can remove a previously broadcast lock after a competing spend wins, invalidating an outpoint the screen already read. Tell the user to restart and recheck the saved operation, then follow the reported status. Do not promise that nothing was sent, that the coins are free, or that a new Max can start.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:267-275: Show recovered and completed locks without inventing a finality lane
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658175643)
… guard - Every Core-funded shield on the asset-lock screen, generic resume included, refuses to start while an SDK rebuild runs; resume holds the manager's admission, so starting one mid-rebuild could block shutdown. - Dismissing a shield sheet removes its slot only if that slot still holds the dismissed controller, so a stale sheet's Done can no longer drop a newer in-flight funding that the rebuild guard must see. - A Resume that finds no tracked lock no longer claims nothing was sent: it asks for a restart and a fresh status check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
At 38dfc9a, generic Core shield submissions now honor the rebuild reservation, and the untracked-lock message directs users to recheck status without promising that inputs were released. The new coordinator test covers dismissal of a replaced controller after success. The Kotlin emulator build and tests passed on this head; review and hygiene checks were pending, and the funded SwiftExampleApp process-death scenario remains unrun.
🔴 2 blocking | 🟡 3 suggestion(s)
Still open from earlier rounds (2)
- 🔴 Blocking: Keep SPV running while Max is waiting for Core finality —
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:325-328(thread) - 🟡 Suggestion: Show recovered and completed locks without inventing a finality lane —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:267-275(thread)
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: Make the rebuild reservation reciprocal for top-ups and registrations
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-696
The new pre-stop check counts address top-ups and identity registrations, but their submitters do not check the rebuild reservation. Once stopSpv suspends, a second window can reach FundFromAssetLockPlatformAddressView.startFunding's coordinator call or the Core-funded CreateIdentityView registration call and schedule work against the manager that is stopping. Both sibling coordinators also reuse failed controllers and dismiss by slot key, so a stale failure dismissal can hide a retry from this predicate. Use a shared app-level reservation for the flows this check covers, and test that a top-up cannot start once the rebuild has entered the stop step.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, 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: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: 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) — ShieldedFundFromAssetLockView and WalletDrainCoordinator add an intricate funds-moving flow that initiates a full Core account sweep, constrains its destination, and resumes the exact asset lock after a restart. - 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)
- Code unchanged since the last final review (
1319012c): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/ShieldedFundFromAssetLockCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/ShieldedFundFromAssetLockCoordinator.swift:218-221: Keep SPV running while Max is waiting for Core finality
The new test proves that Done on a completed controller cannot remove a distinct replacement. The failed-slot branch is different: at line 158, `existing.submit(...)` puts the same controller back in flight for a Max or Resume to the same recipient. A Dismiss action from the failed presentation still passes the identity check and removes the live worker from `hasInFlightFundings`. Rebuild can then stop SPV while that worker still holds native admission. Check ownership and terminal phase together at removal, including in the retention sweep, which currently checks ownership before a separate async removal. Extend the test with a failed first attempt, a retry held open on the same object, and a dismissal from the first presentation.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:169-175: Match fixed-amount shield progress to the outpoint the SDK emits
The new matcher is exact for Max and Resume, but its fixed-amount branch still selects the newest untagged row. An earlier ChainLocked shield can therefore put a new `shield:<uuid>` on the Orchard proof step before the new attempt has built anything. The new matcher test makes this ambiguity part of the expected behavior. The SDK already exposes `onAssetLockBuilt`; bind that outpoint to the submitting attempt and show no matching row until its outpoint is known.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:267-275: Show recovered and completed locks without inventing a finality lane
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658175643)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:372-377: Return worker acceptance instead of inferring it from a timestamp
`startFunding` knows whether it scheduled the body or only returned an existing controller. The caller infers that distinction by comparing identity and `lastSubmittedAt`. A failed-slot retry reuses the object, and `Date()` does not guarantee a distinct value per submission. If an accepted attempt is misclassified as a re-presentation, its running count is released early and a status read that starts before the worker checkpoints can treat `notSent` as safe to forget. Return whether the body was scheduled and balance the running count from that result.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:325-328: Keep SPV running while Max is waiting for Core finality
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658175637)
…d report when a body was scheduled - The shielded-funding coordinator removes a slot only when the caller owns it and its controller is not in flight, in dismiss and in the retention sweep (one main-actor step there). A retried failed slot reuses its controller, so the failed sheet's Dismiss could otherwise drop a running, admitted worker from hasInFlightFundings. - startFunding reports whether it scheduled the body, and the Max coordinator balances its running count from that instead of guessing from controller identity and lastSubmittedAt. - Progress shows finality as confirmed with the proof kind unknown when the lock does not record which proof was used, instead of marking both the InstantSend and ChainLock steps done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Three lifecycle blockers remain: a failed Max sheet can report another transfer’s success, address funding and identity registration can start during a rebuild, and exact-outpoint resume can leave public SDK shutdown waiting indefinitely. Kotlin CI passed and Swift SDK CI was pending when checked; this was a static review, and the funded app restart scenario remains untested.
A pattern across this PR's review rounds
This is review round 6, and the PR has drawn 22 blocking findings so far. 16 of them share 4 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. No wallet-owned recovery decision for Max (6 earlier finding(s))
shieldedWalletDrainStatus can name an outpoint from a retained checkpoint or a durable row, but shieldedResumeFundFromAssetLock requires a live tracked lock; the UUID-based drain call can restore the checkpoint but can also start a new sweep. Swift therefore has to infer whether to offer Resume or Check again from its marker file, PersistentAssetLock, and AssetLockNotTracked, none of which alone answers that question. Marker cleanup depends on the same wallet contract: DrainCompleted can still come from an unverified already-consumed reply, which the mainnet gate avoids for new transfers without changing what the receipt means.
Already tracked: #5580
2. Manager admission does not make finality waits stoppable (1 new in this round, 4 earlier finding(s))
withAdmittedNativeOperation keeps the native handle alive until exact-outpoint resume returns, but the FFI passes no ChainLock deadline and wait_for_chain_lock does not observe shutdown. The app's rebuild guard keeps its own path from stopping SPV under a known worker; it cannot give the same guarantee to another SDK host. Once shutdown() revokes the public handle and starts waiting, that host cannot restart SPV on the manager to unblock the admitted call.
Already tracked: #6003
In this round: Let SDK shutdown interrupt a parked exact-outpoint finality wait
3. A recipient slot doubles as an operation record (1 new in this round, 2 earlier finding(s))
ShieldedFundFromAssetLockCoordinator.controllers is keyed by wallet and recipient, but the same mutable controller owns the task, supplies hasInFlightFundings, and tells an already-open sheet which operation it is showing. The dismissal patches keep an old sheet from removing a running entry, but the failed-slot branch still lets submit rewrite that controller's operationId, so the old sheet can report a different transfer's result.
In this round: Keep a failed Max sheet bound to its original operation
4. Stored lock rows stand in for progress events (5 earlier finding(s))
ShieldedFundFromAssetLockProgressSection reconstructs progress from the controller phase, PersistentAssetLock status, and elapsed time rather than receiving milestones for that operation. Matching Max by UUID prevents it from borrowing another lock's progress, but a missing row, a durable Built checkpoint, and a recovered lock still tell the UI different things; the display and restart test have to infer where the worker actually is.
Already tracked: #5539
Suggested decision (land the prerequisite first): Land a wallet-owned Max recovery API in rs-platform-wallet, exposed through Swift, before enabling Max in the example app. It must identify the drain blocking a new sweep even without an app marker, distinguish Resume from Check again, and resume only the original asset lock. If shutdown interrupts its finality wait, it must return with the checkpoint still pending. If that prerequisite does not land first, remove Max from this PR rather than adding another Swift fallback. The Swift SDK build and tests, PR Hygiene, and the review check are still pending.
🔴 2 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (1)
- 🟡 Suggestion: Match fixed-amount shield progress to the outpoint the SDK emits —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:169-175(thread)
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: Apply the rebuild reservation to address funding and registration starts
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-697
The new predicate rejects a rebuild if an address top-up or identity registration is already running, but neither start path honors the rebuild reservation. After the predicate returns false and stopSpv() suspends, another window can call FundFromAssetLockPlatformAddressView’s startFunding or CreateIdentityView’s asset-lock startRegistration on the outgoing manager. Both native funding paths can wait for Core finality, which the rebuild is stopping on that manager. Make the rebuild reservation and these coordinator starts mutually exclusive under one app-level rule. Hold the stop step open in a test and assert that neither start schedules its body.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, 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: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: 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) — WalletDrainCoordinator.swift adds intricate persistence and concurrency logic that governs when a whole-balance transfer is initiated, which asset lock can be resumed, and when its recovery record can be cleared. - 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)
- Code unchanged since the last final review (
38dfc9a6): 2 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed, 1 not confirmed (now 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— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (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): No wallet-owned recovery decision for Max; Manager admission does not make finality waits stoppable; A recipient slot doubles as an operation record; Stored lock rows stand in for progress events. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a wallet-owned Max recovery API in `rs-platform-wallet`, exposed through Swift, before enabling Max in the example app. It must identify the drain blocking a new sweep even without an app marker, distinguish Resume from Check again, and resume only the original asset lock. If shutdown interrupts its finality wait, it must return with the checkpoint still pending. If that prerequisite does not land first, remove Max from this PR rather than adding another Swift fallback. The Swift SDK build and tests, PR Hygiene, and the review check are still pending. 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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/ShieldedFundFromAssetLockCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/ShieldedFundFromAssetLockCoordinator.swift:148-161: Keep a failed Max sheet bound to its original operation
The failed-slot branch reuses `existing` without comparing operation IDs. If a second Max is refused and its sheet stays open, resuming the first Max in another window uses the same wallet and recipient slot. `submit` overwrites the refused controller’s `operationId`, and the refused sheet observes that same controller’s new phase and displays “Shielded” when the first Max finishes. A fixed-amount self-shield can produce the same misattribution. Reuse a failed controller only for a retry of the same operation ID; allocate a replacement for a different ID, as the completed-slot branch does. Test that the original controller remains failed when the second operation succeeds.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:325-328: Let SDK shutdown interrupt a parked exact-outpoint finality wait
The new admission makes public `shutdown()` wait for this resume call. A host can stop SPV while resume is waiting for a ChainLock that has not arrived, then call `shutdown()`. The resume FFI passes `cl_wait: None`, and `wait_for_chain_lock` only wakes to recheck finality; it has no shutdown exit. Swift revokes the public handle before draining admitted calls, so the host cannot restart SPV on that manager to free the wait. Keep admission, but signal a native cancellation or equivalent bounded exit before the drain, leaving the tracked outpoint pending. The native cancellation work is tracked in #6003; test that shutdown completes without a ChainLock and without consuming or removing the checkpoint.
_Raised on code unchanged since the last review, and confirmed by an independent pass: Resume a tracked, broadcast shielded asset lock whose proof wait falls back to ChainLock, then stop SPV before a covering ChainLock arrives and call shutdown(). Shutdown never returns: it waits for the newly admitted resume, but the resume has no deadline or cancellation path, and shutdown has already revoked the handle needed to restart SPV._
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:169-175: Match fixed-amount shield progress to the outpoint the SDK emits
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658466728)
…r and its own lock's progress - A failed slot is reused only to retry the same operation; a different operation on the same wallet and recipient gets a fresh controller, so the old failed sheet no longer shows the new operation's progress. - A fresh fixed-amount shield follows only an untagged lock created since it was submitted, instead of the wallet's newest untagged lock, so an older recovered lock cannot put it on the shield step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…own and must not lose SPV Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head gives a different shield operation its own controller and documents the SDK’s shutdown behavior. The rebuild guard still misses Core-to-shielded Send, and restart recovery temporarily hides saved transfers while reading their status. The Kotlin emulator check passed; review and PR Hygiene remained pending, and funded process-death recovery was not exercised.
🔴 1 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (2)
- 🔴 Blocking: Let SDK shutdown interrupt a parked exact-outpoint finality wait —
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:331-334(thread) - 🟡 Suggestion: Match fixed-amount shield progress to the outpoint the SDK emits —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:190-195(thread)
Follow-up candidates (optional) (2)
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: Show a saved transfer while its restart status is being read
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:398-403
On cold launch, latest is empty. Publishing markedOperationIds suppresses the matching lock in Pending Platform Top Ups, but compactMap drops the saved transfer from Unfinished Max Transfers until reconciliation publishes a status. A status read that suspends therefore leaves neither list showing a transfer whose marker was already loaded. Publish a non-spending “Checking status” row immediately for saved markers in the loaded wallet and network, and enable Resume only once the SDK reports an outpoint. Test visibility and the absence of Resume while the status read is held open.
source: gpt-6.2-astra (phase2-reviewer: architecture-layering)
🟡 Suggestion: Include Core-to-shielded sends in the rebuild reservation
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-697
The new pre-stop check only sees work registered in these three coordinators. SendViewModel.executeSend calls shieldedFundFromAssetLock directly at line 820 and does not check isRebuildingSdk. If a Send has broadcast and is waiting for a ChainLock, a network switch can pass this check and stop the outgoing manager’s SPV. The native funding call has no ChainLock deadline, and the Rust shield mutex does not exclude SPV teardown. The reverse ordering also bypasses the reservation: Send can enter while the rebuild is suspended in stopSpv. Use a shared app-level funding reservation for Send and the dedicated funding paths, acquired before scheduling native work and held until it returns. Test both orderings.
source: gpt-6.2-astra (phase2-reviewer: general)
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: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: 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) — ShieldedFundFromAssetLockView adds a whole-balance sweep, and WalletDrainCoordinator adds intricate persistence and recovery logic that determines when to start a sweep or resume a specific asset lock. - 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)
- Code unchanged since the last final review (
7ebc3b10): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 not confirmed (now follow-up candidates); 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:331-334: Let SDK shutdown interrupt a parked exact-outpoint finality wait
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658634534)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:190-195: Match fixed-amount shield progress to the outpoint the SDK emits
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658466728)
…uilt, and list saved Max transfers before their status is read - A fresh fixed-amount shield records the outpoint the SDK reports from onAssetLockBuilt (before the lock's row is stored) and its progress follows only that row, so a historical lock inserted during catch-up cannot drive it. - Every saved Max transfer is listed on the wallet screen as soon as the marker is loaded, as "Checking status" with no Resume until a status read names its outpoint; the list shows only the current network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Fixed-amount shield progress now follows the exact asset lock the SDK reports, but the Max recovery screen still shows a zero count when it cannot read the marker file and can infer a finality timeout from a restored row's age. The Kotlin emulator build and tests passed; the review and PR Hygiene checks were still pending. Funded process-death recovery has not been run in SwiftExampleApp.
A pattern across this PR's review rounds
This is review round 8, and the PR has drawn 23 blocking findings so far. 13 of them share 3 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. No wallet-owned recovery decision for Max (1 new in this round, 6 earlier finding(s))
shieldedWalletDrainStatus needs a known UUID and can return an outpoint that shieldedResumeFundFromAssetLock cannot resume because it is not tracked live; the UUID-based drain call can restore that checkpoint but can also start a new sweep. Swift therefore reconstructs what is pending and what can be resumed from WalletDrainOperationStore and PersistentAssetLock, so an unreadable marker file is another way the recovery list can disagree with what blocks a new sweep in Rust. Marker cleanup also trusts DrainCompleted, which can still come from an unverified already-consumed reply; blocking new Max transfers on mainnet does not change what that receipt means.
Already tracked: #5580
In this round: Show an unknown transfer count when the marker file cannot be read
2. Manager admission does not make finality waits stoppable (4 earlier finding(s))
withAdmittedNativeOperation protects the native handle, but shieldedResumeFundFromAssetLock can wait for a ChainLock with no deadline or shutdown signal. The app's rebuild guard and the SDK instruction to keep SPV running try to preserve the conditions the worker needs to finish; neither lets shutdown() stop the wait and leave the original lock pending.
Already tracked: #6003
3. Stored lock rows stand in for progress events (1 new in this round, 5 earlier finding(s))
ShieldedFundFromAssetLockProgressSection reconstructs progress from controller phase, PersistentAssetLock status and updatedAt, rather than receiving milestones for the current attempt. Matching the exact lock fixes which row is shown, but not what that row can tell the UI: a missing row cannot confirm broadcast, and an old Broadcast row cannot tell Swift whether the new resume attempt's InstantSend wait has expired.
Already tracked: #5539
In this round: Do not infer a resumed lock's finality timeout from the age of its row
Suggested decision (land the prerequisite first): Land a wallet-owned Max recovery API in rs-platform-wallet, exposed through Swift, before enabling Max in the example app. It must identify the drain blocking a new sweep without relying on an app marker, distinguish an unknown outcome from a resumable lock, and resume only the original lock; shutdown must be able to end the wait with that lock still pending. The discussion leaves checkpoint recovery and cancellation as follow-ups while this PR still enables Max, so if the prerequisite does not land first, drop Max from this PR rather than adding another Swift fallback. At this head, the Kotlin emulator check passed; the review and PR Hygiene checks are pending.
🔴 2 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (1)
- 🔴 Blocking: Let SDK shutdown interrupt a parked exact-outpoint finality wait —
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:331-334(thread)
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: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: 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) — The intricate changes in ShieldedFundFromAssetLockView.swift and WalletDrainCoordinator.swift directly control real funds movement: which Core account is swept, where the funds go, and which exact asset lock can be resumed after restart. - 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— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (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): No wallet-owned recovery decision for Max; Manager admission does not make finality waits stoppable; Stored lock rows stand in for progress events. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a wallet-owned Max recovery API in `rs-platform-wallet`, exposed through Swift, before enabling Max in the example app. It must identify the drain blocking a new sweep without relying on an app marker, distinguish an unknown outcome from a resumable lock, and resume only the original lock; shutdown must be able to end the wait with that lock still pending. The discussion leaves checkpoint recovery and cancellation as follow-ups while this PR still enables Max, so if the prerequisite does not land first, drop Max from this PR rather than adding another Swift fallback. At this head, the Kotlin emulator check passed; the review and PR Hygiene checks are pending. 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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift:51-68: Show an unknown transfer count when the marker file cannot be read
On a cold launch with a corrupt or temporarily unreadable marker file, `refreshFromStore()` sets `storeError` and leaves `unfinished` empty. This section still displays “Unfinished Max Transfers (0)” and “Nothing is lost” above the error. A failed read establishes neither claim; after a previous successful read, the displayed count and rows can instead be stale. Show an unnumbered heading and the read error, label any cached rows as last known, and offer a section-level retry that works without a row. Test the coordinator-to-view error state, not just that the store throws.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:223-227: Do not infer a resumed lock's finality timeout from the age of its row
Resume a lock whose stored `Broadcast` row is more than five minutes old: the first render says “InstantSend timed out” and skips that lane. But `FromExistingAssetLock` calls `resume_asset_lock` with a new 300-second proof window; the persisted `updatedAt` identifies neither the start nor the outcome of this attempt. The same timer runs after `.failed`, so a failed sheet can move its error to the ChainLock step without a wallet event. Show “Waiting for Core finality” while the row only reports `Broadcast`, name a fallback only when the native worker reports it, and keep terminal progress from advancing on the clock alone. Cover both an old restored row and a clock advance after failure.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:331-334: Let SDK shutdown interrupt a parked exact-outpoint finality wait
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658634534)
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Reject malformed recipient edits on fixed-amount shields — The base and head both leave
recipientRaw43set to the last valid address when a nonempty edit is malformed. A fixed-amount shield can therefore submit to the previous external address while the editor displays an invalid replacement. New Max does not use this editor or its cached address.- Follow-up: File a separate fix for the editable fixed-amount flow: reject a malformed current destination at submit and add a regression test that replaces a valid address with an invalid one.
commented
Nov 22, 2026
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…ker file, and no finality fallback guessed from a row's age - When the Max marker file cannot be read, the wallet screen drops the count and the "nothing is lost" line, shows the read error, labels any rows as last known, and offers a section-level Try again that re-reads the file and reconciles the wallet. - Shield progress no longer derives the ChainLock fallback from how old the lock's row is: a Broadcast row waits on a lane-neutral step 3 (step 2 only in the first seconds of a live attempt), a failed attempt does not use the clock, and step 4 is reached only when the row reports a ChainLock. A recorded proof of either kind completes step 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head stops counting markers when the file is unreadable and stops inferring a ChainLock fallback from the age of a Broadcast row. A readable marker can still be mislabeled as an unfinished transfer, and the review found two smaller gaps in rebuild admission and resume progress. Kotlin SDK build and tests passed; PR Hygiene and review are pending, and the funded iOS restart scenario remains unrun.
A pattern across this PR's review rounds
This is review round 9, and the PR has drawn 24 blocking findings so far. 16 of them share 3 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. No wallet-owned recovery decision for Max (1 new in this round, 7 earlier finding(s))
begin_wallet_drain decides what blocks a new sweep from live and persisted wallet state, but shieldedWalletDrainStatus requires a known UUID, and the outpoint it returns may name a checkpoint that exact-outpoint resume cannot load. Swift fills that gap with WalletDrainOperationStore and PersistentAssetLock: a missing marker can hide a blocker, while a readable marker can be counted as a blocker before Rust answers or after Rust says the transfer is done. The latest patch removes the count when the file is unreadable, but readability still says nothing about wallet state, and even Rust's DrainCompleted can reflect an unverified already-consumed reply.
Already tracked: #5580
In this round: Distinguish saved transfer IDs from transfers Rust reports as unfinished
2. Manager admission does not make finality waits stoppable (6 earlier finding(s))
withAdmittedNativeOperation makes shutdown() wait for shieldedResumeFundFromAssetLock, but the native wait_for_chain_lock has neither a deadline on this path nor a shutdown signal. The app has to keep SPV alive by making every funding entry point and controller dismissal respect the rebuild guard, so a missed route or a removed controller can bring back the same wait.
Already tracked: #6003
3. Stored lock rows stand in for progress events (1 new in this round, 6 earlier finding(s))
ShieldedFundFromAssetLockProgressSection turns controller phase, PersistentAssetLock status, and row age into steps for the current attempt. Matching the exact lock and removing the inferred InstantSend timeout fix two guesses, but the row records what the lock has reached, not what this attempt is doing: a resumed Built lock already has a signed transaction even when the screen says it is building one.
Already tracked: #5539
In this round: Show what the resumed asset lock has recorded
Suggested decision (land the prerequisite first): Land a wallet-owned Max recovery API in rs-platform-wallet, exposed through Swift, before enabling Max in the example app. It must identify the drain blocking a new sweep without an app marker, distinguish unknown status from a resumable lock and verified completion, and resume only the original checkpoint. Shutdown must be able to end a finality wait with that checkpoint still pending. The discussion defers checkpoint recovery and cancellation while the PR still enables Max off mainnet; if the prerequisite does not land first, drop Max from this PR rather than adding another Swift fallback. At this head, the Kotlin emulator check passed; the PastaClaw review and PR Hygiene checks are pending.
🔴 2 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (1)
- 🔴 Blocking: Let SDK shutdown interrupt a parked exact-outpoint finality wait —
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:331-334(thread)
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: Honor the rebuild reservation at address-funding and registration entry points
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-696
The new pre-stop check protects address funding and identity registration if their workers start first, but those entry points do not honor isRebuildingSdk. While stopSpv() or the SDK build is suspended, FundFromAssetLockPlatformAddressView.submit() and the Core-funded registration paths, including CreateIdentityView.submitResumed(), can still schedule work on the outgoing manager. The rebuild does not recheck before replacing it, so that work can lose the SPV client it needs for finality. Apply the reservation before those paths schedule a worker, and test a submission while the stop step is suspended. This is a gap in the app guard, not a claim that these wrappers join the newly admitted shield resume's shutdown drain.
source: gpt-6.2-astra (phase2-reviewer: general)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: 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) — ShieldedFundFromAssetLockView.swift and WalletDrainCoordinator.swift introduce an intricate funds-movement flow that initiates a whole-account sweep and governs which asset lock and recipient are used when resuming after a restart. - 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)
- Code unchanged since the last final review (
d7f259cd): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— 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): No wallet-owned recovery decision for Max; Manager admission does not make finality waits stoppable; Stored lock rows stand in for progress events. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a wallet-owned Max recovery API in `rs-platform-wallet`, exposed through Swift, before enabling Max in the example app. It must identify the drain blocking a new sweep without an app marker, distinguish unknown status from a resumable lock and verified completion, and resume only the original checkpoint. Shutdown must be able to end a finality wait with that checkpoint still pending. The discussion defers checkpoint recovery and cancellation while the PR still enables Max off mainnet; if the prerequisite does not land first, drop Max from this PR rather than adding another Swift fallback. At this head, the Kotlin emulator check passed; the PastaClaw review and PR Hygiene checks are pending. 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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UnfinishedWalletDrainsList.swift:372-377: Distinguish saved transfer IDs from transfers Rust reports as unfinished
This branch counts readable JSON markers as unfinished transfers and says a new Max cannot start until they finish. The app lists markers before checking native status, and `reconcile` keeps them when a status read fails. It also keeps a marker when Rust reports `completed` or `notSent` but the removal write fails. In that case the row says “Could not clear the finished marker” while the heading says the transfer is unfinished and blocks a new Max. Rust's `begin_wallet_drain` checks live and persisted locks, excludes `DrainCompleted`, and never reads the app marker. Count these as saved records, not unfinished transfers, and remove the unconditional safety assurance. Keep the status retry and cover a readable marker retained after a terminal response.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:233-243: Show what the resumed asset lock has recorded
In SH-19's kill-after-checkpoint case, Resume finds its existing `Built` row, maps it to step 1, and displays “Building a Core asset-lock transaction from wallet funds.” Rust already has the signed transaction and can redispatch it; this path cannot build a new lock. A stored InstantSend proof likewise is not evidence that the worker skipped ChainLock: `submit_with_chain_lock_fallback` can wait for a replacement proof while the stored row still says `InstantSendLocked`. For the new Resume flow, describe the durable facts (“Asset lock built,” “Resuming existing lock,” “InstantSend proof recorded”) rather than deriving the worker's live stage from them. If exact live stages are needed, report them from the Rust worker.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:331-334: Let SDK shutdown interrupt a parked exact-outpoint finality wait
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4658634534)
| case 2, 3, 5: | ||
| // InstantSend-locked (2), ChainLock-locked (3) or | ||
| // RecoveredFromChain (5): the lock is final on Core and | ||
| // only the shield remains. | ||
| return 5 | ||
| case 6: | ||
| // DrainCompleted: Rust recorded the shield as done. | ||
| return 6 | ||
| default: | ||
| // Built (0) and any other status. | ||
| return 1 |
There was a problem hiding this comment.
🟡 Suggestion: Show what the resumed asset lock has recorded
In SH-19's kill-after-checkpoint case, Resume finds its existing Built row, maps it to step 1, and displays “Building a Core asset-lock transaction from wallet funds.” Rust already has the signed transaction and can redispatch it; this path cannot build a new lock. A stored InstantSend proof likewise is not evidence that the worker skipped ChainLock: submit_with_chain_lock_fallback can wait for a replacement proof while the stored row still says InstantSendLocked. For the new Resume flow, describe the durable facts (“Asset lock built,” “Resuming existing lock,” “InstantSend proof recorded”) rather than deriving the worker's live stage from them. If exact live stages are needed, report them from the Rust worker.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)
There was a problem hiding this comment.
Partly done in 17d42b1. A resume (Max Resume or a generic resume: operation) now shows step 1 as "Asset lock built" and puts a Built row on step 2 with a footer saying the existing asset lock is sent again and no new one is built; fresh attempts are unchanged. Tests cover a resumed and a fresh Built row. I left the InstantSend/ChainLock lane display as it is: showing which lane the worker is in right now needs the Rust worker to report its live stage, which is beyond this app change.
There was a problem hiding this comment.
Still applies (re-reviewed at 17d42b12): Your Built title now correctly says the lock exists. Rust's locally-final Built test shows why the footer should not promise another send, and you can describe the recorded InstantSend proof without new telemetry because only an assertion about the worker's live step requires it.
There was a problem hiding this comment.
Done in 61633ec. A resumed Built lock now reads "Resuming the existing asset lock" with the footer "The asset lock already exists; no new one is built.", with no promise of a re-send. The finality step is titled by the proof the row records ("InstantSend proof recorded" / "ChainLock proof recorded"), and a recorded InstantSend proof shows the ChainLock step in a neutral "only if needed" state instead of skipped. Step tests updated.
There was a problem hiding this comment.
Still applies (re-reviewed at 61633ecb): Your update fixes the Built footer and the two proof indicators. The remaining live claim is now in step 5: after Rust rejects the first proof, the row still selects the ~30-second proving footer while the worker waits for the replacement ChainLock.
There was a problem hiding this comment.
Fixed in b3cc8bc. Step 5 is now titled "Shielding" and its footer states recorded facts: the lock has a proof, the wallet is proving the shield (about 30 s) and submitting it, which can include waiting for a ChainLock if Platform asks for one. A test checks the title and footer for a fresh run and a resume.
… last reported, and do not show a resumed lock as being built - The wallet-screen section is "Saved Max transfers": each row says what Rust last reported (unfinished, checking, status unreadable, or finished with the saved record not cleared), and only a pending report says a new Max cannot start. Resume is offered only for a pending report that named an outpoint. - A resume (Max or generic) shows step 1 as "Asset lock built" and puts a Built lock on step 2, re-sending the existing transaction, instead of claiming a new lock is being built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head counts saved records rather than unfinished transfers, but a failed marker cleanup still makes a transfer Rust reports as not sent look finished. Overlapping status reads can restore a stale Resume action, and address funding and identity registration can still start after a rebuild reserves the outgoing manager. The Swift frozen-schema check passed, Swift and Kotlin build/test checks are pending, and funded process-death recovery has not been demonstrated.
A pattern across this PR's review rounds
This is review round 10, and the PR has drawn 25 blocking findings so far. 17 of them share 3 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. Max recovery has no wallet-owned answer (2 new in this round, 8 earlier finding(s))
begin_wallet_drain knows what blocks a new sweep, but shieldedWalletDrainStatus needs a known UUID and can return an outpoint that shieldedResumeFundFromAssetLock cannot load. Swift uses WalletDrainOperationStore, PersistentAssetLock rows, and separate status reads to fill that gap: a missing marker can hide a blocker, and a saved marker says nothing about whether funds moved. The latest patch stops counting markers as unfinished, but WalletDrainCoordinator now renders notSent and completed alike when cleanup fails and can let an older read replace a newer report; separately, Rust's DrainCompleted can still come from an unverified already-consumed reply.
Already tracked: #5580
In this round: Keep “Not sent” distinct from “Completed” when marker cleanup fails; Order status reads for the same saved operation
2. Shutdown can join a wait it cannot stop (6 earlier finding(s))
withAdmittedNativeOperation makes shutdown() wait for exact-outpoint resume, but that path calls wait_for_chain_lock without a deadline or a shutdown signal. The app protects its rebuild by keeping SPV running and using hasInFlightFundings to find active workers, so every funding route and controller dismissal had to preserve that guard; the guard still cannot end the native wait.
Already tracked: #6003
3. Stored lock state is not live progress (7 earlier finding(s))
ShieldedFundFromAssetLockProgressSection maps controller phase and PersistentAssetLock state to live steps. Matching the exact lock and removing the timeout guess fix individual cases, but a row records what the lock has reached, not what this attempt is doing: a resumed Built lock is already signed, and a recorded InstantSend proof does not say whether the worker is now waiting for a ChainLock.
Already tracked: #5539
Suggested decision (land the prerequisite first): Land a wallet-owned Max recovery API in rs-platform-wallet, exposed through Swift, before enabling Max in the example app. It must find the drain blocking a new sweep without an app marker, distinguish an unresolved outcome from a resumable checkpoint and verified completion, and resume only the original checkpoint; shutdown must be able to end the finality wait with that checkpoint still pending. The discussion still defers checkpoint recovery and cancellation, and this head still enables new Max off mainnet. If the prerequisite does not land first, drop Max from this PR rather than adding another Swift fallback. The Swift SDK and Kotlin emulator checks, PastaClaw review, and PR Hygiene are pending.
🔴 1 blocking | 🟡 2 suggestion(s)
Still open from earlier rounds (1)
- 🟡 Suggestion: Show what the resumed asset lock has recorded —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:427-434(thread)
Disputed — left to maintainers (1)
- 🔴 Blocking: Let SDK shutdown interrupt a parked exact-outpoint finality wait —
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift:325-328(thread)
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: Honor the rebuild reservation at address funding and registration starts
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-696
The new pre-stop check includes address funding and identity registration, but their submit paths do not check isRebuildingSdk. After the check passes and stopSpv() suspends, another window can run FundFromAssetLockPlatformAddressView.submit() or start a Core-funded registration from CreateIdentityView against the outgoing manager. The rebuild does not recheck before activation, so a worker can start just as it loses its source of Core finality. Apply the same app-level reservation at those start boundaries and cover submission while the stop step is suspended.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 5: 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) — WalletDrainCoordinator.swift adds an intricate funds-movement workflow that starts a whole-account sweep, persists its operation ID, and reconciles or resumes the transfer against the exact asset-lock outpoint after restart. - 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)
- Code unchanged since the last final review (
993ae1c2): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— 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): Max recovery has no wallet-owned answer; Shutdown can join a wait it cannot stop; Stored lock state is not live progress. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a wallet-owned Max recovery API in `rs-platform-wallet`, exposed through Swift, before enabling Max in the example app. It must find the drain blocking a new sweep without an app marker, distinguish an unresolved outcome from a resumable checkpoint and verified completion, and resume only the original checkpoint; shutdown must be able to end the finality wait with that checkpoint still pending. The discussion still defers checkpoint recovery and cancellation, and this head still enables new Max off mainnet. If the prerequisite does not land first, drop Max from this PR rather than adding another Swift fallback. The Swift SDK and Kotlin emulator checks, PastaClaw review, and PR Hygiene are pending. 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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:236-242: Keep “Not sent” distinct from “Completed” when marker cleanup fails
If the app exits after saving the UUID but before Rust checkpoints the lock, Rust can report `notSent` on relaunch. If the marker is readable but cannot be removed, `rowStatus` renders the same “Finished; the saved record could not be cleared” message as a completed shield. The user cannot tell whether their funds moved. Keep Check again, but report “Not sent; the saved record could not be cleared” for `.notSent`. Split the test that currently requires identical text for the two outcomes.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/WalletDrainCoordinator.swift:354-362: Order status reads for the same saved operation
Launch, wallet-detail, and post-attempt reconciliation can all suspend in `readStatus` for the same UUID. If an older pending result is delivered after a newer completed result whose marker removal failed, this assignment replaces the completed report and cleanup error with the old outpoint. The row offers Resume instead of Check again. Exact-outpoint recovery still prevents a fresh sweep, but the displayed state and action are wrong. Serialize reads per UUID without dropping the post-attempt refresh, and use the injected status reader to cover the stale-result ordering. The attempt counters only protect the `notSent` removal decision.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:427-434: Show what the resumed asset lock has recorded
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4659016413)
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Contain worker panics at the native exact-outpoint resume export — The unchanged
platform_wallet_manager_shielded_resume_fund_from_asset_lockexport callsblock_on_workerwithout a panic guard. A Tokio worker panic is propagated by the join'sexpect, aborting the host at theextern "C"boundary instead of returning a recoverable error.- Follow-up: Use the existing native funding panic guard in a separate FFI PR and verify that an ambiguous result preserves the tracked checkpoint.
| case 2, 3, 5: | ||
| // InstantSend-locked (2), ChainLock-locked (3) or | ||
| // RecoveredFromChain (5): the lock is final on Core and | ||
| // only the shield remains. | ||
| return 5 | ||
| case 6: | ||
| // DrainCompleted: Rust recorded the shield as done. | ||
| return 6 | ||
| default: | ||
| // Built (0) and any other status. | ||
| return 1 |
There was a problem hiding this comment.
Still applies (re-reviewed at 17d42b12): Your Built title now correctly says the lock exists. Rust's locally-final Built test shows why the footer should not promise another send, and you can describe the recorded InstantSend proof without new telemetry because only an assertion about the worker's live step requires it.
…status reads, and state recorded proof facts - A Max whose marker could not be cleared after Rust reported notSent now says "Not sent", not "Finished". - Status reads for the same saved operation apply in start order: an older read that finishes late no longer overwrites a newer report. - Shield progress states what is recorded: a resumed Built lock is "Resuming the existing asset lock" with no promise of a re-send, the finality step is titled by the proof the row records, and a recorded InstantSend proof no longer marks the ChainLock step skipped. - Platform address funding and Core-funded identity registration refuse to start while an SDK rebuild runs, like the shield paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head distinguishes “Not sent” from “Finished” and prevents an older status read from overwriting a newer result. The shared rebuild guard still misses active Core funding workers and lets a shielded identity registration start on the outgoing manager. Kotlin CI passed; the Swift build and tests, frozen-schema check, PR Hygiene, and review check were pending, and the funded iOS restart scenario remains unverified.
A pattern across this PR's review rounds
This is review round 11, and the PR has drawn 27 blocking findings so far. 20 of them share 3 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. Max recovery has no wallet-owned answer (10 earlier finding(s))
begin_wallet_drain knows what blocks a new sweep, but shieldedWalletDrainStatus requires a known UUID and can return an outpoint that shieldedResumeFundFromAssetLock cannot load. Swift reconstructs recovery from WalletDrainOperationStore, PersistentAssetLock rows, and separate status reads, so a missing marker can hide a blocker and a saved marker cannot tell the app whether funds moved. The latest patch separates notSent from completed and orders the reads, but Rust can still record DrainCompleted from an unverified already-consumed reply.
Already tracked: #5580
2. SDK replacement does not own worker admission (2 new in this round, 7 earlier finding(s))
OptionsView decides whether it can stop SPV by scanning coordinator rows, while individual submit paths decide whether to honor AppState.isRebuildingSdk. A stale address top-up sheet can hide a live worker, direct funding calls bypass the scan, and shielded identity registration is counted by the scan but can still start after the rebuild reserves the outgoing manager. withAdmittedNativeOperation makes shutdown() wait for exact-outpoint resume, but it cannot interrupt wait_for_chain_lock, so patching individual screens still leaves teardown dependent on every caller keeping SPV available.
Already tracked: #6003
In this round: Track Core funding workers independently of progress rows; Block shielded identity registration during an SDK rebuild
3. Stored lock state is not live progress (1 new in this round, 7 earlier finding(s))
ShieldedFundFromAssetLockProgressSection turns the controller phase and a PersistentAssetLock row into live steps, but finding the right row only establishes what that lock has recorded. A Built row does not say whether Resume will rebroadcast or find finality already available, just as a recorded InstantSend proof does not say whether the worker is now waiting for a ChainLock; SH-19 still expects a rebroadcast the UI no longer promises.
Already tracked: #5539
In this round: Allow SH-19 to pass when a Built lock needs no rebroadcast
Suggested decision (land the prerequisite first): Land a wallet-owned Max recovery API in rs-platform-wallet, exposed through Swift, before enabling Max in the example app. It must find the drain blocking a new sweep without an app marker, distinguish an unresolved outcome from a resumable checkpoint and verified completion, and resume only the original checkpoint. The SDK manager must own admission against replacement and be able to end a finality wait at shutdown with the checkpoint still pending. The discussion still defers checkpoint recovery and cancellation, and this head still enables new Max off mainnet; if the prerequisite does not land first, drop Max from this PR. The Kotlin emulator check passed; Swift SDK build and tests, PastaClaw review, and PR Hygiene are pending.
🔴 2 blocking | 🟡 2 suggestion(s)
Still open from earlier rounds (1)
- 🟡 Suggestion: Show what the resumed asset lock has recorded —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:280-284(thread)
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: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: 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) — The new WalletDrainCoordinator and ShieldedFundFromAssetLockView implement an intricate live funds-movement flow that selects the source account and recipient for a full-balance sweep and coordinates recovery of the exact asset lock after restart. - 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)
- Code unchanged since the last final review (
17d42b12): 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— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (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): Max recovery has no wallet-owned answer; SDK replacement does not own worker admission; Stored lock state is not live progress. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land a wallet-owned Max recovery API in `rs-platform-wallet`, exposed through Swift, before enabling Max in the example app. It must find the drain blocking a new sweep without an app marker, distinguish an unresolved outcome from a resumable checkpoint and verified completion, and resume only the original checkpoint. The SDK manager must own admission against replacement and be able to end a finality wait at shutdown with the checkpoint still pending. The discussion still defers checkpoint recovery and cancellation, and this head still enables new Max off mainnet; if the prerequisite does not land first, drop Max from this PR. The Kotlin emulator check passed; Swift SDK build and tests, PastaClaw review, and PR Hygiene are pending. 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 `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/OptionsView.swift:692-697: Track Core funding workers independently of progress rows
This rebuild check can report no funding while a worker still needs SPV. Leave a failed Platform address top-up sheet open in one window, dismiss its row from Wallet Detail, then start a replacement for the same unused address. Dismiss on the old sheet removes the replacement by slot key in `AddressFundFromAssetLockCoordinator.dismiss`, but does not cancel its worker. Direct calls bypass the check altogether: `SendViewModel` starts a fixed-amount Core shield without a coordinator, and `TransitionDetailView` and `ReclaimInvitationSheet` call the wallet’s Core-funded identity methods directly. Both address and identity top-ups can wait for a ChainLock without a deadline. A same-network rebuild that misses the worker stops SPV and replaces the manager that worker is waiting on. Hold a manager-scoped reservation from before dispatch until the worker returns, and reject new Core funding once a rebuild is reserved. Test both stale dismissal during a replacement top-up and rebuilding during a direct Core funding.
_Raised on code unchanged since the last review, and confirmed by an independent pass: On a funded wallet, dismiss a failed Platform address top-up from Wallet Detail, start a replacement for the same unused address, then dismiss the original sheet in the other window. If the replacement is waiting for a ChainLock, the stale dismissal hides it from the rebuild check, so an Options rebuild can stop the SPV client it needs and strand the top-up._
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift:1447-1453: Block shielded identity registration during an SDK rebuild
The rebuild checks `hasInFlightRegistrations`, which includes shielded registrations, but the reverse check runs only in the fresh and resumed Core branches. While a same-network rebuild is suspended in `stopSpv`, another window can enter `submitShieldedFunded` and start `shieldedIdentityCreateFromPool` on the outgoing manager. That detached call is not counted by manager admission, so replacement does not wait for it. If it returns `.unconfirmed`, only the old coordinator holds the live slot reservation; `markIdentitySlotUsed` is best-effort, so the replacement can offer the same index before sync finds the identity. Check the rebuild reservation at common registration submission, before persisting keys or scheduling work, and test a shielded submission while the rebuild is held in its stop step.
In `packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md:281: Allow SH-19 to pass when a Built lock needs no rebroadcast
SH-19 still requires Resume to rebroadcast a durably Built transaction. Rust’s `a_locally_final_built_row_completes_without_touching_the_transport` explicitly expects zero broadcast attempts when finality is already available, and launch-time `catchUpStuckAssetLocks` can advance the row before the user taps Resume. Require the original outpoint, no second lock, and successful recovery. If a broadcast occurs, require the original txid; if catch-up has already advanced the row, do not require the Built-stage UI after tapping Resume.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/ShieldedFundFromAssetLockProgressView.swift:280-284: Show what the resumed asset lock has recorded
(carried; thread: https://github.com/dashpay/platform/pull/6050#discussion_r4659016413)
| fundingInFlight: { | ||
| walletManager.shieldedFundFromAssetLockCoordinator.hasInFlightFundings | ||
| || walletManager.addressFundFromAssetLockCoordinator.hasInFlightFundings | ||
| || walletManager.registrationCoordinator.hasInFlightRegistrations | ||
| }, | ||
| stopSpv: { await stopSpvForReconfiguration(failurePrefix: failurePrefix) }, |
There was a problem hiding this comment.
⏸️ Needs a tracking issue (not yet deferred) at
61633ecb; see the replies below.
🔴 Blocking: Track Core funding workers independently of progress rows
This rebuild check can report no funding while a worker still needs SPV. Leave a failed Platform address top-up sheet open in one window, dismiss its row from Wallet Detail, then start a replacement for the same unused address. Dismiss on the old sheet removes the replacement by slot key in AddressFundFromAssetLockCoordinator.dismiss, but does not cancel its worker. Direct calls bypass the check altogether: SendViewModel starts a fixed-amount Core shield without a coordinator, and TransitionDetailView and ReclaimInvitationSheet call the wallet’s Core-funded identity methods directly. Both address and identity top-ups can wait for a ChainLock without a deadline. A same-network rebuild that misses the worker stops SPV and replaces the manager that worker is waiting on. Hold a manager-scoped reservation from before dispatch until the worker returns, and reject new Core funding once a rebuild is reserved. Test both stale dismissal during a replacement top-up and rebuilding during a direct Core funding.
Raised on code unchanged since the last review, and confirmed by an independent pass: On a funded wallet, dismiss a failed Platform address top-up from Wallet Detail, start a replacement for the same unused address, then dismiss the original sheet in the other window. If the replacement is waiting for a ChainLock, the stale dismissal hides it from the rebuild check, so an Options rebuild can stop the SPV client it needs and strand the top-up.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)
There was a problem hiding this comment.
Declining for this PR. The paths you list (the address top-up coordinator's stale dismissal, SendViewModel's fixed-amount shield, and the direct Core-funded identity calls in TransitionDetailView and ReclaimInvitationSheet) are flows this PR does not change, and none of them holds the manager's admission, so none can make shutdown() wait. Before this PR the SDK rebuild had no funding check at all; this PR adds one for the work it made shutdown-blocking (Max and exact-outpoint resume) and extends it, best-effort, to the shield, address and registration coordinators and their submit paths. A manager-scoped reservation held by every Core funding from dispatch to return, including the direct calls, is a reasonable hardening of the rebuild path, but it is a change to those other flows and belongs in its own PR.
There was a problem hiding this comment.
I checked the base and agree I scoped this blocker too broadly. A same-network rebuild could already stop SPV under those legacy calls, and none of the cited calls holds the native admission that shutdown() waits for. Max and exact-outpoint shield resume are covered by the shield coordinator, whose dismissal guard keeps in-flight controllers visible. I’m fine with moving the broader worker reservation to a follow-up; could you link a tracking issue in dashpay/platform, or let me know and I’ll file one?
Not deferred yet: a deferral needs a tracking issue for the follow-up; until then the finding stands.
There was a problem hiding this comment.
Tracking issue filed: #6083 (one app-level funding reservation held from dispatch to return, covering the address top-up's stale dismissal, SendViewModel's shield and the direct Core-funded identity calls).
| // A rebuild counts this registration before it stops SPV, so it | ||
| // must not start once the rebuild has reserved its slot: it would | ||
| // wait for a ChainLock that never comes. | ||
| if let refusal = AppState.coreFundingRefusal(isRebuildingSdk: platformState.isRebuildingSdk) { | ||
| submitError = .init(message: refusal) | ||
| return | ||
| } |
There was a problem hiding this comment.
🔴 Blocking: Block shielded identity registration during an SDK rebuild
The rebuild checks hasInFlightRegistrations, which includes shielded registrations, but the reverse check runs only in the fresh and resumed Core branches. While a same-network rebuild is suspended in stopSpv, another window can enter submitShieldedFunded and start shieldedIdentityCreateFromPool on the outgoing manager. That detached call is not counted by manager admission, so replacement does not wait for it. If it returns .unconfirmed, only the old coordinator holds the live slot reservation; markIdentitySlotUsed is best-effort, so the replacement can offer the same index before sync finds the identity. Check the rebuild reservation at common registration submission, before persisting keys or scheduling work, and test a shielded submission while the rebuild is held in its stop step.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)
There was a problem hiding this comment.
Fixed in b3cc8bc. The rebuild refusal is now the first thing CreateIdentityView.submit() does, before keys are persisted or anything is scheduled, so every funding source (Platform addresses, Core, resumed lock and shielded pool) refuses while isRebuildingSdk is set; the per-branch checks are gone. The shared function is renamed fundingRefusal(isRebuildingSdk:) and its test updated.
| | SH-16 | Shielded withdraw from A to B's Core L1 address | Shielded | Uncommon | ✅ | multiwallet, withdrawal | Wallet A's pool → a Core L1 address owned by wallet B (`SH-08`). Completes the cross-wallet shielded exit set (→ shielded `SH-14`, → Platform `SH-15`, → Core `SH-16`). Both wallets are engine-bound automatically at rebind (no wallet-swap needed). Verify B's Core balance rises after SPV sync. | | ||
| | SH-17 | Multiple wallets bound to the shielded pool concurrently | Shielded | Uncommon | ✅ | multiwallet | `platform_wallet_manager_bind_shielded` is per `wallet_id`; the manager syncs all bound wallets. UI (`ShieldedService.boundWalletId`) displays one wallet's shielded state at a time — switching should swap cleanly, not merge balances. | | ||
| | SH-18 | Shield the whole Core balance (Max) | Cross | Common | ✅ | | Max is unavailable on mainnet until #5580 is fixed: there the **Max** toggle is disabled and off, its footer says why and names #5580, and a submit sends nothing; existing unfinished Max transfers still list and resume there (`SH-19`). `ShieldedFundFromAssetLockView` (from `WalletDetailView`, source **Core Balance**) → turn on **Max (everything at this account index)** (`shieldFromCore.maxToggle`). The amount field is replaced by the estimate from `shieldedWalletDrainPreview` (`platform_wallet_manager_shielded_wallet_drain_preview`) for the selected account index: swept amount and input count, Core network fee, shielded pool fee and amount received (`shieldFromCore.maxPreview.*`); changing the account index clears the estimate and disables submit until the new one loads. The recipient is the wallet's own shielded address, read-only (`shieldFromCore.fixedRecipient`), with no override field. **Shield Max** (`shieldFromCore.submitButton`) → `shieldedFundFromWalletDrain` (`platform_wallet_manager_shielded_fund_from_wallet_drain`), with the same five-step progress as `SH-07`. Verify: no change output on the asset-lock transaction; the note pays the wallet's own shielded address; standard funds at other account indices, coins that are not final, locked coins and CoinJoin stay in Core; the shielded note arrives on the next sync; the wallet screen lists the transfer under **Saved Max transfers** (status "In progress.") while it runs and drops it when it completes. Preview status: an empty or dust wallet shows "does not cover the fees" and no submit button; a wallet over the asset-lock input limit shows a warning and can still try; if Rust refuses the attempt, it does so with a typed error and nothing is sent. | | ||
| | SH-19 | Max transfer survives a restart | Cross | Thorough | ✅ | restart | Start `SH-18`, wait for progress step 2 (**Broadcasting**) or later, such as step 3 (**Waiting for InstantSend or ChainLock proof**), so the asset lock is broadcast, then kill the app (`simctl terminate`) before step 5 finishes. Relaunch: at launch the app reads `shieldedWalletDrainStatus` for the operation id it stored before the call, and `WalletDetailView` lists every saved record under **Saved Max transfers (N)** (`walletDetail.unfinishedMaxTransfers`; no count while the marker file cannot be read), each with its asset-lock outpoint and a status line (`walletDetail.unfinishedMaxTransfer.status`, or `walletDetail.unfinishedMaxTransfer.checkingStatus` for **Checking status…** before the first read). The section makes no claim for all rows; only a row Rust reported `pending` says **Unfinished: resume to finish it. A new Max cannot start until it does.** A failed read shows **Status could not be read: …**; a transfer Rust reported finished whose saved record could not be removed shows **Finished; the saved record could not be cleared: …**, and one Rust reported not sent shows **Not sent; the saved record could not be cleared: …** instead. **Resume** (`walletDetail.unfinishedMaxTransfer.resumeButton`) is offered only when the status read reported `pending` and named an outpoint, and calls `shieldedResumeFundFromAssetLock` with that exact outpoint and the stored recipient (never `shieldedFundFromWalletDrain`); every other row offers only **Check again** (`walletDetail.unfinishedMaxTransfer.checkAgainButton`), which re-reads the status (and retries removing a finished record) and sends nothing. Verify: the outpoint shown after the restart equals the one broadcast before it; a resumed lock that is still Broadcast waits on step 3 (**Waiting for InstantSend or ChainLock proof**), after at most a 2 s **Broadcasting** step, and never shows a ChainLock fallback inferred from the lock's age, and step 4 (**ChainLock proof**) is marked only once the lock reports a ChainLock; a lock that reports InstantSend titles step 3 **InstantSend proof recorded** and shows step 4 with a grey dash ("ChainLock proof only if needed"), neither a check nor skipped; no second asset-lock transaction is built (one `PersistentAssetLock` row with that `operationId`, ending at `statusRaw == 6`); the note arrives; the row disappears; the lock is not also offered in **Pending Platform Top Ups**. Also kill during step 1, which covers two states; read the SwiftData `PersistentAssetLock` rows to know which one you hit. Killed before the lock's row is stored (no `PersistentAssetLock` row with the operation id yet): after relaunch nothing is listed and the Core balance is untouched. Killed after the row is stored as Built (`statusRaw == 0`): after relaunch the transfer is listed with its outpoint, **Resume** rebroadcasts the same transaction (same txid, no second row), and it completes; its progress shows step 1 as **Asset lock built** (done) and step 2 (**Resuming the existing asset lock**) as current, with the footer **The asset lock already exists; no new one is built.**, never **Building asset-lock transaction**. The same holds for a Built lock resumed from **Pending Platform Top Ups**. | |
There was a problem hiding this comment.
🟡 Suggestion: Allow SH-19 to pass when a Built lock needs no rebroadcast
SH-19 still requires Resume to rebroadcast a durably Built transaction. Rust’s a_locally_final_built_row_completes_without_touching_the_transport explicitly expects zero broadcast attempts when finality is already available, and launch-time catchUpStuckAssetLocks can advance the row before the user taps Resume. Require the original outpoint, no second lock, and successful recovery. If a broadcast occurs, require the original txid; if catch-up has already advanced the row, do not require the Built-stage UI after tapping Resume.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)
There was a problem hiding this comment.
Fixed in b3cc8bc. SH-19's Built case now requires the original outpoint to be listed and resumed, one PersistentAssetLock row, no transaction with a different txid, and recovery to complete. A broadcast is not required; if one happens it carries the original txid. The Built-stage progress view is required only if the row is still Built when Resume is tapped.
| case 2, 3, 5: | ||
| // InstantSend-locked (2), ChainLock-locked (3) or | ||
| // RecoveredFromChain (5): the lock is final on Core and | ||
| // only the shield remains. | ||
| return 5 | ||
| case 6: | ||
| // DrainCompleted: Rust recorded the shield as done. | ||
| return 6 | ||
| default: | ||
| // Built (0) and any other status. | ||
| return 1 |
There was a problem hiding this comment.
Still applies (re-reviewed at 61633ecb): Your update fixes the Built footer and the two proof indicators. The remaining live claim is now in step 5: after Rust rejects the first proof, the row still selects the ~30-second proving footer while the worker waits for the replacement ChainLock.
…SDK rebuild, and word the shield step as recorded facts - Identity registration checks the rebuild reservation once, at the top of submit, before keys are saved or work is scheduled, so the shielded pool and Platform address sources refuse too. The refusal function is renamed fundingRefusal(isRebuildingSdk:). - Step 5 is "Shielding" and its footer no longer claims live proving: it can include waiting for a ChainLock if Platform asks for one. - SH-19 accepts a Built lock that finishes without a rebroadcast, and requires the original outpoint and txid instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
…e-shielded-wallet-drain # Conflicts: # packages/kotlin-sdk/PARITY_SUMMARY.md
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
Basic explanation
What this does: The example iOS app can now move everything held at one Core (L1) account index into the wallet's own shielded balance in one step, called "Max". Before it runs, the screen shows the wallet's estimate of what will be swept, the fees, and what arrives in the shielded balance. If the app is killed mid-transfer, the next launch finds the unfinished transfer and offers to finish that same asset lock instead of losing track of it.
Value: The Swift SDK already supported this (preview, execute, status by a durable operation id), but no app screen used it, so it could not be tested by hand or shown to integrators. It also gives the Kotlin port a reference screen with fixed accessibility ids.
Risks: Low. No Rust or FFI changes and no consensus effect. One SDK wrapper,
shieldedResumeFundFromAssetLock, now waits inside the manager's operation admission (see Public interface changes). Otherwise the change is app-only, and the existing fixed-amount shield path is unchanged unless the new toggle is turned on. Max only pays the wallet's own shielded address, because the drain sweeps whatever is eligible when it runs, which can exceed the estimate, and new Max transfers are not offered on mainnet until a drain's completion is proof-backed (#5580). Resume can only finish an existing asset lock, never build a new one. What could go wrong is in the app itself: a stored operation id that is never cleared would keep a stale row on the wallet screen, and Rust refuses a new Max while one is unfinished, so the user must resume it first. The flow has not yet been run on a funded testnet wallet or through a process kill (see testing).Issue being fixed or feature implemented
docs/sdk/sdk-parity-manifest.jsonlistedshielded.core_wallet_drainas supported in the Swift SDK and unsupported in SwiftExampleApp:shieldedWalletDrainPreview,shieldedFundFromWalletDrainandshieldedWalletDrainStatushad no caller in the app.No open PR or issue covered the app side. Related SDK work: #5528, #5788; issues #5607, #5737, #5478, #5580.
What was done?
ShieldedFundFromAssetLockView, Core Balance source). When it is on, the amount field is replaced by the preview fromshieldedWalletDrainPreviewfor the selected account index, and the button reads "Shield Max". The preview carries the wallet and account index it was read for; submit requires a match and uses the quoted index. Max pays the wallet's own shielded address, read at submit, with no override field, until the SDK can cap the swept amount (Wallet drain: let the host cap the swept balance at what the user confirmed #5607). The drain runs through the existingShieldedFundFromAssetLockCoordinator, so it shares the per-wallet single-flight rule and the five-step progress UI with the fixed-amount shield.WalletDrainOperationStorewrites the operation UUID, wallet, network, account index and recipient to a JSON file (.atomic) before the FFI call, as the SDK contract requires. It is a file rather thanUserDefaultsbecause it must be on disk before the call starts, and rather than a SwiftData model to avoid changing the shared model graph for an app-only marker. A corrupt file throws instead of reading as empty, so an unfinished transfer cannot be hidden.WalletDrainCoordinator.reconcilereadsshieldedWalletDrainStatusfor every stored id at launch, when the wallet screen opens, and after each attempt. A stored id is forgotten when Rust reportscompleted, ornotSentwith no attempt overlapping the read. Apendingresult or a failed read keeps it. Unfinished transfers are listed on the wallet screen under "Unfinished Max Transfers". Resume is offered only when a status read named the asset lock's outpoint, and callsshieldedResumeFundFromAssetLockwith that exact outpoint and the stored recipient, which can never build a new lock; Rust writes the drain's completion receipt when it lands. A row without an outpoint offers only Check again, which re-reads the status. Progress follows the operation's own lock (by drain id or resumed outpoint), not the wallet's newest shielded lock. Deleting a wallet removes its stored ids.operationIdhas a stored marker is not also offered in "Pending Platform Top Ups". A drain lock without a marker stays there, since resuming by exact outpoint is the fallback Rust supports.SdkRebuildOutcome.fundingInFlight; Max and Resume refuse to start while a rebuild runs. Otherwise a rebuild could wait forever for a funding that needs a ChainLock from the SPV client it had just stopped.shieldedResumeFundFromAssetLocknow runs inside the manager's native-operation admission, sodeleteWalletandshutdown()wait for it.shieldedFundFromCoinJoinDrain), because the app shows CoinJoin balances only read-only and has no flow that starts from one; and a Max option in the send flow's Core to Shielded pair.TEST_PLAN.mdrows SH-18 (Max), SH-19 (restart), SH-20 (second Max refused while one is unfinished) and arestarttag. The manifest entry now sayspartialfor the Swift example app, andPARITY_SUMMARY.mdis regenerated.Before / after
Shield from Core screen, Core Balance source:
App killed after the asset lock was broadcast, then relaunched:
The figures above illustrate the layout; they are not from a run.
Public interface changes
No
pubitem in any Rust crate and no FFI symbol changed. InSwiftDashSDKno public signature changed; one public method's runtime behaviour did:PlatformWalletManager.shieldedResumeFundFromAssetLock(walletId:outPointTxid:outPointVout:recipients:surplusOutput:)now runs inside the manager's native-operation admission, as the wallet-drain wrappers already did. While it runs,deleteWallet(walletId:)throws ("an async native operation is in flight") andshutdown()waits for it. During a shutdown it is rejected withPlatformWalletError.invalidHandleinstead of calling into Rust. Existing callers compile unchanged.withWalletDrainNativeOperationis renamedwithAdmittedNativeOperationand moved toPlatformWalletManager.swift.App side: All new types (
WalletDrainOperationStore,WalletDrainOperationRecord,WalletDrainCoordinator, the two views) are internal to the SwiftExampleApp target. New accessibility ids, for the Kotlin app to reuse verbatim:shieldFromCore.maxToggle,shieldFromCore.maxPreview.{swept,l1Fee,poolFee,receive,status,refreshButton},shieldFromCore.fixedRecipient,shieldFromCore.submitButton,walletDetail.unfinishedMaxTransfers,walletDetail.unfinishedMaxTransfer.resumeButton,walletDetail.unfinishedMaxTransfer.checkAgainButton.How Has This Been Tested?
build_ios.sh --target sim --profile dev(framework), then the SwiftExampleApp target built with-warnings-as-errors: BUILD SUCCEEDED.xcodebuild test -only-testing:SwiftExampleAppTests/WalletDrainRecoveryTestsplusPendingPlatformTopUpResumeTestsandWalletBalanceCardStateTestson an iPhone 17 simulator (iOS 27.2): plusWalletDeletionTests,SdkRebuildSequenceTestsandAppStateSdkRebuildTests: all 64 passed. SDK:PlatformWalletShutdownTestsandWalletDrainTests, 21 of 21 passed, including the newtestShouldRefuseDeleteWalletWhileAnAdmittedOperationIsInFlight. The new tests cover the store surviving a reopen, removing only the named record or wallet, a corrupt file and an unwritable directory throwing, the rule for forgetting a stored id (including anotSentread overlapped by an attempt), a completed outcome that carries an error counting as done, the row action (In progress / Resume by outpoint / Check again), the progress lock matching, the progress steps for a failed attempt with no lock, the mainnet rule, the resumable-list decision including Built drain checkpoints, progress for recovered and completed locks, the resume message when a lock was never stored, and the rebuild refusal while a funding is in flight.python3 scripts/check_sdk_parity_manifest.py --write-summary: OK.Not run yet: SH-18, SH-19 and SH-20 on a funded testnet wallet, including the process-death run of SH-19. The new screens have compiled but have not been driven in the simulator. For that reason the manifest keeps the Swift example app at
partial; the host-widerestart: testedrests on the existing SDK tests.Separately, building the test target with
-warnings-as-errorsfails inStateTransitionTests.swift, which this PR does not touch; the tests above ran without that flag.Breaking Changes
None.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
7226e6b/self-reviewedsdk-parity— you own itkotlin-sdk(packages/kotlin-sdk/PARITY_SUMMARY.md) — HashEngineeringswift-sdk(packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManager.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerShieldedFunding.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletManagerWalletDrain.swiftand 24 more) — llbartekll or romchornyiWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.