code-423n4 / 2021-12-pooltogether-findings

0 stars 0 forks source link

loops: skip initialization, do prefix increments #143

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

loops can be more efficient if you skip the default initialization to 0 and move postfix incrementation to prefix:

  for (uint256 index = 0; index < _epochIds.length; index++) //before
  for (uint256 index; index < _epochIds.length; ++index) //after
PierrickGT commented 2 years ago

Duplicate of https://github.com/code-423n4/2021-12-pooltogether-findings/issues/17