pub struct Queries { /* private fields */ }Expand description
Decommitments to evaluations of a set of functions at multiple points.
Given a set of functions evaluated over a domain D, a commitment is assumed to be a vector commitment where the i-th vector entry contains evaluations of all functions at xi. Thus, a query (i.e. a single decommitment) for position i includes evaluations of all functions at xi, accompanied by an opening proof of leaf i against the vector commitment string.
This struct can contain one or more queries. In cases when more than one query is stored, a batch opening proof is used in order to compress the individual opening proofs.
Internally, all opening proofs and query values are stored as a sequence of bytes. Thus, to retrieve query values and their corresponding opening proofs, parse() function should be used.
Implementations§
Source§impl Queries
impl Queries
Sourcepub fn new<H: Hasher, E: FieldElement, V: VectorCommitment<H>>(
opening_proof: V::MultiProof,
query_values: Vec<Vec<E>>,
) -> Self
pub fn new<H: Hasher, E: FieldElement, V: VectorCommitment<H>>( opening_proof: V::MultiProof, query_values: Vec<Vec<E>>, ) -> Self
Returns queries constructed from evaluations of a set of functions at some number of points in a domain and their corresponding batch opening proof.
For each evaluation point, the same number of values must be provided.
§Panics
Panics if:
- No queries were provided (
query_valuesis an empty vector). - Any of the queries does not contain any evaluations.
- Not all queries contain the same number of evaluations.
Sourcepub fn parse<E, H, V>(
self,
domain_size: usize,
num_queries: usize,
values_per_query: usize,
) -> Result<(V::MultiProof, Table<E>), DeserializationError>
pub fn parse<E, H, V>( self, domain_size: usize, num_queries: usize, values_per_query: usize, ) -> Result<(V::MultiProof, Table<E>), DeserializationError>
Convert internally stored bytes into a set of query values and the corresponding batch opening proof.
§Panics
Panics if:
domain_sizeis not a power of two.num_queriesis zero.values_per_queryis zero.
Trait Implementations§
Source§impl Deserializable for Queries
impl Deserializable for Queries
Source§fn read_from<R: ByteReader>(
source: &mut R,
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R, ) -> Result<Self, DeserializationError>
Reads a query struct from the specified source and returns the result
§Errors
Returns an error of a valid query struct could not be read from the specified source.
Source§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§impl Serializable for Queries
impl Serializable for Queries
Source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes self and writes the resulting bytes into the target.
Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self.