hardhat-deploy: Upgrade with an unknown signer doesn't update deployment

Describe the bug deployments/network/ContractName.json file is not updated when an upgrade with an unknown signer is performed

To Reproduce Steps to reproduce the behavior:

  1. Deploy a contract as OptimizedTransparentProxy
  2. Create a new version of the contract ContractNameV2 and add a new function newFunction()
  3. Deploy upgrade like this:
  await hre.deployments.catchUnknownSigner(
    hre.deployments.deploy("ContractName", {
      from: deployerAddress,
      proxy: {
        proxyContract: "OptimizedTransparentProxy",
        owner: newProxyAdminOwnerAddress, // make sure this one is unknown to hardhat!
      },
      contract: "ContractNameV2",
      args: []
    })
  );
  1. Execute the instruction form console (replace the implementation in a proxy)
  2. In a hardhat task try to call the new function:
const token = await hre.ethers.getContract("ContractName") as ContractNameV2;
const newFieldValue = await token.newFunction();
  1. You get TypeError: token.newFunction is not a function
  2. It works fine if you do it like this:
const token = await hre.ethers.getContractAt("ContractNameV2", proxy_address) as ContractNameV2;

Expected behavior deployments/network/ContractName.json Should be updated and await hre.ethers.getContract("ContractName") should return the right ABI

versions

  • hardhat-deploy 0.9.27
  • hardhat 2.6.8
  • nodejs v14.17.5

Additional context

  1. If you use a known signer there it works jus fine
  2. It look like this line throws: https://github.com/wighawag/hardhat-deploy/blob/19b4ef8f9b1423ade4c318178d356f1747cadf63/src/helpers.ts#L1520
  3. and therefore this line never gets called: https://github.com/wighawag/hardhat-deploy/blob/19b4ef8f9b1423ade4c318178d356f1747cadf63/src/helpers.ts#L1564

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I am currently working on hardhat-deploy v2 and the same issue will be present there and i think adding a new command that “sync” the deployment files make sense

It can read the implementation address onchain and check for the matching implementation deployment file and update the abi,etc…