Added serialize and deserialize to starky proofs (#1630)

* changed to web-time in circuit_builder

* Rustfmt

* lint

* added serialize and deseralize to starky proofs

* linting fix

---------

Co-authored-by: Robin Salen <30937548+Nashtare@users.noreply.github.com>
This commit is contained in:
Arman Aurobindo 2024-10-02 23:36:06 +05:30 committed by GitHub
parent 41dc325e61
commit 27a972f1cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 6 deletions

View File

@ -23,6 +23,7 @@ anyhow = { workspace = true }
hashbrown = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
serde = { workspace = true, features = ["rc"] }
num-bigint = { version = "0.4.3", default-features = false }
# Local dependencies

View File

@ -61,7 +61,8 @@ const FIBONACCI_COLUMNS: usize = 2;
const FIBONACCI_PUBLIC_INPUTS: usize = 3;
impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for FibonacciStark<F, D> {
type EvaluationFrame<FE, P, const D2: usize> = StarkFrame<P, P::Scalar, FIBONACCI_COLUMNS, FIBONACCI_PUBLIC_INPUTS>
type EvaluationFrame<FE, P, const D2: usize>
= StarkFrame<P, P::Scalar, FIBONACCI_COLUMNS, FIBONACCI_PUBLIC_INPUTS>
where
FE: FieldExtension<D2, BaseField = F>,
P: PackedField<Scalar = FE>;

View File

@ -55,7 +55,8 @@ const PERM_COLUMNS: usize = 3;
const PERM_PUBLIC_INPUTS: usize = 1;
impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for PermutationStark<F, D> {
type EvaluationFrame<FE, P, const D2: usize> = StarkFrame<P, P::Scalar, PERM_COLUMNS, PERM_PUBLIC_INPUTS>
type EvaluationFrame<FE, P, const D2: usize>
= StarkFrame<P, P::Scalar, PERM_COLUMNS, PERM_PUBLIC_INPUTS>
where
FE: FieldExtension<D2, BaseField = F>,
P: PackedField<Scalar = FE>;

View File

@ -19,12 +19,14 @@ use plonky2::iop::target::Target;
use plonky2::plonk::config::{GenericConfig, Hasher};
use plonky2::util::serialization::{Buffer, IoResult, Read, Write};
use plonky2_maybe_rayon::*;
use serde::{Deserialize, Serialize};
use crate::config::StarkConfig;
use crate::lookup::GrandProductChallengeSet;
/// Merkle caps and openings that form the proof of a single STARK.
#[derive(Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(bound = "")]
pub struct StarkProof<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize> {
/// Merkle cap of LDEs of trace values.
pub trace_cap: MerkleCap<F, C::Hasher>,
@ -120,7 +122,8 @@ impl<const D: usize> StarkProofTarget<D> {
}
/// Merkle caps and openings that form the proof of a single STARK, along with its public inputs.
#[derive(Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(bound = "")]
pub struct StarkProofWithPublicInputs<
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
@ -217,7 +220,8 @@ pub struct MultiProofChallenges<F: RichField + Extendable<D>, const D: usize, co
}
/// Purported values of each polynomial at the challenge point.
#[derive(Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(bound = "")]
pub struct StarkOpeningSet<F: RichField + Extendable<D>, const D: usize> {
/// Openings of trace polynomials at `zeta`.
pub local_values: Vec<F::Extension>,

View File

@ -45,7 +45,8 @@ const COLUMNS: usize = 2;
const PUBLIC_INPUTS: usize = 0;
impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for UnconstrainedStark<F, D> {
type EvaluationFrame<FE, P, const D2: usize> = StarkFrame<P, P::Scalar, COLUMNS, PUBLIC_INPUTS>
type EvaluationFrame<FE, P, const D2: usize>
= StarkFrame<P, P::Scalar, COLUMNS, PUBLIC_INPUTS>
where
FE: FieldExtension<D2, BaseField = F>,
P: PackedField<Scalar = FE>;