Skip to content

platform-wallet: set_contact_info_with_external_signer changes the local contact copy even when it returns an error #5646

Open

Description

@Claudius-Maginificent

TL;DR: set_contact_info_with_external_signer changes the wallet's local copy of a contact's details (alias, note, hidden flag) even when it returns an error. That local copy then stays out of step with what is published on Platform, and the caller cannot tell from the error that anything was stored.

User story

As a wallet app built on platform-wallet, I want a failed contact-details save to leave the local state as it was, or to tell me exactly what was stored, so that the details users see always match what they were told about the save.

Scenario

Base flow

Clear a contact's note and save it. The publish fails, for example on a network error.

Actual behavior

The app reports that the save failed, but the cleared note is already stored locally. In Dash Evo Tool the empty local entry then lets older details show again after a restart.

Expected behavior

Either nothing changes locally when the call returns an error, or the error says that the local copy was kept but not published.

Detailed discussion

At 575d961f, in packages/rs-platform-wallet/src/wallet/identity/network/contact_info.rs:

  • set_contact_info_with_external_signer (around line 504) persists the new metadata locally in step 1 (around line 544). Only after that does it select the signing key, fetch the existing documents, encrypt and broadcast the contactInfo document.
  • If any later step fails, the function returns Err, but the local change remains. The error type does not say whether local state changed.
  • Nothing retries the publish: PendingContactCryptoOp (changeset/changeset.rs) has no publish operation. sync_contact_infos only overwrites contacts that already have a document on Platform. As a result, the local copy and the published state diverge permanently.

Expected, one of:

  1. Atomic: restore the previous local metadata when the publish fails before broadcast. For an uncertain broadcast, either queue a retry or report it as in (2).
  2. A typed outcome, e.g. "stored locally, not published", so the caller can record and report it accurately.

Seen in dashpay/dash-evo-tool#1102 (review thread on src/backend_task/dashpay/contact_info.rs).

🤖 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