Skip to content

Commit fbdc226

Browse files
blockifier: encode blake in trait
1 parent 889cd06 commit fbdc226

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

crates/blockifier/src/execution/casm_hash_estimation.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::execution::contract_class::{
1010
FeltSizeCount,
1111
NestedFeltCounts,
1212
};
13-
use crate::execution::execution_utils::poseidon_hash_many_cost;
13+
use crate::execution::execution_utils::{encode_and_blake_hash_resources, poseidon_hash_many_cost};
1414
use crate::utils::u64_from_usize;
1515

1616
#[cfg(test)]
@@ -151,8 +151,7 @@ trait EstimateCasmHashResources {
151151
/// Estimates the Cairo execution resources used when applying the hash function during CASM
152152
/// hashing.
153153
fn estimated_resources_of_hash_function(
154-
&mut self,
155-
_felt_count: FeltSizeCount,
154+
_felt_size_groups: &FeltSizeCount,
156155
) -> EstimatedExecutionResources;
157156

158157
/// Estimates the Cairo execution resources for `compiled_class_hash` in the
@@ -177,12 +176,11 @@ impl EstimateCasmHashResources for CasmV1HashResourceEstimate {
177176
}
178177

179178
fn estimated_resources_of_hash_function(
180-
&mut self,
181-
felt_count: FeltSizeCount,
179+
felt_size_groups: &FeltSizeCount,
182180
) -> EstimatedExecutionResources {
183181
EstimatedExecutionResources::V1Hash {
184182
// TODO(AvivG): Consider inlining `poseidon_hash_many_cost` logic here.
185-
resources: poseidon_hash_many_cost(felt_count.n_felts()),
183+
resources: poseidon_hash_many_cost(felt_size_groups.n_felts()),
186184
}
187185
}
188186
}
@@ -197,10 +195,8 @@ impl EstimateCasmHashResources for CasmV2HashResourceEstimate {
197195
}
198196

199197
fn estimated_resources_of_hash_function(
200-
&mut self,
201-
_felt_count: FeltSizeCount,
198+
felt_size_groups: &FeltSizeCount,
202199
) -> EstimatedExecutionResources {
203-
// TODO(AvivG): Use `cost_of_encode_felt252_data_and_calc_blake_hash` once it returns ER.
204-
EstimatedExecutionResources::new(HashVersion::V2)
200+
encode_and_blake_hash_resources(felt_size_groups)
205201
}
206202
}

0 commit comments

Comments
 (0)