TSender

Cyfrin
DeFiFoundry
15,000 USDC
View results
Submission Details
Severity: low
Invalid

Loop inside loop with no constrained length may make this function unusable by other contracts

Loop inside loop causes O(n**2) time complexity which is very costly in solidity. And due to gas limit this code can go in DOS at very less length of these arrays. So better to use some other approach
src/protocol/TSender.sol

function areListsValid(address[] calldata recipients, uint256[] calldata amounts) external pure returns (bool) {
if (recipients.length == 0) {
return false;
}
if (recipients.length != amounts.length) {
return false;
}
for (uint256 i; i < recipients.length; i++) {
if (recipients[i] == address(0)) {
return false;
}
if (amounts[i] == 0) {
return false;
}
for (uint256 j = i + 1; j < recipients.length; j++) {
if (recipients[i] == recipients[j]) {
return false;
}
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 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.