The graduateAndUpgrade
function calculates payPerTeacher
as 35% of the total bursary
and then pays this amount to each teacher. This results in a total teacher payout of N * 35% * bursary
(where N is the number of teachers), far exceeding the intended 35% share and potentially draining the contract or causing reverts due to insufficient funds.
In LevelOne.sol#graduateAndUpgrade
:
If bursary
is 1000 USDC and there are 3 teachers:
payPerTeacher
= (1000 * 35) / 100 = 350 USDC.
Each of the 3 teachers receives 350 USDC.
Total payout to teachers = 3 * 350 = 1050 USDC.
The principal also receives 5% (50 USDC).
Total attempted payout = 1050 + 50 = 1100 USDC, which is more than the bursary
of 1000 USDC.
If there is more than one teacher, the total payout to teachers will exceed the intended 35% share. If the contract holds insufficient USDC to cover these inflated payouts, the usdc.safeTransfer
calls will revert, blocking wage payments and the upgrade process. This violates the specified payment structure (teachers share 35%) and can lead to a denial of service for wage distribution and system upgrade.
Manual Review, Logical Analysis.
Calculate the total wage pool for all teachers first (35% of bursary
). Then, if there are teachers, divide this pool инфекци them.
(The code modification for this is combined with H-03, H-04, and L-03 fixes in the graduateAndUpgrade
function shown below H-04.)
Consolidated Code Modification for LevelOne.sol::graduateAndUpgrade
(addressing H-02, H-03, H-04, L-03):
`payPerTeacher` in `graduateAndUpgrade()` is incorrectly calculated.
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.