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§
- Average
Entry - 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).
- Chained
Documents - The verified result of a chained document query, both halves in inner-proof order.
- Composite
Documents - The verified result of a composite document query.
- Document
Average - Verified average result types. Average-side analog of
DocumentSum/DocumentSplitSums; carry the(count, sum)pair the verifier recovers from grovedb PR 670’sAggregateCountAndSumOnRangeprimitive. Client computesavg = sum / count. The(count, sum)pair across documents matching a query, verified from proof. Client computesavg = sum / countusing whichever precision representation it wants. - Document
Count - The count of documents matching a query, verified from proof.
- Document
Having Entries - Verified having-range (
GROUP BY … HAVING <aggregate> <op> <value> LIMIT n) result types.DocumentHavingEntriescarries one entry per matching group in axis order;verify_having_range_proofis 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 aGROUP BY … HAVING <aggregate> <op> <value> LIMIT nquery: the groups whose aggregate falls inside the bound. - Document
Ranked Entries - Verified ranked (
GROUP BY … ORDER BY <aggregate> LIMIT n [OFFSET m]) result types.DocumentRankedEntriescarries one entry per returned group in ranking order, plus thestarting_rankthat pins each entry to an absolute position;verify_ranked_top_k_proofis the tenderdash-composition wrapper that binds the proof’s reconstructed root hash to the signed app hash and returns the whole verifieddrive::query::RankedPage. One page of aGROUP BY … ORDER BY <aggregate> LIMIT n [OFFSET m]query: the ranked groups, plus the rank the page starts at. - Document
Split Averages - The full per-entry average result, verified from proof.
- Document
Split Counts - The split counts of documents matching a query, verified from proof.
- Document
Split Sums - 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. - Document
Sum - The aggregated sum of an integer property across documents matching a query, verified from proof.
- Mock
Context Provider - Mock ContextProvider that can read quorum keys from files.
- Ranked
Entry - One group in a ranked result: the group’s index key plus its aggregate.
- Ranked
Page - A page of a ranked result: the entries, plus how many ranks were actually skipped to reach them.
- Split
Average Entry - A single verified
(in_key?, key, count, sum)entry from an average query withgroup_by. Mirrors sum’sSplitSumEntryshape with both metrics carried alongside. - Split
Count Entry - An entry in a split count result, containing the serialized key(s) and the count of documents matching them.
- Split
SumEntry - 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 withgroup_by. Mirrors count’sSplitCountEntryshape. - SumEntry
- A single per-key sum entry, parallels count’s
SplitCountEntry.
Enums§
- Composite
SubQuery Result - One sub-query’s materialized result.
- Context
Provider Error - Errors returned by the context provider
- Ranked
Entry Value - 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 aVec<RankedEntry>and anAxisEntriescarry 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| × SCALEstill fits ini128(≈ 9.2×10^37 againsti128::MAX≈ 1.7×10^38 — proven by the compile-time assertion below).
Traits§
- Context
Provider - Interface between the Sdk and state of the application.
- Data
Contract Provider - A trait that provides a function that can be used to look up a [DataContract] by its [Identifier].
- From
Proof - 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’sAggregateCountAndSumOnRangeprimitive. Client computesavg = sum / count. Verify a leaf-PCPSAggregateCountAndSumOnRangeproof and the surrounding tenderdash commit, returning the verified(count, sum)pair. Used by the prove path’sselect=AVG, group_by=[]with a range clause on an index that declares BOTHrangeCountable: trueANDrangeSummable: true(i.e. the terminator is aProvableCountProvableSumTree). - verify_
aggregate_ count_ proof - Verify a grovedb
AggregateCountOnRangeproof and the surrounding tenderdash commit, returning the verified document count. - verify_
aggregate_ sum_ proof - Verify a grovedb
AggregateSumOnRangeproof and the surrounding tenderdash commit, returning the verifiedi64sum from one range traversal. Used by the prove path’sselect=SUM, group_by=[]with a range clause on arangeSummable: trueindex. - 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’sAggregateCountAndSumOnRangeprimitive. Client computesavg = sum / count. Verify a carrier-PCPSAggregateCountAndSumOnRangeproof and return the per-In-branch(count, sum)triples. AVG analog of count’ssuper::document_count::verify_carrier_aggregate_count_proofand sum’ssuper::document_sum::verify_carrier_aggregate_sum_proof. - verify_
carrier_ aggregate_ count_ proof - Verify a carrier
AggregateCountOnRangeproof against arangeCountable: trueindex and return the per-In-branch counts. - verify_
carrier_ aggregate_ sum_ proof - Verify a carrier
AggregateSumOnRangeproof against arangeSummable: trueindex 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’sAggregateCountAndSumOnRangeprimitive. Client computesavg = sum / count. Verify a per-distinct-key range-AVG proof against an index that declares BOTHrangeCountable: trueANDrangeSummable: true(arangeAverageable: trueindex) and return per-(in_key, key)(count, sum)entries. AVG analog ofsuper::document_sum::verify_distinct_sum_proof. - verify_
distinct_ count_ proof - Verify a regular grovedb range proof against a
ProvableCountTreeand 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: trueindex 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.DocumentHavingEntriescarries one entry per matching group in axis order;verify_having_range_proofis 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’sAggregateCountAndSumOnRangeprimitive. Client computesavg = sum / count. Verify a grovedb point-lookup proof against a count-sum-bearing index terminator and return per-branch(count, sum)entries. AVG analog ofsuper::document_sum::verify_point_lookup_sum_proof. - verify_
point_ lookup_ count_ proof - Verify a grovedb point-lookup count proof against a
countable: trueindex 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’sAggregateCountAndSumOnRangeprimitive. Client computesavg = 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
CountTreeelement and return the unfiltered total count. - verify_
primary_ key_ sum_ tree_ proof - Verify a grovedb proof of the document type’s primary-key
SumTreeelement and return the unfiltered total sum. - verify_
ranked_ top_ k_ proof - Verified ranked (
GROUP BY … ORDER BY <aggregate> LIMIT n [OFFSET m]) result types.DocumentRankedEntriescarries one entry per returned group in ranking order, plus thestarting_rankthat pins each entry to an absolute position;verify_ranked_top_k_proofis the tenderdash-composition wrapper that binds the proof’s reconstructed root hash to the signed app hash and returns the whole verifieddrive::query::RankedPage. Verify a grovedb indexed-axis top-k proof and the surrounding tenderdash commit, returning the reconstructed root hash and theRankedPageit commits to.