hyperplonk/poly-iop/src/structs.rs
poly-iop/src/structs.rsRaw
1//! This module defines structs that are shared by all sub protocols.
2
3use arithmetic::VirtualPolynomial;
4use ark_ff::PrimeField;
5use ark_serialize::{CanonicalSerialize, SerializationError, Write};
6
7/// An IOP proof is a collections of
8/// - messages from prover to verifier at each round through the interactive
9/// protocol.
10/// - a point that is generated by the transcript for evaluation
11#[derive(Clone, Debug, Default, PartialEq)]
12pub struct IOPProof<F: PrimeField> {
13 pub point: Vec<F>,
14 pub proofs: Vec<IOPProverMessage<F>>,
15}
16
17/// A message from the prover to the verifier at a given round
18/// is a list of evaluations.
19#[derive(Clone, Debug, Default, PartialEq, Eq, CanonicalSerialize)]
20pub struct IOPProverMessage<F: PrimeField> {
21 pub(crate) evaluations: Vec<F>,
22}
23
24/// Prover State of a PolyIOP.
25pub struct IOPProverState<F: PrimeField> {
26 /// sampled randomness given by the verifier
27 pub challenges: Vec<F>,
28 /// the current round number
29 pub(crate) round: usize,
30 /// pointer to the virtual polynomial
31 pub(crate) poly: VirtualPolynomial<F>,
32}
33
34/// Prover State of a PolyIOP
35pub struct IOPVerifierState<F: PrimeField> {
36 pub(crate) round: usize,
37 pub(crate) num_vars: usize,
38 pub(crate) max_degree: usize,
39 pub(crate) finished: bool,
40 /// a list storing the univariate polynomial in evaluation form sent by the
41 /// prover at each round
42 pub(crate) polynomials_received: Vec<Vec<F>>,
43 /// a list storing the randomness sampled by the verifier at each round
44 pub(crate) challenges: Vec<F>,
45}