Skip to content

refactor(drive)!: route ranked and having-range proofs through grovedb's unified PathQuery surface - #4488

Merged
QuantumExplorer merged 3 commits into
time-range-indexesfrom
claude/ranked-queries-unified-pathquery
Aug 26, 2026
Merged

refactor(drive)!: route ranked and having-range proofs through grovedb's unified PathQuery surface#4488
QuantumExplorer merged 3 commits into
time-range-indexesfrom
claude/ranked-queries-unified-pathquery

Conversation

@QuantumExplorer

@QuantumExplorerQuantumExplorer commented Aug 26, 2026

Copy link
Copy Markdown
Member

What

Switches the four remaining direct indexed-axis call sites onto grovedb's unified PathQuery surface — prove_query / verify_path_query over PathQuery::new_axis_top_k / new_axis_bounded:

call sitebeforeafter
execute_top_k_with_proofprove_indexed_axis_top_k_paginatedprove_query(new_axis_top_k)
verify_ranked_top_k_proof/v0verify_indexed_axis_top_k_paginatedverify_path_queryVerifiedPathQuery::AxisEntries
execute_range_with_proofprove_indexed_{count,sum,avg}_queryprove_query(new_axis_bounded)
verify_having_range_proof/v0verify_indexed_{count,sum,avg}_queryverify_path_queryVerifiedPathQuery::AxisEntries

Why

grovedb is retiring the standalone indexed-axis provers/verifiers from its public API (dashpay/grovedb#839) so their standalone envelope wire format never becomes consensus-frozen — only the GroveDBProof V1 axis-descent format ships with GROVE_V4. This PR is the platform half of that retirement; grovedb pinned the byte-level relationship between the two envelope families first (dashpay/grovedb#837: the semantic core — secondary proof bytes, target chains, root bindings — is byte-identical; only the outer envelope differs), so this is a proven envelope swap, not a behavioral leap.

The change compiles against the current grovedb pin (the unified surface already exists there), so this PR does not require a grovedb bump — but the next grovedb bump past dashpay/grovedb#839 requires this PR.

Wire format changes (unreleased surface)

The proof bytes for ranked/having responses change from the standalone envelopes to GroveDBProof::V1. Both surfaces exist only on this feature branch (#3740, unreleased), and prover + verifier switch together in this commit.

Behavioral deltas, pinned by updated tests

  • AxisRangeBounds::merk_query is retired. The prover/verifier agreement artifact is now grovedb's own bounded-axis lowering, shared by both proof sides inside grovedb; platform feeds it AxisRangeBounds::i128_bounds (lossless widening). The two repos can no longer drift on the bounds→keyspace translation.
  • Having-range over a completely empty secondary now proves instead of erroring (the unified prover carries the same empty-secondary convention the ranked paginated prover already had). an_empty_match_set_reads_empty_and_proves_empty flipped to the round-trip its own comment promised; drive-abci's empty_ranking_proof_rejection stays as the backstop it was already documented to be.
  • Query-as-input instead of echo checks. The unified verifier holds "a proof can never make the client believe a wrong answer to the client's own query", not "a proof only verifies under the exact request it was built for". Answer-changing tampers (bounds, direction) still fail closed; the limit-tamper arm of a_proof_does_not_verify_under_different_bounds now pins that the same bytes verify under an answer-equivalent limit — to that query's own correct answer, capped by the verifier's ≤-limit shape check.
  • prove_query proves committed state (no transaction parameter). The executors keep their TransactionArg for signature stability; the query dispatch passes None on this surface anyway.

Trusted-read call sites (indexed_*_top_k_paginated_keys, indexed_*_range_keys) are untouched — grovedb's trusted-read surface remains public.

Trusted reads (second commit)

The no-proof executors and the platform tests calling grovedb trusted reads directly now also route through the unified surface — grovedb is retiring those wrappers to crate-internal engine status (second commit on dashpay/grovedb#839):

  • execute_top_k_no_proof: indexed_*_top_k_paginated_keysrun_path_query(PathQuery::new_axis(AxisQuery::top_k(..).keys_only())), destructuring PathQueryRun::AxisKeys { keys, skipped }.
  • execute_range_no_proof: indexed_*_range_keys → the bounded equivalent.
  • The keys-only projection preserves the old read cost: ranking pairs come straight off the pinned secondary view, no primary values resolved.
  • One request shape now serves reads, proving, and verification.

This needs the attested-skip field on PathQueryRun (grovedb #836), so the grovedb pin moves 753a11f1 → 6b34ea81 (current grovedb develop, merged commits only), and rs-drive gains a direct grovedb-query dep at the same rev for the AxisQuery builder. Bump fallout: grovedb #833 made transaction commit/rollback/savepoint return grovedb_storage::Error directly, so drive-abci's three RocksDBError(e) re-wraps become StorageError(e).

Tests

  • drive ranked: 72 passed (incl. prove+verify round trips, empty-index proving, tamper rejection)
  • drive having: 38 passed
  • drive-abci document_query: 108 passed
  • dash-platform-queries: 37 passed
  • drive builds clean under server,verify and verify-only feature cuts

🤖 Generated with Claude Code

…b's unified PathQuery surface
grovedb is retiring the standalone indexed-axis provers/verifiers from
its public API (dashpay/grovedb#839) so the standalone envelope wire
format never becomes consensus-frozen — the unified PathQuery surface
(prove_query / verify_path_query over new_axis_top_k / new_axis_bounded)
is the only public proof surface for indexed-axis reads. This switches
the four remaining direct call sites:
- execute_top_k_with_proof: prove_indexed_axis_top_k_paginated →
prove_query(PathQuery::new_axis_top_k)
- verify_ranked_top_k_proof/v0: verify_indexed_axis_top_k_paginated →
verify_path_query, destructuring VerifiedPathQuery::AxisEntries
- execute_range_with_proof: prove_indexed_{count,sum,avg}_query →
prove_query(PathQuery::new_axis_bounded)
- verify_having_range_proof/v0: verify_indexed_{count,sum,avg}_query →
verify_path_query
Wire format changes (standalone envelopes → GroveDBProof V1 with an
axis descent); both surfaces are unreleased and prover+verifier switch
together in this commit. The semantic core of the proofs is
byte-identical between the two envelopes (pinned by grovedb's
envelope_byte_equality_tests, dashpay/grovedb#837).
Consequences pinned by updated tests:
- AxisRangeBounds::merk_query is retired: grovedb's shared bounded-axis
lowering is now the prover/verifier agreement artifact on both sides
(AxisRangeBounds::i128_bounds feeds it losslessly), so the two repos
can no longer drift on the bounds-to-keyspace translation.
- Having-range over a completely empty secondary now PROVES instead of
erroring (the unified prover carries the empty-secondary convention
the ranked paginated prover already had);
an_empty_match_set_reads_empty_and_proves_empty flipped to the
round-trip its comment promised, and drive-abci's
empty_ranking_proof_rejection remains as a backstop.
- The unified verifier is query-as-input rather than echo-checked: a
proof verifies under any query whose answer it correctly attests, so
the limit-tamper arm of a_proof_does_not_verify_under_different_bounds
now pins that the same bytes verify under an answer-equivalent limit
(to the correct answer) while answer-changing tampers (bounds,
direction) still fail closed.
- prove_query proves committed state and takes no transaction; the
executors keep their TransactionArg for signature stability (the
query dispatch passes None on this surface).
Tests: drive ranked (72) + having (38) + drive-abci document_query
(108) + dash-platform-queries (37) all pass.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitaiBot commented Aug 26, 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: Pro Plus

Run ID: 251cbc3d-4cd6-4ed5-a50e-f177ba2a1fa4

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 26, 2026

Copy link
Copy Markdown
Collaborator

ℹ️ Review skipped (commit a2faef1)
Last checked: 2026-08-26 17:00 UTC

…ath_query; bump grovedb to 6b34ea81
grovedb is also retiring the per-axis trusted-read wrappers
(indexed_*_top_k_paginated_keys, indexed_*_range_keys, ...) to
crate-internal engine status: run_path_query over the same axis
PathQuery is the only public read surface, so one request shape serves
reads (run_path_query), proving (prove_query) and verification
(verify_path_query).
- execute_top_k_no_proof: indexed_*_top_k_paginated_keys →
run_path_query(PathQuery::new_axis(AxisQuery::top_k(..).keys_only()))
destructuring PathQueryRun::AxisKeys { keys, skipped }
- execute_range_no_proof: indexed_*_range_keys →
run_path_query(PathQuery::new_axis(AxisQuery::bounded(..).keys_only()))
- test helpers in ranked_index_e2e_tests and ranked_group_drain moved
off the retired wrappers onto the same route
The keys-only projection preserves the old wrappers' read cost: the
ranking pairs come straight off the pinned secondary view, no primary
values resolved.
Requires the attested-skip field on PathQueryRun's axis variants
(grovedb #836), so the grovedb pin moves 753a11f1 → 6b34ea81 (current
grovedb develop; merged commits only). rs-drive gains a direct
grovedb-query dependency at the same rev for the AxisQuery builder
(grovedb re-exports it at the root only after dashpay/grovedb#839).
Fallout from the bump: grovedb #833 made transaction
commit/rollback/savepoint return grovedb_storage::Error directly, so
drive-abci's three RocksDBError(e) re-wraps become StorageError(e).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
grovedb #839 (squashed as 6c882c3e) retires the standalone indexed-axis
provers/verifiers, leaving PathQuery as the only public proof surface.
This PR already routes everything through PathQuery, so the bump is a
pin move from develop~1 (6b34ea81) with no platform code changes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@QuantumExplorer
QuantumExplorer merged commit dd061f9 into time-range-indexesAug 26, 2026
1 check passed
@QuantumExplorer
QuantumExplorer deleted the claude/ranked-queries-unified-pathquery branch August 26, 2026 16:59
QuantumExplorer added a commit that referenced this pull request Aug 26, 2026
The unified-PathQuery grovedb pin (#4488) changed
rollback_to_savepoint()'s error type so the RocksDBError wrap went
away, leaving |e| StorageError(e) closures that clippy 1.92 rejects
as redundant_closure under CI's -D warnings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for freeto 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

@QuantumExplorer@thepastaclaw