-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
DEFAULT_PRIME = 2**251 + 17 * 2**192 + 1 | ||
|
||
print((pow(193456804421077096570009938751278224656090409051406060084, 193456804421077096570009938751278224656090409051406060084, DEFAULT_PRIME))) | ||
print((pow(3, DEFAULT_PRIME-2, DEFAULT_PRIME))) |
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,34 @@ | ||
use core::array::SpanTrait; | ||
use core::option::OptionTrait; | ||
use core::array::ArrayTrait; | ||
use core::traits::TryInto; | ||
|
||
use cairo_verifier::common::math; | ||
use cairo_verifier::fri::fri_layer::FriLayerQuery; | ||
use cairo_verifier::FIELD_GENERATOR_INV; | ||
|
||
fn gather_first_layer_queries( | ||
n_queries: felt252, queries: Span<felt252>, evaluations: Span<felt252>, x_values: Span<felt252> | ||
) { | ||
let mut fri_queries = ArrayTrait::<FriLayerQuery>::new(); | ||
|
||
let len: u32 = n_queries.try_into().unwrap(); | ||
let mut i: u32 = 0; | ||
loop { | ||
if i == len { | ||
break; | ||
} | ||
|
||
// Translate the coset to the homogenous group to have simple FRI equations. | ||
let shifted_x_value = *(x_values.at(i)) * FIELD_GENERATOR_INV; | ||
|
||
fri_queries | ||
.append( | ||
FriLayerQuery { | ||
index: *(queries.at(i)), | ||
y_value: *(evaluations.at(i)), | ||
x_inv_value: math::mul_inverse(shifted_x_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