Hello, i was reading the frequently asked questions about upgradeability, and it said to refer to forum and ask whether or not my structs are safe for proxies.
So my structs are as follows
struct Reserves {
uint256 eth;
uint256 token;
uint256 lastPrice;
uint256 middlePrice;
}
struct EthRef {
uint256 eth;
address ref;
}
Thanks in advance!
1 Like
Hi @Dellybro,
For anyone reading this, 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
Update: The latest version of the Upgrades Plugins supports checking structs and enums automatically, so you won’t run into this error anymore. See the full announcement at Upgrades with Peace of Mind: "Structs" Edition.
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
How are you using your structs? (e.g. in a mapping or a state variable)
Are you able to share your smart contract?
Depending on how you are using your structs, this may limit what changes you can make to state variables in upgrades.
Hi @Dellybro,
Just wanted to follow up to see if you needed more information?