The DebtToken::totalSupply and DebtToken::balanceOf functions apply inconsistent scaling directions when adjusting values using getNormalizedDebt(). balanceOf scales up using rayMul, while totalSupply scales down using rayDiv, leading to discrepancies in debt tracking.
Problem description
DebtToken::balanceOf applies rayMul(getNormalizedDebt()), scaling up the balance value.
DebtToken::totalSupply applies rayDiv(getNormalizedDebt()), scaling down the supply value.
This inconsistency results in mismatched debt calculations between individual users and the overall total supply.
Affected Code in DebtToken
Incorrect total supply representation: The total supply does not align with individual balances.
Potential accounting errors: Debt tracking mechanisms relying on totalSupply may operate with incorrect values.
Inconsistencies in debt calculations: Users may observe discrepancies in their individual debt balances versus the protocol’s overall reported debt.
Manual Review
Use the same scaling operation (rayMul or rayDiv) in both functions to maintain consistency.
Adjust either totalSupply or balanceOf to match the scaling direction of the other.
Verify and test that the sum of individual balances aligns with the total supply.
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.