From d99cabded9b8f05e46f81665b8f9dc0d844d8f7d Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Fri, 4 Feb 2022 15:56:59 +0100 Subject: [PATCH] Working --- starky/src/fibonacci_stark.rs | 18 ++++++++++++++++++ starky/src/lib.rs | 2 ++ starky/src/stark.rs | 3 +++ system_zero/src/system_zero.rs | 4 ++++ 4 files changed, 27 insertions(+) diff --git a/starky/src/fibonacci_stark.rs b/starky/src/fibonacci_stark.rs index f3ffd8a2..ad9685bb 100644 --- a/starky/src/fibonacci_stark.rs +++ b/starky/src/fibonacci_stark.rs @@ -81,6 +81,10 @@ impl, const D: usize> Stark for FibonacciStar ) { todo!() } + + fn degree(&self) -> usize { + 2 + } } #[cfg(test)] @@ -93,6 +97,7 @@ mod tests { use crate::config::StarkConfig; use crate::fibonacci_stark::FibonacciStark; use crate::prover::prove; + use crate::stark_testing::test_low_degree; use crate::verifier::verify; fn fibonacci(n: usize, x0: usize, x1: usize) -> usize { @@ -125,4 +130,17 @@ mod tests { verify(stark, proof, &config) } + + #[test] + fn test_fibonacci_stark_degree() -> Result<()> { + const D: usize = 2; + type C = PoseidonGoldilocksConfig; + type F = >::F; + type S = FibonacciStark; + + let config = StarkConfig::standard_fast_config(); + let num_rows = 1 << 5; + let stark = S::new(num_rows); + test_low_degree(stark) + } } diff --git a/starky/src/lib.rs b/starky/src/lib.rs index e56c0ef6..dd3a6ec3 100644 --- a/starky/src/lib.rs +++ b/starky/src/lib.rs @@ -17,3 +17,5 @@ pub mod verifier; #[cfg(test)] pub mod fibonacci_stark; +#[cfg(test)] +pub mod stark_testing; diff --git a/starky/src/stark.rs b/starky/src/stark.rs index 00441240..9721c203 100644 --- a/starky/src/stark.rs +++ b/starky/src/stark.rs @@ -62,6 +62,9 @@ pub trait Stark, const D: usize>: Sync { yield_constr: &mut RecursiveConstraintConsumer, ); + /// The maximum constraint degree. + fn degree(&self) -> usize; + /// Computes the FRI instance used to prove this Stark. // TODO: Permutation polynomials. fn fri_instance( diff --git a/system_zero/src/system_zero.rs b/system_zero/src/system_zero.rs index 31b8434f..e5990af9 100644 --- a/system_zero/src/system_zero.rs +++ b/system_zero/src/system_zero.rs @@ -80,6 +80,10 @@ impl, const D: usize> Stark for SystemZero usize { + 3 + } } #[cfg(test)]