sherlock-audit / 2024-06-magicsea-judging

2 stars 0 forks source link

neogranicen - User will lose all his secondary rewards if the extra rewarder gets updated while he is staking #649

Closed sherlock-admin3 closed 1 month ago

sherlock-admin3 commented 2 months ago

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

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

WangSecurity commented 4 weeks ago

Invalid based on the discussion under #460