diff --git a/src/cairo_runner.rs b/src/cairo_runner.rs index 4946d48c..609c3e8f 100644 --- a/src/cairo_runner.rs +++ b/src/cairo_runner.rs @@ -16,7 +16,10 @@ use cairo_vm::{ }, vm::{ errors::vm_exception::{get_error_attr_value, get_location, get_traceback}, - runners::cairo_runner::{CairoRunner, ExecutionResources}, + runners::{ + builtin_runner::{HASH_BUILTIN_NAME, POSEIDON_BUILTIN_NAME, RANGE_CHECK_BUILTIN_NAME}, + cairo_runner::{CairoRunner, ExecutionResources}, + }, security::verify_secure_runner, }, }; @@ -622,7 +625,7 @@ impl PyCairoRunner { let vm = (*self.pyvm.vm).borrow_mut(); vm.get_builtin_runners() .iter() - .find(|b| b.name() == "pedersen") + .find(|b| b.name() == HASH_BUILTIN_NAME) .ok_or_else(|| PyValueError::new_err("hash builtin not present")) .map(|b| PyRelocatable::from((b.base() as isize, 0_usize))) } @@ -632,7 +635,7 @@ impl PyCairoRunner { let vm = (*self.pyvm.vm).borrow_mut(); vm.get_builtin_runners() .iter() - .find(|b| b.name() == "poseidon") + .find(|b| b.name() == POSEIDON_BUILTIN_NAME) .ok_or_else(|| PyValueError::new_err("poseidon builtin not present")) .map(|b| PyRelocatable::from((b.base() as isize, 0_usize))) } @@ -642,7 +645,7 @@ impl PyCairoRunner { let vm = (*self.pyvm.vm).borrow_mut(); vm.get_builtin_runners() .iter() - .find(|b| b.name() == "range_check") + .find(|b| b.name() == RANGE_CHECK_BUILTIN_NAME) .ok_or_else(|| PyValueError::new_err("range_check builtin not present")) .map(|b| PyRelocatable::from((b.base() as isize, 0_usize))) } @@ -714,17 +717,7 @@ impl PyExecutionResources { #[getter] fn builtin_instance_counter(&self) -> HashMap { - let mut instance_counters = self.0.builtin_instance_counter.clone(); - // replace the builtin name with "_builtin" as expected in the Starknet code. - for builtin_name in self.0.builtin_instance_counter.keys() { - if let Some((key, counter)) = instance_counters.remove_entry(builtin_name) { - instance_counters - .entry(format!("{key}_builtin").to_string()) - .or_insert(counter); - } - } - - instance_counters + self.0.builtin_instance_counter.clone() } }