code-423n4 / 2021-10-tally-findings

0 stars 0 forks source link

Prefix increaments are cheaper than postfix increaments #71

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

pants

Vulnerability details

The function Swap.sweepFees uses postfix increaments (x++) instead of prefix increaments (++x).

Impact

Prefix increaments are cheaper than postfix increaments.

Tool Used

Manual code review.

Recommended Mitigation Steps

Change all postfix increaments to prefix increaments where it doesn't affects the functionality.