The executeQueuedWithdrawals function in the PriorityPool contract contains a critical flaw in its token flow, potentially leading to stuck funds and failed withdrawals.
In the executeQueuedWithdrawals function:
The issue lies in the stakingPool.withdraw call. It uses address(this) (PriorityPool) as both the account to withdraw from and the receiver of the withdrawn tokens. This is incorrect because:
The PriorityPool doesn't own the LST tokens it's trying to burn.
The underlying tokens are being sent to the PriorityPool instead of directly to the WithdrawalPool.
WithdrawalPool calls executeQueuedWithdrawals on PriorityPool with _amount = 100 tokens.
LST tokens are transferred from WithdrawalPool to PriorityPool.
PriorityPool calls stakingPool.withdraw(address(this), address(this), 100, _data).
StakingPool attempts to burn 100 LST from PriorityPool's balance, which fails because PriorityPool doesn't have these tokens (they were just transferred and not approved).
The withdrawal fails, and the LST tokens are now stuck in the PriorityPool.
Here's how the StakingPool's withdraw function works:
The _burn(_account, toWithdraw) call will fail because the PriorityPool (specified as _account) doesn't have the LST balance and approval to burn.
Users' withdrawal requests will fail, leaving their funds locked in the protocol.
LST tokens will be stuck in the PriorityPool, leading to a discrepancy between the protocol's accounting and actual token distribution.
This could lead to a loss of funds for users and damage the protocol's functionality and reputation.
Manual review
Modify the executeQueuedWithdrawals function to correctly specify the WithdrawalPool as the account to withdraw from and receive tokens:
This change ensures that:
LST tokens are burned directly from the WithdrawalPool's balance.
Underlying tokens are sent directly to the WithdrawalPool.
There's no unnecessary token transfer through the PriorityPool.
These modifications will prevent the funds from getting stuck and ensure the withdrawal process works as intended.
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.