|
1 | 1 | use crate::{ |
2 | 2 | hint_processor::builtin_hint_processor::hint_utils::get_constant_from_var_name, |
3 | 3 | math_utils::signed_felt, |
| 4 | + serde::deserialize_program::Identifier, |
4 | 5 | stdlib::{boxed::Box, collections::HashMap, prelude::*}, |
5 | | - types::errors::math_errors::MathError, |
| 6 | + types::{errors::math_errors::MathError, program::Program}, |
6 | 7 | }; |
7 | 8 | use lazy_static::lazy_static; |
8 | 9 | use num_traits::{Signed, Zero}; |
@@ -384,15 +385,18 @@ pub fn split_felt( |
384 | 385 | vm: &mut VirtualMachine, |
385 | 386 | ids_data: &HashMap<String, HintReference>, |
386 | 387 | ap_tracking: &ApTracking, |
387 | | - constants: &HashMap<String, Felt252>, |
| 388 | + identifiers: &HashMap<String, Identifier>, |
388 | 389 | ) -> Result<(), HintError> { |
389 | 390 | let assert = |b: bool, msg: &str| { |
390 | 391 | b.then_some(()) |
391 | 392 | .ok_or_else(|| HintError::AssertionFailed(msg.to_string().into_boxed_str())) |
392 | 393 | }; |
393 | 394 | let bound = pow2_const(128); |
394 | | - let max_high = get_constant_from_var_name("MAX_HIGH", constants)?; |
395 | | - let max_low = get_constant_from_var_name("MAX_LOW", constants)?; |
| 395 | + |
| 396 | + let constants = Program::extract_constants(identifiers).unwrap(); |
| 397 | + let max_high = get_constant_from_var_name("MAX_HIGH", &constants)?; |
| 398 | + let max_low = get_constant_from_var_name("MAX_LOW", &constants)?; |
| 399 | + |
396 | 400 | assert( |
397 | 401 | max_high < &bound && max_low < &bound, |
398 | 402 | "assert ids.MAX_HIGH < 2**128 and ids.MAX_LOW < 2**128", |
|
0 commit comments