You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Certora Audit] G-08. Use shift right/left instead of division/multiplication if possible (safe-global#895)
This pull request includes optimizations to the gas usage in the
`Safe.sol` and `StorageAccessible.sol` contracts by replacing
multiplication operations with bitwise shift operations. While the `DIV
/ MUL` opcode uses 5 gas, the `SHR / SHL` opcode only uses 3 gas.
Gas optimization changes:
*
[`contracts/Safe.sol`](diffhunk://#diff-587b494ea631bb6b7adf4fc3e1a2e6a277a385ff16e1163b26e39de24e9483deL168-R169):
Replaced the multiplication operation `* 64` with the bitwise shift
operation `<< 6` to reduce gas costs in the `gasleft` check.
*
[`contracts/common/StorageAccessible.sol`](diffhunk://#diff-a7dd65d90b0567bb9ba14ecd4ff414529a934cd3752ccf309800fad93fba354eL18-R18):
Replaced the multiplication operation `* 32` with the bitwise shift
operation `<< 5` to reduce gas costs when creating a new bytes array.
0 commit comments