Skip to main content

verify_distinct_count_proof

Function verify_distinct_count_proof 

Source
pub fn verify_distinct_count_proof(
    query: &DriveDocumentCountQuery<'_>,
    proof: &Proof,
    mtd: &ResponseMetadata,
    limit: u16,
    left_to_right: bool,
    platform_version: &PlatformVersion,
    provider: &dyn ContextProvider,
) -> Result<Vec<SplitCountEntry>, Error>
Expand description

Verify a regular grovedb range proof against a ProvableCountTree and the surrounding tenderdash commit, returning the verified per-(in_key, key) counts the proof commits to.

Thin tenderdash-composition wrapper over DriveDocumentCountQuery::verify_distinct_count_proof in rs-drive (which does the merk-level verification and the in_key extraction from (path, key, element) triples).

§No cross-fork merge

For compound queries (an In clause on a prefix property) each returned SplitCountEntry retains its in_key (the In value for that fork) alongside the terminator key. Cross-fork aggregation is intentionally NOT done here — see SplitCountEntry’s doc for the rationale.

§Trade-off vs. the aggregate path

Proof size is O(distinct (in_key, terminator) pairs matched) rather than O(log n), because each distinct in-range pair emits its own KVCount op instead of being collapsed into a boundary subtree. Still strictly smaller than materialize-and-count.