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_lenlog_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>
impl<F> FRIParams<F>
Sourcepub fn n_test_queries(&self) -> usize
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,
impl<F> FRIParams<F>where
F: BinaryField,
Sourcepub fn new(
rs_code: ReedSolomonCode<F>,
log_batch_size: usize,
fold_arities: Vec<usize>,
n_test_queries: usize,
) -> Self
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 mostrs_code.log_dim().
Sourcepub fn new_batch(
rs_code: ReedSolomonCode<F>,
oracles: Vec<CodewordSpec>,
fold_arities: Vec<usize>,
n_test_queries: usize,
) -> Self
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
oraclesis non-empty.sum(fold_arities)must be at mostrs_code.log_dim().- For each oracle,
log_lift <= rs_code.log_dim().
Sourcepub 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,
) -> Selfwhere
MerkleScheme: MerkleTreeScheme<F>,
Strategy: AritySelectionStrategy,
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,
) -> Selfwhere
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- ifSome, fixes the batch size; ifNone, 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_sizeisSome(b), thenb <= log_msg_len.
Sourcepub fn optimal_for_batch<MerkleScheme>(
merkle_scheme: &MerkleScheme,
oracles: &[OracleSpec],
log_inv_rate: usize,
n_test_queries: usize,
) -> (Self, usize)where
MerkleScheme: MerkleTreeScheme<F>,
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 (fixedlog_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
oraclesis non-empty.
Sourcepub const fn n_fold_rounds(&self) -> usize
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.
Sourcepub const fn index_bits(&self) -> usize
pub const fn index_bits(&self) -> usize
Number of bits in the query indices sampled during the query phase.
Sourcepub const fn n_final_challenges(&self) -> usize
pub const fn n_final_challenges(&self) -> usize
Number of folding challenges the verifier sends after receiving the last oracle.
Sourcepub fn fold_arities(&self) -> &[usize]
pub fn fold_arities(&self) -> &[usize]
The reduction arities between each oracle sent to the verifier.
Sourcepub fn input_oracles(&self) -> &[CodewordSpec]
pub fn input_oracles(&self) -> &[CodewordSpec]
The specifications of the input oracles batched into the first-round FRI oracle.
Sourcepub fn log_batch_size(&self) -> usize
pub fn log_batch_size(&self) -> usize
The arity of the reduction to the first round oracle.
Sourcepub const fn log_msg_len(&self) -> usize
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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