You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pragma solidity 0.5.8;
contract V1 {
address public a;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
pragma solidity 0.5.8;
contract V2 {
address public a;
address public b;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
Test:
const v1 = await deployTransparentProxy("V1", deployer, V1__factory);
const V1 = await ethers.getContractFactory("V1");
const V2 = await ethers.getContractFactory("V2");
// forces the import of an existing proxy to be used with this plugin
await upgrades.forceImport(v1.address, V1);
// validates an implementation
await upgrades.validateImplementation(V2);
// compares the current implementation to the new implementation to check for storage layout compatibility errors
await upgrades.validateUpgrade(v1.address, V2);
Error:
`Error: New storage layout is incompatible
contracts/V2.sol:5: Inserted b
New variables should be placed after all existing inherited variables
contracts/V2.sol:11: Upgraded __gap to an incompatible type
Bad storage gap resize from 50 to 49
Size decrease must match with corresponding variable inserts`
For newer solc versions, at leat > v0.7.6, works fine
The text was updated successfully, but these errors were encountered:
It is not expectd to work with 0.5.8. This feature requires the storageLayout compiler output, which was introduced in 0.5.13. If you need 0.5, that version might work. But note that both v1 and v2 should be compiled using that compiler version.
Related to #698
Test:
Error:
`Error: New storage layout is incompatible
contracts/V2.sol:5: Inserted
b
contracts/V2.sol:11: Upgraded
__gap
to an incompatible typeSize decrease must match with corresponding variable inserts`
For newer solc versions, at leat > v0.7.6, works fine
The text was updated successfully, but these errors were encountered: