Repository navigation
Description
TL;DR: Saving a contact's nickname, note or hidden flag through set_contact_info_with_external_signer always writes an empty acceptedAccounts list, so the accounts stored in the existing DIP-15 contactInfo document are silently erased.
User story
As a wallet app developer, I want to update a contact's nickname, note or hidden flag without losing the accepted accounts already saved for that contact, to achieve a metadata edit that changes only what the user edited.
Scenario
Base flow
A contact already has a contactInfo document on Platform whose private data lists one or more accepted accounts (written by another app or an older version of this one). The user edits the contact's note and saves.
Actual behavior
The wallet builds the new private data with accepted_accounts: Vec::new() and publishes it as the replacement document. The previously stored accepted accounts are gone after the save.
Expected behavior
The stored accepted accounts survive a metadata edit. Callers that do want to change them can say so explicitly.
Detailed discussion
At the revision Dash Evo Tool pins (575d961), packages/rs-platform-wallet/src/wallet/identity/network/contact_info.rs, set_contact_info_with_external_signer (~line 504) builds:
let metadata = ContactInfoPrivateData {
alias_name: alias,
note,
display_hidden,
// Multi-account acceptance isn't populated yet; a metadata
// update carries an empty `acceptedAccounts`.
accepted_accounts: Vec::new(), // ~line 531
};The method has no parameter for accepted accounts and does not read the existing document's value before encoding, so the field cannot be kept or set by the caller. The same struct is used both for the local contact copy and for the encrypted payload that replaces the document.
Dash Evo Tool's earlier in-house writer avoided this with an explicit choice per field (AcceptedAccounts::Preserve / Replace, see src/backend_task/dashpay/contact_info.rs on v1.0-dev): it decrypted the existing document and carried accepted_accounts over unless told otherwise. Moving to the platform-wallet writer loses that behaviour. This blocks dashpay/dash-evo-tool#1102.
Proposed approach (either is fine):
- Default to preserving: when a previous
contactInfois available (it is already fetched/decrypted for the document slot), reuse itsaccepted_accounts. - Or add an
accepted_accounts: Option<Vec<u32>>parameter (None= keep stored,Some= replace).
Option 1 is the smaller API change; option 2 is more explicit and lets callers clear the list. Either way a test should cover "edit note, accepted accounts unchanged".
Prior work
- platform-wallet: contactInfo update rewrites the oldest of a contact's documents, while sync shows the newest #5544 — contactInfo update rewrites the oldest of a contact's documents while sync shows the newest; same write path, different defect (which document is chosen).
- platform-wallet: contactInfo update has no expected-revision check, so a stale read overwrites another device's edit #5545 — no expected-revision check on contactInfo update; same write path, concurrent-edit overwrite.
- platform-wallet: serialize contact-details saves per identity so two saves cannot pick the same document slot #5599 — serialize contact-details saves per identity; same write path, document-slot race.
- platform-wallet: set_contact_info_with_external_signer changes the local contact copy even when it returns an error #5646 —
set_contact_info_with_external_signerchanges the local copy even when it returns an error; same method. - DashPay backlog (post-M1) — migrated from docs/dashpay/TODO.md #4020 — DashPay backlog notes that
accepted_accountsround-trip is currently inert.
None of these covers dropping acceptedAccounts on replace.
Attribution
🤖 Co-authored by Claudius the Magnificent AI Agent
Activity