New storage layout is incompatible: ContextUpgradeable.sol:36: Inserted `__gap`

Another fix is to write your V2 like this:

contract GreeterV1Storage {
    string public greeting;
}

contract GreeterV2 is Initializable, GreeterV1Storage, OwnableUpgradeable {
    ...
}

This ensure V1's variables are not pushed further down in storage.

3 Likes