Skip to content

fix(platform-wallet): wait for shield confirmations#3715

Draft
thepastaclaw wants to merge 1 commit into
dashpay:platform-wallet/shielded-spend-ffifrom
thepastaclaw:fix-3603-shielded-reviewbot
Draft

fix(platform-wallet): wait for shield confirmations#3715
thepastaclaw wants to merge 1 commit into
dashpay:platform-wallet/shielded-spend-ffifrom
thepastaclaw:fix-3603-shielded-reviewbot

Conversation

@thepastaclaw
Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw commented May 20, 2026

Issue being fixed or feature implemented

Follow-up for review-bot feedback on #3603.

Shielding from transparent platform credits and asset locks previously returned after broadcast submission, while the other shielded operations waited for the state transition proof result before reporting success. The Swift Example App's global shielded Clear action also needed a stronger confirmation because it removes persisted shielded rows across every wallet on the device.

What was done?

  • Changed shield to use broadcast_and_wait::<StateTransitionProofResult>(sdk, None) while preserving the rich addresses_not_enough_funds diagnostic.
  • Changed shield_from_asset_lock to wait for the proof result before returning success.
  • Renamed the Swift Example App destructive button to Clear Shielded Data.
  • Added a visible confirmation dialog explaining that the action clears persisted shielded notes and sync state for all wallets on the device.

How Has This Been Tested?

  • git diff --check HEAD~1..HEAD
  • cargo check -p platform-wallet
  • Code review gate: ship

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Added confirmation dialog before clearing shielded data to prevent accidental deletion
  • Improvements

    • Shielded transactions now wait for proof confirmation before completion
    • Enhanced error messages for failed shielded operations with additional diagnostic information

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83d13b36-29e1-4786-8e91-60e9ec6b60b5

📥 Commits

Reviewing files that changed from the base of the PR and between 407e0da and 529d53d.

📒 Files selected for processing (2)
  • packages/rs-platform-wallet/src/wallet/shielded/operations.rs
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/CoreContentView.swift

📝 Walkthrough

Walkthrough

This PR enhances safety for shielded operations across two platforms: the Rust backend now waits for state transition proof confirmation after broadcasting shield transactions and provides diagnostic details on funding errors, while the Swift example app adds a confirmation dialog for clearing sensitive shielded data to prevent accidental loss.

Changes

Shielded Broadcast Proof Waiting

Layer / File(s) Summary
Shield operation proof waiting and error diagnostics
packages/rs-platform-wallet/src/wallet/shielded/operations.rs
shield now calls broadcast_and_wait::<StateTransitionProofResult> to wait for proof confirmation instead of returning immediately. Error handling maps addresses_not_enough_funds into detailed diagnostics including required credits, claimed per-input nonces, and platform address info; other errors stringify to ShieldedBroadcastFailed.
ShieldFromAssetLock proof waiting
packages/rs-platform-wallet/src/wallet/shielded/operations.rs
shield_from_asset_lock replaced with broadcast_and_wait::<StateTransitionProofResult> to wait for proof confirmation while keeping existing error mapping.

Shielded Data Clear Confirmation Dialog

Layer / File(s) Summary
Confirmation dialog for shielded data clearing
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/CoreContentView.swift
New @State flag gates clearing behind a confirmation dialog. "Clear Shielded Data" button triggers dialog instead of immediate action. confirmationDialog presents destructive confirm action that calls clearLocalState, plus cancel option and explanatory message about removing persisted shielded notes and sync state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

  • dashpay/platform#3704: Directly implements the fix described—switching shield and shield_from_asset_lock to broadcast_and_wait:: with updated error mapping for insufficient-funds scenarios.

Poem

🐰 A shield must wait, not rush ahead,
Proof in hand before success is said,
And when you clear with trembling hand,
Confirm the choice—a safe command!
With dialogs kind and warnings clear,
The shielded path has naught to fear.

🚥 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 'fix(platform-wallet): wait for shield confirmations' directly matches the main objective: ensuring shielding operations wait for state transition proof results before reporting success.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@thepastaclaw
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant