-
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
1 parent
e174bc3
commit 3343630
Showing
4 changed files
with
52 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use core::traits::Div; | ||
use cairo_verifier::{ | ||
common::{consts::{FIELD_GENERATOR, STARK_PRIME_MINUS_ONE}, math::{pow, mul_inverse}}, | ||
stark::StarkConfig, | ||
}; | ||
|
||
// Information about the domains that are used in the stark proof. | ||
#[derive(Drop)] | ||
struct StarkDomains { | ||
// Log2 of the evaluation domain size. | ||
log_eval_domain_size: felt252, | ||
// The evaluation domain size. | ||
eval_domain_size: felt252, | ||
// The generator of the evaluation domain (a primitive root of unity of order eval_domain_size). | ||
eval_generator: felt252, | ||
// Log2 of the trace domain size. | ||
log_trace_domain_size: felt252, | ||
// The trace domain size. | ||
trace_domain_size: felt252, | ||
// The generator of the trace domain (a primitive root of unity of order trace_domain_size). | ||
trace_generator: felt252, | ||
} | ||
|
||
#[generate_trait] | ||
impl StarkDomainsImpl of StarkDomainsTrait { | ||
fn new(stark_config: @StarkConfig) -> StarkDomains { | ||
// Compute stark_domains. | ||
let log_eval_domain_size = *stark_config.log_trace_domain_size + *stark_config.log_n_cosets; | ||
let eval_domain_size = pow(2, log_eval_domain_size); | ||
let eval_generator = pow( | ||
FIELD_GENERATOR, STARK_PRIME_MINUS_ONE * mul_inverse(eval_domain_size) | ||
); | ||
let trace_domain_size = pow(2, *stark_config.log_trace_domain_size); | ||
let trace_generator = pow( | ||
FIELD_GENERATOR, STARK_PRIME_MINUS_ONE * mul_inverse(trace_domain_size) | ||
); | ||
|
||
StarkDomains { | ||
log_eval_domain_size, | ||
eval_domain_size, | ||
eval_generator, | ||
log_trace_domain_size: *stark_config.log_trace_domain_size, | ||
trace_domain_size, | ||
trace_generator, | ||
} | ||
} | ||
} |
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