In the `unstakeAll` function, deposit records are only deleted if both the `dr.vestedStaked` and `dr.staked` values are zero. If there are any remaining vested stakes, the function only resets the `dr.staked` value to zero, leaving the deposit record in storage. While this behavior may be intentional to track ongoing vested stakes, it can lead to unnecessary data retention and potential user confusion regarding their remaining stakes.
The `unstakeAll` function allows users to unstake their tokens from all active epochs at once. As it iterates through each of the user's active deposits, the function determines whether to delete the deposit record or merely update it based on the state of the user's stake
Unnecessary Data Storage: Retaining deposit records when only vested stakes remain could lead to increased storage usage, which may result in higher gas costs over time, especially in contracts with many users or frequent staking activity.
Potential User Confusion: Users might assume that all records are removed once they have unstaked their tokens. However, the presence of partial records could cause misunderstandings about what remains staked, especially if the details of this behavior are not clearly communicated.
Manual Review
Consider Storage Optimization: Evaluate whether it is necessary to retain deposit records when only vested stakes remain. If not, optimizing the storage of these records could improve the contract's efficiency by reducing unnecessary storage costs.
Enhanced Documentation: If the decision to retain partial records is intentional, it is crucial to document this behavior clearly. Users and developers should be informed that records will only be deleted when both `dr.staked` and `dr.vestedStaked` are zero. Clear documentation will help prevent confusion and ensure users understand how their stakes are managed.
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.