feat(sdk): composite document queries, the client stack - #4604
feat(sdk): composite document queries, the client stack#4604QuantumExplorer wants to merge 1 commit into
Conversation
The client half of composite document queries (a page plus the sub-queries derived from it, answered as ONE merged proof): - dash-platform-queries: `CompositeDocumentQuery` (page + `CompositeSubQuery` list with kind, fixed clauses, per-value limit and binding), the V1 wire encoder (refuses V0, a zero page limit, cursors, offsets, projections, grouping and time ranges), the rich-to-drive conversion mirroring the server's limit contract, and `FromProof<CompositeDocumentQuery> for CompositeDocuments`. - rs-drive-proof-verifier: `CompositeDocuments` plus `verify_composite_documents_tenderdash_proof`, which composes rs-drive's merged-proof verification with the tenderdash root binding; `CompositeSubQueryResult` re-exported at the crate root. - rs-sdk: `Query` impls, `impl Fetch for CompositeDocuments`, the mock round-trip, and the `platform` re-exports. - rs-drive-abci: a `composite_trust_boundary` suite running the SDK entry points against server-generated proofs: wire encoding, end-to-end FromProof (page, like counts, quoted-post join, cross-contract profile lookup with a proven absence), a wrong quorum key, tampered metadata, and a page-only proof presented for the composite query. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
🕓 Ready for review — 51 ahead in queue (commit 9036af2) |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Replaces #4600, which GitHub closed as merged when a mistaken force-push briefly collapsed the stack's branches onto one commit. Same branch, same content, same base.
Issue being fixed or feature implemented
Part of the composite document query series (Yappr feed: one merged proof per feed page instead of 15 to 19 round trips). Stack:
sub_queries, drive-abci dispatch)What was done?
The client half of composite queries, mirroring the chained-query client stack shipped in #4552:
CompositeDocumentQuery(a pageDocumentQueryplus a list ofCompositeSubQuery, each with a kind, fixed clauses, an optional per-value limit and an optional binding). The V1 wire encoder attachessub_queriesto the typed request and refuses the V0 wire, a zero page limit, cursors, offsets, projections, grouping and time ranges. The rich-to-drive conversion mirrors the server's sub-query limit contract ([1, 100], refused rather than clamped).FromProof<CompositeDocumentQuery> for CompositeDocumentsverifies the single merged proof. Builders:CompositeSubQuery::documents(..)/::count(..),.bound_to_page(source_property, field),.bound_to(CompositeBindingSource::SubQuery(n), ..),.with_where,.with_order_by,.with_limit.CompositeDocuments { page_documents, sub_results }andverify_composite_documents_tenderdash_proof, composing rs-drive's merged-proof verification (bootstrap subset pass on the page, re-derivation of every sub-query, one authoritative verify, routing with completeness checks) with the tenderdash root binding.CompositeSubQueryResult(rs-drive'sSubQueryResult) is re-exported at the crate root, likeSplitCountEntry.Queryimpls,impl Fetch for CompositeDocuments, the mock round-trip (page and documents sub-results as per-document CBOR, count sub-results as triples, all order preserving), and theplatformre-exports.composite_trust_boundarysuite that runs the actual SDK entry points against server-generated proofs, same split as the having and chained suites. It covers the wire encoding, the fullFromProofcomposition (page, like counts, quoted-post by-id join, cross-contract profile lookup where one author's missing profile is a proven absence), a wrong quorum key, tampered metadata, and a plain page-only proof presented for the composite query.Usage:
How Has This Been Tested?
cargo test -p dash-platform-queries composite: 7 offline tests (wire shape, source numbering, page-limit and page-feature refusals, drive conversion + shape validation, out-of-range sub-query limit, non-refersTo join refusal).cargo test -p drive-abci --lib composite_trust_boundary: 5 tests, all green.cargo clippy -p dash-platform-queries -p drive-proof-verifier -p dash-sdk -p drive-abci --features dash-sdk/mocks --tests: clean apart from the pre-existing rs-driveDocumentPropertyTypeunused import under verify-only features.Breaking Changes
None. New types and functions only; the chained surface is untouched.
Checklist
🤖 Generated with Claude Code