The LevelOne::graduateAndUpgrade function lacks critical checks to enforce protocol invariants, allowing the principal to upgrade the system prematurely (before sessionEnd), graduate students without 4 reviews, and upgrade students who don’t meet the cutOffScore. This violates multiple invariants: a 4-week session duration, one review per week, 4 reviews per student before upgrade, and exclusion of students below the cutoff score. These issues compromise the academic evaluation process and financial distribution.
The graduateAndUpgrade function is responsible for upgrading the system to LevelTwo and distributing wages, but it fails to enforce the following invariants:
Invariant 7: "System upgrade cannot take place unless school's sessionEnd has reached." The function does not check if block.timestamp >= sessionEnd.
Invariant 4: "Students must have gotten all reviews before system upgrade. System upgrade should not occur if any student has not gotten 4 reviews (one for each week)." There is no check to ensure each student has reviewCount == 4.
Invariant 6: "Any student who doesn't meet the cutOffScore should not be upgraded." The function does not filter students based on studentScore >= cutOffScore or update LevelTwo with eligible students.
Invariant 5 (implied): "Students can only be reviewed once per week." While enforced in giveReview, the lack of review count validation in graduateAndUpgrade allows upgrades with incomplete or incorrect review cycles.
The function’s logic:
lacks checks for sessionEnd, reviewCount, or cutOffScore, allowing the principal to execute upgrades at any time, even immediately after starting a session, and without verifying student eligibility.
Add this function in LevelOneIAndGraduateTest.t.sol to check that no invarients are checked.
Incorrect Graduations: Students can graduate without completing the required 4 reviews or meeting the cutOffScore, violating Invariants 4 and 6. This undermines the academic evaluation process.
Premature Upgrades: Upgrading before sessionEnd (Invariant 7) disrupts the 4-week session cycle, potentially allowing incomplete review cycles and incorrect wage distributions.
Financial Disruption: Wages may be paid out before all reviews are completed, misaligning with the academic cycle and potentially overpaying teachers.
Protocol Integrity: The failure to enforce core invariants erodes trust in the system’s ability to manage academic progression and financial distributions fairly.
Foundry
In LevelTwo.sol
All students are graduated when the graduation function is called as the cut-off criteria is not applied.
`graduateAndUpgrade()` can be called successfully even when the school session has not ended
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.