Submitted by 0xpiken, also found by zzebra83 and rscodes
New reward distribution can not start automatically when lastRPS is set to 0 accidentally.
When ChefIncentivesController#claim() is called to vest reward for eligible user, _updateEmissions() is invoked first. This function checks if the current reward distribution has ended and, if so, stores the value of rewardsPerSecond into lastRPS for future use:
When new rewards are deposited, the cached value in lastRPS should be restored to rewardsPerSecond to restart the reward distribution.
However, if somehow claim() is called twice continually when the current reward distribution ends, lastRPS will be set to 0 and registerRewardDeposit() can not restart new reward distribution.
Copy below codes to ChefIncentivesController.t.sol and run forge test --match-test test_setLastRPStoZero:
lastRPS should not be updated when rewardsPerSecond is 0:
Invalid Validation
amarcu (LoopFi) confirmed
0xAlix2 (warden) commented:
zzebra83 (warden) commented:
Koolex (judge) commented:
