Sitelet https://github.com/starkware-libs/cairo/commit/8a421c1f3f02d839d856d5da1f19da7aee34ebe0
Skip to content

Commit 8a421c1

Browse files
committed
fix(runner): correct n_steps by removing erroneous -1 offsets
1 parent 6a9d40a commit 8a421c1

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • crates/cairo-lang-runner/src

‎crates/cairo-lang-runner/src/lib.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,9 @@ impl SierraCasmRunner {
286286
// The execution from the header created by self.builder.create_entry_code().
287287
// We expect the last trace entry to be the `ret` instruction at the end of the header.
288288
let header_end = relocated_trace.last().unwrap().pc;
289+
used_resources.n_steps -= relocated_trace.iter().position(|e| e.pc > header_end).unwrap();
289290
used_resources.n_steps -=
290-
relocated_trace.iter().position(|e| e.pc > header_end).unwrap() - 1;
291-
used_resources.n_steps -=
292-
relocated_trace.iter().rev().position(|e| e.pc > header_end).unwrap() - 1;
291+
relocated_trace.iter().rev().position(|e| e.pc > header_end).unwrap();
293292

294293
let (results_data, gas_counter) = self.get_results_data(&return_types, &memory, ap);
295294
assert!(results_data.len() <= 1);

0 commit comments

Comments
 (0)