From 4de33d6102cf1ab2a08407d6170ba26f05bb7c48 Mon Sep 17 00:00:00 2001 From: armanthepythonguy Date: Wed, 11 Sep 2024 02:19:52 +0530 Subject: [PATCH 1/5] changed to web-time in circuit_builder --- plonky2/src/plonk/circuit_builder.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index b36a78f038..784794eada 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -4,7 +4,9 @@ use alloc::{collections::BTreeMap, sync::Arc, vec, vec::Vec}; use core::cmp::max; #[cfg(feature = "std")] -use std::{collections::BTreeMap, sync::Arc, time::Instant}; +use std::{collections::BTreeMap, sync::Arc}; +#[cfg(feature = "timing")] +use web_time::Instant; use hashbrown::{HashMap, HashSet}; use itertools::Itertools; From e77cde2709ef96f9a087b9af7a3da13076999164 Mon Sep 17 00:00:00 2001 From: Robin Salen <30937548+Nashtare@users.noreply.github.com> Date: Wed, 11 Sep 2024 06:04:00 +0900 Subject: [PATCH 2/5] Rustfmt --- plonky2/src/plonk/circuit_builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index 784794eada..d0d96f39ba 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -5,12 +5,12 @@ use alloc::{collections::BTreeMap, sync::Arc, vec, vec::Vec}; use core::cmp::max; #[cfg(feature = "std")] use std::{collections::BTreeMap, sync::Arc}; -#[cfg(feature = "timing")] -use web_time::Instant; use hashbrown::{HashMap, HashSet}; use itertools::Itertools; use log::{debug, info, warn, Level}; +#[cfg(feature = "timing")] +use web_time::Instant; use crate::field::cosets::get_unique_coset_shifts; use crate::field::extension::{Extendable, FieldExtension}; From 23700eb938cc81a4e3a0836e442208707c970bdb Mon Sep 17 00:00:00 2001 From: armanthepythonguy Date: Wed, 11 Sep 2024 02:34:22 +0530 Subject: [PATCH 3/5] lint --- plonky2/src/plonk/circuit_builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index 784794eada..d0d96f39ba 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -5,12 +5,12 @@ use alloc::{collections::BTreeMap, sync::Arc, vec, vec::Vec}; use core::cmp::max; #[cfg(feature = "std")] use std::{collections::BTreeMap, sync::Arc}; -#[cfg(feature = "timing")] -use web_time::Instant; use hashbrown::{HashMap, HashSet}; use itertools::Itertools; use log::{debug, info, warn, Level}; +#[cfg(feature = "timing")] +use web_time::Instant; use crate::field::cosets::get_unique_coset_shifts; use crate::field::extension::{Extendable, FieldExtension}; From 757b5925743df2473d2b3641aed20d31629eb283 Mon Sep 17 00:00:00 2001 From: armanthepythonguy Date: Wed, 2 Oct 2024 20:14:08 +0530 Subject: [PATCH 4/5] added serialize and deseralize to starky proofs --- starky/Cargo.toml | 1 + starky/src/proof.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/starky/Cargo.toml b/starky/Cargo.toml index 92fdf4759d..31bd5e6e9b 100644 --- a/starky/Cargo.toml +++ b/starky/Cargo.toml @@ -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 diff --git a/starky/src/proof.rs b/starky/src/proof.rs index 09d3822dd2..31151f1c3b 100644 --- a/starky/src/proof.rs +++ b/starky/src/proof.rs @@ -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, C: GenericConfig, const D: usize> { /// Merkle cap of LDEs of trace values. pub trace_cap: MerkleCap, @@ -120,7 +122,8 @@ impl StarkProofTarget { } /// 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, C: GenericConfig, @@ -217,7 +220,8 @@ pub struct MultiProofChallenges, 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, const D: usize> { /// Openings of trace polynomials at `zeta`. pub local_values: Vec, From f71940336b950ae680c2a26acacf2afc2cacd05a Mon Sep 17 00:00:00 2001 From: armanthepythonguy Date: Wed, 2 Oct 2024 23:26:17 +0530 Subject: [PATCH 5/5] linting fix --- starky/src/fibonacci_stark.rs | 3 ++- starky/src/permutation_stark.rs | 3 ++- starky/src/unconstrained_stark.rs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/starky/src/fibonacci_stark.rs b/starky/src/fibonacci_stark.rs index fdbc081686..69dfc46d37 100644 --- a/starky/src/fibonacci_stark.rs +++ b/starky/src/fibonacci_stark.rs @@ -61,7 +61,8 @@ const FIBONACCI_COLUMNS: usize = 2; const FIBONACCI_PUBLIC_INPUTS: usize = 3; impl, const D: usize> Stark for FibonacciStark { - type EvaluationFrame = StarkFrame + type EvaluationFrame + = StarkFrame where FE: FieldExtension, P: PackedField; diff --git a/starky/src/permutation_stark.rs b/starky/src/permutation_stark.rs index 8a897d792b..ec7f2e41ef 100644 --- a/starky/src/permutation_stark.rs +++ b/starky/src/permutation_stark.rs @@ -55,7 +55,8 @@ const PERM_COLUMNS: usize = 3; const PERM_PUBLIC_INPUTS: usize = 1; impl, const D: usize> Stark for PermutationStark { - type EvaluationFrame = StarkFrame + type EvaluationFrame + = StarkFrame where FE: FieldExtension, P: PackedField; diff --git a/starky/src/unconstrained_stark.rs b/starky/src/unconstrained_stark.rs index c8ce633537..495123acf8 100644 --- a/starky/src/unconstrained_stark.rs +++ b/starky/src/unconstrained_stark.rs @@ -45,7 +45,8 @@ const COLUMNS: usize = 2; const PUBLIC_INPUTS: usize = 0; impl, const D: usize> Stark for UnconstrainedStark { - type EvaluationFrame = StarkFrame + type EvaluationFrame + = StarkFrame where FE: FieldExtension, P: PackedField;