Skip to content

Commit

Permalink
Add RunResources.get_n_steps method (lambdaclass#1225)
Browse files Browse the repository at this point in the history
* Add RunResources.get_n_steps method

* Update CHANGELOG.md

* use no mut reference
  • Loading branch information
pefontana authored and kariy committed Jun 23, 2023
1 parent 99f70c6 commit 6af4f90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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(&self) -> usize {
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

0 comments on commit 6af4f90

Please sign in to comment.