uint256 payPerTeacher = (bursary * TEACHER_WAGE) / PRECISION;
uint256 principalPay = (bursary * PRINCIPAL_WAGE) / PRECISION;
_authorizeUpgrade(_levelTwo);
for (uint256 n = 0; n < totalTeachers; n++) {
usdc.safeTransfer(listOfTeachers[n], payPerTeacher);
}
usdc.safeTransfer(principal, principalPay);```
The for loop iterates through listOfTeachers to transfer tokens to each teacher.
If the number of teachers grows large enough, the transaction will exceed the block gas limit.
This will cause every call to graduateAndUpgrade() to fail, permanently preventing the school from graduating students or upgrading the contract — creating a DoS scenario.
Teacher payouts
Principal payout
Contract upgrade process
Governance Paralysis: Upgrading to levelTwo is a critical function for the lifecycle of the system. DoS in this function prevents any protocol progression.
User Trust Damage: Teachers and principals expecting payment would be indefinitely stuck without recourse if this function fails.
## Tools Used - Manual code review
Limit Number of Teachers: Enforce an upper cap on the maximum number of teachers allowed.
Batch Payouts: If full migration to pull payments isn't desired, implement batch processing using pagination (e.g., process 10 teachers per transaction).
Warn During Enrollment: Notify or revert when teacher count approaches a critical threshold where the graduateAndUpgrade() function risks gas exhaustion.