This report identifies a potential efficiency improvement in the SDLPoolCCIPControllerPrimary.sol
smart contract, specifically within the distributeRewards
function. The issue is related to the handling of token arrays, where unnecessary execution costs can be avoided.
In SDLPoolCCIPControllerPrimary.sol:58
, the distributeRewards
function retrieves a list of supported tokens and proceeds with its logic without checking if the tokens.length
is greater than zero. This oversight can lead to unnecessary execution costs when the tokens
array is empty, as the function still executes several operations that are redundant in this case.
Executing operations with an empty tokens
array leads to wasteful consumption of gas, which results in higher transaction costs.
Manual Review
To address this, the following modifications are recommended:
Add a Preliminary Check: Implement a check at the beginning of the distributeRewards
function to verify if tokens.length
is greater than zero. If the array is empty, the function should return early to avoid further execution.
Example:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.