I'm trying to upgrade proxy contracts that use an inherited storage pattern - that is, the order of the state variables cannot change.
In v2 of my implementation contract, I added a new state variable to the storage in a position that should cause a storage collision (i.e. it was not appended to the end).
Then i called prepareUpgade():
const v2 = await ethers.getContractFactory("JCollateralCapErc20Delegate"); const v2Address = await upgrades.prepareUpgrade(proxyAddress, v2);
And to my surprise, it did not throw any validation error.
Is there something I'm missing here? Do i need to call prepareUpgrade() with some flag to check of changes in storage layout. I looked in the docs but couldn't find anything of the sort.