15,000 USDC
View results
Submission Details
Severity: gas

Array lacks use of the pop function

Summary

There are some arrays that can grow indefinitely in size, as they never shrink: this can lead to inefficient memory management and increase the likelihood of out-of-gas errors.

Vulnerability Details

In this code, the s_collateralTokens array is continually being appended with new elements without any mechanism to remove or reduce its size. This can lead to the array growing indefinitely, consuming unnecessary memory and potentially causing out-of-gas errors in transactions due to excessive computational costs.

for (uint256 i = 0; i < tokenAddresses.length; i++) {
s_priceFeeds[tokenAddresses[i]] = priceFeedAddresses[i];
s_collateralTokens.push(tokenAddresses[i]);
}

impact

Gas Inefficiency: Growing arrays without limits may lead to increased gas costs during smart contract interactions

Support

FAQs

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