Closed sherlock-admin2 closed 5 months ago
1 comment(s) were left on this issue during the judging contest.
0xmystery commented:
valid because lastRewardBlock for each pool should indeed sync with the latest startBlock
The protocol team fixed this issue in the following PRs/commits: https://github.com/sophon-org/farming-contracts/commit/1f8d4e5ccec63052fcaf751b867294472e2d20a7
yamato
medium
Pools will remain with their old
startTime
ifstartTime
is changed to earlier.Summary
Pools might be forced to start the reward accrual later than supposed to.
Vulnerability Detail
When a pool is added, if
startBlock
is in the future, the pool'slastRewardBlock
gets set tostartBlock
The problem is that
startBlock
value can be changedIn the case that
startBlock
is reduced, pools created prior to that will only start accruing points after the oldstartBlock
passes.Any new added pool (or adjusted via
set
) will start accruing points from the newstartBlock
on.Impact
Some pools will start accruing rewards later than the others
Code Snippet
https://github.com/sherlock-audit/2024-05-sophon/blob/main/farming-contracts/contracts/farm/SophonFarming.sol#L272C1-L280C6
Tool used
Manual Review
Recommendation
upon changing startBlock, adjust all pools accordingly.
Duplicate of #108