feature(sierra): Added cost-token for blake. #9506
Open
+136
−128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Summary
Added Blake hash function as a cost token type for gas calculations. This PR implements proper gas accounting for the Blake hash function by adding a new
Blakecost token type and updating the gas cost calculation for Blake operations.Type of change
Please check one:
Why is this change needed?
Previously, the Blake hash function was using a placeholder gas cost calculation without a dedicated cost token. This PR adds proper gas accounting for Blake operations by introducing a dedicated
Blakecost token type with an appropriate gas cost value (491), similar to how other builtin operations are handled.What was the behavior or documentation before?
Before this change, the Blake hash function had a TODO comment indicating that a Blake token needed to be added to the gas cost calculation. It was using a simple constant cost without accounting for the actual computational complexity of the operation.
What is the behavior or documentation after?
After this change, Blake hash operations properly account for gas using a dedicated
Blakecost token type with a gas cost of 491. This ensures that gas calculations accurately reflect the computational cost of using the Blake hash function, similar to other builtin operations like Pedersen, Poseidon, etc.Additional context
This change ensures consistent gas accounting across all cryptographic primitives in the system. The Blake hash function now has proper gas accounting like other builtins, which is important for accurate resource usage estimation.