Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Dec 18, 2023
1 parent e3c9791 commit dd2b9ef
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
15 changes: 9 additions & 6 deletions src/fri/fri_config.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ fn fri_config_validate(
config: FriConfig, log_n_cosets: felt252, n_verifier_friendly_commitment_layers: felt252
) -> felt252 {
assert(0_u256 <= config.log_last_layer_degree_bound.into(), 'Invalid value');
assert(config.log_last_layer_degree_bound.try_into().unwrap() <= MAX_LAST_LAYER_LOG_DEGREE_BOUND, 'Invalid value');
assert(
config.log_last_layer_degree_bound.try_into().unwrap() <= MAX_LAST_LAYER_LOG_DEGREE_BOUND,
'Invalid value'
);

assert(2_u256 <= config.n_layers.into(), 'Invalid value');
assert(config.n_layers.try_into().unwrap() <= MAX_FRI_LAYERS + 1, 'Invalid value');
Expand All @@ -38,7 +41,9 @@ fn fri_config_validate(
let mut sum_of_step_sizes: felt252 = 0;
let mut log_input_size = config.log_input_size;
loop {
if i == len { break; }
if i == len {
break;
}

let fri_step: felt252 = *(config.fri_step_sizes.at(i));
let table_commitment = *(config.inner_layers.at(i));
Expand All @@ -53,9 +58,7 @@ fn fri_config_validate(
sum_of_step_sizes += fri_step;

validate_vector_commitment(
table_commitment.vector,
log_input_size,
n_verifier_friendly_commitment_layers,
table_commitment.vector, log_input_size, n_verifier_friendly_commitment_layers,
);
};

Expand All @@ -69,4 +72,4 @@ fn validate_vector_commitment(
config: VectorCommitmentConfig,
expected_height: felt252,
n_verifier_friendly_commitment_layers: felt252,
) {}
) {}
13 changes: 6 additions & 7 deletions src/fri/fri_formula.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,17 @@ fn fri_formula16(values: Span<felt252>, eval_point: felt252, x_inv: felt252) ->

// Folds 'coset_size' elements into one using log2(coset_size) layers of FRI.
// 'coset_size' can be 2, 4, 8, or 16.
fn fri_formula(values: Span<felt252>, eval_point: felt252, x_inv: felt252, coset_size: felt252) -> felt252 {
fn fri_formula(
values: Span<felt252>, eval_point: felt252, x_inv: felt252, coset_size: felt252
) -> felt252 {
// Sort by usage frequency.
if (coset_size == 8) {
return fri_formula8(values, eval_point, x_inv);
}
else if (coset_size == 4) {
} else if (coset_size == 4) {
return fri_formula4(values, eval_point, x_inv);
}
else if (coset_size == 16) {
} else if (coset_size == 16) {
return fri_formula16(values, eval_point, x_inv);
}
else {
} else {
assert(values.len() == 2, 'Values length not equal 2');
return fri_formula2(*values[0], *values[1], eval_point, x_inv);
}
Expand Down
2 changes: 1 addition & 1 deletion src/fri/fri_layer.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ struct FriLayerQuery {
index: felt252,
y_value: felt252,
x_inv_value: felt252,
}
}
1 change: 1 addition & 0 deletions src/fri/tests/test_fri_formula.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit dd2b9ef

Please sign in to comment.