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

source

pub fn new<H, E>( merkle_proof: BatchMerkleProof<H>, query_values: Vec<Vec<E>> ) -> Queries
where 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_values is an empty vector).
  • Any of the queries does not contain any evaluations.
  • Not all queries contain the same number of evaluations.
source

pub fn parse<H, E>( self, domain_size: usize, num_queries: usize, values_per_query: usize ) -> Result<(BatchMerkleProof<H>, Table<E>), DeserializationError>
where E: FieldElement, H: ElementHasher<BaseField = <E as FieldElement>::BaseField>,

Convert internally stored bytes into a set of query values and the corresponding Merkle authentication paths.

§Panics

Panics if:

  • domain_size is not a power of two.
  • num_queries is zero.
  • values_per_query is zero.

Trait Implementations§

source§

impl Clone for Queries

source§

fn clone(&self) -> Queries

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Queries

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Deserializable for Queries

source§

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>

Attempts to deserialize the provided bytes into Self and returns the result. Read more
source§

impl PartialEq for Queries

source§

fn eq(&self, other: &Queries) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serializable for Queries

source§

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

Returns an estimate of how many bytes are needed to represent self.

source§

fn to_bytes(&self) -> Vec<u8>

Serializes self into a vector of bytes.
source§

impl Eq for Queries

source§

impl StructuralPartialEq for Queries

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more