The graduateAndUpgrade function in the LevelOne contract fails to reset role-related state variables (isStudent, isTeacher, listOfStudents, and listOfTeachers) before upgrading to LevelTwo. This allows legacy role assignments and lists to persist in storage, corrupting access control and data integrity in LevelTwo.
In UUPS upgradeable contracts, storage slots retain their values unless explicitly cleared. The graduateAndUpgrade function upgrades to LevelTwo without resetting:
Role Mappings: isStudent and isTeacher retain their boolean flags.
Role Arrays: listOfStudents and listOfTeachers preserve old addresses.
Code Reference:
LevelTwo inherits these variables but lacks logic to handle stale data:
Unauthorized Access: Expelled students or removed teachers from LevelOne retain access to LevelTwo functions.
Data Pollution: Obsolete students/teachers appear in LevelTwo’s lists, breaking UI/UX and internal logic (e.g., rewards distribution).
Manual review
Modify graduateAndUpgrade to reset role states before upgrading:
All students are graduated when the graduation function is called as the cut-off criteria is not applied.
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.