Skip to content

fix(wallet): handle reported-consumed asset-lock recovery - #963

Merged
llbartekll merged 4 commits into
developfrom
codex/fix-stale-shielded-transfer-recovery
Aug 11, 2026
Merged

fix(wallet): handle reported-consumed asset-lock recovery#963
llbartekll merged 4 commits into
developfrom
codex/fix-stale-shielded-transfer-recovery

Conversation

@llbartekll

@llbartekll llbartekll commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Depends on dashpay/platform#4357.

Summary

  • map the typed assetLockAlreadyConsumed report to submittedUnconfirmed, not verified success
  • refresh ShieldedTxLookup, publish the transaction-projection notification, and schedule shielded sync after recovery
  • stop advertising Pending — tap to finish once Rust has durably retained the lock as Core-final with Platform consumption unknown
  • refresh the projection after the normal fresh asset-lock success path as well
  • show Completion unknown for status 5 and add a unit-level mapping regression test
  • fix the test import order required by sorted_imports

Testing

Summary by CodeRabbit

  • Bug Fixes
    • Resuming a shielded transfer whose asset lock was already consumed now shows it as submitted and awaiting confirmation.
    • Transaction details refresh automatically after transfer recovery, with shielded synchronization scheduled afterward.
    • Recovered transfers now display “Completion unknown” for clearer status information.
    • Other transfer recovery errors continue to be handled normally.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b6c6922-f8e7-4ab3-ba05-bf59db319674

📥 Commits

Reviewing files that changed from the base of the PR and between edf6be1 and c9164c9.

📒 Files selected for processing (2)
  • DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift

📝 Walkthrough

Walkthrough

The asset-lock resume flow maps an already-consumed lock to .submittedUnconfirmed. Resume completion refreshes transaction projections, posts a change notification, and schedules shielded resynchronization. Status-5 documentation and display text now describe unknown completion without the restored label.

Changes

Asset-lock resume and status presentation

Layer / File(s) Summary
Resume state mapping and refresh
DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift, DashWalletTests/PassiveWalletStateUITailTests.swift
The coordinator maps assetLockAlreadyConsumed to .submittedUnconfirmed. Other errors keep the existing failure handling. Resume completion refreshes projections, posts a transaction-change notification, and schedules shielded resynchronization. Tests cover consumed locks and unrelated invalid parameters.
Recovered asset-lock status semantics
DashWallet/Sources/Infrastructure/SwiftDashSDK/PlatformAddressSyncCoordinator.swift, DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift, DashWallet/Sources/UI/Tx/Details/Model/TxDetailModel.swift, DashWallet/en.lproj/Localizable.strings
Status 5 documentation and display text now state that completion is unknown without describing the lock as restored.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the asset-lock recovery fix addressed by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-stale-shielded-transfer-recovery

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@DashWalletTests/PassiveWalletStateUITailTests.swift`:
- Around line 9-11: Reorder the imports at the top of
PassiveWalletStateUITailTests.swift to match the configured sorted_imports
order, keeping the same three imports and no other changes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e4f508b3-cd19-4ded-ace7-164e004e035a

📥 Commits

Reviewing files that changed from the base of the PR and between fb08d72 and cb48ff7.

📒 Files selected for processing (2)
  • DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift
  • DashWalletTests/PassiveWalletStateUITailTests.swift

Comment thread DashWalletTests/PassiveWalletStateUITailTests.swift Outdated
@llbartekll
llbartekll requested a review from romchornyi August 10, 2026 15:50

@romchornyi romchornyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

idempotentAssetLockResumePhase maps any assetLockAlreadyConsumed to success, but that error also comes from the pre-existing local tombstone path (recovery.rs:345, AssetLockStatus::Consumed), where the lock was burned by an identity registration/top-up rather than by this shield — so a transfer that never landed would be reported as complete. Reachability is low and the refresh() + resync you added make the real balance surface shortly after, so either narrowing the mapping to the reconciled case or just softening the code comment works for me — as written it asserts a stronger invariant than the tombstone path guarantees. Two smaller notes: the title check fails because shielded isn't an allowed scope (wallet would do), and ShieldedTxLookup.refresh() + the projection notification were added only to the resume tail while the fresh performAssetLock success path (~line 466) probably wants the same.

@llbartekll
llbartekll force-pushed the codex/fix-stale-shielded-transfer-recovery branch from cb48ff7 to 673f557 Compare August 10, 2026 16:23
@llbartekll llbartekll changed the title fix(shielded): finish consumed asset-lock recovery fix(wallet): handle reported-consumed asset-lock recovery Aug 10, 2026
@llbartekll

Copy link
Copy Markdown
Contributor Author

Addressed the latest review points:

  • assetLockAlreadyConsumed now maps to .submittedUnconfirmed, not .success; the comment explicitly states that the report is unauthenticated and does not prove that this shield completed.
  • the PR title now uses the allowed wallet scope.
  • the normal fresh performAssetLock success path now refreshes ShieldedTxLookup and publishes the transaction-projection notification too (edf6be1).

I also kept the status-5 history wording neutral (Completion unknown) and verified the rebased branch with a successful dashpay simulator build.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@DashWallet/en.lproj/Localizable.strings`:
- Line 3586: Add the "Completion unknown" localization key to all 42 non-English
locale catalogs, matching the existing English entry and each catalog’s
formatting conventions, then synchronize the updated catalogs with Transifex.

In
`@DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift`:
- Around line 545-553: The status comments must reflect the consumed-lock
outcome across all three locations. In
DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift
lines 545-553, document both error sources that produce .submittedUnconfirmed;
in
DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift
lines 710-714, remove the claim that consumed locks surface a real SDK error;
and in DashWallet/Sources/UI/Tx/Details/Model/TxDetailModel.swift lines 503-508,
document unauthenticated consumed reports alongside restore-only status 5.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 60553932-38f8-410b-a612-c70451afaf4f

📥 Commits

Reviewing files that changed from the base of the PR and between cb48ff7 and 673f557.

📒 Files selected for processing (6)
  • DashWallet/Sources/Infrastructure/SwiftDashSDK/PlatformAddressSyncCoordinator.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift
  • DashWallet/Sources/UI/Tx/Details/Model/TxDetailModel.swift
  • DashWallet/en.lproj/Localizable.strings
  • DashWalletTests/PassiveWalletStateUITailTests.swift

Comment thread DashWallet/en.lproj/Localizable.strings
Comment thread DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift Outdated
@llbartekll
llbartekll merged commit 1efe380 into develop Aug 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants