As the title says.
The constant keccak variables are defined all throughout the diamond storage contracts. So they are used often.
Warden TomFrench has written a good description of the issue here, so I'm copying it: (Cheers Tom... 🙂🥂)
"
In a number of places a keccak("string") expression is assigned to a constant variable. Due to how constant variables are implemented this results in the hash being recomputed each time that the variable is used, spending the gas necessary to perform this action.
If these variables were to be immutable this hash is calculated once at deploy time and then the result is saved to be used directly at runtime rather than recalculating, saving the cost of hashing.
Handle
kenzo
Vulnerability details
As the title says. The constant keccak variables are defined all throughout the diamond storage contracts. So they are used often.
Warden TomFrench has written a good description of the issue here, so I'm copying it: (Cheers Tom... 🙂🥂)
" In a number of places a keccak("string") expression is assigned to a constant variable. Due to how constant variables are implemented this results in the hash being recomputed each time that the variable is used, spending the gas necessary to perform this action.
If these variables were to be immutable this hash is calculated once at deploy time and then the result is saved to be used directly at runtime rather than recalculating, saving the cost of hashing.
See: ethereum/solidity#9232
Recommended Mitigation Steps
Change all constant hashes to be immutable "