This loop in graduateAndUpgrade
calls safeTransfer
on the list of teachers:
safeTransfer
is an external call that consumes gas.
In the case where listOfTeachers.length
is very large the total gas needed may exceed the block gas limit, bringing the function in a point where it can't be executed or finish its execution.
The graduateAndUpgrade
function can not be executed => DoS
The upgrade process is compromised.
The contract loses its main functionality.
Manual Code Review
Add a constant for MAX_TEACHERS.
Add a new conditional in addTeacher
to check if the teachers array is always within boundries.
Add a new error for this check:
This will prevent the array to grow beyound limits.
Other solutions can be batching the payments or a pull-based system where the teachers withdraw their wages.
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.