Skip to content

platform-wallet: refuse to create again a private document entry whose earlier create may have gone through #6193

Backlog

Description

@QuantumExplorer

Problem

A private document create (type 29, PlatformWallet::create_private_document_entry) can end as ShieldedSpendUnconfirmed: the entry may already be in the store. Rust keeps the spent notes reserved and redrives the saved transition. But a new call with the same entry seals a fresh commitment and can pay from other spendable notes, so the user is charged a second fee for the same entry.

Today only the hosts guard against this, and only in memory:

Both guards have gaps:

  • A byte array entered as deadbeef in one create and DEADBEEF in the next encodes the same bytes but a different properties string. That passes the Kotlin hold.
  • After a restart, neither app remembers the earlier attempt.
  • Deciding when a request may be sent again is wallet policy, which belongs in Rust, not in each host.

Proposal

Keep pending creates in rs-platform-wallet, keyed by a durable operation identity or by the normalized request, meaning what Rust would seal, not the host's JSON text. A create matching an unresolved earlier attempt should be refused, with a typed error that names that attempt, until a shielded sync settles it. Expose this through the FFI so both apps show the existing attempt instead of deciding themselves.

The same question applies to the DashPay private contact request, which pays the same way.

Found in review of #6169 (thepastaclaw).

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