Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* Add `RunResources::get_n_steps` method [#1225](https://github.com/lambdaclass/cairo-rs/pull/1225)

* fix: pin Cairo compiler version [#1220](https://github.com/lambdaclass/cairo-rs/pull/1220)

* perf: make `inner_rc_bound` a constant, improving performance of the range-check builtin
Expand Down
6 changes: 5 additions & 1 deletion src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ impl RunResources {
pub fn consume_steps(&mut self) {
self.n_steps -= 1;
}

pub fn get_n_steps(&mut self) -> usize {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a mutable reference here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch!
copy paste staff

self.n_steps
}
}

#[derive(Debug)]
Expand Down Expand Up @@ -4978,7 +4982,7 @@ mod tests {
Ok(())
);

assert_eq!(run_resources, Some(RunResources::new(1)));
assert_eq!(run_resources.unwrap().get_n_steps(), 1);
}

#[test]
Expand Down