Contract upgrade failed because variables are deleted in openzepplin 5.0

It is NOT safe to upgrade existing deployments from 4.x to 5.0 because they use different storage layouts.

The OpenZeppelin Contracts 5.0 readme states:

Important
OpenZeppelin Contracts uses semantic versioning to communicate backwards compatibility of its API and storage layout. For upgradeable contracts, the storage layout of different major versions should be assumed incompatible, for example, it is unsafe to upgrade from 4.9.3 to 5.0.0. Learn more at Backwards Compatibility.

1 Like