From ce02a5348f6bfc0b470f57cbb55bd1fef1eb05f5 Mon Sep 17 00:00:00 2001 From: Stephen Shelton Date: Thu, 26 Sep 2024 12:57:40 -0600 Subject: [PATCH] Use HintError instead of assert --- .../hint_processor/cairo_1_hint_processor/dict_manager.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs b/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs index 12b7098740..797d224a0d 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs @@ -124,10 +124,14 @@ impl DictManagerExecScope { // there is nothing to do unless there are at least two segments. if self.use_temporary_segments && self.trackers.len() > 1 { let first_segment = self.trackers.get(0).unwrap(); - assert!(first_segment.start.segment_index >= 0, "First dict segment should not be temporary"); + if first_segment.start.segment_index < 0 { + return Err(HintError::CustomHint("First dict segment should not be temporary".to_string().into_boxed_str())); + } let mut prev_end = first_segment.end.unwrap_or_default(); for tracker in &self.trackers[1..] { - assert!(tracker.start.segment_index < 0, "Dict segment should be temporary"); + if tracker.start.segment_index >= 0 { + return Err(HintError::CustomHint("Dict segment should be temporary".to_string().into_boxed_str())); + } vm.add_relocation_rule(tracker.start, prev_end)?; prev_end += (tracker.end.unwrap_or_default() - tracker.start)?; prev_end += 1;