Struct winter_prover::proof::Queries
source · 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 Merkle tree where a leaf at position i 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 a Merkle authentication path from the leaf i to the tree root.
This struct can contain one or more queries. In cases when more than one query is stored, Merkle authentication paths are compressed to remove redundant nodes.
Internally, all Merkle paths and query values are stored as a sequence of bytes. Thus, to retrieve query values and the corresponding Merkle authentication paths, parse() function should be used.
Implementations§
source§impl Queries
impl Queries
sourcepub fn new<H, E>(
merkle_proof: BatchMerkleProof<H>,
query_values: Vec<Vec<E>>
) -> Querieswhere
H: Hasher,
E: FieldElement,
pub fn new<H, E>(
merkle_proof: BatchMerkleProof<H>,
query_values: Vec<Vec<E>>
) -> Querieswhere
H: Hasher,
E: FieldElement,
Returns queries constructed from evaluations of a set of functions at some number of points in a domain and their corresponding Merkle authentication paths.
For each evaluation point, the same number of values must be provided, and a hash of these values must be equal to a leaf node in the corresponding Merkle authentication path.
§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<H, E>(
self,
domain_size: usize,
num_queries: usize,
values_per_query: usize
) -> Result<(BatchMerkleProof<H>, Table<E>), DeserializationError>
pub fn parse<H, E>( self, domain_size: usize, num_queries: usize, values_per_query: usize ) -> Result<(BatchMerkleProof<H>, Table<E>), DeserializationError>
Convert internally stored bytes into a set of query values and the corresponding Merkle authentication paths.
§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 PartialEq for Queries
impl PartialEq for Queries
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.