Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
f5e39e3
feat(grovedb,query): allow AggregateCountOnRange as carrier subquery
QuantumExplorer May 14, 2026
73ccbc2
fix(grovedb,query): address review feedback on carrier ACOR
QuantumExplorer May 14, 2026
ae7962d
test(grovedb,query): boost carrier ACOR patch coverage
QuantumExplorer May 14, 2026
f31fcb2
refactor(grovedb): reject V0 envelopes for AggregateCountOnRange enti…
QuantumExplorer May 14, 2026
4219045
fix(grovedb): support right-to-left direction in carrier ACOR verifier
QuantumExplorer May 14, 2026
d8ddda5
docs(grovedb): tone down carrier ACOR direction comment
QuantumExplorer May 14, 2026
e1dddd5
refactor(grovedb,query): drop "ACOR" abbreviation for forward-compat
QuantumExplorer May 14, 2026
066c774
refactor(grovedb): split aggregate_count proof module into submodules
QuantumExplorer May 14, 2026
19739e5
fix(grovedb): canonical decoding for aggregate-count proofs
QuantumExplorer May 14, 2026
f1c365a
test(grovedb,query): pin nested-carrier rejection
QuantumExplorer May 14, 2026
7b083f5
test(grovedb): pin SQL-style A=1, B>4, COUNT(C>4) carrier query
QuantumExplorer May 14, 2026
0dbeff4
fix(grovedb): emit lower-layer for empty count tree under carrier ACOR
QuantumExplorer May 14, 2026
2bbf7d1
fix(grovedb): tighten query_aggregate_count to leaf-only validation
QuantumExplorer May 14, 2026
fc4e09e
fix(grovedb): surface InvalidProof instead of panicking on classifica…
QuantumExplorer May 14, 2026
d1cd151
feat(grovedb): add no-proof query_aggregate_count_per_key entry point
QuantumExplorer May 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
877 changes: 877 additions & 0 deletions grovedb-query/src/aggregate_count.rs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions grovedb-query/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
/// Error types for query operations.
pub mod error;

/// `AggregateCountOnRange` (ACOR) construction and validation. The
/// shape, detection, and leaf/carrier rule sets live here; the proof
/// generation and verification live in the `grovedb` crate.
mod aggregate_count;

/// Aggregate sum query for sum-up-to style queries.
pub mod aggregate_sum_query;

Expand Down
372 changes: 0 additions & 372 deletions grovedb-query/src/query.rs

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions grovedb/src/operations/get/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,16 @@ where {
/// skips proof generation, serialization, and verification entirely.
///
/// `path_query` must satisfy
/// [`PathQuery::validate_aggregate_count_on_range`] — a single
/// `AggregateCountOnRange(_)` item, no subqueries, no pagination, and an
/// inner range that isn't `Key`, `RangeFull`, or another
/// `AggregateCountOnRange`. Any other shape is rejected up front with
/// [`PathQuery::validate_leaf_aggregate_count_on_range`] — strictly the
/// **leaf** shape: a single `AggregateCountOnRange(_)` item, no
/// subqueries, no pagination, and an inner range that isn't `Key`,
/// `RangeFull`, or another `AggregateCountOnRange`. Carrier-shape
/// queries (outer `Keys` + `AggregateCountOnRange` subquery) are
/// rejected here because this entry point returns one `u64` and has
/// no way to surface per-outer-key counts; use
/// [`Self::prove_query`] +
/// [`Self::verify_aggregate_count_query_per_key`](GroveDb::verify_aggregate_count_query_per_key)
/// for those. Any other shape is rejected up front with
/// `Error::InvalidQuery` before any merk reads happen.
///
/// The subtree at `path_query.path` must be a `ProvableCountTree` or
Expand Down Expand Up @@ -701,12 +707,14 @@ where {

let mut cost = OperationCost::default();

// Up-front shape validation: same gate the prover and verifier use.
// Catches malformed ACOR queries (illegal inner range, ACOR-hidden-in-
// subquery, pagination, etc.) before any storage reads.
// Up-front shape validation. Strictly the leaf shape — this
// entry point returns a single `u64` and has no way to surface
// per-outer-key carrier results. Catches malformed leaf
// aggregate-count queries (illegal inner range, pagination,
// etc.) AND carrier-shape queries before any storage reads.
let inner_range = cost_return_on_error_no_add!(
cost,
path_query.validate_aggregate_count_on_range().cloned()
path_query.validate_leaf_aggregate_count_on_range().cloned()
);

let tx = TxRef::new(&self.db, transaction);
Expand Down
Loading
Loading