Layer

Trait Layer 

Source
pub trait Layer<F: Field> {
    // Required methods
    fn layer_id(&self) -> LayerId;
    fn initialize(&mut self, claim_point: &[F]) -> Result<()>;
    fn prove(
        &mut self,
        claims: &[&RawClaim<F>],
        transcript: &mut impl ProverTranscript<F>,
    ) -> Result<()>;
    fn compute_round_sumcheck_message(
        &mut self,
        round_index: usize,
        random_coefficients: &[F],
    ) -> Result<Vec<F>>;
    fn bind_round_variable(
        &mut self,
        round_index: usize,
        challenge: F,
    ) -> Result<()>;
    fn sumcheck_round_indices(&self) -> Vec<usize>;
    fn max_degree(&self) -> usize;
    fn get_post_sumcheck_layer(
        &self,
        round_challenges: &[F],
        claim_challenges: &[&[F]],
        random_coefficients: &[F],
    ) -> PostSumcheckLayer<F, F>;
    fn get_claims(&self) -> Result<Vec<Claim<F>>>;
    fn initialize_rlc(
        &mut self,
        random_coefficients: &[F],
        claims: &[&RawClaim<F>],
    );
}
Expand description

A layer is the smallest component of the GKR protocol.

Each Layer is a sub-protocol that takes in some Claim and creates a proof that the Claim is correct

Required Methods§

Source

fn layer_id(&self) -> LayerId

Gets this layer’s ID.

Source

fn initialize(&mut self, claim_point: &[F]) -> Result<()>

Initialize this layer and perform any necessary pre-computation: beta table, number of rounds, etc.

Source

fn prove( &mut self, claims: &[&RawClaim<F>], transcript: &mut impl ProverTranscript<F>, ) -> Result<()>

Tries to prove claims for this layer. There is only a single aggregated claim if our [shared_types::config::ClaimAggregationStrategy] is [shared_types::config::ClaimAggregationStrategy::Interpolative], otherwise we have several claims we take the random linear combination over.

In the process of proving, it mutates itself binding the variables of the expression that define the layer.

If successful, the proof is implicitly included in the modified transcript.

Source

fn compute_round_sumcheck_message( &mut self, round_index: usize, random_coefficients: &[F], ) -> Result<Vec<F>>

Return the evaluations of the univariate polynomial generated during this round of sumcheck.

This must be called with a steadily incrementing round_index & with a securely generated challenge.

Source

fn bind_round_variable( &mut self, round_index: usize, challenge: F, ) -> Result<()>

Mutate the underlying bookkeeping tables to “bind” the given challenge to the bit. labeled with that round_index.

Source

fn sumcheck_round_indices(&self) -> Vec<usize>

The list of sumcheck rounds this layer will prove, by index.

Source

fn max_degree(&self) -> usize

The maximum degree for any univariate in the sumcheck protocol.

Source

fn get_post_sumcheck_layer( &self, round_challenges: &[F], claim_challenges: &[&[F]], random_coefficients: &[F], ) -> PostSumcheckLayer<F, F>

Get the PostSumcheckLayer for a certain layer, which is a struct which represents the fully bound layer. Relevant for the Hyrax IP, where we need commitments to fully bound MLEs as well as their intermediate products.

Source

fn get_claims(&self) -> Result<Vec<Claim<F>>>

Generates and returns all claims that this layer makes onto previous layers.

Source

fn initialize_rlc(&mut self, random_coefficients: &[F], claims: &[&RawClaim<F>])

Transforms the underlying expression in the layer to the expression that must be sumchecked over to verify claims combined using the RLC claim aggregation method presented in Libra (2019).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F: Field> Layer<F> for LayerEnum<F>

Source§

impl<F: Field> Layer<F> for GateLayer<F>

Source§

impl<F: Field> Layer<F> for IdentityGate<F>

The layer trait implementation for IdentityGate, which has the proving functionality as well as the modular functions for each round of sumcheck.

Source§

impl<F: Field> Layer<F> for MatMult<F>

Source§

impl<F: Field> Layer<F> for RegularLayer<F>