Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added serialize and deserialize to starky proofs #1630

Merged
merged 8 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions starky/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion starky/src/fibonacci_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
3 changes: 2 additions & 1 deletion starky/src/permutation_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
10 changes: 7 additions & 3 deletions starky/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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>,
Expand Down Expand Up @@ -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>,
Expand Down
3 changes: 2 additions & 1 deletion starky/src/unconstrained_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down