@@ -431,15 +431,17 @@ fn felts_steps(n_big_felts: usize, n_small_felts: usize) -> usize {
431
431
/// Estimates the number of VM steps needed to hash the given felts with Blake in Starknet OS.
432
432
/// Each small felt unpacks into 2 u32s, and each big felt into 8 u32s.
433
433
/// Adds a base cost depending on whether the total fits exactly into full 16-u32 messages.
434
- fn compute_blake_hash_steps ( n_big_felts : usize , n_small_felts : usize ) -> usize {
435
- let total_u32s = total_u32s_from_felts ( n_big_felts, n_small_felts) ;
434
+ fn estimate_steps_of_encode_felt252_data_and_calc_blake_hash (
435
+ felt_size_groups : & FeltSizeCount ,
436
+ ) -> usize {
437
+ let total_u32s = felt_size_groups. encoded_u32_len ( ) ;
436
438
if total_u32s == 0 {
437
439
// The empty input case is a special case.
438
440
return blake_estimation:: STEPS_EMPTY_INPUT ;
439
441
}
440
442
441
443
let base_steps = base_steps_for_blake_hash ( total_u32s) ;
442
- let felt_steps = felts_steps ( n_big_felts , n_small_felts ) ;
444
+ let felt_steps = felts_steps ( felt_size_groups . large , felt_size_groups . small ) ;
443
445
444
446
base_steps. checked_add ( felt_steps) . expect ( "Overflow computing total Blake hash steps" )
445
447
}
@@ -465,7 +467,7 @@ fn count_blake_opcode(n_big_felts: usize, n_small_felts: usize) -> usize {
465
467
pub fn encode_and_blake_hash_resources (
466
468
felt_size_groups : & FeltSizeCount ,
467
469
) -> EstimatedExecutionResources {
468
- let n_steps = compute_blake_hash_steps ( felt_size_groups. large , felt_size_groups . small ) ;
470
+ let n_steps = estimate_steps_of_encode_felt252_data_and_calc_blake_hash ( felt_size_groups) ;
469
471
let builtin_instance_counter = match felt_size_groups. n_felts ( ) {
470
472
// The empty case does not use builtins at all.
471
473
0 => HashMap :: new ( ) ,
0 commit comments