Skip to content

platform-wallet: an asset lock Platform already consumed stays resumable when the local Consumed record is missed #6385

Backlog

Description

@Claudius-Maginificent

TL;DR: If a wallet shields funds from an asset lock and Platform accepts it, but the wallet never records the lock as used (the app stops at the wrong moment, or the local write fails), the lock stays "resumable" forever. Resuming it is always refused, and nothing ever closes it.

User story

As a user of a wallet built on platform-wallet (for example Dash Evo Tool shielding Core funds), I want an asset lock that Platform already used to show as finished, so that I am not offered a "resume" that can never succeed.

Scenario

Base flow

The wallet builds and broadcasts an asset lock, waits for its proof, submits a shield-from-asset-lock transition (Type 18), and then records the lock as consumed locally.

Actual behavior

  • Platform accepts the Type 18, but the local Consumed record is not written. This happens when the process stops or the request is dropped after submit and before the write, when the response is lost, or when the store write fails. In shielded/fund_from_asset_lock.rs a failed consume_asset_lock after an accepted Type 18 is only logged ("the lock row stays non-Consumed and surfaces in the Resumable Funding list").
  • After a restart the row reloads as nonterminal and is listed as resumable.
  • A resume submits again and gets Platform's "asset lock already consumed" report. That report is unauthenticated (one node, CheckTx), so reconcile_asset_lock_submit_result (asset_lock/orchestration.rs) correctly does not trust it: it records consumption-unknown at most, and the row never becomes Consumed.
  • The value itself is not lost: shielded note sync finds the note. Only the asset-lock lifecycle is left stuck.

Expected behavior

  • When the wallet sees an already-consumed report for a tracked lock, or during recovery of a nonterminal lock, it asks Platform for the outpoint's state with a proof. If the verified state is fully consumed, it writes the Consumed tombstone, and the lock stops appearing as resumable.
  • A partially consumed lock and a not-spent lock keep today's behaviour, with the verified state available to the caller.
  • Without a proof, behaviour stays exactly as today: nothing terminal is written on an unauthenticated report.

Detailed discussion

#5580 covers the wallet-drain path (operation-tagged Type 18) and proposes the proof-backed outpoint query. #5581 adds that query (getAssetLockOutpointInfo) and removes the drain shortcut, but notes that the query alone does not resolve the unknown outcome on retry or resume. This issue is the missing wallet-side step for every tracked asset lock, not only drains:

  • Use the verified outpoint state from feat(platform): add proof-backed asset lock outpoint query #5581 in reconcile_asset_lock_submit_result and in asset-lock recovery (sync/recovery.rs, resume_asset_lock) to write Consumed for a fully consumed lock.
  • Cover Type 18 from wallet balance, Type 18 from an existing lock, and identity create/top-up, which share the generic reconciliation.
  • Tests: accepted-but-not-recorded lock + verified fully consumed → tombstone, no further resume; partially consumed → no tombstone; proof unavailable or invalid → unchanged nonterminal state and the existing typed error.

Open questions:

  • Whether reconciliation runs only on an already-consumed report, or also on load for every nonterminal lock that has a proof (one query per lock).
  • Whether the tombstone should record that it was reconciled rather than written after a direct submit.

Prior work

Attribution

🤖 Co-authored by Claudius the Magnificent AI Agent

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions