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