Both functions iterate through dynamic arrays (listOfTeachers and listOfStudents) to locate and remove specific entries. As these arrays grow, the gas required for iteration increases, potentially exceeding the block gas limit and causing transaction failures.
Unbounded Loops: The functions use for loops to traverse arrays without limiting the number of iterations. These patterns are susceptible to gas limit vulnerabilities,If a function in a smart contract requires more gas than the block gas limit to complete its execution, the transaction will fail."
Functionality Loss: Essential administrative actions like removing teachers or expelling students could become impossible, disrupting contract operations.
Manual Code review
Use Mappings Instead of Arrays: Replace dynamic arrays with mappings for tracking teachers and students. Mappings offer constant-time access and are not susceptible to iteration-based gas issues.
Implement Index Tracking: If arrays are necessary, maintain a separate mapping to track each address's index in the array, enabling direct access and removal without iteration.
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.