Skip to content

Check chained document queries before sending them #5677

Open

Description

@shumkov

Summary

ChainedDocuments has no FromProof::check_request of its own, so it uses the default, which accepts every query. A malformed chained document query is therefore sent, and the server refuses it, instead of being refused by the SDK before sending.

The SDK's other document views already refuse such shapes before sending. This applies the same rule to chained queries.

What to do

  • Give ChainedDocuments a check_request (packages/dash-platform-queries/src/documents/chained_document_query.rs). It converts the query to its Drive form and runs Drive's validate_chained(platform_version) (packages/rs-drive/src/query/chained_document_query/mod.rs), mapping a refusal to drive_proof_verifier::Error::RequestError.
  • Refuse only shapes that every node refuses at every protocol version where the query can be sent. Accept every query that some node serves and the verifier can verify.
  • Cover malformed chained queries with tests:
    • inner index-only shapes;
    • join properties;
    • same-contract and reference targets;
    • outer document constraints;
    • join indexes that do not resolve.

Context

Raised in the review of #5638. That PR covers pre-send checks for windows and ranked indexes, so chained queries are left to this issue.

Activity

  1. added this to the v5.1.0 milestone on Oct 30, 2026
  2. added
    enhancement
    on Oct 30, 2026
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

    enhancementrs-sdk

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions