From 99bf52afefa71a0500c8a30212f8e3bb916a85a2 Mon Sep 17 00:00:00 2001 From: Yuval Goldberg Date: Thu, 27 Feb 2025 23:34:51 +0200 Subject: [PATCH] Fixed some warnings --- vm/src/hint_processor/builtin_hint_processor/signature.rs | 7 +------ .../hint_processor/cairo_1_hint_processor/dict_manager.rs | 2 +- vm/src/vm/runners/cairo_pie.rs | 3 +-- vm/src/vm/vm_memory/memory.rs | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/vm/src/hint_processor/builtin_hint_processor/signature.rs b/vm/src/hint_processor/builtin_hint_processor/signature.rs index 878a379b7a..2a77752c7e 100644 --- a/vm/src/hint_processor/builtin_hint_processor/signature.rs +++ b/vm/src/hint_processor/builtin_hint_processor/signature.rs @@ -1,7 +1,5 @@ use crate::stdlib::{boxed::Box, collections::HashMap, prelude::*}; -use num_integer::Integer; - use crate::{ hint_processor::{ builtin_hint_processor::hint_utils::{get_integer_from_var_name, get_ptr_from_var_name}, @@ -27,10 +25,7 @@ pub fn verify_ecdsa_signature( if ecdsa_ptr.segment_index != ecdsa_builtin.base() as isize { return Err(HintError::AddSignatureWrongEcdsaPtr(Box::new(ecdsa_ptr))); } - if !ecdsa_ptr - .offset - .is_multiple_of(&(CELLS_PER_SIGNATURE as usize)) - { + if !num_integer::Integer::is_multiple_of(&ecdsa_ptr.offset, &(CELLS_PER_SIGNATURE as usize)) { return Err(HintError::AddSignatureNotAPublicKey(Box::new(ecdsa_ptr))); } ecdsa_builtin 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 f3fe2fb9a0..a82a4fa2db 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 @@ -126,7 +126,7 @@ impl DictManagerExecScope { if self.use_temporary_segments { let mut prev_end = vm.add_memory_segment(); for tracker in &self.trackers { - vm.add_relocation_rule(tracker.start, prev_end.into())?; + vm.add_relocation_rule(tracker.start, prev_end)?; prev_end += (tracker.end.unwrap_or_default() - tracker.start)?; prev_end += 1; } diff --git a/vm/src/vm/runners/cairo_pie.rs b/vm/src/vm/runners/cairo_pie.rs index ca6960e2d4..5364d0fe25 100644 --- a/vm/src/vm/runners/cairo_pie.rs +++ b/vm/src/vm/runners/cairo_pie.rs @@ -437,7 +437,6 @@ impl CairoPie { pub(super) mod serde_impl { use crate::stdlib::collections::HashMap; use crate::types::builtin_name::BuiltinName; - use num_integer::Integer; use num_traits::Num; use super::CAIRO_PIE_VERSION; @@ -723,7 +722,7 @@ pub(super) mod serde_impl { } pub fn from_bytes(bytes: &[u8]) -> Option { - if !bytes.len().is_multiple_of(&CELL_BYTE_LEN) { + if !num_integer::Integer::is_multiple_of(&bytes.len(), &CELL_BYTE_LEN) { return None; } diff --git a/vm/src/vm/vm_memory/memory.rs b/vm/src/vm/vm_memory/memory.rs index 9a20b60d05..c5f7e32055 100644 --- a/vm/src/vm/vm_memory/memory.rs +++ b/vm/src/vm/vm_memory/memory.rs @@ -233,7 +233,7 @@ impl Memory { } /// Retrieve a value from memory (either normal or temporary) and apply relocation rules - pub(crate) fn get<'a, 'b: 'a, K: 'a>(&'b self, key: &'a K) -> Option> + pub(crate) fn get<'a, 'b: 'a, K: 'a>(&'b self, key: &'a K) -> Option> where Relocatable: TryFrom<&'a K>, {