code-423n4 / 2022-06-nested-findings

0 stars 1 forks source link

Gas Optimizations #97

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Nested Factory.sol

OperatorResolver.sol

MixinOperatorResolver.sol

OwnableProxyDelegation.sol

BeefyVaultOperator.sol

BeefyZapBiswapLPVaultOperator.sol

StakingLPVaultHelpers.sol

Yashiru commented 2 years ago

Modifiers generate a lot of gas cost (Disputed)

This optimizes the deployment costs but reduces the readability of the code. We prefer to keep good readability even if we have to pay more for the deployment.

Instead of using a modifier, a private view function could be used and it would not generate gas costs (Disputed)

This optimizes the deployment costs but reduces the readability of the code. We prefer to keep good readability even if we have to pay more for the deployment.

maximebrugel commented 2 years ago

These operations can be unchecked since it is not possible to generate an underflow (Disputed)

We can’t guarantee that the balance after is more/equal than before or the other way around (with an exotic token).

maximebrugel commented 2 years ago

Using Errors in solidity can reduce the deployment gas cost. (Duplicated)

6 (see comment)

Yashiru commented 2 years ago

It is not necessary to initialize variables to their default value (Duplicated)

Duplicated of #2 at For loop optimizaion

use a for loop with i++ instead of ++i unchecked (Duplicated)

Duplicated of #2 at For loop optimizaion