The giveReview function uses require(reviewCount[_student] < 5, ...). If reviewCount is correctly incremented (addressing H-05), this allows a student to receive up to 5 reviews. However, a school session lasts 4 weeks with one review per week, implying exactly 4 reviews are intended.
The condition reviewCount[_student] < 5 means the transaction will pass if reviewCount[_student] is 0, 1, 2, 3, or 4. If reviewCount is incremented after this check, a student can effectively receive reviews when their count before the review is 0, 1, 2, 3, and 4, leading to a total of 5 reviews. The README states "A school session lasts 4 weeks" and implies one review per week.
Students can receive a 5th review, which is one more than implied by the 4-week session. This could be exploited to give an extra "make-up" good review or a final punitive bad review, misaligning with the expected "4 reviews (one for each week)" structure. It also complicates the graduation check, which should verify exactly 4 reviews.
Manual Review, Logical Analysis.
Change the condition to require(reviewCount[_student] < 4, "HH__MaxReviewsReached"); to ensure that a student can only receive reviews when their current count is 0, 1, 2, or 3, leading to a maximum of 4 reviews after incrementing. The graduation check in graduateAndUpgrade should then confirm reviewCount[student] == 4.
Consolidated Code Modification for LevelOne.sol::giveReview (addressing H-05, M-01):
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.