The burn function in the RToken contract has a critical scaling issue where it burns raw underlying asset amounts instead of scaled amounts, while also transferring the same raw amount of underlying assets. This breaks the interest-bearing token mechanism and leads to incorrect token accounting.
The protocol uses a liquidity index that grows over time to represent accumulated interest that means when users deposit crvUSD, they receive RTokens that are scaled by dividing by the current liquidity index and when users burn RTokens, the amount should be scaled back up by multiplying by the current index.
Before we dive deep into the issue, here is a short recap of the flow as the lender withdraws his asset tokens;
LendingPool.withdraw(amountOfCRVUSD) -> ReserveLibrary.withdraw -> RToken.burn
The Current Implementation of RToken::burn:
The issue lies in how amounts are handled:
The function receives amount which represents underlying crvUSD tokens
It calculates amountScaled but doesn't use it
It burns the raw amount of RTokens
It transfers the raw amount of crvUSD
Why This Is Wrong:
Let's say:
Initial deposit: 100 crvUSD when index = 1.0
Later, index grows to 1.1 (10% interest)
User's 100 RTokens should now be worth 110 crvUSD
When burning 110 crvUSD worth:
Should burn 100 RTokens (110/1.1)
Should transfer 110 crvUSD
Current implementation:
Burns 110 RTokens (too much)
Transfers 110 crvUSD
This breaks the fundamental accounting of the interest-bearing token system.
Alice deposits 100 crvUSD when index = 1.0
Receives 100 RTokens
Index grows to 1.1 (10% interest)
Alice's 100 RTokens should be worth 110 crvUSD
Alice burns for 110 crvUSD
Current: Burns 110 RTokens (wrong)
Should: Burn 100 RTokens (110/1.1)
Result: System burns more RTokens than it should, breaking the interest-bearing mechanism
Incorrect burning of RTokens leads to accounting errors in the protocol
Users lose their interest-bearing position value
System's total supply becomes incorrect
Breaks the core mechanism of the interest-bearing token system
Manual code review
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.