Is it possible to upgrade a struct within an upgradable contract without altering the storage slots of variables stored after the struct?
For example:
contract MyContract{
uint256 a;
struct Random {
uint256 b;
address c;
bytes d;
}
uint256 e;
}
Would it be possible to upgrade the contract to add an address f
inside the struct without altering e
?
I believe this would work if the struct was listed last in MyContract
, but any subsequent upgrade after adding a non-struct variable would then make the struct un-upgradable. Is this statement correct?
Is it not advised to use a struct in an upgradable contract?
Edit:
The example listed in the following Zeppelin blog post does in fact use a struct, but it appears as though this particular struct is not meant to be upgraded at any point.