diff --git a/cairo1-run/src/main.rs b/cairo1-run/src/main.rs index 1905ce5748..5f39f13ac1 100644 --- a/cairo1-run/src/main.rs +++ b/cairo1-run/src/main.rs @@ -520,27 +520,21 @@ fn get_function_builtins(func: &Function) -> (Vec, HashMap = HashMap::new(); - // Fetch builtins from the entry_params - for type_id in entry_params { - if type_id.debug_name == Some("RangeCheck".into()) { - builtins.push(BuiltinName::range_check); - } - - if type_id.debug_name == Some("Pedersen".into()) { - builtins.push(BuiltinName::pedersen); - } - - if type_id.debug_name == Some("Bitwise".into()) { - builtins.push(BuiltinName::bitwise); - } - - if type_id.debug_name == Some("EcOp".into()) { - builtins.push(BuiltinName::ec_op); - } - - if type_id.debug_name == Some("Poseidon".into()) { - builtins.push(BuiltinName::poseidon); - } + // Fetch builtins from the entry_params in the standard order + if entry_params.iter().any(|ti| ti.debug_name == Some("Pedersen".into())) { + builtins.push(BuiltinName::pedersen); + } + if entry_params.iter().any(|ti| ti.debug_name == Some("RangeCheck".into())) { + builtins.push(BuiltinName::range_check); + } + if entry_params.iter().any(|ti| ti.debug_name == Some("Bitwise".into())) { + builtins.push(BuiltinName::bitwise); + } + if entry_params.iter().any(|ti| ti.debug_name == Some("EcOp".into())) { + builtins.push(BuiltinName::ec_op); + } + if entry_params.iter().any(|ti| ti.debug_name == Some("Poseidon".into())) { + builtins.push(BuiltinName::poseidon); } let first_offset = builtins.len() as i16 + 2; for (i, builtin) in builtins.iter().enumerate() {