notifyDistribution Function:
This function is called by the TempleGold contract after minting new rewards.
It updates nextRewardAmount with the newly minted amount.
distributeRewards Function:
This function is responsible for starting a new reward distribution epoch.
It checks if the distribution starter is authorized, if the cooldown period has passed, and if there are stakers.
It then calls _notifyReward to update the reward rate and period.
Detailed Step-by-Step Attack by Alice:
Inflating Rewards:
Alice calls notifyDistribution with a large amount, say 1,000,000 tokens.
This updates nextRewardAmount to 1,000,000 tokens.
Alice calls notifyDistribution again with another 1,000,000 tokens.
Now, nextRewardAmount is 2,000,000 tokens.
Starting New Reward Epoch:
Alice ensures no one else has called distributeRewards yet.
She calls distributeRewards, which starts a new epoch with nextRewardAmount as 2,000,000 tokens.
The reward rate and period are now based on this inflated amount.
This can lead to rapid depletion of the reward token pool, causing significant financial losses to the staking contract and diminishing the value of the reward tokens for legitimate stakers.
Implement a check to ensure notifyDistribution can only be called once within a certain time frame.
Introduce a cap on the nextRewardAmount to prevent excessive inflation of rewards.
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.