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

0 stars 0 forks source link

confirm if lengths are equal before looping #175

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

hack3r-0m

Vulnerability details

https://github.com/XDeFi-tech/xdefi-distribution/blob/master/contracts/XDEFIDistribution.sol#L80

check the length of durations_ and multipliers is equal and revert if it is not resulting in gas savings rather than delayed revert.

deluca-mike commented 2 years ago

We try to reduce gas costs for happy path, not for sad path. Assuming lengths are equal (which they will be in the overwhelming majority of the time), it is cheaper not to check them. Further, most wallets (and certainly the one we use) will alert the user if a transaction is going to fail, so it will never waste gas anyway.

deluca-mike commented 2 years ago

Duplicate #38