Skip to content

Conversation

@orizi
Copy link
Collaborator

@orizi orizi commented Jan 20, 2026

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 Blake cost token type and updating the gas cost calculation for Blake operations.


Type of change

Please check one:

  • Bug fix (fixes incorrect behavior)
  • New feature
  • Performance improvement
  • Documentation change with concrete technical impact
  • Style, wording, formatting, or typo-only change

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 Blake cost 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 Blake cost 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.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator Author

orizi commented Jan 20, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@orizi orizi marked this pull request as ready for review January 20, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants