The LevelTwo contract defines a graduate() function that serves as the reinitializer for the upgraded implementation, but it is empty and does not properly initialize critical state variables. This oversight will cause the contract to operate with default values (zero values) after upgrade instead of carrying forward the necessary state from LevelOne.
The LevelTwo contract includes a graduate() function marked with reinitializer(2) which should properly initialize the contract state after an upgrade, but the function body is empty:
According to the OpenZeppelin documentation and best practices for upgradeable contracts, the reinitializer function should initialize all storage variables that will be used in the new implementation. Failing to do so leads to several issues:
Critical state variables like principal, cutOffScore, and others will revert to their default values
Access control will be broken since principal will be set to address(0)
The upgraded contract will not maintain the state necessary for its functionality
This is further compounded by the fact that there is a storage slot inconsistency between LevelOne and LevelTwo. Specifically, LevelTwo is missing several state variables that exist in LevelOne (such as schoolFees and mappings for reviewCount and lastReviewTime), causing a misalignment in storage slots. This means that even if data remains in the proxy's storage after upgrade, it won't be correctly interpreted by the new implementation.
This issue has the following consequences:
Loss of critical contract state after upgrade, including principal address and access controls
Core functionality of the upgraded contract will be broken
Security mechanisms based on properly initialized state variables will fail
The upgrade process will not meet the project's invariants and requirements
The severity is assessed as Medium rather than High because while it poses significant operational issues, it doesn't directly lead to fund loss since the issue would be discovered immediately upon upgrade before critical operations can occur.
Manual code review
Implement proper initialization logic in the graduate() function to fulfill the project's requirements for system upgrade and student graduation. The function should address both state variable maintenance and business logic requirements:
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.