This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
neogranicen - User will lose all his secondary rewards if the extra rewarder gets updated while he is staking #649
Labels
Non-Reward
This issue will not receive a payout
neogranicen
Medium
User will lose all his secondary rewards if the extra rewarder gets updated while he is staking
Summary
If a user stakes tokens in the masterchefV2 and the Extra Rewarder gets changed while the user tokens are staked he will loose all his rewards from the previous rewarder
Vulnerability Detail
A users rewards from the masterchef rewarder are sent to him everytime he: deposits,withrawls,claim rewards or the trustee deposits for him and this is done by calling
onModify
onModify
to be called on here account happen_setExtraRewarder
is called and the extra rewarder is changedImpact
The issue outlined above will cause loss of funds to users who did not get their rewards yet and the damage will depend on how frequently the rewarder is updated
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/42e799446595c542eff9519353d3becc50cdba63/magicsea-staking/src/MasterchefV2.sol#L488
Tool used
Manual Analysis
Recommendation
Ensure that all the rewards from the old extra rewarder are distrubuted before setting a new one
The text was updated successfully, but these errors were encountered: