If we are using the initializable contract before OZ 0.5.0
for our transparent Upgradeable proxy.
It had two variables in slot 0
.
uint8 private _initialized;
bool private _initializing;
Now in OZ 0.5.0
the storage alignment has been changed, including a struct and namespaces storage pattern.
struct InitializableStorage {
uint64 _initialized;
bool _initializing;
}
The problem is if we try to use the latest initializable
contract for our new implementation contract, it messes up the storage layout because now slot 0
is empty, and the rest of our contract variables point to one storage less than the initially assigned slot.
What should be the solution for this:
- We add a variable at the top to use up
slot 0
so that the rest of the variables start from their original slot. - We use OZ 0.4.9 because it has the old
initializable
, that uses up theslot 0
.