The giveReview()
function in level1.sol
fails to update the review count for each student when a review is given. This leads to a critical logical flaw where students may receive reviews without incrementing their count, which directly affects whether the system can accurately determine if a student has received all 4 weekly reviews required for graduation.
1) A student can receive more than 4 reviews without proper tracking, since the review count is not updated.
2) Even if a student receives 4 reviews, the contract may incorrectly assume they haven’t, causing the upgrade process to fail.
The test case testreviewcountnotupdated()
was written to verify that the giveReview()
function correctly increments the student's review count when a teacher gives a review.
In this test:
Two students (student1
and student2
) are enrolled.
The school session is started by the principal.
After 1 week, the teacher alice
gives a review to student1
.
We expect reviewCount(student1)
to be 1
.
However, when the test runs, the assertion fails because reviewCount(student1)
remains 0
, indicating that the review count is not being updated inside the giveReview()
function
Test Output :
Ran 1 test for test/LeveOnelAndGraduateTest.t.sol:LevelOneAndGraduateTest
[FAIL: panic: assertion failed (0x01)] testreviewcountnotupdated() (gas: 588735)
Logs:
student1 review count 0
student2 review count 0
1) VS code
2) Manual Review
update the review count inside the giveReview() function
`reviewCount` for students is not updated after each review session
`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.