Skip to content

platform-wallet-ffi: ASSET_LOCK_PAYMENT_INTENTS is attested without atomic changesets #5986

Open

Description

@romchornyi

The FFI persister reports PersistenceCapabilities::ASSET_LOCK_PAYMENT_INTENTS whenever the host wires on_persist_asset_lock_payment_intent_fn and on_load_asset_lock_payment_intent_fn next to the asset-lock persist/load callbacks (rs-platform-wallet-ffi/src/persistence.rs, persistence_capabilities()). The constant's doc promises the intent survives store and load with its row. In store(), though, the signed Built row (on_persist_asset_locks_fn) and its intent are two separate callbacks; they commit as one unit only when the host also declares ATOMIC_CHANGESETS and provides on_changeset_begin_fn / on_changeset_end_fn, and nothing requires that.

Impact. A host that commits each callback on its own can stop between the two calls. After a restart it loads a signed, resumable lock with no intent, and an owned resume can broadcast and consume that lock into the sender's wallet without paying the recorded recipients. The flush after store() does not close this window.

Fix direction. Attest ASSET_LOCK_PAYMENT_INTENTS only when the host also declares ATOMIC_CHANGESETS and wires both changeset callbacks (the gate CORE_SWEEP_REMOVAL already uses for its split write), with a test that the bit is withheld when either is missing. A host without the capability keeps today's best-effort path, where build.rs warns that the recipients survive only in memory.

Raised in review of #5930, which documents the limitation (8dcf289).

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