Gas Optimizations #148
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
G01 - Comparison
> 0
is less gas efficient than!= 0
withuint256
inrequire
statement with optimizerG02 - Too long revert string
Shortening revert strings to fit in 32 bytes will decrease deployment time gas and will decrease runtime gas when the revert condition has been met.
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/tokenomics/Minter.sol#L152
G03 -
unchecked
block can be used for gas efficiency of the expression that can't overflow/underflowCheck comments
G04 - Caching storage values in memory
Variables that are read multiple times in a code block can be cached and re-used instead of reading from storage to save gas.
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/StakerVault.sol#L322-L349
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/StakerVault.sol#L359-L398
G05 - Redundant code
The following lines don't change the value of the variable since it's uint256:
https://github.com/code-423n4/2022-05-backd/blob/main/protocol/contracts/tokenomics/InflationManager.sol#L575
The text was updated successfully, but these errors were encountered: