Skip to main content

verify_aggregate_count_and_sum_proof

Function verify_aggregate_count_and_sum_proof 

Source
pub fn verify_aggregate_count_and_sum_proof(
    query: &DriveDocumentSumQuery<'_>,
    proof: &Proof,
    mtd: &ResponseMetadata,
    platform_version: &PlatformVersion,
    provider: &dyn ContextProvider,
) -> Result<(u64, i64), Error>
Expand description

Verified average result types. Average-side analog of DocumentSum / DocumentSplitSums; carry the (count, sum) pair the verifier recovers from grovedb PR 670’s AggregateCountAndSumOnRange primitive. Client computes avg = sum / count. Verify a leaf-PCPS AggregateCountAndSumOnRange proof and the surrounding tenderdash commit, returning the verified (count, sum) pair. Used by the prove path’s select=AVG, group_by=[] with a range clause on an index that declares BOTH rangeCountable: true AND rangeSummable: true (i.e. the terminator is a ProvableCountProvableSumTree).

Thin tenderdash-composition wrapper over [DriveDocumentSumQuery::verify_aggregate_count_and_sum_proof]. Both metrics come from one root-hash-committed traversal of the PCPS terminator — no way for the server to splice a count from one set with a sum from another.