diff --git a/src/air/public_input.cairo b/src/air/public_input.cairo index 15d42f8d7..3bd46e106 100644 --- a/src/air/public_input.cairo +++ b/src/air/public_input.cairo @@ -118,3 +118,4 @@ impl PublicInputImpl of PublicInputTrait { (program_hash, 0) } } + diff --git a/src/air/public_memory.cairo b/src/air/public_memory.cairo index 522d52a51..376806a8b 100644 --- a/src/air/public_memory.cairo +++ b/src/air/public_memory.cairo @@ -61,6 +61,30 @@ impl PageImpl of PageTrait { i += 1; } } + + fn verify_stack( + self: @Page, + start_ap: felt252, + segment_address: felt252, + builtins: Array, + 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) -> (felt252, felt252) {