Repository navigation
Description
TL;DR: A shielded Clear is not refused while the wallet is shielding funds from an asset lock. The Clear can wipe the wallet's shielded state while the shielding is still waiting for its proof or confirmation, and the shielding then carries on and records its activity afterwards.
User story
As a wallet user, I want a request to clear my shielded data to be refused while a shielding from Core funds is still in progress, as it is for every other shielded operation, to achieve a cleared wallet that a running operation does not write into afterwards.
Scenario
Base flow
The wallet starts shielding Core funds through an asset lock (shielded_fund_from_asset_lock: a user-facing shield from Core, a wallet drain, or the seed pool). While it waits for the asset lock's proof or ChainLock, or for Platform's result, the user clears the wallet's shielded data.
Actual behavior
The Clear is admitted and wipes the shielded state. The shielding keeps its signer, finishes, and then records its ShieldFromAssetLock activity.
Expected behavior
While the shielding runs, the Clear is refused with the retryable "shielded operation in progress" error, as it is while any other shielded operation runs.
Detailed discussion
- A Clear checks only the coordinator's operation admission:
NetworkShieldedCoordinator::try_admit_clearrefuses while an operation holdsoperation_guard()(coordinator.rs). The pool spends (fix(platform-wallet): hold the lifecycle gate and Clear admission across credit pool spends #6178), the three pool payments (fix(platform-wallet): hold the Clear admission across the remaining shielded pool payments #6203), tips and tip payments take that admission. PlatformWallet::shielded_fund_from_asset_locktakes only the wallet'sshield_guard, whichtry_admit_cleardoes not look at (fund_from_asset_lock.rs#L244). Neither its callers (the FFI entry points inshielded_send.rsandshielded_wallet_drain.rs, andseed_pool.rs) nor the function itself takeoperation_guard().- After Platform's verdict it settles the asset lock (L766-L776) and records the landed bundle as live activity through
record_shield_from_asset_lock_activity(L948-L957). A Clear admitted in between therefore does not stop it, and its activity lands in the store the Clear emptied. - Proposed: hold
operation_guard()for the whole operation, acquired beforeshield_guardand the wallet's configuration locks, as the admission's documentation requires, sotry_admit_clearrefuses meanwhile. - One consequence to decide: user-facing funding waits for the ChainLock without a deadline (
cl_wait: None), so the Clear would stay refused for as long as that wait lasts. platform-wallet: shielded funding holdsshield_guardthrough the unbounded ChainLock wait, blocking other shield-class operations #5518 tracksshield_guardbeing held through that wait, and Let shutdown cancel long-running shielded wallet operations #6003 tracks cancelling long-running operations. - Found while reviewing fix(storage): make Clear Database clear everything or nothing dash-evo-tool#1255. Dash Evo Tool refuses a Clear on its own path for now, as a stopgap.
Prior work
- fix(platform-wallet): refuse a shielded Clear while a shielded operation runs #6182: refuses a shielded Clear while a shielded operation holds the admission.
- platform-wallet: token purchase, private contact request and private document payments do not hold the shielded coordinator's operation admission #6176 (closed by fix(platform-wallet): hold the lifecycle gate and Clear admission across credit pool spends #6178 and fix(platform-wallet): hold the Clear admission across the remaining shielded pool payments #6203): the same gap for the token purchase, private contact request and private document payments.
- platform-wallet: wallet removal and shielded Clear wait for a host signer (and for a shield queued behind asset-lock funding) #6189: wallet removal and Clear waiting for a host signer, and a shield queued behind asset-lock funding.
- platform-wallet: shielded funding holds
shield_guardthrough the unbounded ChainLock wait, blocking other shield-class operations #5518:shield_guardheld through the unbounded ChainLock wait. - Let shutdown cancel long-running shielded wallet operations #6003: letting shutdown cancel long-running shielded operations.
- fix(platform-wallet): own the shielded coordinator and wipe host rows inside Clear #5934: the coordinator owns Clear and wipes host rows inside it.
🤖 Co-authored by Claudius the Magnificent AI Agent
Activity
PastaPastaPasta commentedon Dec 4, 2026
#5934 takes the other route for this: a shielded Clear stays admitted while an asset-lock funding waits on its proof or ChainLock, and the funding's closing activity write is fenced by the Clear epoch, so nothing lands in the store a Clear emptied (
should_record_no_funding_activity_after_a_clear_that_followed_its_broadcast). Refusing the Clear would hold it for the unbounded ChainLock wait (#5518). If that resolves the issue, it can be closed when #5934 merges.🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.