Skip to content

feat(sdk): chained document queries — ChainedDocuments fetch with composed proof verification - #4552

Merged
QuantumExplorer merged 6 commits into
v4.2-devfrom
feat/sdk-chained-documents
Sep 1, 2026
Merged

feat(sdk): chained document queries — ChainedDocuments fetch with composed proof verification#4552
QuantumExplorer merged 6 commits into
v4.2-devfrom
feat/sdk-chained-documents

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Aug 31, 2026

Copy link
Copy Markdown
Member

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?

  • dash-platform-queries: ChainedDocumentQuery — a rich, transport-free query (inner DocumentQuery + join_property + outer type name). 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); requires a non-zero inner limit; refuses inner features the chained surface doesn't support; always proves. Converts to DriveChainedDocumentQuery, and carries the concrete FromProof<ChainedDocumentQuery> impl: it decodes the response's proven_join_values (32-byte identifiers, fail-closed) as the untrusted bootstrap hint and runs the single-pass merged verification.
  • rs-drive-proof-verifier: ChainedDocuments result 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.
  • rs-sdk: Query wire-encoding impl + explicit identity Query<Self> impl, Fetch binding, MockResponse (per-document CBOR halves, list order preserved), mock expectation loading, platform::{ChainedDocumentQuery, ChainedDocuments} re-exports.
  • The Fetch binding's Request is GetDocumentsRequest; 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's chained_query_e2e_tests (including the hint-tamper matrix) and rs-drive-abci's handler tests. Devnet test vectors can be generated with generate_test_vectors.sh once a local network is up — follow-up.

cargo check --workspace --all-targets, cargo fmt, grpc-coverage gate.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: e759e38e-b495-449b-bebf-102706c695e6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review — 32 ahead in queue (commit 9400531)
Queue position: 33/34 · 2 reviews active
ETA: start ~17:23 UTC · complete ~18:27 UTC (median 1h 4m across 30 recent reviews; 2 slots)
Queued 1m ago · Last checked: 2026-09-01 00:10 UTC

@QuantumExplorer
QuantumExplorer force-pushed the feat/dapi-chained-documents branch from a956ff6 to c69dd17 Compare August 31, 2026 20:30
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch from 747a4ff to 1fce7c0 Compare August 31, 2026 20:36
@QuantumExplorer
QuantumExplorer force-pushed the feat/dapi-chained-documents branch from c69dd17 to 2f9f7dd Compare August 31, 2026 20:58
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch from 1fce7c0 to 0b952fa Compare August 31, 2026 20:58
@QuantumExplorer
QuantumExplorer force-pushed the feat/dapi-chained-documents branch from 2f9f7dd to 6319b3b Compare August 31, 2026 21:04
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch from 0b952fa to 73db084 Compare August 31, 2026 21:04
@QuantumExplorer
QuantumExplorer force-pushed the feat/dapi-chained-documents branch from 6319b3b to c7b0d80 Compare August 31, 2026 21:13
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch from 73db084 to 71237d7 Compare August 31, 2026 21:13
@QuantumExplorer
QuantumExplorer force-pushed the feat/dapi-chained-documents branch from c7b0d80 to dc279e6 Compare August 31, 2026 21:16
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch from 71237d7 to 287fdb6 Compare August 31, 2026 21:16
@QuantumExplorer
QuantumExplorer force-pushed the feat/dapi-chained-documents branch from dc279e6 to 2267967 Compare August 31, 2026 22:13
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch 7 times, most recently from 5b81820 to 69e5cb7 Compare August 31, 2026 23:45
Base automatically changed from feat/dapi-chained-documents to v4.2-dev September 1, 2026 00:02
@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 1, 2026
QuantumExplorer and others added 2 commits September 1, 2026 02:06
…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>
QuantumExplorer and others added 4 commits September 1, 2026 02:06
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>
@QuantumExplorer
QuantumExplorer force-pushed the feat/sdk-chained-documents branch from 69e5cb7 to 9400531 Compare September 1, 2026 00:06
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.97%. Comparing base (ff0a7b9) to head (9400531).
⚠️ Report is 1 commits behind head on v4.2-dev.

Files with missing lines Patch % Lines
...rm-queries/src/documents/chained_document_query.rs 0.00% 44 Missing ⚠️
...drive-proof-verifier/src/proof/chained_document.rs 0.00% 24 Missing ⚠️

❌ 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     
Components Coverage Δ
dpp 88.62% <ø> (+0.24%) ⬆️
drive 85.71% <62.50%> (-0.07%) ⬇️
drive-abci 89.73% <91.93%> (-0.08%) ⬇️
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.92% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 40.82% <0.00%> (-7.82%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@QuantumExplorer
QuantumExplorer merged commit 94c68e5 into v4.2-dev Sep 1, 2026
12 of 13 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/sdk-chained-documents branch September 1, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants