@@ -394,18 +394,6 @@ mod blake_estimation {
394
394
pub const STEPS_EMPTY_INPUT : usize = 170 ;
395
395
}
396
396
397
- /// Calculates the total number of u32s required to encode the given number of big and small felts.
398
- /// Big felts encode to 8 u32s each, small felts encode to 2 u32s each.
399
- fn total_u32s_from_felts ( n_big_felts : usize , n_small_felts : usize ) -> usize {
400
- let big_u32s = n_big_felts
401
- . checked_mul ( FeltSizeCount :: U32_WORDS_PER_LARGE_FELT )
402
- . expect ( "Overflow computing big felts u32s" ) ;
403
- let small_u32s = n_small_felts
404
- . checked_mul ( FeltSizeCount :: U32_WORDS_PER_SMALL_FELT )
405
- . expect ( "Overflow computing small felts u32s" ) ;
406
- big_u32s. checked_add ( small_u32s) . expect ( "Overflow computing total u32s" )
407
- }
408
-
409
397
fn base_steps_for_blake_hash ( n_u32s : usize ) -> usize {
410
398
let rem_u32s = n_u32s % FeltSizeCount :: U32_WORDS_PER_MESSAGE ;
411
399
if rem_u32s == 0 {
@@ -446,14 +434,6 @@ fn estimate_steps_of_encode_felt252_data_and_calc_blake_hash(
446
434
base_steps. checked_add ( felt_steps) . expect ( "Overflow computing total Blake hash steps" )
447
435
}
448
436
449
- /// Returns the number of BLAKE opcodes needed to hash the given felts.
450
- /// Each BLAKE opcode processes 16 u32s (partial messages are padded).
451
- fn count_blake_opcode ( felt_size_groups : & FeltSizeCount ) -> usize {
452
- // Count the total number of u32s to be hashed.
453
- let total_u32s = total_u32s_from_felts ( felt_size_groups. large , felt_size_groups. small ) ;
454
- total_u32s. div_ceil ( FeltSizeCount :: U32_WORDS_PER_MESSAGE )
455
- }
456
-
457
437
/// Estimates resource usage for `encode_felt252_data_and_calc_blake_hash` in the Starknet OS.
458
438
///
459
439
/// # Encoding Details
@@ -482,7 +462,7 @@ pub fn encode_and_blake_hash_resources(
482
462
483
463
EstimatedExecutionResources :: V2Hash {
484
464
resources,
485
- blake_count : count_blake_opcode ( felt_size_groups) ,
465
+ blake_count : felt_size_groups. blake_opcode_count ( ) ,
486
466
}
487
467
}
488
468
0 commit comments