morpho-org / morpho-blue-irm

Morpho Blue Interest Rate Models
https://morpho.org
MIT License
26 stars 17 forks source link

Sanitize target utilization input #25

Closed QGarchery closed 1 year ago

QGarchery commented 1 year ago

Right now the choice was made to sanitize the target utilization input in the constructor. Because of this choice, I feel like the sanitization should prevent problematic values to be input. Input 0 is problematic because errNormFactor can be 0 and it would lead to a division by 0 in the computation of err. Input WAD is problematic because it would lead to a market with a rate that is always decreasing.

Found when thinking about Certora invariants, thanks @mailalexjoseph, @jhoenicke