Omniscia AllianceBlock Audit
Multicall2 Code Style Findings
Multicall2 Code Style Findings
M2L-01C: Loop Iterator Optimizations
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | Multicall2.sol:L21, L56 |
Description:
The linked for
loops increment / decrement their iterator "safely" due to Solidity's built - in safe arithmetics (post-0.8.X
).
Example:
21for (uint256 i = 0; i < calls.length; i++) {
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.
M2L-02C: Suboptimal Struct Declaration Style
Type | Severity | Location |
---|---|---|
Code Style | ![]() | Multicall2.sol:L63 |
Description:
The linked declaration style of a struct is using index-based argument initialization.
Example:
63returnData[i] = Result(success, ret);
Recommendation:
We advise the key-value declaration format to be utilized instead, greatly increasing the legibility of the codebase.
Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):
The key-value declaration style is now properly in use within the referenced struct
declaration, addressing this exhibit in full.