The LevelOne::giveReview function contains an issue regarding the number of reviews a student can receive. While the protocol defines an invariant that each student should receive only four reviews, the current implementation allows five.
The protocol establishes that each student must receive a maximum of four reviews. However, the LevelOne::giveReview function checks whether the student's reviewCount is less than five (< 5) before allowing another review, effectively enabling a fifth review. This breaks the intended invariant of the system.
This issue violates a core protocol invariant and may lead to unintended behavior. Although reviews are restricted to one per week as enforced by the immutable LevelOne::reviewTime and sessions are expected to last four weeks as defined by LevelOne::sessionEnd making this issue not very likely to happen, this discrepancy could become problematic if these values change or are misinterpreted. Additionally, it harms code clarity and may confuse future maintainers or integrators.
The issue can be confirmed by adding the following proof of code to the LevelOneAngGraduateTest.t.sol contract. The test will pass, showing that five reviews are allowed.
Teacher alice submits five reviews for student fin.
The test passes, as the code allows for five reviews.
This issue was identified through manual review.
Modify the conditional in the LevelOne::giveReview function to enforce the intended limit of four reviews per student, modifying the require statement:
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.