stake.link

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

Issue in `removeWhitelistedChain` Function

Summary

Array Modification:

  • In the removeWhitelistedChain function, modifying arrays can be expensive, especially if the array is long. Consider using a mapping for more efficient removal.

Vulnerability Details

The removeWhitelistedChain function in the SDLPoolCCIPControllerPrimary contract attempts to remove a whitelisted chain and its associated data from various arrays. However, the implementation employs a loop through the whitelistedChains array to find the index of the chain to be removed. This approach may lead to higher gas costs and potential inefficiencies, especially when the array is long

Impact

Results in higher gas costs, particularly problematic with an increasing number of whitelisted chains.

Compromises scalability due to inefficient whitelisted chain removal.

Raises operational costs with increased gas consumption.

Tools Used

Manual Reviews

Recommendations

Consider refactoring the implementation to use a mapping instead of an array for storing whitelisted chains. This approach would enhance gas efficiency when adding or removing whitelisted chains, providing a more scalable and cost-effective solution.

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.