You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.9 KiB

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