Description
In the MToken._mint function, there's a check to make sure the total principal doesn't become larger than a uint112: if ( principalOfTotalEarningSupply + _getPrincipalAmountRoundedDown(totalNonEarningSupply) >= type(uint112).max
) {
revert OverflowsPrincipalOfTotalSupply();
}Inside the condition, we're adding two uint112 numbers, which will panic overflow if the result is greater than type(uint112).max (solidity 0.8 is being used). For this reason, the error inside the if statement will never actually be reached.
Recommendation
Cast one of the numbers to uint256 to prevent the addition from panic overflowing:
if ( uint256(principalOfTotalEarningSupply) +
_getPrincipalAmountRoundedDown(totalNonEarningSupply) >= type(uint112).max
) {
revert OverflowsPrincipalOfTotalSupply();
}Status
Addressed in #bdd94b9.