The calculation about the reward use the current state as the parameter. If user perform the withdraw, the current state will be zero in calling claimRewards() later.
The user might lose the whole of reward no matter how long they stake.
Manual.
add a state variable to track user's unclaimed reward
add function to calculate reward
record the user's unclaimed reward before the change of staking token's balance in user-faced functions.
Logs below. testClaimPoC perform withdraw before claiming reward. It shows that user lose the reward.
If we we implement a correct claimRewards function with its intended logic, this would indeed be an issue. I believe low severity for this findings and its duplicates to be appropriate given it is dependent on users lack of understanding of claiming rewards first before a withdrawal.
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.