stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: low
Invalid

Unnecessary execution costs when there are no supported tokens

Summary

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.

Vulnerability Details

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.

Impact

Executing operations with an empty tokens array leads to wasteful consumption of gas, which results in higher transaction costs.

Tools Used

Manual Review

Recommendations

To address this, the following modifications are recommended:

  1. 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:

    if (tokens.length == 0) {
    return;
    }
Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.