The protocol stores all bursary fees in LevelOne::bursary variable upon each enrolment of students, however when the principal calls LevelOne::graduateAndUpgrade and payments are been made, the LevelOne::bursary variable is never updated and this reflects an inaccurate amount in the protocol. In real sense the protocol has less than 60% of the initial bursary fees and this breaks one of the invariants
The function does not decrement the LevelOne::bursary variable which stores all schoolFees in LevelOne::graduateAndUpgrade, instead it transfers shares to beneficiaries(principal and teachers) directly without no virtual balance update for LevelOne::bursary. Secondly the remaining bursary does not amount to 60% bursary left after transfer of tokens
Using the foundry testing library , include this in the test suite
This clearly breaks the protocol invariant and could deceive the protocol to think they have more bursary than they actually do by reading the LevelTwo::bursary storage variable
Manual Review and Foundry Testing
One of the solutions the protocol can use is to refactor the LevelOne::graduateAndUpgrade function to do this below, after upgrade, the LevelTwo::bursary variable will reflect the correct percentage of total bursary left in the contract
The bursary is not updated after wages have been paid in `graduateAndUpgrade()` function
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.