Repository navigation
Description
A client that broadcast a state transition and got no clear answer has no way to learn, with proof, whether that transition executed, can never execute, or may still execute, and until when. #5269 asks for a node's unproved view of a transition: pending, committed, dropped or unknown. This issue asks for the proven half next to it. Only proven answers may drive decisions that move or release funds.
We hit this in the platform wallet's private payments (#5810). After a broadcast that may have reached the network, the wallet keeps the payment's notes reserved and, for a DashPay private contact request, the contact pair locked. It does this until the payment provably landed or provably can't land, so it never pays twice or exposes a relationship. Today the only provable "can't land" signal it has is waiting for the spend's anchor to age out, so it can't tell the user how long the wait is.
Expected Behavior
An SDK function, for example Sdk::state_transition_outcome(&transition), takes the full transition (not just its hash, since it needs its inputs) and returns one of the following, each backed by proofs the client verifies:
| Outcome | Meaning | Proven by |
|---|---|---|
Executed |
In a block, with its effect present | Affected-state proof: for a shielded spend, its nullifiers spent; for a private document create, its entry in the type's store |
ExecutedWithError |
Included but failed with a paid error | Fee or balance proof, only for types with a paid failure path (type 29 has none) |
CannotExecute(AnchorExpired) |
A shielded spend whose anchor is no longer among the anchors Platform keeps | getShieldedAnchors. Anchors are kept for shielded_anchor_retention_blocks (1000) and pruned every shielded_anchor_pruning_interval (100), so this holds at the latest from about anchor height + 1100 |
CannotExecute(InputUsed) |
A nullifier spent by another transition, or an identity or contract nonce or asset lock already consumed, with this transition's effect absent | getShieldedNullifiers, getIdentityNonce, getIdentityContractNonce or the asset lock proof, plus the absence of the effect |
CannotExecute(Invalid) |
Fails the state-independent checks (signature, structure) | Checked locally and deterministically |
StillPossible { until_height } |
None of the above; it may still execute, but no later than until_height |
Anchor still kept, nullifiers unspent and nonce free, with the deadline taken from the anchor's height |
It may attach the node's unproved view from #5269 as a separate, clearly typed hint (for example "in this node's mempool"), for display only.
Why the two must stay separate
- A node's "not in my mempool" proves nothing. Mempools differ between nodes, anyone who saw the signed transition can rebroadcast it, and a node's answer is unverified.
- Releasing reserved notes, retrying a payment, or unlocking a held pair must only follow
ExecutedorCannotExecute. Otherwise a client can pay twice, or reveal something it meant to keep private. - Separate types (a proven
TransitionOutcomeand an unprovedNodeTransitionStatus) make that hard to get wrong.
Possible Solution
- rs-sdk: compose the outcome from the proved queries that already exist (
getShieldedAnchors,getShieldedNullifiers,getIdentityNonce,getIdentityContractNonce,getPrivateDocumentEntries,waitForStateTransitionResultwithprove). This needs no Drive or consensus change. Per-type rules decide which inputs to check. - DAPI: a non-blocking call to look up a state transition's status by hash (pending, committed, dropped or unknown) #5269's call: name it
getRecentStateTransitionStatus, in line withgetRecentAddressBalanceChanges. "Recent" fits because a node's view covers only its mempool, its recently seen hashes and its transaction index. The proven outcome is not "recent":ExecutedandCannotExecute(AnchorExpired)stay provable indefinitely. - platform-wallet: once this exists, the shielded coordinator's stranded-release pass and the private payment journal can use
CannotExecuteto free reservations and pairs, andStillPossible { until_height }to show the user a deadline instead of "pending". - wasm-sdk, evo-sdk, Swift and Kotlin: expose the outcome where they already expose
waitForStateTransitionResult.
Notes
- Privacy. For shielded and private document transitions, a client should only ask the node it broadcast to: asking several nodes about the same transition spreads the link between the client's network address and the transition. The proven queries leak less when they are batched with the client's ordinary sync reads.
- Ordering. A
CannotExecute(AnchorExpired)decision must use an anchor set fetched before the read that shows the effect absent. Otherwise a spend that executed just before pruning could be missed. The wallet's stranded-release pass already follows this order and documents why.
Related
- DAPI: a non-blocking call to look up a state transition's status by hash (pending, committed, dropped or unknown) #5269: node's unproved status by hash. This issue is its proven counterpart.
- rs-dapi: "tx already exists in cache" skips the duplicate check, so a dropped state transition looks the same as a pending one #5266, IdentityCreditTransfer to a non-existent recipientId passes check_tx and stays in the mempool, blocking the sender's nonce slot #4624, rs-sdk: put_to_platform_and_wait_* fails with AlreadyExists when a timed-out broadcast was already accepted #4998, fix(rs-dapi,rs-sdk): generalize retryable post-broadcast result-wait errors #4137: re-broadcast ambiguity and wait results.
Activity