Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low

For loops in `public` or `external` functions should be avoided due to high gas costs and possible DOS

Summary

For loops in public or external functions should be avoided due to high gas costs and possible DOS

Vulnerability Details

In Solidity, for loops can potentially cause Denial of Service (DoS) attacks if not handled carefully. DoS attacks can occur when an attacker intentionally exploits the gas cost of a function, causing it to run out of gas or making it too expensive for other users to call. Below are some scenarios where for loops can lead to DoS attacks: Nested for loops can become exceptionally gas expensive and should be used sparingly.

Impact

File: src/ProxyFactory.sol
/// @audit on line 83
81: constructor(address[] memory _whitelistedTokens) EIP712("ProxyFactory", "1") Ownable() {
82: if (_whitelistedTokens.length == 0) revert ProxyFactory__NoEmptyArray();
83: for (uint256 i; i < _whitelistedTokens.length;) {
84: if (_whitelistedTokens[i] == address(0)) revert ProxyFactory__NoZeroAddress();
85: whitelistedTokens[_whitelistedTokens[i]] = true;
86: unchecked {
87: i++;
88: }
89: }
90: }

81-90

Tools Used

Personal bot

Recommendations

Support

FAQs

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