The RToken contract fails to update the user state indices during token transfers, which leads to incorrect interest calculations for users after token transfers occur. This breaks a core invariant of lending protocols where interest should accrue correctly regardless of token transfers.
In the current implementation:
The RToken contract maintains user state indices in the _userState mapping:
This index is properly updated during mints and burns in RToken:
However, in the transfer functions (both the transfer and transferFrom), the indices are not updated:
This causes two critical issues:
The sender's remaining tokens will accrue interest from their last index update, not from the transfer time
The recipient's received tokens will accrue interest from their existing index (or zero if first time), not from the transfer time
The core issue is that while the transfer amount is properly scaled, the user indices are not updated to reflect the new "checkpoint" time for interest calculations.
This breaks a fundamental invariant that Interest accrual should be accurate regardless of token transfers between users.
Alice deposits 100 tokens, receiving 100 rTokens (index = 1.0)
After some time, index increases to 1.1 (10% interest accrued)
Alice transfers 50 rTokens to Bob
After more time, index increases to 1.2
Due to missing index updates:
Alice's remaining 50 tokens still accrue from index 1.0
Bob's 50 tokens accrue from index 0 (or his last stored index)
This leads to incorrect balances for both users
The missing index updates cause:
Incorrect interest accrual calculations
Users potentially earning more or less interest than they should
Breaking of core lending protocol accounting invariants
Manual review
Update the transfer and transferFrom functions to maintain indices:
Apply similar changes to transferFrom.
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.