Closed code423n4 closed 2 years ago
Please provide a concrete example with file and line where this would impact TempusAMM/TempusPool/TempusController. Auxiliary mock and debug libraries should be ignored during the review.
closing due to lack of information and finding no obvious examples in the code base.
Handle
pants
Vulnerability details
There are many places in the code (especially in for-each loops) that loads the same array element more than once. In such cases, only one array boundaries check should take place, and the rest are unnecessary. Therefore, this array element should be cached in a local variable and then be loaded again using this local variable, skipping the redundent second array boundaries check.
Impact
Unnecessary array boundaries checks are taken place and increase gas costs.
Tool Used
Manual code review.
Recommended Mitigation Steps
Load the array elements once, cache them in local variables and then read them again using the local variables. For example: