Closed sherlock-admin4 closed 1 month ago
Albort
high
SophonFarming :: setStartBlock ()cannot throw an exception when endBlock is 0
SophonFarming :: setStartBlock ()
if (_startBlock == 0 || (endBlock != 0 && _startBlock >= endBlock)) {
This could lead to unexpected behavior in the contract.
https://github.com/sherlock-audit/2024-05-sophon/blob/05059e53755f24ae9e3a3bb2996de15df0289a6c/farming-contracts/contracts/farm/SophonFarming.sol#L273
Manual Review
if (_startBlock == 0 || _startBlock >= endBlock) {
1 comment(s) were left on this issue during the judging contest.
0xmystery commented:
invalid because of insufficient proof
Albort
high
The function has a logical error in its checks.
Summary
SophonFarming :: setStartBlock ()
cannot throw an exception when endBlock is 0Vulnerability Detail
if (_startBlock == 0 || (endBlock != 0 && _startBlock >= endBlock)) {
Impact
This could lead to unexpected behavior in the contract.
Code Snippet
https://github.com/sherlock-audit/2024-05-sophon/blob/05059e53755f24ae9e3a3bb2996de15df0289a6c/farming-contracts/contracts/farm/SophonFarming.sol#L273
Tool used
Manual Review
Recommendation
if (_startBlock == 0 || _startBlock >= endBlock) {