Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Each Teacher Receives 35% of Bursary Instead of Sharing It

Summary

According to the documentation, teachers are collectively entitled to 35% of the bursary. However, the current implementation allocates 35% of the bursary to each teacher individually, leading to an overpayment when multiple teachers exist.

Vulnerability Details

The current wage calculation for teachers is as follows:

uint256 public constant TEACHER_WAGE = 35;
uint256 public constant PRECISION = 100;
...
uint256 payPerTeacher = (bursary * TEACHER_WAGE) / PRECISION;

This formula allocates 35% of the total bursary to each teacher, rather than splitting 35% among all teachers. However, as per the documentation:

“Teachers will share in 35% of all school fees paid as their wages.”

This implies that 35% of the bursary should be distributed among all teachers, not given in full to each

Impact

If there is more than one teacher, the system will overpay the total teacher wages—potentially distributing more than 100% of the bursary. This breaks the intended accounting model and could drain school funds.

Tools Used

Manual code review.

Recommendations

Update the payPerTeacher calculation to divide the 35% wage pool equally among all teachers:

uint256 totalTeacherWage = (bursary * TEACHER_WAGE) / PRECISION;
uint256 payPerTeacher = totalTeacherWage / numberOfTeachers;

This ensures that the total teacher payout does not exceed 35% of the bursary.

Updates

Lead Judging Commences

yeahchibyke Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

incorrect teacher pay calculation

`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.

Support

FAQs

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

Give us feedback!