The UUPS upgrade from LevelOne to LevelTwo contains critical storage layout mismatches that will corrupt the contract's state. The v2 contract reorders/deletes state variables from v1 and fails to maintain storage layout compatibility, violating upgrade safety requirements.
Storage Layout Analysis:
| Slot | LevelOne (v1) | LevelTwo (v2) |
|---|---|---|
| 0 | principal | principal |
| 1 | schoolFees | inSession (bool) |
| 2 | inSession (bool) | sessionEnd |
| 3 | reviewTime (immutable) | bursary |
| 4 | sessionEnd | cutOffScore |
| 5 | bursary | isTeacher (mapping base) |
| 6 | cutOffScore | isStudent (mapping base) |
| 7 | isTeacher (mapping base) | studentScore (mapping base) |
| 8 | isStudent (mapping base) | listOfStudents (array base) |
| 9 | studentScore (mapping base) | listOfTeachers (array base) |
| 10 | reviewCount (mapping base) | usdc (IERC20) |
Key Issues:
Critical Misalignment: sessionEnd moves from slot 4→2, bursary from 5→3, and cutOffScore from 6→4
Missing Variables: v2 doesn't account for v1's reviewTime, reviewCount, and lastReviewTime mappings
Type Corruption: schoolFees (uint256) in v1 is overwritten by inSession (bool) in v2
Token Address Risk: usdc in v2 occupies slot 9 which overlaps with v1's mapping storage
High Severity: Upgrade will permanently corrupt all state variables, leading to:
Incorrect access control (principal address may change)
Broken financial logic (bursary amounts corrupted)
Lost student/teacher records (mappings point to wrong storage)
Bricked token transfers (USDC address overwritten)
Irreversible damage to contract state
Manual review
Maintain Identical Storage Layout:
Keep all v1 variables in exact same order
Append new variables only at the end
Correct v2 Implementation:
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.