UpdateSilo Code Style Findings
UpdateSilo Code Style Findings
USO-01C: Redundant Conditional Evaluation
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | UpdateSilo.sol:L33 |
Description:
The linked conditional evaluation is redundant as it is guaranteed by its previous chained if clause given that the roots member is an unsigned integer data type (uint256).
Example:
protocol/contracts/farm/facets/SiloFacet/UpdateSilo.sol
30if (s.a[account].roots > 0) {31 farmSops(account, update);32 farmBeans(account, update);33} else if (s.a[account].roots == 0) {
Recommendation:
We advise the conditional to be dropped in favour of gas costs.
Alleviation:
The linked else if structure was properly set as an else given its conditional's guarantee.