The LevelOne::giveReview
function checks reviewCount[_student] < 5
to limit student reviews but fails to increment reviewCount
after a review is given. This renders the check ineffective, allowing teachers to submit unlimited reviews for a student, violating Invariant 4
("Students must have gotten all reviews before system upgrade") and Invariant 5
(implied: "Students can only be reviewed once per week"). The issue also misaligns with the 4-review
limit intended for a 4-week
session, compromising the academic evaluation process.
The giveReview
function is designed to allow teachers to give weekly reviews (good or bad) to students, with a limit of one review per week and a maximum of 4 reviews per student over a 4-week session. The function includes:
Unincremented reviewCount: The reviewCount[_student] mapping is never incremented, so it remains 0, making the reviewCount[_student] < 5 check always pass. This allows unlimited reviews.
Incorrect Limit: The check uses < 5, allowing up to 5 reviews, which conflicts with Invariant 4’s requirement of exactly 4 reviews per student (one per week for 4 weeks).
Invariant Violations:
Invariant 4: "Students must have gotten all reviews before system upgrade" implies exactly 4 reviews. Unlimited reviews skew studentScore and bypass this requirement.
Invariant 5 (implied): "Students can only be reviewed once per week" is enforced by the lastReviewTime check, but unlimited reviews within a week (if lastReviewTime is manipulated or bypassed) could occur without proper reviewCount tracking.
This bug allows teachers to excessively increase or decrease studentScore (e.g., reducing it by 10 per bad review indefinitely), undermining the fairness of the review process.
Add this test to LevelOneAndGraduateTest.t.sol
to demonstrate that reviewCount
is not incremented, allowing unlimited reviews.
Unlimited Reviews: Teachers can give unlimited reviews, manipulating studentScore
excessively (e.g., reducing it to 0 with repeated bad reviews), which undermines Invariant 4’s
requirement of exactly 4
reviews.
Academic Fairness Compromised: Students may fail to graduate due to unfair score reductions or pass with inflated scores, affecting Invariant 6 ("Students below cutOffScore
should not be upgraded").
Protocol Integrity: The review process’s reliability is eroded, as stakeholders expect a fair, 4
-review evaluation.
Foundry
Update giveReview to:
Increment reviewCount[_student] after a review.
Enforce a 4-review limit (not 5) to align with Invariant 4.
Use custom errors for gas efficiency and clarity.
`reviewCount` for students is not updated after each review session
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.