Skip to main content

BaseFoldProverCompiler

Struct BaseFoldProverCompiler 

Source
pub struct BaseFoldProverCompiler<P, NTT>
where P: PackedField<Scalar: BinaryField>, NTT: AdditiveNTT<Field = P::Scalar> + Sync,
{ /* private fields */ }
Expand description

A compiler that creates BaseFold ZK prover channels with precomputed parameters.

This compiler builds a single combined FRI over all oracles, with ZK oracles configured for zero-knowledge mode.

Implementations§

Source§

impl<F, P, NTT> BaseFoldProverCompiler<P, NTT>
where F: BinaryField, P: PackedField<Scalar = F>, NTT: AdditiveNTT<Field = F> + Sync,

Source

pub fn new<H>( ntt: NTT, merkle_scheme: &BinaryMerkleTreeScheme<F, H>, oracle_specs: Vec<OracleSpec>, log_inv_rate: usize, n_test_queries: usize, ) -> Self

Creates a new compiler with precomputed combined FRI parameters.

The merkle_scheme is consulted only for proof-size estimation while choosing the FRI parameters; it is not stored. Each oracle’s batch size is derived from its ZK flag: a ZK oracle fixes log_batch_size = 1 (message ‖ equal-length mask), a non-ZK oracle takes a flexible batch size.

Source

pub fn from_verifier_compiler( verifier_compiler: &BaseFoldVerifierCompiler<F>, ntt: NTT, ) -> Self

Creates a prover compiler from a verifier compiler.

This reuses the precomputed FRI parameters and oracle specifications.

Source

pub const fn ntt(&self) -> &NTT

Returns a reference to the NTT.

Source

pub fn oracle_specs(&self) -> &[OracleSpec]

Returns a reference to the oracle specifications.

Source

pub const fn fri_params(&self) -> &FRIParams<F>

Returns a reference to the precomputed combined FRI parameters.

Source

pub fn create_channel<Channel, A>( &self, channel: Channel, rng: impl CryptoRng, alloc: A, ) -> BaseFoldProverChannel<'_, F, P, NTT, Channel, A>
where Channel: MerkleIPProverChannel<F>, A: Allocator,

Creates a ZK prover channel over the given Merkle channel and an RNG.

The returned channel drives all prover interaction through channel, committing and opening oracles with this compiler’s NTT, oracle specs, and combined FRI parameters. The caller constructs the Merkle channel, so it decides how commitments are produced.

The RNG seeds the channel’s own generator, whose only output is the ZK masks. A mask is what hides a committed witness at the positions the verifier opens. Hiding is therefore only as strong as this RNG, so it must be a cryptographic one.

Source

pub fn create_channel_without_zk<Channel, A>( &self, channel: Channel, alloc: A, ) -> BaseFoldProverChannel<'_, F, P, NTT, Channel, A>
where Channel: MerkleIPProverChannel<F>, A: Allocator,

Creates a prover channel for a compiler whose oracles are all non-ZK.

A mask is drawn from the channel’s RNG only when committing a ZK oracle. With no ZK oracle the RNG is never read, so its seed cannot affect the proof. The seed is therefore fixed, and no randomness needs to be supplied by the caller.

§Panics

Panics if any configured oracle is ZK. A ZK oracle would draw its mask from the fixed seed, which destroys the hiding property. So this constructor refuses to build a channel that could mask deterministically.

Source

pub fn create_channel_from_transcript<H, Challenger_, T, A>( &self, transcript: T, rng: impl CryptoRng, alloc: A, ) -> TranscriptBaseFoldProverChannel<'_, F, P, NTT, T, Challenger_, H, A>
where H: ParallelHashSuite, Challenger_: Challenger, T: BorrowMut<ProverTranscript<Challenger_>>, Output<H::LeafHash>: SerializeBytes, A: Allocator,

Creates a ZK prover channel over a transcript, for the common case.

The transcript may be owned or mutably borrowed. It is wrapped in a ProverMerkleTranscriptChannel for the given hash suite. That channel is then passed to Self::create_channel. alloc backs both the channel’s working buffers and the nodes of every Merkle tree it commits, so one pool serves the whole opening.

Source

pub fn create_channel_without_zk_from_transcript<H, Challenger_, T, A>( &self, transcript: T, alloc: A, ) -> TranscriptBaseFoldProverChannel<'_, F, P, NTT, T, Challenger_, H, A>
where H: ParallelHashSuite, Challenger_: Challenger, T: BorrowMut<ProverTranscript<Challenger_>>, Output<H::LeafHash>: SerializeBytes, A: Allocator,

Creates a non-ZK prover channel over a transcript, for the common case.

The transcript handling matches Self::create_channel_from_transcript; the channel is built with Self::create_channel_without_zk and panics under the same conditions.

Trait Implementations§

Source§

impl<P, NTT> Debug for BaseFoldProverCompiler<P, NTT>
where P: PackedField<Scalar: BinaryField> + Debug, NTT: AdditiveNTT<Field = P::Scalar> + Sync + Debug, P::Scalar: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P, NTT> Freeze for BaseFoldProverCompiler<P, NTT>
where <<P as FieldOps>::Scalar as UnderlierView>::Underlier: Sized, <P as FieldOps>::Scalar: Sized, NTT: Freeze,

§

impl<P, NTT> RefUnwindSafe for BaseFoldProverCompiler<P, NTT>

§

impl<P, NTT> Send for BaseFoldProverCompiler<P, NTT>
where <<P as FieldOps>::Scalar as UnderlierView>::Underlier: Sized, <P as FieldOps>::Scalar: Sized, NTT: Send,

§

impl<P, NTT> Sync for BaseFoldProverCompiler<P, NTT>

§

impl<P, NTT> Unpin for BaseFoldProverCompiler<P, NTT>
where <<P as FieldOps>::Scalar as UnderlierView>::Underlier: Sized, <P as FieldOps>::Scalar: Sized + Unpin, NTT: Unpin, P: Unpin,

§

impl<P, NTT> UnsafeUnpin for BaseFoldProverCompiler<P, NTT>

§

impl<P, NTT> UnwindSafe for BaseFoldProverCompiler<P, NTT>

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