# Precision in the trapezoidal borrow-rate curve, and the Yearn post-mortem behind it

Mentorship Series #23 · 15 January 2026 · [@0xfirefist](https://x.com/0xFireFist) · Panoptic · Code4rena

Mentorship Series · [The Contest Academy](https://0xsimao.com/the-contest-academy) · 0xSimao

---

We continued the Panoptic [contest](https://code4rena.com/audits/2025-12-panoptic-next-core) 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 `borrowRate` function: 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 == 0` handled in `_borrowRate`? Verdict: the precision is handled well.
- What if `_borrowRate` is spammed? Verdict: fine.
- Call it often, call it rarely, skip a day, make a huge deposit, borrow a lot.

https://youtu.be/RcZ5xmOQGWQ

Session video: https://youtu.be/RcZ5xmOQGWQ

---

Newer: [What happens when the borrow index stops updating, and how far linear adaptation can run](https://0xsimao.com/the-contest-academy/mentorship-series-24) · Older: [Downcasts that silently truncate, and gaming which branch accrueInterest takes](https://0xsimao.com/the-contest-academy/mentorship-series-22)
