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:
- Deploy a contract as
OptimizedTransparentProxy
- Create a new version of the contract
ContractNameV2
and add a new functionnewFunction()
- 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: []
})
);
- Execute the instruction form console (replace the implementation in a proxy)
- In a hardhat task try to call the new function:
const token = await hre.ethers.getContract("ContractName") as ContractNameV2;
const newFieldValue = await token.newFunction();
- You get
TypeError: token.newFunction is not a function
- 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
- If you use a known signer there it works jus fine
- It look like this line throws: https://github.com/wighawag/hardhat-deploy/blob/19b4ef8f9b1423ade4c318178d356f1747cadf63/src/helpers.ts#L1520
- 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)
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…