hyperplonk/subroutines/src/poly_iop/structs.rs
subroutines/src/poly_iop/structs.rsRaw
1// Copyright (c) 2023 Espresso Systems (espressosys.com)
2// This file is part of the HyperPlonk library.
3
4// You should have received a copy of the MIT License
5// along with the HyperPlonk library. If not, see <https://mit-license.org/>.
6
7//! This module defines structs that are shared by all sub protocols.
8
9use arithmetic::VirtualPolynomial;
10use ark_ff::PrimeField;
11use ark_serialize::{CanonicalSerialize, SerializationError, Write};
12
13/// An IOP proof is a collections of
14/// - messages from prover to verifier at each round through the interactive
15/// protocol.
16/// - a point that is generated by the transcript for evaluation
17#[derive(Clone, Debug, Default, PartialEq, Eq)]
18pub struct IOPProof<F: PrimeField> {
19 pub point: Vec<F>,
20 pub proofs: Vec<IOPProverMessage<F>>,
21}
22
23/// A message from the prover to the verifier at a given round
24/// is a list of evaluations.
25#[derive(Clone, Debug, Default, PartialEq, Eq, CanonicalSerialize)]
26pub struct IOPProverMessage<F: PrimeField> {
27 pub(crate) evaluations: Vec<F>,
28}
29
30/// Prover State of a PolyIOP.
31pub struct IOPProverState<F: PrimeField> {
32 /// sampled randomness given by the verifier
33 pub challenges: Vec<F>,
34 /// the current round number
35 pub(crate) round: usize,
36 /// pointer to the virtual polynomial
37 pub(crate) poly: VirtualPolynomial<F>,
38 /// points with precomputed barycentric weights for extrapolating smaller
39 /// degree uni-polys to `max_degree + 1` evaluations.
40 pub(crate) extrapolation_aux: Vec<(Vec<F>, Vec<F>)>,
41}
42
43/// Prover State of a PolyIOP
44pub struct IOPVerifierState<F: PrimeField> {
45 pub(crate) round: usize,
46 pub(crate) num_vars: usize,
47 pub(crate) max_degree: usize,
48 pub(crate) finished: bool,
49 /// a list storing the univariate polynomial in evaluation form sent by the
50 /// prover at each round
51 pub(crate) polynomials_received: Vec<Vec<F>>,
52 /// a list storing the randomness sampled by the verifier at each round
53 pub(crate) challenges: Vec<F>,
54}