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

1 stars 0 forks source link

Redundant code #173

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

wuwe1

Vulnerability details

Proof of Concept

redundant code

https://github.com/code-423n4/2022-01-elasticswap/blob/main/elasticswap/src/contracts/Exchange.sol#L266-L269

https://github.com/code-423n4/2022-01-elasticswap/blob/main/elasticswap/src/libraries/MathLib.sol#L663-L666

Tools Used

remove Exchange.sol#L266-L269

GalloDaSballo commented 2 years ago

Interestingly the warden advise to remove the 0 check to save gas, what will the 0 check people say?

GalloDaSballo commented 2 years ago

As linked by the warden the 0 check also happens in the library. As such the 0 check in the external function is redundant. Agree with the finding