Submitted by jonah1005, also found by 0xsanson
In controller.sols function setCap, the contract wrongly handles _vaultDetails[_vault].balance. While the balance should be decreased by the difference of strategies balance, it subtracts the remaining balance of the strategy. See Controller.sol L262-L278.
_vaultDetails[_vault].balance = _vaultDetails[_vault].balance.sub(_balance);
This would result in vaultDetails[_vault].balance being far smaller than the strategys value. A user would trigger the assertion at Controller.sol#475 and the fund would be locked in the strategy.
Though setCap is a permission function that only the operator can call, its likely to be called and the fund would be locked in the contract. I consider this a high severity issue.
We can trigger the issue by setting the cap 1 wei smaller than the strategys balance.
Hardhat
I believe the dev would spot the issue in the test if _vaultDetails[_vault].balance is a public variable.
One possible fix is to subtract the difference of the balance.
transferAndCall (yAxis) confirmed and patched:
GalloDaSballo (judge) commented:
