code-423n4 / 2022-03-lifinance-findings

6 stars 4 forks source link

Gas Optimizations #199

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Prefix increments are cheaper than postfix increments.

Handle

tchkvsky

Vulnerability details

These functions use not using prefix increments (++x)

Impact

Using prefix increment is more gas efficient

Proof of Concept

DexManagerFacet.sol

#L33

#L52

#L65

Swapper.sol

#L14

Tools Used

Manual review

Recommendation

Consider using prefix increments (++i) to save gas

H3xept commented 2 years ago

We internally decided to ignore prefix increments for now.