Skip to content

platform-wallet: a payment admitted during a wallet's first shielded bind can read the store before its notes are restored #6204

Backlog

Description

@QuantumExplorer

What happens

A shielded install (install_shielded_views_in_one_transaction in packages/rs-platform-wallet/src/wallet/platform_wallet.rs) records the coordinator the wallet is bound on and publishes the wallet's keys before it restores the wallet's notes from the host's snapshot. Between those two steps the wallet reads as bound, and its store holds no note yet.

A payment that does not wait for the bind can start in that window: it passes its binding check, derives its spend key from the published keys, selects from the store before the restore, and fails with ShieldedNoUnspentNotes although the account is funded. Nothing is reserved or sent, and the same payment goes through once the bind has returned.

Which payments can start there:

Why it is not fixed by making the three wait

Waiting for the configuration lock orders a payment behind any bind in flight, a routine re-bind of a ready wallet included, and a bind can wait a long time holding that lock: it takes shield_guard next, which an asset-lock funding holds across a ChainLock wait with no deadline (#5518). The payment would then return neither a result nor an error.

Suggested fix

Keep the early coordinator record (a bind dropped while it waits must leave the wallet knowing it is registered), and track readiness to spend separately from it: an account whose restore has not finished is refused with a retryable setup error, and an account that is already ready does not wait for a routine re-bind. ShieldedInstall::is_hydrated is close to that signal.

Raised in the review of #6203 (thread).

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