Upgrading base and child contracts

Hi @zhengger,

It depends how you are using your struct. If you are using it with a mapping then this should be upgrade safe. If you are using it in a state variable, then you can only add to the last field in the struct if the state variable is the last state variable.

The Upgrades Plugins don’t currently support checking enums and structs for upgrade safety, see: https://docs.openzeppelin.com/upgrades-plugins/1.x/faq#why-cant-i-use-custom-types

For checking for upgrade safety I suggest writing higher level tests that check all the state before and after an upgrade, see the proxy tests for an example: OpenZeppelin Upgrades: Step by Step Tutorial for Truffle

1 Like