Skip to content

Commit

Permalink
verify stack
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofneto committed Jan 5, 2024
1 parent 67146ba commit 0e9544d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/air/public_input.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ impl PublicInputImpl of PublicInputTrait {
(program_hash, 0)
}
}

24 changes: 24 additions & 0 deletions src/air/public_memory.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,30 @@ impl PageImpl of PageTrait {
i += 1;
}
}

fn verify_stack(
self: @Page,
start_ap: felt252,
segment_address: felt252,
builtins: Array<felt252>,
memory_index: felt252
) {
let mut i = 0;

// TODO size of SegmentInfo
let size = 2;
loop {
if i == builtins.len() {
break;
}

let current = *self.at(memory_index.try_into().unwrap() + i);

assert(current.address == start_ap + i.into(), 'Invalid address');
assert(current.value == segment_address + size * (i.into() + 1), 'Invalid builtin');
i += 1;
};
}
}

fn get_continuous_pages_product(page_headers: Span<ContinuousPageHeader>) -> (felt252, felt252) {
Expand Down

0 comments on commit 0e9544d

Please sign in to comment.