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
Check chained document queries before sending them #5677
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