Hi,
Probably there are similar issues, but I couldn't find the exact same problem.
We have an upgradeable contract deployed with the package @openzeppelin/contracts-upgradeable 3.2.2 and we wanted to upgrade it but updating the package to 4.5.1.
We did not make changes in parent contracts, the changes are only in Box
contract to be upgraded.
But it throws this error when we execute the upgrade
$ npx hardhat run scripts/upgrades/upgrade-box.js
Upgrading Box...
Error: New storage layout is incompatible
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36: Inserted `__gap`
> New variables should be placed after all existing inherited variables
@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:61: Inserted `_roles`
> New variables should be placed after all existing inherited variables
@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:235: Inserted `__gap`
> New variables should be placed after all existing inherited variables
@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol:22: Replaced `_roles` with `_roleMembers` of incompatible type
ERC20Upgradeable: Deleted `_decimals`
> Keep the variable even if unused
@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol:394: Upgraded `__gap` to an incompatible type
- Bad array resize from 44 to 45
Size cannot increase here
As you can see, all the incompatibility errors are from the package.
Are we doing something wrong or there's no compatibility between these packages?
Thanks in advance.
Environment
Hardhat