Skip to content

Commit

Permalink
Remove unused CairoRunner field original_steps (#1742)
Browse files Browse the repository at this point in the history
* Remove `CairoRunner` field `original_steps`

* Add changelog entry
  • Loading branch information
fmoletta committed Apr 30, 2024
1 parent 0df3f34 commit d556d25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
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

* BREAKING: Remove unused `CairoRunner` field `original_steps`[#1742](https://github.com/lambdaclass/cairo-vm/pull/1742)

* feat: Add `--run_from_cairo_pie` to `cairo-vm-cli` + workflow [#1730](https://github.com/lambdaclass/cairo-vm/pull/1730)

* Serialize directly into writer in `CairoPie::write_zip_file`[#1736](https://github.com/lambdaclass/cairo-vm/pull/1736)
Expand Down
23 changes: 9 additions & 14 deletions vm/src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ pub struct CairoRunner {
segments_finalized: bool,
execution_public_memory: Option<Vec<usize>>,
runner_mode: RunnerMode,
pub original_steps: Option<usize>,
pub relocated_memory: Vec<Option<Felt252>>,
pub exec_scopes: ExecutionScopes,
pub relocated_trace: Option<Vec<RelocatedTraceEntry>>,
Expand Down Expand Up @@ -200,7 +199,6 @@ impl CairoRunner {
run_ended: false,
segments_finalized: false,
runner_mode: mode.clone(),
original_steps: None,
relocated_memory: Vec::new(),
exec_scopes: ExecutionScopes::new(),
execution_public_memory: if mode != RunnerMode::ExecutionMode {
Expand Down Expand Up @@ -1041,14 +1039,11 @@ impl CairoRunner {
&self,
vm: &VirtualMachine,
) -> Result<ExecutionResources, RunnerError> {
let n_steps = match self.original_steps {
Some(x) => x,
None => vm
.trace
.as_ref()
.map(|x| x.len())
.unwrap_or(vm.current_step),
};
let n_steps = vm
.trace
.as_ref()
.map(|x| x.len())
.unwrap_or(vm.current_step);
let n_memory_holes = self.get_memory_holes(vm)?;

let mut builtin_instance_counter = HashMap::new();
Expand Down Expand Up @@ -3906,10 +3901,10 @@ mod tests {
fn get_execution_resources_empty_builtins() {
let program = program!();

let mut cairo_runner = cairo_runner!(program);
let cairo_runner = cairo_runner!(program);
let mut vm = vm!();

cairo_runner.original_steps = Some(10);
vm.current_step = 10;
vm.segments.segment_used_sizes = Some(vec![4]);
assert_eq!(
cairo_runner.get_execution_resources(&vm),
Expand All @@ -3926,10 +3921,10 @@ mod tests {
fn get_execution_resources() {
let program = program!();

let mut cairo_runner = cairo_runner!(program);
let cairo_runner = cairo_runner!(program);
let mut vm = vm!();

cairo_runner.original_steps = Some(10);
vm.current_step = 10;
vm.segments.segment_used_sizes = Some(vec![4]);
vm.builtin_runners = vec![{
let mut builtin = OutputBuiltinRunner::new(true);
Expand Down

0 comments on commit d556d25

Please sign in to comment.