20,000 USDC
View results
Submission Details
Severity: gas
Valid

caching the array length into a memory variable in loops

Summary

storing the length of the array in a variable is more gas efficient

Vulnerability Details

storing the length of the array in a variable is more gas efficient and save one calldatacopy (3 gas )

Impact

gas saved 6 * 3 = 18 gas unit

Tools Used

manual review

Recommendations

cache the length of the array in local variable before starting the loop

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.