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, E, V>(
opening_proof: <V as VectorCommitment<H>>::MultiProof,
query_values: Vec<Vec<E>>,
) -> Queries
pub fn new<H, E, V>( opening_proof: <V as VectorCommitment<H>>::MultiProof, query_values: Vec<Vec<E>>, ) -> Queries
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 as VectorCommitment<H>>::MultiProof, Table<E>), DeserializationError>where
E: FieldElement,
H: ElementHasher<BaseField = <E as FieldElement>::BaseField>,
V: VectorCommitment<H>,
pub fn parse<E, H, V>(
self,
domain_size: usize,
num_queries: usize,
values_per_query: usize,
) -> Result<(<V as VectorCommitment<H>>::MultiProof, Table<E>), DeserializationError>where
E: FieldElement,
H: ElementHasher<BaseField = <E as FieldElement>::BaseField>,
V: VectorCommitment<H>,
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>(source: &mut R) -> Result<Queries, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<Queries, DeserializationError>where
R: ByteReader,
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>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
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.