Skip to content

Commit

Permalink
Stark: Implement Stone compatible serialization (#625)
Browse files Browse the repository at this point in the history
* add serialization to stark proof and two tests

* test pub

* remove pub use

* add grinding nonce to serialized proof

* pow in little endian

* nonce in be bytes

* clippy, fmt

* add code comment

* fix position of nonce in proof

* poc merge auth paths

* fix state

* add missing sym trace paths

* fmt

* clippy

* add test with 3 queries

* minor refactor

* remove repeated query openings

* fix repeated composition poly openings

* minor change

* use strong fiat shamir for fibonacci test cases

* make public parameters input to serializer

* make serialize method public

* minor refactor

* fmt

* clippy

* clippy

* make serialize_proof pub

* add docs

* add docs

* Add small comment

* Add small comment

* Add small comment

* Update provers/stark/src/proof/stark.rs

* Fmt

---------

Co-authored-by: Agustin <[email protected]>
Co-authored-by: Mauro Toscano <[email protected]>
Co-authored-by: MauroFab <[email protected]>
  • Loading branch information
4 people authored Oct 27, 2023
1 parent a724038 commit 6645ea6
Show file tree
Hide file tree
Showing 6 changed files with 1,196 additions and 24 deletions.
17 changes: 16 additions & 1 deletion provers/stark/src/examples/fibonacci_2_cols_shifted.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use lambdaworks_math::field::{element::FieldElement, traits::IsFFTField};
use lambdaworks_math::{
field::{element::FieldElement, traits::IsFFTField},
traits::Serializable,
};

use crate::{
constraints::boundary::{BoundaryConstraint, BoundaryConstraints},
Expand All @@ -19,6 +22,18 @@ where
pub claimed_index: usize,
}

impl<F> Serializable for PublicInputs<F>
where
F: IsFFTField,
FieldElement<F>: Serializable,
{
fn serialize(&self) -> Vec<u8> {
let mut transcript_init_seed = self.claimed_index.to_be_bytes().to_vec();
transcript_init_seed.extend_from_slice(&self.claimed_value.serialize());
transcript_init_seed
}
}

#[derive(Clone, Debug)]
pub struct Fibonacci2ColsShifted<F>
where
Expand Down
2 changes: 1 addition & 1 deletion provers/stark/src/fri/fri_decommit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ use crate::config::Commitment;

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct FriDecommitment<F: IsPrimeField> {
pub layers_auth_paths_sym: Vec<Proof<Commitment>>,
pub layers_auth_paths: Vec<Proof<Commitment>>,
pub layers_evaluations_sym: Vec<FieldElement<F>>,
}
2 changes: 1 addition & 1 deletion provers/stark/src/fri/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ where
}

FriDecommitment {
layers_auth_paths_sym,
layers_auth_paths: layers_auth_paths_sym,
layers_evaluations_sym,
}
})
Expand Down
Loading

0 comments on commit 6645ea6

Please sign in to comment.