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}
39
40/// Prover State of a PolyIOP
41pub struct IOPVerifierState<F: PrimeField> {
42 pub(crate) round: usize,
43 pub(crate) num_vars: usize,
44 pub(crate) max_degree: usize,
45 pub(crate) finished: bool,
46 /// a list storing the univariate polynomial in evaluation form sent by the
47 /// prover at each round
48 pub(crate) polynomials_received: Vec<Vec<F>>,
49 /// a list storing the randomness sampled by the verifier at each round
50 pub(crate) challenges: Vec<F>,
51}