Reordering the state varibales in the upgradeable implementation contracts can lead to storage collisions, modifying the contract state. This happens because of the proxy contract retain the original storage layout but the new implementation contracts introduces the mismatched layout, resulting in unintended overwrites and unpredictable behaviour.
There is a mismatch in the order of state variables declared in LevelOne.sol and LevelTwo.sol. This leads to storage collisions and unpredictable behaviour.
state variables in LevelOne.sol:LevelOne contract
state variables in LevelTwo.sol:LevelTwo contract
let's see how storage is modified
We can clearly see that the values in
slot 1 (schoolFees) is overwritten with sessionEnd
slot2 (sessionEnd) with bursary
slot3 (bursary) with cutOffScore
This causes the contract to read incorrect values from storage, leading to unintended and unpredictable behavior.
Manual Analysis
Foundry
Maintain the same variable order in all implementation versions.
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.