Skip to content

sdk: a document delete's confirmation should be proved at a block after the one it was signed against #6076

Open

Description

@QuantumExplorer

Expected Behavior

Sdk::document_delete reports a delete as confirmed only on a proof from a block after the state the SDK had verified before it signed. That proof shows the document gone after the delete was sent, not merely gone at some earlier block.

Current Behavior

A stored-document delete's proved result is verified as "the document is absent at the signed root" (packages/rs-drive/src/verify/state_transition/verify_state_transition_was_executed_with_proof/v0/mod.rs) and tagged as execution-proved. The SDK's default height tolerance allows a proof one block behind the newest it has verified (packages/rs-sdk/src/sdk.rs). Neither the height the caller observed the document at nor the wait's proof height is compared, and DocumentDeleteResult::Deleted carries no height.

With honest nodes this does not happen: the wait is answered only after the transition is included, so the proof is at or after the execution block. A node serving state from before the document existed could still answer the wait with an absence that predates the document. The SDK would then report the delete confirmed while the document still exists.

Callers that share the path: Sdk::document_delete and builders over it, delete_dpns_name / delete_dpns_domain, platform-wallet's document deletes, rs-sdk-ffi and wasm-sdk document deletes.

Possible Solution

In Sdk::document_delete, capture the highest verified height before signing, and require the wait's proof height to be above it before returning Deleted. Otherwise report the result unconfirmed. Honest flows always satisfy this, so no caller changes.

Context

Found reviewing #6055 (DPNS name give-up). Related: #6072 tracks settling a signed give-up by its attempt.

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