The removeTeacher and expel functions in the LevelOne contract use linear search (O(n)) to find elements in arrays before removing them, which becomes increasingly gas-inefficient as the arrays grow in size.
Both functions iterate through arrays to find target elements:
As the school grows and more teachers/students are added, these operations will:
Consume increasingly more gas
Eventually risk hitting block gas limits with large arrays
Make operations prohibitively expensive during high network congestion
Potentially cause transaction failures for critical administrative functions
Foundry Forge
Manuel Code review
Implement a mapping-based approach to track array indices:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.