# To Inherit Version1 to Version2, Or to Copy Code + Inheritance Order from Version1 to Version2?

**URL:** <https://forum.openzeppelin.com/t/to-inherit-version1-to-version2-or-to-copy-code-inheritance-order-from-version1-to-version2/28069>\
**Category:** Upgrades\
**Tags:** upgrades\
**Created:** [April 27, 2022, 3:00am UTC](https://forum.openzeppelin.com/t/to-inherit-version1-to-version2-or-to-copy-code-inheritance-order-from-version1-to-version2/28069 "2022-04-27T03:00:58Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![frangio](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/frangio/32/15251_2.png) [@frangio](https://forum.openzeppelin.com/u/frangio)\
**Post date:** [November 1, 2022, 8:06pm UTC](https://forum.openzeppelin.com/t/to-inherit-version1-to-version2-or-to-copy-code-inheritance-order-from-version1-to-version2/28069/18 "2022-11-01T20:06:59Z")

</div>

@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`.

```nohighlight
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.

> <https://github.com/OpenZeppelin/openzeppelin-contracts/issues/2964>
>
> \*\*🧐 Motivation\*\*
> Gaps are problematic and this: https://eips.ethereum.org/EIPS/…eip-2535#facets-state-variables-and-diamond-storage seems to be a great idea.
> 
> \*\*📝 Details\*\*
> The proposed changes look like: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/pull/134 
> I think this will improve the usability of upgradeable contracts and avoid a lot of common mistakes that are hard to fix.

---

_[View the full topic](https://forum.openzeppelin.com/t/to-inherit-version1-to-version2-or-to-copy-code-inheritance-order-from-version1-to-version2/28069)._
