You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
platform-wallet: fail a shielded spend that a snapshot result confirmed when the scan later reads another transition's action for its input #6180
An identity top-up from the shielded pool (type 22) and a private document create from the shielded pool (type 29) get their result as an affected-state snapshot: every nullifier of the spend reads spent, which does not say which transition spent them.
#6160 described two orders in which this meets the note scan's proof that another transition spent one of the spend's inputs (#6151). The fix for #6160 covers the first: the scan fails the row, then the snapshot arrives, and the row now stays Failed.
The second order is still open:
The snapshot arrives first. settle_affected_state_spend (rs-platform-wallet/src/wallet/shielded/operations.rs) confirms the row without a height and marks the spend's notes spent.
A later scan pass reads another transition's action for one of the spend's inputs.
Nothing fails the row at step 2:
marking the notes spent drops the spend's saved transition, which is what the scan compares a scanned action against (sync::SavedSpendInput), so the scan no longer knows the spend's inputs;
fail_spends_spent_elsewhere only changes a row that is still Pending.
The row keeps reading Confirmed for a top-up or payment that did not execute. The notes are not affected: the snapshot proves each of them spent on chain.
When it can happen
Only for a bundle with no padding action, that is, when every action of the bundle spends one of the wallet's notes (two or more notes in, at most as many outputs). A bundle with a padding action also spends a dummy note whose nullifier no other transition can produce, so a snapshot that shows it spent does prove the spend executed. It also needs a second device restored from the same seed that spends the same notes first.
What a fix needs
After a snapshot confirms a bundle with no padding action, keep what the scan compares: each input nullifier with the commitment the spend's action pairs it with. Keep it until the scan reads the item for one of the inputs, which either is the spend's own action (it executed) or another transition's (it did not).
That record must not read as an unresolved spend elsewhere: the redrive pass must not re-broadcast it, and the pair holds, the reservations and the Clear rules must not count it.
Let the scan fail a row that a snapshot confirmed without a height.
A cheaper first step is possible at the snapshot itself: a bundle with a padding action can be recorded as proven executed, which separates the unambiguous case from the one above.
The immediate confirmation of the ordinary case (a top-up is reported done without waiting for a sync) should stay.
Three notes for whoever picks this up, from the review of #6226 (which names the type 29 activity rows and does not change how a row's status is decided):
Type 29 rows are now their own kinds. After fix(platform-wallet)!: name private entry and contact request payments in shielded activity #6226 a private document create records PrivateDocumentCreate (tag 13) or PrivateContactRequest (tag 14), with a counterparty and with amount equal to the fee, in place of ShieldedSpend with amount 0. The scan-side step "fail a row that a snapshot confirmed without a height" has to cover these kinds, and a wrongly Confirmed row now reads as a named payment with a fee.
The generic entry call's result is wrong in the same ordering, not only the row.settle_private_document_payment returns Ok(metadata) once the snapshot is accepted, so create_private_document_entry reports the entry as created. The DashPay private send and the two accepts do not: they return PrivateContactRequestPending unless the request's entry is read back, so there the user is told the request is pending while the row reads Confirmed. Un-confirming the row alone would contradict the entry call's result and would leave the loser Pending forever, so the fix belongs in settlement. (Edited: an earlier version of this note said the DashPay send also reports the payment as done. It does not.)
The ordering also needs a faulty or dishonest endpoint. An honest rs-dapi returns a proof from waitForStateTransitionResult only for a transition whose result code is 0. The losing transition gets an error there, the wallet reports it as unconfirmed, its row stays Pending, and the scan then fails it correctly. The SDK cannot check this from the proof (accept_affected_state), which is why the case exists at all, but it narrows "When it can happen" above.
The regression test asked for in that review (snapshot before scan, a type 29 bundle with two real notes in and no padding action) belongs with this fix.
Activity
QuantumExplorer commentedon Nov 24, 2026
Three notes for whoever picks this up, from the review of #6226 (which names the type 29 activity rows and does not change how a row's status is decided):
Type 29 rows are now their own kinds. After fix(platform-wallet)!: name private entry and contact request payments in shielded activity #6226 a private document create records
PrivateDocumentCreate(tag 13) orPrivateContactRequest(tag 14), with a counterparty and withamountequal to the fee, in place ofShieldedSpendwith amount 0. The scan-side step "fail a row that a snapshot confirmed without a height" has to cover these kinds, and a wrongly Confirmed row now reads as a named payment with a fee.The generic entry call's result is wrong in the same ordering, not only the row.
settle_private_document_paymentreturnsOk(metadata)once the snapshot is accepted, socreate_private_document_entryreports the entry as created. The DashPay private send and the two accepts do not: they returnPrivateContactRequestPendingunless the request's entry is read back, so there the user is told the request is pending while the row reads Confirmed. Un-confirming the row alone would contradict the entry call's result and would leave the loser Pending forever, so the fix belongs in settlement. (Edited: an earlier version of this note said the DashPay send also reports the payment as done. It does not.)The ordering also needs a faulty or dishonest endpoint. An honest rs-dapi returns a proof from
waitForStateTransitionResultonly for a transition whose result code is 0. The losing transition gets an error there, the wallet reports it as unconfirmed, its row stays Pending, and the scan then fails it correctly. The SDK cannot check this from the proof (accept_affected_state), which is why the case exists at all, but it narrows "When it can happen" above.The regression test asked for in that review (snapshot before scan, a type 29 bundle with two real notes in and no padding action) belongs with this fix.