Closed adhusson closed 11 months ago
I took another look (and finally got to try making plots with ChatGPT): (edit: reposting image due to previous image link being dead)
Every dot on the yellow line corresponds to running a single accrueInterest
, either after 1 week, or after 2 weeks, etc. Other lines accrue interests at regular intervals over a 10 weeks duration. It may not look like it but the yellow line is an exponential.
The difference comes from the fact that utilization goes up through compounding and that the speed and rate corrections are exponential in the utilization (utilization
feeds into the error err
, which is itself used by speed
, startBorrowRate
and endBorrowRate
).
Closing (initial rate 200% + 9 weeks untouched market not realistic)
(uses the cantina-review branch of morpho-blue) Calling
accrueInterests
frequently seems to accumulate errors. I haven't looked into why yet but it seemed worth flagging.The tests start from a market with 1e18 supplied and 0.9e18 borrowed.
forge test --mt CompareAccrual -vv
: callingaccrueInterests
every 1000 seconds over a 9 week period increases borrow by 1627% compared to callingaccrueInterests
once after 9 weeks.forge test --mt SteppedAccrual
: calling every 1k seconds over a 13 week periods overflows adding interests tototalBorrowAssets
andtotalSupplyAssets
, ie there:This happens on
main
as well, with the same starting params & update period the overflow occurs faster (under 9 weeks).