The giveReview() function deducts 10 points from a students’s score when a bad review is given. However, it does not check whether the student score is at least 10 before doing the subtraction. In solidity versions ≥0.8.0, this will revert automatically due to built-in underflow check.
The function will revert if studentScore[_student] < 10, due to underflow protection in Solidity ≥0.8.0.
This may unintentionally prevent teachers from submitting bad reviews for students with low scores.
Manual code review
Add a require statement to explicitly validate that the student has enough score to deduct:
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.