Closed code423n4 closed 2 years ago
This is a duplicate of https://github.com/code-423n4/2021-10-tempus-findings/issues/38 The quality of explanation in the linked issue is much better. Also, storage doesn't have to do anything with this issue and is mentioned here for some reason...
Handle
pauliax
Vulnerability details
Impact
Lower than uint256 size storage variables are less gas efficient. E.g. using uint8 does not give any efficiency, actually, it is the opposite as EVM operates on default of 256-bit values so uint8 is more expensive in this case as it needs a conversion. It only gives improvements in cases where you can pack variables together, e.g. structs. An example where uint8 does not give any performance boost: for (uint8 i = 0; i < 32; i++)
Recommended Mitigation Steps
Consider using optimal uint256 values.