Root: There's a loss of precision in the ThunderLoan::redeem function during the calculation of amountUnderlying, as it's not been rounded up.
Impact: With this, dust will start getting collected in the protocol itself. The amount might look tiny, but after a while it will get a lot bigger.
Normal Behaviour: The protocol is intended to take funds from Liquidity Providers, collect fees from users who process flash loans, and then redeem the funds to liquidity providers along with the interest they accrued, which is coming from those fees, obviously. Overall, no dust or pending amount should be left in the protocol.
Issue: Unfortunately, the case discussed above doesn't appear to be completely true. As there's definitely a case of loss of precision in the system when we calculate the amountUnderlying in the redeem function. Due to this, the Liquidity providers will start losing some wei every time. The worst part? This amount will keep getting bigger and bigger over time. And no one's there to collect it anyway.
Likelihood: High
Occurs every time a liquidity provider tries to redeem their underlying tokens
Impact: Medium
Dust is getting collected in the protocol, leading to a good amount of loss collectively.
Frequent users will be affected more than others.
First, add this particular modifier in test/unit/ThunderLoanTest.t.sol
Next, add this test
Run the test using:
Logs:
Round up amountUnderlying to 1
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.