https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L772-L793
Users cannot withdraw funds even when the protocol has sufficient liquidity. The withdrawal process is fundamentally broken because liquidity intended to cover withdrawals is routed to the wrong contract (LendingPool instead of the RToken buffer). This results in:
Failed transactions for all withdrawals requiring vault top-ups.
Loss of user trust and potential fund lockup.
Liquidity Check Misdirects Funds
_ensureLiquidity withdraws from the vault to address(this) (LendingPool) instead of reserveRTokenAddress.
Withdrawal Relies on Incorrect Buffer
ReserveLibrary.withdraw calls IRToken.burn, which attempts to transfer assets from reserveRTokenAddress.
Rebalance Fails to Fix Buffer
_rebalanceLiquidity withdraws vault funds to address(this), not reserveRTokenAddress, leaving the buffer underfunded.
User requests withdrawal of X tokens.
reserveRTokenAddress has Y < X tokens.
_ensureLiquidity withdraws X - Y tokens from the vault to LendingPool (not reserveRTokenAddress).
ReserveLibrary.withdraw attempts to send X tokens from reserveRTokenAddress (still Y tokens), causing a revert.
_rebalanceLiquidity is never executed (transaction already reverted).
Manual code review
Modify _withdrawFromVault to send withdrawn funds to reserveRTokenAddress:
Update _rebalanceLiquidity to interact with reserveRTokenAddress:
When depositing excess buffer liquidity into the vault, pull from reserveRTokenAddress.
When withdrawing to cover shortages, send funds to reserveRTokenAddress.
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.