Hey, I'm having a similar issue. This time it's slightly more complex, but appears to be directly related. When I add a new variable in my V2 contract it works without issue.
contract V1 is ERC721Upgradeable {
uint256[50] private __gap;
}
contract V2 is ERC721Upgradeable {
uint256 public someNumber;
uint256[49] private __gap;
}
When I add ERC721URIStorageUpgradeable
into the same upgrade
contract V1 is ERC721Upgradeable {
uint256[50] private __gap;
}
contract V2 is ERC721Upgradeable, ERC721URIStorageUpgradeable {
uint256 public someNumber;
uint256[49] private __gap;
}
I receive the error:
Error: New storage layout is incompatible
@openzeppelin\contracts-upgradeable\token\ERC721\extensions\ERC721URIStorageUpgradeable.sol:74: Upgraded `__gap` to an incompatible type
- Bad storage gap resize from 48 to 49
Size cannot increase
at assertStorageUpgradeSafe (node_modules\@openzeppelin\upgrades-core\src\storage\index.ts:35:11)
at validateImpl (node_modules\@openzeppelin\hardhat-upgrades\src\utils\validate-impl.ts:42:31)
at async deployBeaconImpl (node_modules\@openzeppelin\hardhat-upgrades\src\utils\deploy-impl.ts:84:3)
at async Proxy.upgradeBeacon (node_modules\@openzeppelin\hardhat-upgrades\src\upgrade-beacon.ts:21:32)
at async Context.<anonymous> (test\MintClipUpgradeable\suites\V2\clone.test.ts:20:5)
I tried a version where I don't change the storage in my contracts
contract V1 ERC721Upgradeable{
uint256[50] private __gap;
}
contract V2 is ERC721Upgradeable, ERC721URIStorageUpgradeable {
uint256[50] private __gap;
}
It worked fine. Is this simply a case where I should do two upgrades?
Like this:
contract V1 is ERC721Upgradeable {
uint256[50] private __gap;
}
contract V2 is ERC721Upgradeable {
uint256 public someNumber;
uint256[49] private __gap;
}
contract V3 is ERC721Upgradeable, ERC721URIStorageUpgradeable {
uint256 public someNumber;
uint256[49] private __gap;
}
I'm not sure why it's throwing an error when I try to include the ERC721URIStorageUpgradeable in the same upgrade. Any help would be appreciated. Thanks!