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

0 stars 0 forks source link

Unnecessary casting #177

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

sirhashalot

Vulnerability details

Impact

When comparing an integer variable with a constant, there is no need to cast the constant using uint256() or similar casting functions

Proof of Concept

There are multiple instances of this in the XDEFIDistribution.sol contract, including: Lines 122, 145, 149, 177, 207, 215, 255, 259, 285, 289, 304, 322 https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol

Recommended Mitigation Steps

Remove the unnecessary casting operations

deluca-mike commented 2 years ago

These aren't casting. They are just making the types explicit for litterals, and just in no bytecode difference or additional gas costs. We just like to be explicit where possible.

Ivshti commented 2 years ago

agreed, once again these aren't castings