Open c4-bot-3 opened 5 months ago
0xleastwood marked the issue as primary issue
This is not medium
severity, there is minimal rounding here that does not cause significant leakage of funds. Downgrading to QA
because rounding should always be done in favour of the protocol.
0xleastwood changed the severity to QA (Quality Assurance)
Again, why this is not ideal in any way, no specific attack has been outlined abusing this inconsistency. Keeping it as is.
Lines of code
https://github.com/code-423n4/2024-05-bakerfi/blob/main/contracts/core/Vault.sol#L153-L158
Vulnerability details
Description
The Vault::rebalance() function rounds-down the
sharesToMint
against the protocol's favour. It ought to be rounded-up to avoid loss of funds for the protocol.Impact
Loss of funds for the protocol.
Tools Used
Manual review
Recommended Mitigation Steps
Round up in favour of the protocol. A library like solmate can be used which has
mulDivUp
:Assessed type
Math