Any user who withdraws before calling claim can have WETH stuck forever in Staking.sol.
Due to the nature of how shares are calculated, and not claimed when someone calls withdraw, there is a possibility that any user maliciously, unknowingly or accidentally can withdraw before claiming. And when he withdraws before claiming the WETH he quarried will remain stuck in the contract forever.
This issue arises from 2 different things:
WETH is not claimed on withdraw
Shares are only calculated with an increase on already accumulated balances
First one is simple, so lets focus on the latter one. When update is called,the difference of the 2 balances is only added. If there was already a balance (like the unclaimed one) it will not be included in the diff, thus will not account for any increase.
And because updateFor only adds the index extracted from update it will also not be able to add the amount that was not claimed.
Now here are some examples of how this can happen:
User accidentally withdraws without claiming
Tho really, a reorg can make it so only withdraw executes on the long chain
Claim stays in the mem pool for a long time and when user the calls withdraw it gets executed first
WETH can become stuck forever.
Manual review
Claim shares when someone withdraws. Here is some pseudo code:
And you would need to make claim public, or even better - Make an internal claim that is called by main claim and withdraw.
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.