Error: New storage layout is incompatible
contracts/metatx/ERC2771Context.sol:21: Inserted `_forwarder`
> New variables should be placed after all existing inherited variables
contracts/metatx/ERC2771Context.sol:85: Upgraded `__gap` to an incompatible type
- Bad array resize from 50 to 49
Size cannot decrease
Dependencies
"@openzeppelin/contracts-upgradeable": "^4.1.0",
"@openzeppelin/hardhat-upgrades": "^1.8.2",
As far as I understand hardhat-upgrades does not support it yet.
Is there a way to do this?
Hi @aquiladev. I'm sorry this is not natively supported by the plugin yet. I also don't want to rush to implement this feature for you because it's sensitive and would want to review it and test it thoroughly.
For your particular use case, I would recommend manually modifying the network file under .openzeppelin to include this variable you want to add, as if it had been included in your previous version.
I realize this is a little tricky, if you can share a repository link I can help you figure out the exact change you should make.
Hi @frangio how should i manually modify file .openzeppelin/unknown-31337.json and still have tests run? currently what happens is that the tests first deploy the first version, which resets unknown-31337.json to have __gap be of size 50 and then the test which upgrades fails as it expects it to be 49. any suggestions would be very helpful. thanks
@Mister_Singh An alternative would be to test with a modified copy of your first version for now, where the modified copy already has the variable you want to add.