arnaucube
arnaucube/hyperplonkPublic Self-hosted repository
hyperplonk/poly-iop/src/structs.rs
poly-iop/src/structs.rsRaw
 1//! Structs for polynomials and extensions.
 2
 3use crate::VirtualPolynomial;
 4use ark_ff::PrimeField;
 5use std::marker::PhantomData;
 6
 7#[derive(Clone, Debug, Default, PartialEq)]
 8/// Auxiliary information about the multilinear polynomial
 9pub struct DomainInfo<F: PrimeField> {
10    /// max number of multiplicands in each product
11    pub max_degree: usize,
12    /// number of variables of the polynomial
13    pub num_variables: usize,
14    /// Associated field
15    #[doc(hidden)]
16    pub(crate) phantom: PhantomData<F>,
17}
18
19/// Subclaim when verifier is convinced
20pub struct SubClaim<F: PrimeField> {
21    /// the multi-dimensional point that this multilinear extension is evaluated
22    /// to
23    pub point: Vec<F>,
24    /// the expected evaluation
25    pub expected_evaluation: F,
26}
27
28/// An IOP proof is a list of messages from prover to verifier
29/// through the interactive protocol.
30/// It is a shared struct for both sumcheck and zerocheck protocols.
31#[derive(Clone, Debug, Default, PartialEq)]
32pub struct IOPProof<F: PrimeField> {
33    pub proofs: Vec<IOPProverMessage<F>>,
34}
35
36/// A message from the prover to the verifier at a given round
37/// is a list of evaluations.
38#[derive(Clone, Debug, Default, PartialEq)]
39pub struct IOPProverMessage<F: PrimeField> {
40    pub(crate) evaluations: Vec<F>,
41}
42
43/// Prover State of a PolyIOP
44pub struct IOPProverState<F: PrimeField> {
45    /// sampled randomness given by the verifier
46    pub challenges: Vec<F>,
47    /// the current round number
48    pub(crate) round: usize,
49    /// pointer to the virtual polynomial
50    pub(crate) poly: VirtualPolynomial<F>,
51}
52
53/// Prover State of a PolyIOP
54pub struct IOPVerifierState<F: PrimeField> {
55    pub(crate) round: usize,
56    pub(crate) num_vars: usize,
57    pub(crate) max_degree: usize,
58    pub(crate) finished: bool,
59    /// a list storing the univariate polynomial in evaluation form sent by the
60    /// prover at each round
61    pub(crate) polynomials_received: Vec<Vec<F>>,
62    /// a list storing the randomness sampled by the verifier at each round
63    pub(crate) challenges: Vec<F>,
64}