Omniscia AllianceBlock Audit

DiamondLoupeFacet Code Style Findings

DiamondLoupeFacet Code Style Findings

DLF-01C: Loop Iterator Optimizations

Description:

The linked for loops increment / decrement their iterator "safely" due to Solidity's built - in safe arithmetics (post-0.8.X).

Example:

contracts/facets/DiamondLoupeFacet.sol
29for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) {

Recommendation:

We advise the increment / decrement operations to be performed in an unchecked code block as the last statement within each for loop to optimize their execution cost.

Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):

The referenced loop iterator increment statements have been relocated at the end of each respective for loop's body and have been unwrapped in an unchecked code block, optimizing their gas cost.