Use of constant keccak variables results in extra hashing (and so gas) #17
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
invalid
This doesn't seem right
Handle
defsec
Vulnerability details
Impact
That would Increase gas costs on all privileged operations.
Proof of Concept
The following role variables are marked as constant.
This results in the keccak operation being performed whenever the variable is used, increasing gas costs relative to just storing the output hash. Changing to immutable will only perform hashing on contract deployment which will save gas.
See: ethereum/solidity#9232 (ethereum/solidity#9232 (comment))
Tools Used
Code Review
Recommended Mitigation Steps
Consider to change the variable to be immutable rather than constant.
The text was updated successfully, but these errors were encountered: