Audit review for 2024-04-interest-rate-model from sherlock
1.The calculation of released in config function of RewardsController is wrong
summary
1 | rewardData.lastConfig = uint32(block.timestamp); |
As we can see, the protocol uses the time period from lastConfig
to the present to calculate the released amount. However, consider a scenario where the start time is set in the future.
root cause
protocol assume start time is equal to the configuration time.
2.Expired maturities longer than FixedLib.INTERVAL with unaccrued earnings may be arbitraged and/or might lead to significant bad debt creation
summary
1 | > uint256 latestMaturity = block.timestamp - (block.timestamp % FixedLib.INTERVAL); |
when calculate latestMaturity
use block.timestamp - (block.timestamp % FixedLib.INTERVAL)
which can lead to a replay more than 1 INTERVAL not accounted.
root causeblock.timestamp - (block.timestamp % FixedLib.INTERVAL)
has a time range.