Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xRajkumar - Delegating Stake Without Claiming Reward Causes Loss #224

Open
sherlock-admin3 opened this issue Sep 23, 2024 · 0 comments
Open

Comments

@sherlock-admin3
Copy link

sherlock-admin3 commented Sep 23, 2024

0xRajkumar

High

Delegating Stake Without Claiming Reward Causes Loss

Summary and Vulnerability Detail

In L2Staking, we have a function that allows stake delegation to a delegatee.
This function then calls notifyDelegation in the Distribute contract, and if newDelegation is true, it will modify unclaimedStart to effectiveEpoch.

If a user delegates stake without claiming rewards from their previous stake, he will lose those rewards.

Scenario: A user delegates their stake to a delegatee and, after some epochs, decides to undelegate the stake. Later, the user chooses to delegate to the same delegatee again, but first calls claimUndelegation to pass the requirement require(!_unclaimed(_msgSender(), delegatee), "undelegation unclaimed"). However, when the user delegates the stake again, they will lose the rewards from the previous delegation.

This is a smart contract issue, not the user’s mistake. There should either be a function that allows users to claim rewards from their previous stake, or we should enforce a rule that prevents users from delegating again without first claiming their previous rewards.

Impact

Impact is high because it causes loss of user rewards.

Tool used

Manual Review

Recommendation

There should either be a function that allows users to claim rewards from their previous stake, or we should enforce a rule that prevents users from delegating again without first claiming their previous rewards.

References

https://github.com/sherlock-audit/2024-08-morphl2/blob/main/morph/contracts/contracts/l2/staking/Distribute.sol#L94-L114

@sherlock-admin3 sherlock-admin3 changed the title Crazy Jetblack Pigeon - Delegating Stake Without Claiming Reward Causes Loss 0xRajkumar - Delegating Stake Without Claiming Reward Causes Loss Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant