pub struct FriProof { /* private fields */ }Expand description
A proof generated by a FRI prover.
A FRI proof contains information proving that a function f is a polynomial of some bounded degree d. FRI proofs cannot be instantiated directly - they must be generated by an instance of a FriProver, and can be verified by an instance of a FriVerifier via VerifierChannel interface.
A proof consists of zero or more layers and a remainder polynomial. Each layer contains a set of polynomial evaluations at positions queried by the verifier, a vector commitment to LDE of each polynomial, as well as opening proofs for the evaluations against the vector commitments. The remainder polynomial is given by its list of coefficients i.e. field elements.
All values in a proof are stored as vectors of bytes. Thus, the values must be parsed before they can be returned to the user. To do this, parse_layers() and parse_remainder() methods can be used.
Implementations§
Source§impl FriProof
impl FriProof
Sourcepub fn num_layers(&self) -> usize
pub fn num_layers(&self) -> usize
Returns the number of layers in this proof.
Sourcepub fn num_remainder_elements<E: FieldElement>(&self) -> usize
pub fn num_remainder_elements<E: FieldElement>(&self) -> usize
Returns the number of remainder elements in this proof.
The number of elements is computed by dividing the number of remainder bytes by the size
of the field element specified by E type parameter.
Sourcepub fn num_partitions(&self) -> usize
pub fn num_partitions(&self) -> usize
Returns the number of partitions used during proof generation.
Sourcepub fn parse_layers<E, H, V>(
self,
domain_size: usize,
folding_factor: usize,
) -> Result<(Vec<Vec<E>>, Vec<<V as VectorCommitment<H>>::MultiProof>), DeserializationError>
pub fn parse_layers<E, H, V>( self, domain_size: usize, folding_factor: usize, ) -> Result<(Vec<Vec<E>>, Vec<<V as VectorCommitment<H>>::MultiProof>), DeserializationError>
Decomposes this proof into vectors of query values for each layer and corresponding batch opening proofs.
§Panics
Panics if:
domain_sizeis not a power of two.folding_factoris smaller than two or is not a power of two.
§Errors
Returns an error if:
- This proof is not consistent with the specified
domain_sizeandfolding_factor. - Any of the layers could not be parsed successfully.
Sourcepub fn parse_remainder<E: FieldElement>(
&self,
) -> Result<Vec<E>, DeserializationError>
pub fn parse_remainder<E: FieldElement>( &self, ) -> Result<Vec<E>, DeserializationError>
Returns a vector of remainder values (last FRI layer) parsed from this proof.
§Errors
Returns an error if:
- The number of remainder values implied by a combination of
Etype parameter and the number of remainder bytes in this proof is not a power of two. - Any of the remainder values could not be parsed correctly.
- Not all bytes have been consumed while parsing remainder values.
Trait Implementations§
Source§impl Deserializable for FriProof
impl Deserializable for FriProof
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 FRI proof from the specified source and returns the result.
§Errors
Returns an error if a valid proof could not be read from the source.
Source§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
Source§impl Serializable for FriProof
impl Serializable for FriProof
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 writer.