The graduateAndUpgrade
function in LevelOne.sol
calls _authorizeUpgrade(_levelTwo)
but lacks the necessary call to an actual UUPS upgrade function (e.g., _upgradeToAndCallUUPS
). As a result, the contract will not be upgraded to LevelTwo
as intended.
The UUPS (Universal Upgradeable Proxy Standard) pattern involves two steps for an upgrade:
Authorization: The current implementation authorizes a new implementation (e.g., via _authorizeUpgrade
).
Execution: The proxy contract's upgradeTo
or upgradeToAndCall
function is called, which then invokes the authorization in the current implementation and, if authorized, changes the proxy's implementation address.
LevelOne.sol#graduateAndUpgrade
only performs step 1 implicitly by being onlyPrincipal
and calling _authorizeUpgrade
. The OZ UUPSUpgradeable
contract expects that _authorizeUpgrade
is an internal hook, and the upgrade itself is triggered by a function like _upgradeToAndCallUUPS
.
The function is missing a call like _upgradeToAndCallUUPS(_levelTwo, dataForLevelTwoInitialize, false);
.
The contract will not be upgraded to LevelTwo
when graduateAndUpgrade
is called. Wages might be paid (if H-02 is fixed), but the system will remain on LevelOne
. This fundamentally breaks the school's lifecycle of upgrading to a new system after a session, defeating a primary purpose of the contract.
Manual Review, Understanding of OpenZeppelin UUPSUpgradeable mechanics.
Modify graduateAndUpgrade
to correctly initiate the upgrade by calling the appropriate internal UUPS upgrade function (e.g., _upgradeToAndCallUUPS
) after all checks and wage payments are made.
(The code modification for this is combined with H-02, H-04, and L-03 fixes in the graduateAndUpgrade
function shown below H-04.)
Consolidated Code Modification for LevelOne.sol::graduateAndUpgrade
(addressing H-02, H-03, H-04, L-03):
The system doesn't implement UUPS properly.
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.