Hawk High

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

Principal can call `LevelOne::graduateAndUpgrade` before the session ends

Summary

Principal can call graduateAndUpgrade before the session ends, breaking one of the system's invariants

Impact

Breaks the system's invariant

Tools Used

Manual Review

Recommendations

Add a checker to ensure that graduateAndUpgrade can only be called after the session ends.

function graduateAndUpgrade(address _levelTwo, bytes memory) public onlyPrincipal {
+ require(block.timestamp >= sessionEnd, "Session has not ended yet");
if (_levelTwo == address(0)) {
revert HH__ZeroAddress();
}
uint256 totalTeachers = listOfTeachers.length;
uint256 payPerTeacher = (bursary * TEACHER_WAGE) / PRECISION;
uint256 principalPay = (bursary * PRINCIPAL_WAGE) / PRECISION;
_authorizeUpgrade(_levelTwo);
for (uint256 n = 0; n < totalTeachers; n++) {
//audit-high: you are giving each teacher 35% of the bursary!
usdc.safeTransfer(listOfTeachers[n], payPerTeacher);
}
usdc.safeTransfer(principal, principalPay);
}
Updates

Lead Judging Commences

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

can graduate without session end

`graduateAndUpgrade()` can be called successfully even when the school session has not ended

Support

FAQs

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