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 crate::VirtualPolynomial;
4use ark_ff::PrimeField;
5use ark_serialize::{CanonicalSerialize, SerializationError, Write};
6
7/// An IOP proof is a collections of messages from prover to verifier at each
8/// round through the interactive protocol.
9#[derive(Clone, Debug, Default, PartialEq, CanonicalSerialize)]
10pub struct IOPProof<F: PrimeField> {
11 pub proofs: Vec<IOPProverMessage<F>>,
12}
13
14/// A message from the prover to the verifier at a given round
15/// is a list of evaluations.
16#[derive(Clone, Debug, Default, PartialEq, CanonicalSerialize)]
17pub struct IOPProverMessage<F: PrimeField> {
18 pub(crate) evaluations: Vec<F>,
19}
20
21/// Prover State of a PolyIOP.
22pub struct IOPProverState<F: PrimeField> {
23 /// sampled randomness given by the verifier
24 pub challenges: Vec<F>,
25 /// the current round number
26 pub(crate) round: usize,
27 /// pointer to the virtual polynomial
28 pub(crate) poly: VirtualPolynomial<F>,
29}
30
31/// Prover State of a PolyIOP
32pub struct IOPVerifierState<F: PrimeField> {
33 pub(crate) round: usize,
34 pub(crate) num_vars: usize,
35 pub(crate) max_degree: usize,
36 pub(crate) finished: bool,
37 /// a list storing the univariate polynomial in evaluation form sent by the
38 /// prover at each round
39 pub(crate) polynomials_received: Vec<Vec<F>>,
40 /// a list storing the randomness sampled by the verifier at each round
41 pub(crate) challenges: Vec<F>,
42}