FriProof

Struct FriProof 

Source
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

Source

pub fn new_dummy() -> Self

Creates a dummy FriProof for use in tests.

Source

pub fn num_layers(&self) -> usize

Returns the number of layers in this proof.

Source

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.

Source

pub fn num_partitions(&self) -> usize

Returns the number of partitions used during proof generation.

Source

pub fn size(&self) -> usize

Returns the size of this proof in bytes.

Source

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>
where E: FieldElement, H: ElementHasher<BaseField = E::BaseField>, V: VectorCommitment<H>,

Decomposes this proof into vectors of query values for each layer and corresponding batch opening proofs.

§Panics

Panics if:

  • domain_size is not a power of two.
  • folding_factor is smaller than two or is not a power of two.
§Errors

Returns an error if:

  • This proof is not consistent with the specified domain_size and folding_factor.
  • Any of the layers could not be parsed successfully.
Source

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 E type 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 Clone for FriProof

Source§

fn clone(&self) -> FriProof

Returns a duplicate 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 FriProof

Source§

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

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

impl Deserializable for FriProof

Source§

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>

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

impl PartialEq for FriProof

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serializable for FriProof

Source§

fn write_into<W: ByteWriter>(&self, target: &mut W)

Serializes self and writes the resulting bytes into the target writer.

Source§

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

Serializes self into a vector of bytes.
Source§

fn get_size_hint(&self) -> usize

Returns an estimate of how many bytes are needed to represent self. Read more
Source§

impl Eq for FriProof

Source§

impl StructuralPartialEq for FriProof

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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.