Problem in Upgrades Plugins for users of unsafeAllowCustomTypes

We have found an error in the Upgrades Plugins for Truffle and Hardhat.

Users of the flag unsafeAllowCustomTypes should update to the latest versions of the relevant package:

  • @openzeppelin/hardhat-upgrades → 1.4.3
  • @openzeppelin/truffle-upgrades → 1.3.1
  • @openzeppelin/buidler-upgrades → 1.2.2

The flag unsafeAllowCustomTypes allows deploying and upgrading contracts that use struct or enum types in storage, as an override that asserts that these types have been manually checked for compatibility.

Due to an error in the implementation, enabling this flag caused other kinds of storage layout errors to be ignored.

We believe no one has been affected by this. If you have any doubts about your particular project, let us know and we will look into it.

We reiterate our recommendation to run tests on a contract that is initially used in “v1” and later upgraded to “v2”, as opposed to only testing from-scratch deployments of “v2”. This way one can better understand the effect of running the upgrade in production.

We’re happy to announce that automatic checking of storage compatilibity for structs and enums is in development right now and using this flag will no longer be necessary.

Let us know if you have any further questions!


2 posts were split to a new topic: Defining structs like RoleData is not yet supported

Where is the buidler-upgrades 1.2.2 package available? I can only find 1.2.1.

1 Like

@Alex_Gausman I had tagged the version but forgot to publish it on npm. Sorry for the inconvenience. Please check it out now, it should be up.


Awesome, thanks for the quick response!!