Skip to main content

Crate drive_proof_verifier

Crate drive_proof_verifier 

Source
Expand description

Proof verification library for Dash Drive

Re-exports§

pub use error::Error;

Modules§

error
Errors that can occur during proof verification
from_request
From Request Conversions between Drive queries and dapi-grpc requests.
types
Object types that can be retrieved from proofs.
unproved
Implementation of unproved verification

Structs§

AverageEntry
A single per-key average entry. Carries BOTH count and sum so the client can divide; the server intentionally doesn’t pre-divide (see the module docstring).
ChainedDocuments
The verified result of a chained document query, both halves in inner-proof order.
CompositeDocuments
The verified result of a composite document query.
DocumentAverage
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. The (count, sum) pair across documents matching a query, verified from proof. Client computes avg = sum / count using whichever precision representation it wants.
DocumentCount
The count of documents matching a query, verified from proof.
DocumentHavingEntries
Verified having-range (GROUP BY … HAVING <aggregate> <op> <value> LIMIT n) result types. DocumentHavingEntries carries one entry per matching group in axis order; verify_having_range_proof is the tenderdash-composition wrapper that binds the proof’s reconstructed root hash to the signed app hash and returns the verified entry list — including its completeness: an in-range group the node omitted fails verification. One page of a GROUP BY … HAVING <aggregate> <op> <value> LIMIT n query: the groups whose aggregate falls inside the bound.
DocumentRankedEntries
Verified ranked (GROUP BY … ORDER BY <aggregate> LIMIT n [OFFSET m]) result types. DocumentRankedEntries carries one entry per returned group in ranking order, plus the starting_rank that pins each entry to an absolute position; verify_ranked_top_k_proof is the tenderdash-composition wrapper that binds the proof’s reconstructed root hash to the signed app hash and returns the whole verified drive::query::RankedPage. One page of a GROUP BY … ORDER BY <aggregate> LIMIT n [OFFSET m] query: the ranked groups, plus the rank the page starts at.
DocumentSplitAverages
The full per-entry average result, verified from proof.
DocumentSplitCounts
The split counts of documents matching a query, verified from proof.
DocumentSplitSums
Verified sum result types. Sum-side analogs of DocumentCount / DocumentSplitCounts; see their respective module docs for the grovedb PR 670 dependency status. The full per-entry sum result, verified from proof.
DocumentSum
The aggregated sum of an integer property across documents matching a query, verified from proof.
MockContextProvider
Mock ContextProvider that can read quorum keys from files.
RankedEntry
One group in a ranked result: the group’s index key plus its aggregate.
RankedPage
A page of a ranked result: the entries, plus how many ranks were actually skipped to reach them.
SplitAverageEntry
A single verified (in_key?, key, count, sum) entry from an average query with group_by. Mirrors sum’s SplitSumEntry shape with both metrics carried alongside.
SplitCountEntry
An entry in a split count result, containing the serialized key(s) and the count of documents matching them.
SplitSumEntry
Verified sum result types. Sum-side analogs of DocumentCount / DocumentSplitCounts; see their respective module docs for the grovedb PR 670 dependency status. A single verified (in_key?, key, sum) entry from a sum query with group_by. Mirrors count’s SplitCountEntry shape.
SumEntry
A single per-key sum entry, parallels count’s SplitCountEntry.

Enums§

CompositeSubQueryResult
One sub-query’s materialized result.
ContextProviderError
Errors returned by the context provider
RankedEntryValue
The aggregate value carried by one ranked entry. Mirrors grovedb’s [grovedb::operations::proof::indexed_axis::AxisEntries] variants exactly, one scalar at a time, so a Vec<RankedEntry> and an AxisEntries carry the same information with the same types.

Constants§

RANKED_AVG_SCALE
SCALE for the fixed-point average: 10^19, the largest power of ten whose worst-case product |i64::MIN| × SCALE still fits in i128 (≈ 9.2×10^37 against i128::MAX ≈ 1.7×10^38 — proven by the compile-time assertion below).

Traits§

ContextProvider
Interface between the Sdk and state of the application.
DataContractProvider
A trait that provides a function that can be used to look up a [DataContract] by its [Identifier].
FromProof
Parse and verify the received proof and retrieve the requested object, if any.
Length
Determine number of non-None elements

Functions§

verify_aggregate_count_and_sum_proof
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).
verify_aggregate_count_proof
Verify a grovedb AggregateCountOnRange proof and the surrounding tenderdash commit, returning the verified document count.
verify_aggregate_sum_proof
Verify a grovedb AggregateSumOnRange proof and the surrounding tenderdash commit, returning the verified i64 sum from one range traversal. Used by the prove path’s select=SUM, group_by=[] with a range clause on a rangeSummable: true index.
verify_carrier_aggregate_count_and_sum_proof
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.
verify_carrier_aggregate_count_proof
Verify a carrier AggregateCountOnRange proof against a rangeCountable: true index and return the per-In-branch counts.
verify_carrier_aggregate_sum_proof
Verify a carrier AggregateSumOnRange proof against a rangeSummable: true index and return the per-In-branch sums.
verify_chained_documents_tenderdash_proof
Verify a chained query’s single merged proof and bind its root hash to the quorum signature.
verify_composite_documents_tenderdash_proof
Verify a composite query’s single merged proof and bind its root hash to the quorum signature.
verify_distinct_count_and_sum_proof
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 per-distinct-key range-AVG proof against an index that declares BOTH rangeCountable: true AND rangeSummable: true (a rangeAverageable: true index) and return per-(in_key, key) (count, sum) entries. AVG analog of super::document_sum::verify_distinct_sum_proof.
verify_distinct_count_proof
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.
verify_distinct_sum_proof
Verify a per-distinct-key range-sum proof against a rangeSummable: true index and return the per-(in_key, key) sums.
verify_having_range_proof
Verified having-range (GROUP BY … HAVING <aggregate> <op> <value> LIMIT n) result types. DocumentHavingEntries carries one entry per matching group in axis order; verify_having_range_proof is the tenderdash-composition wrapper that binds the proof’s reconstructed root hash to the signed app hash and returns the verified entry list — including its completeness: an in-range group the node omitted fails verification. Verify a grovedb indexed-axis range proof and the surrounding tenderdash commit, returning the reconstructed root hash and the matching groups it commits to.
verify_point_lookup_count_and_sum_proof
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 grovedb point-lookup proof against a count-sum-bearing index terminator and return per-branch (count, sum) entries. AVG analog of super::document_sum::verify_point_lookup_sum_proof.
verify_point_lookup_count_proof
Verify a grovedb point-lookup count proof against a countable: true index and return the per-branch entries.
verify_point_lookup_sum_proof
Verify a grovedb point-lookup sum proof and return the per-branch entries. Sum analog of count’s super::document_count::verify_point_lookup_count_proof.
verify_primary_key_count_sum_tree_proof
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 grovedb proof of the document type’s primary-key count-sum-bearing element (CountSumTree / ProvableCountSumTree / ProvableCountProvableSumTree) and return the unfiltered (count, sum) pair.
verify_primary_key_count_tree_proof
Verify a grovedb proof of the document type’s primary-key CountTree element and return the unfiltered total count.
verify_primary_key_sum_tree_proof
Verify a grovedb proof of the document type’s primary-key SumTree element and return the unfiltered total sum.
verify_ranked_top_k_proof
Verified ranked (GROUP BY … ORDER BY <aggregate> LIMIT n [OFFSET m]) result types. DocumentRankedEntries carries one entry per returned group in ranking order, plus the starting_rank that pins each entry to an absolute position; verify_ranked_top_k_proof is the tenderdash-composition wrapper that binds the proof’s reconstructed root hash to the signed app hash and returns the whole verified drive::query::RankedPage. Verify a grovedb indexed-axis top-k proof and the surrounding tenderdash commit, returning the reconstructed root hash and the RankedPage it commits to.