feat(sdk): chained document queries — ChainedDocuments fetch with composed proof verification - #4552
Conversation
|
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 |
|
🕓 Ready for review — 32 ahead in queue (commit 9400531) |
a956ff6 to
c69dd17
Compare
747a4ff to
1fce7c0
Compare
c69dd17 to
2f9f7dd
Compare
1fce7c0 to
0b952fa
Compare
2f9f7dd to
6319b3b
Compare
0b952fa to
73db084
Compare
6319b3b to
c7b0d80
Compare
73db084 to
71237d7
Compare
c7b0d80 to
dc279e6
Compare
71237d7 to
287fdb6
Compare
dc279e6 to
2267967
Compare
5b81820 to
69e5cb7
Compare
…posed proof verification Third PR of the chained-document-queries stack. The Rust SDK surface for the provable semi-join: - dash-platform-queries: ChainedDocumentQuery (rich, transport-free) — inner DocumentQuery + join edge, wire encoding onto GetChainedDocumentsRequest (inner clauses in the GetDocumentsRequestV0 CBOR encoding, required non-zero inner limit, always proves), conversion to DriveChainedDocumentQuery, and the concrete FromProof<ChainedDocumentQuery> impl for ChainedDocuments. - rs-drive-proof-verifier: ChainedDocuments result type and the tenderdash-composition wrapper verify_chained_documents_proof — merk-level composition (verifier-derived outer query, root equality, exact set equality) in rs-drive, quorum-signature binding of the shared root here, one function so the composition can never be skipped; plus a generic FromProof for DriveChainedDocumentQuery- convertible requests. No unproven decoder with verification semantics on purpose: an unproven chained response can fabricate the join, which is exactly what the surface exists to prevent. - rs-sdk: Query wire-encoding impl, Fetch binding (ChainedDocuments::fetch), MockResponse (per-document CBOR halves, list order preserved — order IS the answer), mock expectation loading, platform re-exports. - Removes the @sdk-ignore on getChainedDocuments (grpc-coverage cache updated by the gate script). Tested offline against the yappr-likes fixture: wire-shape encoding (byte-exact CBOR clauses), required-limit and unsupported-inner-feature rejections, rich→drive conversion + shared shape validation (valid byLiker shape passes, non-refersTo join property fails). Proof verification is exercised end-to-end in rs-drive's chained_query_e2e_tests and rs-drive-abci's handler tests; SDK test vectors for a devnet round trip can be generated with scripts/generate_test_vectors.sh once a local network is up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same rationale as DocumentQuery's explicit identity impl: the rich query is not a TransportRequest, so the blanket does not apply, and the fetch trampoline needs Query<Self::Query> for the user-supplied form. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rework for the merged-proof wire: the tenderdash-composition wrapper and both FromProof impls take the response's proven_join_values as the untrusted bootstrap hint (decoded as 32-byte identifiers, fail-closed) and run rs-drive's single-pass merged verification. The two-proof plumbing is gone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Appeases clippy::type_complexity on the MockResponse round-trip shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follows the wire fold: ChainedDocumentQuery now encodes through the standard versioned GetDocumentsRequest encoder (typed V1 clauses — no CBOR anywhere on the surface) and attaches the ChainedJoin spec; a network still on the V0 wire is refused rather than silently sent a plain documents query. Both FromProof impls decode GetDocumentsResponse V1 (the merged proof in the standard envelope + the proven_join_values rider), rejecting V0 responses fail-closed. The Fetch binding's Request becomes GetDocumentsRequest and the dedicated mock expectation arm is gone. Offline tests updated: the wire-shape assertion now pins the typed V1 clauses and the riding join spec. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The proof is self-sufficient now: the FromProof impls hand the merged proof straight to rs-drive's bootstrap-then-verify composition, and the proven_join_values decode is gone with the field. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
69e5cb7 to
9400531
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## v4.2-dev #4552 +/- ##
============================================
- Coverage 87.29% 86.97% -0.33%
============================================
Files 2753 2786 +33
Lines 358390 362680 +4290
============================================
+ Hits 312855 315434 +2579
- Misses 45535 47246 +1711
🚀 New features to boost your workflow:
|
Issue being fixed or feature implemented
Third PR of the chained-document-queries stack (base: #4549). The Rust SDK surface for the provable semi-join:
ChainedDocuments::fetch(&sdk, query)returns the liked posts (and the inner projections carrying the pagination cursor) with the single merged proof fully verified.What was done?
ChainedDocumentQuery— a rich, transport-free query (innerDocumentQuery+join_property+ outer type name). Encodes through the standard versionedGetDocumentsRequestencoder — typed V1 clauses, no CBOR anywhere on the surface — and attaches theChainedJoinspec (a network still on the V0 wire is refused rather than silently sent a plain documents query); requires a non-zero inner limit; refuses inner features the chained surface doesn't support; always proves. Converts toDriveChainedDocumentQuery, and carries the concreteFromProof<ChainedDocumentQuery>impl: it decodes the response'sproven_join_values(32-byte identifiers, fail-closed) as the untrusted bootstrap hint and runs the single-pass merged verification.ChainedDocumentsresult type +verify_chained_documents_proof— the tenderdash-composition wrapper: merged-query reconstruction from the hint, single-pass verification, and exact set equality against the proven join values live in rs-drive; this wrapper binds the proof's root to the quorum-signed app hash and exists so the composition can never be skipped. Deliberately no unproven decoder with verification semantics.Querywire-encoding impl + explicit identityQuery<Self>impl,Fetchbinding,MockResponse(per-document CBOR halves, list order preserved), mock expectation loading,platform::{ChainedDocumentQuery, ChainedDocuments}re-exports.Fetchbinding'sRequestisGetDocumentsRequest; no dedicated rpc exists anymore.How Has This Been Tested?
Offline tests against the yappr-likes fixture (
dash-platform-queries): wire-shape encoding pinning the typed V1 clauses and the riding join spec, required-limit and unsupported-inner-feature rejections, rich→drive conversion + shared shape validation (5/5). Proof verification is exercised end-to-end in rs-drive'schained_query_e2e_tests(including the hint-tamper matrix) and rs-drive-abci's handler tests. Devnet test vectors can be generated withgenerate_test_vectors.shonce a local network is up — follow-up.cargo check --workspace --all-targets,cargo fmt, grpc-coverage gate.Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code