Defining structs like `RoleData` is not yet supported

When using the most recent package version and the ERC20PresetMinterPauserUpgradeable preset, I still get the same error:

Error: Contract `MyToken` is not upgrade safe

@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:56: Defining structs like `RoleData` is not yet supported
    If you have manually checked for storage layout compatibility, you can skip this check with the `unsafeAllowCustomTypes` flag
    https://zpl.in/upgrades/error-007

Any solutions for this?

2 Likes

Are you using the flag mentioned in the error message?

The latest version doesn’t support validating structs yet and this affects some of the contracts in OpenZeppelin Contracts.

Automatic struct validation is coming, it should be out next week.

3 Likes