Hawk High

First Flight #39
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

reviewCount[_student] Not Incremented in giveReview()

Summary

The giveReview function does not increment the number of reviews given to a student. As a result, the contract fails to track how many times a student has been reviewed, violating the intended limit of a maximum of 4 reviews per student.

Impact

  • A student can receive more than 4 reviews, bypassing the weekly and overall session constraints.

  • The contract becomes vulnerable to misuse, such as biased grading or review spam.

Tools Used

  • Manual code review

Solution

  1. Correct the review limit condition:

    • Update the requirement from reviewCount < 5 to reviewCount < 4 to enforce a 4-review maximum.

  2. Track the number of reviews properly:

    • Add reviewCount[_student] += 1; immediately after setting lastReviewTime.

Recommendations

  • Add correct condition for number of reviews

require(reviewCount[_student] < 4, "Student review count exceeded!!!");
  • Increment the reviewCount after the review has been given

reviewCount[_student] += 1;
Updates

Lead Judging Commences

yeahchibyke Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

reviewCount not updated

`reviewCount` for students is not updated after each review session

Support

FAQs

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

Give us feedback!