code-423n4 / 2022-01-timeswap-findings

2 stars 0 forks source link

using '!=' instead of '<' or '>' #91

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

rfa

Vulnerability details

Impact

more expensive gas usage

Proof of Concept

since uint variable type cannot < 0. use != to replace < or >

https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L149-L150 https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L153 https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L170 https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L200 https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L203

and more

Tools Used

Recommended Mitigation Steps

replace with '!='

amateur-dev commented 2 years ago

Similar issue reported over here #172; hence closing this.