getInterestOverdue
reverts rather than returning 0 when there is no overdue interest
#74
Labels
0 (Non-critical)
Code style, clarity, syntax, versioning, off-chain monitoring (events etc), exclude gas optimisation
bug
Something isn't working
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Handle
TomFrenchBlockchain
Vulnerability details
Impact
Potentially unexpected reverts when being called by external code
Proof of Concept
Here we revert if there's no extension (and therefore no overdue interest)
https://github.com/code-423n4/2021-12-sublime/blob/9df1b7c4247f8631647c7627a8da9bdc16db8b11/contracts/Pool/Repayments.sol#L300
I would expect in this case to receive a return value of zero as it's a truthful representation of the current state of the pool.
Otherwise if I were to call this from a contract I would have to wrap this function call as we do in
_repayExtension
which will increase costs as I need to make two calls to this contract.https://github.com/code-423n4/2021-12-sublime/blob/9df1b7c4247f8631647c7627a8da9bdc16db8b11/contracts/Pool/Repayments.sol#L325-L335
Low risk as it may cause unexpected reverts in integrators' code but unlikely to cause any loss of funds. At the very least this can be a gas optimisation by removing the if statement in
_repayExtension
and replacing it with an early return for zero interest.Recommended Mitigation Steps
Remove require statement and replace it with returning zero if there's no extension.
The text was updated successfully, but these errors were encountered: