Anyone can call TempleGoldStaking.distributeRewards()
if the distributionStarter
is address(0). This is by design. In order for an account with elevated access(TRUESTED) to callTempleGoldStaking.setVestingPeriod()
or TempleGoldStaking.setRewardDuration()
, the reward epoch needs to have ended, otherwise, those txs revert.
Scenario:
0) distributionStarter is address(0)
1) A trusted user with elevated access sends a tx to the mempool. It calls setVestingPeriod
or setRewardDuration
2) An attacker monitors the mempool and frontruns those txs by calling distributeRewards()
, which calls _notifyRewards()
internally. rewardData.periodFinish
is updated to be into the future
3) The trusted user tx gets executed, and reverts because periodFinish
is in the future. This could happen on every attempt to call those 2 functions(mentioned in 1 point).
4) setVestingPeriod() and setRewardDuration() can never be executed under those conditions
Code snippets:
DOS of setVestingPeriod()
and setRewardDuration()
Manual review
Maybe consider only trusted accounts to trigger: TempleGoldStaking.distributeRewards()
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.