Submitted by 0x52, also found by IllIllI
Some user withdrawals wont be available for withdrawal even though it should be.
sendWithdrawalRequest can only happen once per cycle. canBatchTransactions (L386) must return true for the actual withdrawal request to happen. It checks in L362 that currentCycleIndex > lastTokeCycleIndex and in L397 of sendWithdrawlRequest, lastTokeCycleIndex = currentCycleIndex. This means that for the rest of the cycle, canBatchTransactions will return false. This means that if a user requests a withdrawal towards the end of epoch after the withdrawal has been submitted but before the end of the epoch, their withdrawal will be set to the current epoch but the actual token amount of their withdrawal wont be processed. This will lead to a discrepancy between the number of tokens withdrawn and the number of tokens allowed to be withdrawn by users, which means that not all users who are eligible for withdrawal will actually be able to withdraw because there wont be enough tokens for everyone.
The requirement in L362 should be removed. As noted in the contract, TOKEs requestWithdrawal overwriting the amount if you call it more than once per cycle. Overwriting the withdrawal is perfectly okay though because it already uses requestWithdrawalAmount which is a cumulative measure of the tokens that need to be withdrawn because it is only decreased when the asset it actually received from a withdrawal.
toshiSat (Yieldy) acknowledged and commented:
