@@ -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 {
@@ -444,14 +432,6 @@ fn compute_blake_hash_steps(felt_size_groups: &FeltSizeCount) -> usize {
444
432
base_steps. checked_add ( felt_steps) . expect ( "Overflow computing total Blake hash steps" )
445
433
}
446
434
447
- /// Returns the number of BLAKE opcodes needed to hash the given felts.
448
- /// Each BLAKE opcode processes 16 u32s (partial messages are padded).
449
- fn count_blake_opcode ( n_big_felts : usize , n_small_felts : usize ) -> usize {
450
- // Count the total number of u32s to be hashed.
451
- let total_u32s = total_u32s_from_felts ( n_big_felts, n_small_felts) ;
452
- total_u32s. div_ceil ( FeltSizeCount :: U32_WORDS_PER_MESSAGE )
453
- }
454
-
455
435
/// Estimates resource usage for `encode_felt252_data_and_calc_blake_hash` in the Starknet OS.
456
436
///
457
437
/// # Encoding Details
@@ -480,7 +460,7 @@ pub fn encode_and_blake_hash_resources(
480
460
481
461
EstimatedExecutionResources :: V2Hash {
482
462
resources,
483
- blake_count : count_blake_opcode ( felt_size_groups. large , felt_size_groups . small ) ,
463
+ blake_count : felt_size_groups. blake_opcode_count ( ) ,
484
464
}
485
465
}
486
466
0 commit comments