Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofneto committed Dec 18, 2023
1 parent 1139412 commit e29bfbc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 33 deletions.
8 changes: 3 additions & 5 deletions src/air/composition.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ fn eval_composition_polynomial(
let public_memory_column_size = trace_domain_size / PUBLIC_MEMORY_STEP;
assert(public_memory_column_size >= 0, 'Invalid column size');

let public_memory_prod_ratio = public_input.get_public_memory_product_ratio(memory_z, memory_alpha, public_memory_column_size);
let public_memory_prod_ratio = public_input
.get_public_memory_product_ratio(memory_z, memory_alpha, public_memory_column_size);

// TODO diluted

Expand All @@ -37,10 +38,7 @@ fn eval_composition_polynomial(
rc_max: 0,
offset_size: 0,
half_offset_size: 0,
pedersen_shift_point: EcPoint {
x: 0,
y: 0
},
pedersen_shift_point: EcPoint { x: 0, y: 0 },
pedersen_points_x: 0,
pedersen_points_y: 0,
memory_multi_column_perm_perm_interaction_elm: 0,
Expand Down
4 changes: 0 additions & 4 deletions src/air/global_values.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,20 @@ struct GlobalValues {
initial_bitwise_addr: felt252,
rc_min: felt252,
rc_max: felt252,

// Constants.
offset_size: felt252,
half_offset_size: felt252,
pedersen_shift_point: EcPoint,

// Periodic columns.
pedersen_points_x: felt252,
pedersen_points_y: felt252,

// Interaction elements.
memory_multi_column_perm_perm_interaction_elm: felt252,
memory_multi_column_perm_hash_interaction_elm0: felt252,
rc16_perm_interaction_elm: felt252,
diluted_check_permutation_interaction_elm: felt252,
diluted_check_interaction_z: felt252,
diluted_check_interaction_alpha: felt252,

// Permutation products.
memory_multi_column_perm_perm_public_memory_prod: felt252,
rc16_perm_public_memory_prod: felt252,
Expand Down
13 changes: 5 additions & 8 deletions src/air/public_input.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use cairo_verifier::air::public_memory::{Page, PageTrait, ContinuousPageHeader, get_continuous_pages_product};
use cairo_verifier::air::public_memory::{
Page, PageTrait, ContinuousPageHeader, get_continuous_pages_product
};
use cairo_verifier::common::felt252::{pow, Felt252PartialOrd, Felt252Div};

#[derive(Drop)]
Expand All @@ -15,10 +17,7 @@ impl PublicInputImpl of PublicInputTrait {
// This is the value that needs to be at the memory__multi_column_perm__perm__public_memory_prod
// member expression.
fn get_public_memory_product_ratio(
self: @PublicInput,
z: felt252,
alpha: felt252,
public_memory_column_size: felt252
self: @PublicInput, z: felt252, alpha: felt252, public_memory_column_size: felt252
) -> felt252 {
let (pages_product, total_length) = self.get_public_memory_product(z, alpha);

Expand All @@ -34,9 +33,7 @@ impl PublicInputImpl of PublicInputTrait {

// Returns the product of all public memory cells.
fn get_public_memory_product(
self: @PublicInput,
z: felt252,
alpha: felt252
self: @PublicInput, z: felt252, alpha: felt252
) -> (felt252, felt252) {
let main_page_prod = self.main_page.get_product(z, alpha);

Expand Down
28 changes: 12 additions & 16 deletions src/air/public_memory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ struct ContinuousPageHeader {
#[generate_trait]
impl PageImpl of PageTrait {
// Returns the product of (z - (addr + alpha * val)) over a single page.
fn get_product(
self: @Page,
z: felt252,
alpha: felt252
) -> felt252 {
fn get_product(self: @Page, z: felt252, alpha: felt252) -> felt252 {
let mut res = 1;
let mut i = 0;
loop {
Expand All @@ -49,17 +45,17 @@ impl PageImpl of PageTrait {
}

fn get_continuous_pages_product(page_headers: Span<ContinuousPageHeader>) -> (felt252, felt252) {
let mut res = 1;
let mut total_length = 0;
let mut i = 0;
loop {
if i == page_headers.len() {
break (res, total_length);
}
let current = page_headers.at(i);

res *= *current.prod;
total_length += *current.size;
let mut res = 1;
let mut total_length = 0;
let mut i = 0;
loop {
if i == page_headers.len() {
break (res, total_length);
}
let current = page_headers.at(i);

res *= *current.prod;
total_length += *current.size;
}
}

0 comments on commit e29bfbc

Please sign in to comment.