`PriorityPool::checkUpkeep()` is supposed to do some checks to ensure as to whether performUpkeep() function can be called or not. Now, during the execution of PriorityPool::performUpkeep(), the logic in the checkUpkeep() function is inculcated into the depositQueuedTokens function by the protocol team. However, this logic is wrongly executed within the _depositQueuedTokens function.
Due to this, even though, checkUpkeep confirms that a call should be made to deposit the queued tokens into the strategies contract, the amount to deposit will not be the actual intended amount, resulting in some of the tokens still idle, and missing on yield and rewards.
Have a look at the checkUpkeep() function below:
```solidity
```
Look at the _depositQueuedTokens() function attempting to apply the same checkUpkeep logic, but doing it wrongly.
`PriorityPool::_depositQueuedTokens()` .
Instead of uint256 toDepositFromStakingPool = MathUpgradeable.min(MathUpgradeable.min(unusedDeposits + totalQueued, strategyDepositRoom), ``depositMax);
* as done in the checkUpkeep function, it uses uint256 toDepositFromStakingPool = MathUpgradeable.min(MathUpgradeable.min(unusedDeposits, strategyDepositRoom), _depositMax);
* which is flawed. #see below:
Now, with this current implementation, the value of uint256 toDepositFromStakingPool variable could be lesser than the actual value, which will in turn make the uint256 toDepositFromQueue variable have a wrong value. This will ultimately result in a wrong amount being deposited into the staking Pool. See Below:
Actual intended full amount will not be deposited into the staking Pool even though there is enough room in the strategies contracts, leaving some of the tokens still idle missing on yield and rewards distribution.
Manual Review
Follow the logic in the PriorityPool::checkUpkeep()
function, and ensure that this same logic is applied in PriorityPool::_depositQueuedTokens()
function .
Within PriorityPool::_depositQueuedTokens() function,
Change
From:
To:
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.