Gas Optimizations #188
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
reviewed
Issues that Backd has reviewed (just for internal tracking, can ignore this)
GAS
G-01: Unnecessary if statement in
processExpiredLocks
CvxCrvRewardsLocker.processExpiredLocks; L133-L145
Gas could be saved by changing:
To:
G-02: Changing parameters order could save some gas
TopUpActionFeeHandler.payFees#L81-L109
If
lpToken.safeTransferFrom
revertskeeperAmount
andtreasuryAmount
will be unnecessarily calculated.I suggest setting
keeperAmount
andtreasuryAmount
afterlpToken.safeTransferFrom
as seen below.Ga-03: For loop in
hasAnyRole
can be more gas efficientRoleManager.hasAnyRole#L73-L86
i = 0
as zero is already the default value.roles.length
would save gas from calculating it every iteration++i
is more effecient than using a postfixi++
In summary I suggest changing it from:
To:
Also valid for(list not exhaustive):
StakerVault - getstakedbyactions
The text was updated successfully, but these errors were encountered: