Omniscia AllianceBlock Audit

CCIPProvider Code Style Findings

CCIPProvider Code Style Findings

CCI-01C: Inefficient Iterator Increment Statements

Description:

The referenced iterator increment statements are inefficient as they perform an addition-assignment instead of a prefix increment operator.

Example:

contracts/providers/CCIPProvider/CCIPProvider.sol
113i += 1;

Recommendation:

We advise the prefix increment operator (++i) to be utilized, optimizing each increment statement's gas cost.

Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):

The referenced iterator instances were properly updated to prefix increment operators rendering this exhibit fully addressed.

CCI-02C: Inefficient Loop Implementation

Description:

The referenced for loop utilizes a uint8 iterator which is inefficient as the EVM is built to operate on 32-byte types.

Example:

contracts/providers/CCIPProvider/CCIPProvider.sol
271for (uint8 i = 0; i < _supportedChains.length; i++) {

Recommendation:

We advise the iterator to be updated to a uint256 type, optimizing the loop's gas cost.

Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):

The uint256 data type is now properly utilized in the referenced loop, optimizing its gas cost.

CCI-03C: Loop Iterator Optimization

Description:

The linked for loop increments / decrements the iterator "safely" due to Solidity's built-in safe arithmetics (post-0.8.X).

Example:

contracts/providers/CCIPProvider/CCIPProvider.sol
271for (uint8 i = 0; i < _supportedChains.length; i++) {

Recommendation:

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

Alleviation (54fd570de24631ca65a7cea022aebe43225a08c7):

The referenced loop iterator's increment statement has been relocated at the end of the for loop's body and has been unwrapped in an unchecked code block, optimizing its gas cost.

CCI-04C: Suboptimal Struct Declaration Style

Description:

The linked declaration style of a struct is using index-based argument initialization.

Example:

contracts/providers/CCIPProvider/CCIPProvider.sol
314ITeleport.DappTransmissionReceive(
315 message.sender, // This should be the teleport sender on the source chain
316 sourceChainId,
317 info.dappTransmissionSender,
318 transmissionReceiverAddress,
319 info.dAppId,
320 info.dappPayload
321)

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.