Skip to content

Commit 86ab5e4

Browse files
blockifier: change input to felt_counts fn count_blake_opcodes
1 parent ed0a16f commit 86ab5e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/blockifier/src/execution/execution_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ fn estimate_steps_of_encode_felt252_data_and_calc_blake_hash(
448448

449449
/// Returns the number of BLAKE opcodes needed to hash the given felts.
450450
/// 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 {
452452
// 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);
454454
total_u32s.div_ceil(FeltSizeCount::U32_WORDS_PER_MESSAGE)
455455
}
456456

@@ -482,7 +482,7 @@ pub fn encode_and_blake_hash_resources(
482482

483483
EstimatedExecutionResources::V2Hash {
484484
resources,
485-
blake_count: count_blake_opcode(felt_size_groups.large, felt_size_groups.small),
485+
blake_count: count_blake_opcode(felt_size_groups),
486486
}
487487
}
488488

crates/blockifier/src/execution/execution_utils_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn test_zero_inputs() {
3737
assert_eq!(steps, STEPS_EMPTY_INPUT, "Unexpected base step cost for zero inputs");
3838

3939
// No opcodes should be emitted.
40-
let opcodes = count_blake_opcode(0, 0);
40+
let opcodes = count_blake_opcode(&FeltSizeCount { small: 0, large: 0 });
4141
assert_eq!(opcodes, 0, "Expected zero BLAKE opcodes for zero inputs");
4242

4343
// Should result in base cost only (no opcode cost).

0 commit comments

Comments
 (0)