Precision in the trapezoidal borrow-rate curve, and the Yearn post-mortem behind it
We continued the Panoptic contest on Code4rena.
Lesson Summary:
- There seems to be enough precision when the utilisation error is small, since it only rounds down to 0 when the error is tiny.
- The trapezoidal rule in the
borrowRatefunction: check it holds for all values and conditions. - Check Yearn exploit post-mortem
- What if every rate is 0? Look for edge cases in the trapezoidal rule — this one cannot happen, because of line 1841 in
_borrowRate. - How is
elapsed == 0handled in_borrowRate? Verdict: the precision is handled well. - What if
_borrowRateis spammed? Verdict: fine. - Call it often, call it rarely, skip a day, make a huge deposit, borrow a lot.