This repository has been archived by the owner on Nov 24, 2024. It is now read-only.
zzykxx - setStartBlock()
doesn't change the block at which already existing pools will start accumulating points
#108
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
zzykxx
high
setStartBlock()
doesn't change the block at which already existing pools will start accumulating pointsSummary
The function setStartBlock() can be called by the owner to change the block number at which points will start accumulating. When it's called, the block at which already existing pools will start accumulating points will not change. Already existing pools will:
startBlock
if the newstartBlock
is set after the old one.startBlock
is reached if the newstartBlock
is set before the old one.Vulnerability Detail
This happens because updatePool() considers the pool
lastRewardBlock
as the block number from which points should start accumulating and setStartBlock() never updates thelastRewardBlock
of the already existing pools to the newstartBlock
.POC
Runnable POC that showcases point
1
explained above. Can be copy-pasted inSophonFarming.t.sol
:Can be run with:
forge test --match-test test_SettingStartBlockDoesntUpdatePools -vvvvv
Impact
When setStartBlock() is called the block at which already existing pools will start accumulating points will not change.
Code Snippet
Tool used
Manual Review
Recommendation
In setStartBlock() loop over all of the existing pools and adjust each pool
lastRewardBlock
to the newstartBlock
. Furthermore setStartBlock() should revert if the newstartBlock
is lower than the currentblock.number
as this would create problems in points distribution accounting if the above fix is implemented.The text was updated successfully, but these errors were encountered: