-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/icicle
- Loading branch information
Showing
31 changed files
with
338 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use lambdaworks_math::{ | ||
field::{ | ||
element::FieldElement, | ||
traits::{IsField, IsSubFieldOf}, | ||
}, | ||
traits::AsBytes, | ||
}; | ||
|
||
/// The functionality of a transcript to be used in the STARK Prove and Verify protocols. | ||
pub trait IsTranscript<F: IsField> { | ||
/// Appends a field element to the transcript. | ||
fn append_field_element(&mut self, element: &FieldElement<F>); | ||
/// Appends a bytes to the transcript. | ||
fn append_bytes(&mut self, new_bytes: &[u8]); | ||
/// Returns the inner state of the transcript that fully determines its outputs. | ||
fn state(&self) -> [u8; 32]; | ||
/// Returns a random field element. | ||
fn sample_field_element(&mut self) -> FieldElement<F>; | ||
/// Returns a random index between 0 and `upper_bound`. | ||
fn sample_u64(&mut self, upper_bound: u64) -> u64; | ||
/// Returns a field element not contained in `lde_roots_of_unity_coset` or `trace_roots_of_unity`. | ||
fn sample_z_ood<S: IsSubFieldOf<F>>( | ||
&mut self, | ||
lde_roots_of_unity_coset: &[FieldElement<S>], | ||
trace_roots_of_unity: &[FieldElement<S>], | ||
) -> FieldElement<F> | ||
where | ||
FieldElement<F>: AsBytes, | ||
{ | ||
loop { | ||
let value: FieldElement<F> = self.sample_field_element(); | ||
if !lde_roots_of_unity_coset | ||
.iter() | ||
.any(|x| x.clone().to_extension() == value) | ||
&& !trace_roots_of_unity | ||
.iter() | ||
.any(|x| x.clone().to_extension() == value) | ||
{ | ||
return value; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub mod default_transcript; | ||
pub mod is_transcript; | ||
#[cfg(feature = "test_fiat_shamir")] | ||
pub mod test_transcript; | ||
pub mod transcript; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
provers/cairo/cairo_programs/cairo0/fibonacci_10000_loop.cairo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
// Looped fibonacci is more efficient | ||
// than calling the fibo function with recursion | ||
// For n = 5, it's 31 steps vs 49 steps | ||
// This is useful to compare with other vms that are not validating the call stack for fibonacci | ||
|
||
func main{}() { | ||
tempvar x0 = 0; | ||
tempvar x1 = 1; | ||
tempvar fib_acc = x0 + x1; | ||
tempvar n = 10000; | ||
loop: | ||
tempvar x0 = x1; | ||
tempvar x1 = fib_acc; | ||
tempvar fib_acc = x0 + x1; | ||
tempvar n = n - 1; | ||
jmp loop if n != 0; | ||
|
||
assert fib_acc = 2287375788429092341882876480321135809824733217263858843173749298459021701670; | ||
return (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "cairo-platinum-ffi" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
# libc = "0.2" | ||
stark-platinum-prover = { path = "../../stark" } | ||
cairo-platinum-prover = { path = "../" } | ||
bincode = { version = "2.0.0-rc.2", tag = "v2.0.0-rc.2", git = "https://github.com/bincode-org/bincode.git", features = ['serde'] } | ||
|
||
[lib] | ||
crate-type = ["cdylib", "staticlib", "lib"] |
Binary file not shown.
Oops, something went wrong.