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

0 stars 0 forks source link

`.length` access in loop #110

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

certora

Vulnerability details

Impact

In multiple for loops you access the .length if an array in every loop iteration. for example in BorrowerOperations line 873, 920, 929,930 and more... This is a waste of gas and could easily be reduced by saving the length in a local variable

Proof of Concept

Checked on Remix

Tools Used

Manual code review

Recommended Mitigation Steps

Save the length in a local variable right before entering the loop and iterate over it instead

kingyetifinance commented 2 years ago

@LilYeti: Duplicate of #14

alcueca commented 2 years ago

Duplicate #283