Skip to main content

verify_carrier_aggregate_count_and_sum_proof

Function verify_carrier_aggregate_count_and_sum_proof 

Source
pub fn verify_carrier_aggregate_count_and_sum_proof(
    query: &DriveDocumentSumQuery<'_>,
    proof: &Proof,
    mtd: &ResponseMetadata,
    limit: Option<u16>,
    left_to_right: bool,
    platform_version: &PlatformVersion,
    provider: &dyn ContextProvider,
) -> Result<Vec<AverageEntry>, 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 carrier-PCPS AggregateCountAndSumOnRange proof and return the per-In-branch (count, sum) triples. AVG analog of count’s super::document_count::verify_carrier_aggregate_count_proof and sum’s super::document_sum::verify_carrier_aggregate_sum_proof.

Thin tenderdash-composition wrapper over [DriveDocumentSumQuery::verify_carrier_aggregate_count_and_sum_proof]. Used by the prove path when the request shape is select=AVG, group_by=[in_field], where = In(in_field) + range(other_field), prove=true against a PCPS-eligible index — drive routes it to the carrier-PCPS executor.

Result: one AverageEntry per present In branch with in_key = <serialized In value>, key = [], count = Some(n), sum = Some(v). Absent In branches are omitted; the count and sum axes never disagree on present/absent because the proof commits both metrics from the same merk traversal.