remainder/input_layer/
ligero_input_layer.rs

1//! An InputLayer that will have it's claim proven with a Ligero Opening Proof.
2
3use crate::layer::LayerId;
4use ligero::{
5    ligero_structs::LigeroAuxInfo, poseidon_ligero::PoseidonSpongeHasher, LcCommit, LcRoot,
6};
7use serde::{Deserialize, Serialize};
8use shared_types::Field;
9
10/// The Ligero commitment the prover sees, which contains more information than the verifier should see.
11pub type LigeroCommitment<F> = LcCommit<PoseidonSpongeHasher<F>, LigeroAuxInfo<F>, F>;
12/// The Ligero commitment the prover sends the verifier (adds to transcript) which is the commitment to the root.
13pub type LigeroRoot<F> = LcRoot<LigeroAuxInfo<F>, F>;
14
15/// Type alias for Ligero input layer description + optional precommit,
16/// to be used on the prover's end.
17pub type LigeroInputLayerDescriptionWithOptionalProverPrecommit<F> =
18    (LigeroInputLayerDescription<F>, Option<LigeroCommitment<F>>);
19
20/// Type alias for Ligero input layer description + optional precommit,
21/// to be used on the verifier's end.
22pub type LigeroInputLayerDescriptionWithOptionalVerifierPrecommit<F> =
23    (LigeroInputLayerDescription<F>, Option<LigeroRoot<F>>);
24
25#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Hash)]
26#[serde(bound = "F: Field")]
27/// The circuit description of a `LigeroInputLayer`.
28/// Stores the shape information of this layer.
29pub struct LigeroInputLayerDescription<F: Field> {
30    /// The ID of this Ligero Input Layer.
31    pub layer_id: LayerId,
32
33    /// The number of variables this Ligero Input Layer is on.
34    pub num_vars: usize,
35
36    /// The auxiliary information needed to verify the proof.
37    pub aux: LigeroAuxInfo<F>,
38}