pub struct MultiField32Challenger<F, PF, P, const WIDTH: usize, const RATE: usize>{ /* private fields */ }Expand description
A challenger that operates natively on PF but produces challenges of F: PrimeField32.
Used for optimizing the cost of recursive proof verification of STARKs in SNARKs.
SAFETY: There are some bias complications with using this challenger. In particular, samples are actually random in [0, 2^64) and then reduced to be in F.
Implementations§
Source§impl<F, PF, P, const WIDTH: usize, const RATE: usize> MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> MultiField32Challenger<F, PF, P, WIDTH, RATE>
Trait Implementations§
Source§impl<F, PF, const N: usize, P, const WIDTH: usize, const RATE: usize> CanObserve<[F; N]> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, const N: usize, P, const WIDTH: usize, const RATE: usize> CanObserve<[F; N]> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§impl<F, PF, P, const WIDTH: usize, const RATE: usize> CanObserve<F> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> CanObserve<F> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§impl<F, PF, const N: usize, P, const WIDTH: usize, const RATE: usize> CanObserve<Hash<F, PF, N>> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, const N: usize, P, const WIDTH: usize, const RATE: usize> CanObserve<Hash<F, PF, N>> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§impl<F, PF, P, const WIDTH: usize, const RATE: usize> CanObserve<Vec<Vec<F>>> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> CanObserve<Vec<Vec<F>>> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§impl<F, EF, PF, P, const WIDTH: usize, const RATE: usize> CanSample<EF> for MultiField32Challenger<F, PF, P, WIDTH, RATE>where
F: PrimeField32,
EF: BasedVectorSpace<F>,
PF: PrimeField,
P: CryptographicPermutation<[PF; WIDTH]>,
impl<F, EF, PF, P, const WIDTH: usize, const RATE: usize> CanSample<EF> for MultiField32Challenger<F, PF, P, WIDTH, RATE>where
F: PrimeField32,
EF: BasedVectorSpace<F>,
PF: PrimeField,
P: CryptographicPermutation<[PF; WIDTH]>,
Source§fn sample_array<const N: usize>(&mut self) -> [T; N]
fn sample_array<const N: usize>(&mut self) -> [T; N]
Sample an array of
N challenge values from the transcript.Source§fn sample_vec(&mut self, n: usize) -> Vec<T>
fn sample_vec(&mut self, n: usize) -> Vec<T>
Sample a
Vec of n challenge values from the transcript.Source§impl<F, PF, P, const WIDTH: usize, const RATE: usize> CanSampleBits<usize> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> CanSampleBits<usize> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§fn sample_bits(&mut self, bits: usize) -> usize
fn sample_bits(&mut self, bits: usize) -> usize
The sampled bits are not perfectly uniform, but we can bound the error: every sequence appears with probability 1/p-close to uniform (1/2^b).
Proof:
We denote p = F::ORDER_U32, and b = bits.
If X follows a uniform distribution over F, if we consider the first b bits of X, each
sequence appears either with probability P1 = ⌊p / 2^b⌋ / p or P2 = (1 + ⌊p / 2^b⌋) / p.
We have 1/2^b - 1/p ≤ P1, P2 ≤ 1/2^b + 1/p
Source§impl<F, PF, P, const WIDTH: usize, const RATE: usize> Clone for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> Clone for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§fn clone(&self) -> MultiField32Challenger<F, PF, P, WIDTH, RATE>
fn clone(&self) -> MultiField32Challenger<F, PF, P, WIDTH, RATE>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F, PF, P, const WIDTH: usize, const RATE: usize> Debug for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> Debug for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§impl<F, PF, P, const WIDTH: usize, const RATE: usize> FieldChallenger<F> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> FieldChallenger<F> for MultiField32Challenger<F, PF, P, WIDTH, RATE>
Source§fn observe_algebra_element<A: BasedVectorSpace<F>>(&mut self, alg_elem: A)
fn observe_algebra_element<A: BasedVectorSpace<F>>(&mut self, alg_elem: A)
Absorb an element from a vector space over the base field. Read more
Source§fn observe_algebra_slice<A: BasedVectorSpace<F> + Clone>(
&mut self,
alg_elems: &[A],
)
fn observe_algebra_slice<A: BasedVectorSpace<F> + Clone>( &mut self, alg_elems: &[A], )
Absorb a slice of elements from a vector space over the base field. Read more
Source§fn sample_algebra_element<A: BasedVectorSpace<F>>(&mut self) -> A
fn sample_algebra_element<A: BasedVectorSpace<F>>(&mut self) -> A
Sample an element of a vector space over the base field. Read more
Source§fn observe_base_as_algebra_element<EF>(&mut self, val: F)where
EF: Algebra<F> + BasedVectorSpace<F>,
fn observe_base_as_algebra_element<EF>(&mut self, val: F)where
EF: Algebra<F> + BasedVectorSpace<F>,
Observe base field elements as extension field elements for recursion-friendly transcripts. Read more
Auto Trait Implementations§
impl<F, PF, P, const WIDTH: usize, const RATE: usize> Freeze for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> RefUnwindSafe for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> Send for MultiField32Challenger<F, PF, P, WIDTH, RATE>where
P: Send,
impl<F, PF, P, const WIDTH: usize, const RATE: usize> Sync for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> Unpin for MultiField32Challenger<F, PF, P, WIDTH, RATE>
impl<F, PF, P, const WIDTH: usize, const RATE: usize> UnwindSafe for MultiField32Challenger<F, PF, P, WIDTH, RATE>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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