remainder/
input_layer.rs

1//! InputLayer and InputLayerDescription structs, as well as public- and ligero- input layers and
2//! fiat-shamir challenges.
3use crate::layer::LayerId;
4use crate::mle::evals::MultilinearExtension;
5use serde::{Deserialize, Serialize};
6use shared_types::Field;
7
8/// An input layer in order to generate random challenges for Fiat-Shamir.
9pub mod fiat_shamir_challenge;
10/// An input layer in which the input data is committed to using the Ligero PCS.
11pub mod ligero_input_layer;
12
13/// The prover's view of an input layer during circuit proving (undifferentiated as to type).
14/// Note that, being undifferentiated, no functions for adding values or commitments to the transcript are provided.
15#[derive(Debug, Clone)]
16pub struct InputLayer<F: Field> {
17    /// The MLE for the input layer.
18    pub mle: MultilinearExtension<F>,
19    /// The layer ID of the input layer.
20    pub layer_id: LayerId,
21}
22
23impl<F: Field> InputLayer<F> {
24    /// Create a new [InputLayer] from the given MLE, allocating the next available layer ID.
25    pub fn new(mle: MultilinearExtension<F>) -> Self {
26        let layer_id = LayerId::next_input_layer_id();
27        Self { mle, layer_id }
28    }
29}
30
31#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Hash)]
32/// The verifier's view of an input layer during circuit proving, containing
33/// the shape information of this input layer.
34pub struct InputLayerDescription {
35    /// The layer ID of the input layer.
36    pub layer_id: LayerId,
37    /// The number of variables in the input layer.
38    pub num_vars: usize,
39}