@novaknole Just to clarify, have you actually ran into this issue with an ugprade to your OpenZeppelin dependencies?
There is nothing particularly smart that we do to avoid the situation in your second example. We just avoid making those changes to inheritance, because we know that it would cause problems to users downstream. (We may have missed this at some point which is why I asked the previous question.)
For your first point, the solution to the problem is to create a new contract Voting_V1_Storage
to define Voting_V2
.
contract Voting_V1_Storage {
uint num1;
function foo() external { ... }
}
contract Voting_V2 is OZ_Contract1, Voting_V1_Storage, ThirdContract {
function foo() external { ... }
}
This will keep num1
in the same place.
It is pretty clear at this point that using gaps to keep storage align doesn't scale and still has many problems. This is why the next major version of OpenZeppelin Upgradeable Contracts will use a different way to organize storage.