Omniscia Beanstalk Audit

LPSilo Manual Review Findings

LPSilo Manual Review Findings

LPS-01M: Inexplicable Conditional

TypeSeverityLocation
Logical FaultLPSilo.sol:L54, L55

Description:

The linked conditional will always evaluate as true meaning that the else clause will never be executed.

Example:

protocol/contracts/farm/facets/SiloFacet/LPSilo.sol
47function _depositLP(uint256 amount) internal {
48 updateSilo(msg.sender);
49 uint32 _s = season();
50 uint256 lpb = lpToLPBeans(amount);
51 require(lpb > 0, "Silo: No Beans under LP.");
52 incrementDepositedLP(amount);
53 uint256 seeds = lpb.mul(C.getSeedsPerLPBean());
54 if (season() == _s) depositSiloAssets(msg.sender, seeds, lpb.mul(10000));
55 else depositSiloAssets(msg.sender, seeds, lpb.mul(10000).add(season().sub(_s).mul(seeds)));
56
57 addLPDeposit(msg.sender, _s, amount, lpb.mul(C.getSeedsPerLPBean()));
58
59 LibCheck.lpBalanceCheck();
60}

Recommendation:

We advise this segment of code to be re-evaluated as one of the seasons utilised in the if clause should be different.

Alleviation:

The code was updated to no longer deposit silo assets at a conditional rate.