Is there benefit to use "Explicit Storage Buckets" in OZ's UUPS?

I am using OZ's UUPSUpgradeable package in Solidity 0.8.17 and my question is around best practices.

I found that some people recommend Explicit Storage Buckets for private variable, reference dragonfly docs

However since I am using UUPSUpgradeable on top of @openzeppelin/hardhat-upgrades to deploy my UUPS. This automatically checks for variable collision when I upgrade using deployProxy in hardhat, so are explicit storage buckets necessary?

In seems to add extra code, so I would prefer to keep it out unless there is additional benefits. Only benefit I can think of would be additional safety is upgrades don't happen with hardhat-upgrade's `deployProxy'. Do y'all have any feedback?

:1234: Code to reproduce


:computer: Environment

  • solidity 0.8.17
  • latest hardhat & '@openzeppelin/hardhat-upgrades' "^1.21.0" npm for deployment

This is similar to the diamond storage pattern which is planned for the next major release of OpenZeppelin Upgradeable Contracts. The benefit of this type of pattern is it allows you to add storage variables in parent contracts without affecting the storage layout of child contracts.

An alternative is storage gaps which is used in OpenZeppelin Upgradeable Contracts v4.x.

Currently @openzeppelin/hardhat-upgrades performs validations that include support for storage gaps. It does not validate Explicit Storage Buckets / diamond storage, so if you use these, you would need to manually ensure that your storage layouts within those structs are compatible.