According to spec:
However, the unstakeAll() function does not handle stakings made in the currentEpoch as done in unstake(). Therefore, not all epochs are unstaked from as should be done.
Epoch Handling:
dr.epoch == 0: This condition checks if the deposit record exists. If not, it skips processing. This is a standard check to ensure that the function only processes valid deposits.
currentEpoch - epoch <= lockCycle: This condition is intended to enforce the lock period, ensuring that users cannot unstake their tokens until the lock cycle has passed.
Current Epoch Deposits:
For deposits made in the currentEpoch, currentEpoch - epoch equals 0.
The condition currentEpoch - epoch <= lockCycle evaluates to true for current epoch deposits, causing the function to skip processing these deposits.
This logic inadvertently prevents users from unstaking tokens that were staked in the current epoch. This is because the condition is designed to enforce the lock cycle, but it does not account for the immediate unstaking scenario that should be allowed for deposits made in the current epoch.
Manual Review
Modify the unstakeAll() function to handle current epoch deposits separately, allowing them to be unstaked immediately without the lock cycle restriction.
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.