Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: high
Invalid

Inefficient Iteration in expel and removeTeacher Functions

Summary These functions iterate over the entire list to remove an entry.

Vulnerability Details

for (uint256 n = 0; n < teacherLength; n++) {
if (listOfTeachers[n] == _teacher) {
listOfTeachers[n] = listOfTeachers[teacherLength - 1];
listOfTeachers.pop();
break;
}
}

Impact High gas costs and potential reverts for large lists.

Tools Used github copilot

Recommendations Use a mapping for efficient lookups and removals, or maintain an index mapping to reduce iteration costs.

Updates

Lead Judging Commences

yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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