use window

This commit is contained in:
Sergio Chouhy 2025-11-26 17:37:22 -03:00
parent 97209caa9c
commit bc24f006ef
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,5 @@
use nssa_core::program::{ProgramInput, read_nssa_inputs, write_nssa_outputs};
use risc0_zkvm::{
serde::to_vec,
sha::{Impl, Sha256},
};

View File

@ -37,13 +37,16 @@ fn main() {
panic!("Call stack is incomplete");
}
for i in 0..(program_outputs.len() - 1) {
let Some(chained_call) = &program_outputs[i].chained_call else {
for window in program_outputs.windows(2) {
let caller = &window[0];
let callee = &window[1];
let Some(chained_call) = &caller.chained_call else {
panic!("Expected chained call");
};
// Check that instruction data in caller is the instruction data in callee
if chained_call.instruction_data != program_outputs[i + 1].instruction_data {
if chained_call.instruction_data != callee.instruction_data {
panic!("Invalid instruction data");
}
}