File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
crates/blockifier/src/execution Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -448,9 +448,9 @@ fn estimate_steps_of_encode_felt252_data_and_calc_blake_hash(
448
448
449
449
/// Returns the number of BLAKE opcodes needed to hash the given felts.
450
450
/// Each BLAKE opcode processes 16 u32s (partial messages are padded).
451
- fn count_blake_opcode ( n_big_felts : usize , n_small_felts : usize ) -> usize {
451
+ fn count_blake_opcode ( felt_size_groups : & FeltSizeCount ) -> usize {
452
452
// Count the total number of u32s to be hashed.
453
- let total_u32s = total_u32s_from_felts ( n_big_felts , n_small_felts ) ;
453
+ let total_u32s = total_u32s_from_felts ( felt_size_groups . large , felt_size_groups . small ) ;
454
454
total_u32s. div_ceil ( FeltSizeCount :: U32_WORDS_PER_MESSAGE )
455
455
}
456
456
@@ -482,7 +482,7 @@ pub fn encode_and_blake_hash_resources(
482
482
483
483
EstimatedExecutionResources :: V2Hash {
484
484
resources,
485
- blake_count : count_blake_opcode ( felt_size_groups. large , felt_size_groups . small ) ,
485
+ blake_count : count_blake_opcode ( felt_size_groups) ,
486
486
}
487
487
}
488
488
Original file line number Diff line number Diff line change @@ -30,14 +30,12 @@ fn test_u32_constants() {
30
30
#[ test]
31
31
fn test_zero_inputs ( ) {
32
32
// logic was written.
33
- let steps = estimate_steps_of_encode_felt252_data_and_calc_blake_hash ( & FeltSizeCount {
34
- large : 0 ,
35
- small : 0 ,
36
- } ) ;
33
+ let steps =
34
+ estimate_steps_of_encode_felt252_data_and_calc_blake_hash ( & FeltSizeCount :: default ( ) ) ;
37
35
assert_eq ! ( steps, STEPS_EMPTY_INPUT , "Unexpected base step cost for zero inputs" ) ;
38
36
39
37
// No opcodes should be emitted.
40
- let opcodes = count_blake_opcode ( 0 , 0 ) ;
38
+ let opcodes = count_blake_opcode ( & FeltSizeCount :: default ( ) ) ;
41
39
assert_eq ! ( opcodes, 0 , "Expected zero BLAKE opcodes for zero inputs" ) ;
42
40
43
41
// Should result in base cost only (no opcode cost).
You can’t perform that action at this time.
0 commit comments