Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

Empty graduate() Function Lacks Graduation Logic, Preventing Student Promotion

Summary

The LevelTwo::graduatefunction is empty and should be checking if students are above cutOffScoreand then graduate.

Impact

There is no logic in the contract that checks if students are above cutOffScorebreaking an invariant of the protocol.

Tools Used

Manual code review

Recommendations

Add this code to the graduatefunction:

+ mapping(address => bool) public graduated;
+ event StudentGraduated(address indexed student);
function graduate() public onlyPrincipal reinitializer(2) {
+ uint256 totalStudents = listOfStudents.length;
+ for (uint256 n = 0; n < totalStudents; n++) {
+ address student = listOfStudents[n];
+ // Check cutoff
+ if (studentScore[student] >= cutOffScore) {
+ graduated[student] = true;
+ emit StudentGraduated(student);
+ }
+ }
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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