In the contract DebtToken.sol the update function is overridden and the following line is added:
After these lines of code the amount will be increased. This will cause the burn function to revert in a case when amount > userBalance. We also have the same case in the contract RToken.
In the burn function we see the following code:
In a case where amount is bigger than the user balance we make the amount equal to userBalance. After that we call the function _burn with the amount that is equal to userBalance. You probably see where I am going, as the update function adds additional value the function _burn will revert because the user will not have enough tokens.
Reversion of Burn Transactions:
The additional conversion in the _update function increases the burn amount unexpectedly, leading to transaction reverts when a user’s burn amount is capped to their balance.
Denial of Service:
If burn operations consistently revert, users may be unable to reduce their debt positions, potentially disrupting protocol operations.
Manual Code Review
Use a Consistent Normalized Debt Index Across Calculations
Ensure that the same normalized debt value is used throughout the burn operation to avoid discrepancies between scaled and non‐scaled amounts. For example, capture the normalized debt index once at the start of the function and use it for all scaling operations:
Refactor the Internal _update Function
Modify _update to optionally bypass additional scaling during burn operations. One approach is to add a flag to control whether scaling should occur:
Then update the burn function to call _update without scaling:
The amount and userBalance are both in actual debt units, making the comparison valid. No reverts occur - the burn function works as intended by burning the correct scaled amount from storage.
The amount and userBalance are both in actual debt units, making the comparison valid. No reverts occur - the burn function works as intended by burning the correct scaled amount from storage.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.