wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.18k stars 286 forks source link

deploy does not leverage the safety built in to `contracts-upgradeable` package from openzeppelin #355

Open mistersingh179 opened 1 year ago

mistersingh179 commented 1 year ago

When i upgrade a UUPS proxy contract using deploy it doesn't benefit from all the safety checks built in to @openzeppelin/contracts-upgradeable

For e.g. if i mess up the storage layout and do await upgrades.upgradeProxy(BOX_ADDRESS, BoxV2) it will error out complaining about storage layout issue.

But if i do the following, it doesn't check for any issues, does the upgrade & possibly bricks the proxy.

await deploy('Box', {
    contract: 'BoxV2',
    from: deployer, // address that will perform the transaction.
    log: true,
    proxy: {
      proxyContract: 'ERC1967Proxy',
      proxyArgs: ['{implementation}', '{data}'],
      execute: {
        onUpgrade: {
          methodName: 'init',
          args: []
        }
      }
    }
  });

Is there a way to use hardhat-deploy so behind the scenes it benefits from the safety built in to @openzeppelin/contracts-upgradeable?

fullkomnun commented 1 year ago

@mistersingh179 I submitted a PR with support for openzeppelin's upgradability validations #358