Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: low
Invalid

The incorrect termination condition of the for loop leads to gas wastage.

Summary

The incorrect termination condition of the loop leads to gas wastage.

Vulnerability Details

In the file MembershipFactory.sol, at line 114, a for loop assigns the value of dao.tiers[i].minted to tierConfigs[i].minted. The number of assignments depends on the variable dao.tiers.length,

for (uint256 i = 0; i < tierConfigs.length; i++) {
if (i < dao.tiers.length) {
tierConfigs[i].minted = dao.tiers[i].minted;
}
}

but the loop uses tierConfigs.length as the termination condition. This results in tierConfigs.length - dao.tiers.length unnecessary iterations.

Recommendations

for (uint256 i = 0; i < dao.tiers.length; i++) {
tierConfigs[i].minted = dao.tiers[i].minted;
}
Updates

Lead Judging Commences

0xbrivan2 Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
0xbrivan2 Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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