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
When appending to the end of a struct, and there are no other storage variables after that struct, this should be allowed. This should work for both regular variables and namespaced storage, as long as the struct is at the end of the storage layout.
However, this currently gives an error Bad upgrade from struct MyContractV1.MyStruct to struct MyContractV2.MyStruct
Running upgrades.validateUpgrade from v1 to v2 with the above examples gives an error like:
Error: New storage layout is incompatible
contracts/MyContractV2.sol:12: Upgraded `s` to an incompatible type
- Bad upgrade from struct MyContractV1.MyStruct to struct MyContractV2.MyStruct
- In struct MyContractV2.MyStruct
- Added `z`
When appending to the end of a struct, and there are no other storage variables after that struct, this should be allowed. This should work for both regular variables and namespaced storage, as long as the struct is at the end of the storage layout.
However, this currently gives an error
Bad upgrade from struct MyContractV1.MyStruct to struct MyContractV2.MyStruct
Example:
Example with namespaced storage:
Running
upgrades.validateUpgrade
from v1 to v2 with the above examples gives an error like:Originally reported in https://forum.openzeppelin.com/t/wrong-indication-of-incompatible-layout-after-upgrade/43335
The text was updated successfully, but these errors were encountered: