Skip to main content

FRIParams

Struct FRIParams 

Source
pub struct FRIParams<F> { /* private fields */ }
Expand description

Parameters for an FRI interleaved code proximity protocol.

§Invariants

The dimension of the first-round (reduced) FRI oracle is rs_code.log_dim() == log_terminal_dim + sum(fold_arities). For all oracle specs in input_oracles:

  • log_batch_size <= log_msg_len
  • log_msg_len <= rs_code.log_dim() + log_batch_size (equivalently, log_msg_len <= log_terminal_dim + sum(fold_arities) + log_batch_size)

Implementations§

Source§

impl<F> FRIParams<F>

Source

pub fn rs_code(&self) -> &ReedSolomonCode<F>

The Reed-Solomon code the verifier is testing proximity to.

Source§

impl<F> FRIParams<F>

Source

pub fn n_test_queries(&self) -> usize

The number oracle consistency queries required during the query phase.

Source§

impl<F> FRIParams<F>
where F: BinaryField,

Source

pub fn new( rs_code: ReedSolomonCode<F>, log_batch_size: usize, fold_arities: Vec<usize>, n_test_queries: usize, ) -> Self

§Preconditions
  • sum(fold_arities) must be at most rs_code.log_dim().
Source

pub fn new_batch( rs_code: ReedSolomonCode<F>, oracles: Vec<CodewordSpec>, fold_arities: Vec<usize>, n_test_queries: usize, ) -> Self

Create parameters for a batch of committed codewords with an explicit per-codeword layout.

This is the low-level constructor: the caller supplies the reduced Reed–Solomon code, each codeword’s lift / early & later batch-fold routing, and the fold arities. The proof-size-minimizing selection of those values from a batch of higher-level oracle descriptions lives in Self::optimal_for_batch.

§Preconditions
  • oracles is non-empty.
  • sum(fold_arities) must be at most rs_code.log_dim().
  • For each oracle, log_lift <= rs_code.log_dim().
Source

pub fn with_strategy<MerkleScheme, Strategy>( merkle_scheme: &MerkleScheme, log_msg_len: usize, log_batch_size: Option<usize>, log_inv_rate: usize, n_test_queries: usize, strategy: &Strategy, ) -> Self
where MerkleScheme: MerkleTreeScheme<F>, Strategy: AritySelectionStrategy,

Create parameters using the given arity selection strategy.

§Arguments
  • merkle_scheme - the Merkle tree scheme used for commitments.
  • log_msg_len - the binary logarithm of the length of the message to commit.
  • log_batch_size - if Some, fixes the batch size; if None, the batch size is chosen optimally along with the fold arities.
  • log_inv_rate - the binary logarithm of the inverse Reed–Solomon code rate.
  • n_test_queries - the number of test queries for the FRI protocol.
  • strategy - the strategy for selecting fold arities.
§Preconditions
  • If log_batch_size is Some(b), then b <= log_msg_len.
Source

pub fn optimal_for_batch<MerkleScheme>( merkle_scheme: &MerkleScheme, oracles: &[OracleSpec], log_inv_rate: usize, n_test_queries: usize, ) -> (Self, usize)
where MerkleScheme: MerkleTreeScheme<F>,

Create parameters for a batch of input oracles, minimizing the estimated proof size.

The input oracles may have differing message lengths. Each oracle is reduced into a common first-round FRI oracle, whose dimension is chosen to minimize the estimated proof size; the per-oracle batch sizes and the subsequent fold arities are chosen along with it.

Returns the parameters together with the estimated proof size in bytes.

§Arguments
  • merkle_scheme - the Merkle tree scheme used for commitments.
  • oracles - the oracles to batch. A ZK oracle commits its message interleaved with an equal-length mask (fixed log_batch_size = 1); a non-ZK oracle commits the bare message with a batch size chosen optimally.
  • log_inv_rate - the binary logarithm of the inverse Reed–Solomon code rate.
  • n_test_queries - the number of test queries for the FRI protocol.
§Preconditions
  • oracles is non-empty.
Source

pub const fn n_fold_rounds(&self) -> usize

Number of folding rounds in the FRI protocol.

This is the largest input message length, plus log_n_oracles extra rounds that fold the distinct input oracles together into the batched codeword.

Source

pub const fn n_oracles(&self) -> usize

Number of oracles sent during the fold rounds.

Source

pub const fn index_bits(&self) -> usize

Number of bits in the query indices sampled during the query phase.

Source

pub const fn n_final_challenges(&self) -> usize

Number of folding challenges the verifier sends after receiving the last oracle.

Source

pub fn fold_arities(&self) -> &[usize]

The reduction arities between each oracle sent to the verifier.

Source

pub fn input_oracles(&self) -> &[CodewordSpec]

The specifications of the input oracles batched into the first-round FRI oracle.

Source

pub fn log_batch_size(&self) -> usize

The arity of the reduction to the first round oracle.

Source

pub fn log_len(&self) -> usize

The binary logarithm of the length of the initial oracle.

Source

pub const fn log_msg_len(&self) -> usize

The binary logarithm of the length of the initial message.

This includes the log_n_oracles extra rounds used to fold the distinct input oracles together, so it equals Self::n_fold_rounds.

Trait Implementations§

Source§

impl<F: Clone> Clone for FRIParams<F>

Source§

fn clone(&self) -> FRIParams<F>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<F: Debug> Debug for FRIParams<F>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F> Freeze for FRIParams<F>

§

impl<F> RefUnwindSafe for FRIParams<F>
where F: RefUnwindSafe,

§

impl<F> Send for FRIParams<F>
where F: Send,

§

impl<F> Sync for FRIParams<F>
where F: Sync,

§

impl<F> Unpin for FRIParams<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for FRIParams<F>

§

impl<F> UnwindSafe for FRIParams<F>
where F: UnwindSafe,

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.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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