This repository has been archived by the owner on Nov 24, 2024. It is now read-only.
dhank - Able to update new startBlock greater then old startBlock #222
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Disputed
The sponsor disputed this issue's validity
dhank
medium
Able to update new startBlock greater then old startBlock
Summary
Not checking whether the new startBlock is greater than old startBLock while updating startBlock.Hence the wrong rewards are calculated when the old start Block > current block number
Vulnerability Detail
In the function
https://github.com/sherlock-audit/2024-05-sophon/blob/05059e53755f24ae9e3a3bb2996de15df0289a6c/farming-contracts/contracts/farm/SophonFarming.sol#L272-L280
we dont have the condition to check whether the _startBlock > startBlock.
pool.lastRewardBlock still has the old value of startBLock.
Impact
pool.lastRewardBlock will store the incorrect value of old startBlock even though new startBlock has been initialised by owner.
As a result wrong rewards will get calculated.
Code Snippet
https://github.com/sherlock-audit/2024-05-sophon/blob/05059e53755f24ae9e3a3bb2996de15df0289a6c/farming-contracts/contracts/farm/SophonFarming.sol#L272-L280
Tool used
Manual Review
Recommendation
Duplicate of #108
The text was updated successfully, but these errors were encountered: