upgrades.deployProxy
works as expected on npx hardhat test
(or hh test
), but hangs indefinitely in my project on hh coverage
until the test fails with:
Error: Timed out waiting for implementation contract deployment to address 0x5FbDB2315678afecb367f032d93F642f64180aa3 with transaction 0xa4921ba0e4fd298aa1ddc2e35d440a92d213ece0d0eb44251632a96f19edef7d
Run the function again to continue waiting for the transaction confirmation. If the problem persists, adjust the polling parameters with the timeout and pollingInterval options.
at waitAndValidateDeployment (node_modules/@openzeppelin/upgrades-core/src/deployment.ts:169:17)
at async fetchOrDeployGeneric (node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:70:5)
at async deployImpl (node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy-impl.ts:114:16)
at async Proxy.deployProxy (node_modules/@openzeppelin/hardhat-upgrades/src/deploy-proxy.ts:42:28)
The issue seems to be with the eth_sendTransaction
call to deploy the implementation contract not getting mined, because eth_getTransactionReceipt
for that transaction returns null
after each poll.
After the error, my .openzeppelin/unknown-31337.json file contains "impls"
with an "address"
and "txHash"
but an empty "proxies"
array:
{
"manifestVersion": "3.2",
"proxies": [],
"impls": {
"5f2a9f5431308d48b9e3e2766e716f7ecec632d6781db87ed48a296f48c257f7": {
"address": "0x6c198aa7D4817c62dE7A338316769Be784167646",
"txHash": "0x7969483ee49bd905044a6b609d930d39e0404271f4c102cb5d5494325ff68b10",
Here's my test and attempted deployment:
import { ethers, upgrades } from "hardhat";
describe("Tests", () => {
it("works", async () => {
const factory = await ethers.getContractFactory("MyContractV1");
await upgrades.deployProxy(factory, [40, 20], { kind: "uups" });
console.log("deployed"); // outputs on `hh test` but not `hh coverage`
});
});
And when running in debug mode (DEBUG='*' hh coverage
), the following lines are outputted:
@openzeppelin:upgrades:core initiated deployment transaction hash: 0x704ccf5054e6c77ed09654bc78e3ab2a29f113e74ca3d894b4bdc82d8cc9558e merge: undefined +211ms
@openzeppelin:upgrades:core polling timeout 60000 polling interval 5000 +2ms
@openzeppelin:upgrades:core verifying deployment tx mined 0x704ccf5054e6c77ed09654bc78e3ab2a29f113e74ca3d894b4bdc82d8cc9558e +0ms
@openzeppelin:upgrades:core waiting for deployment tx mined 0x704ccf5054e6c77ed09654bc78e3ab2a29f113e74ca3d894b4bdc82d8cc9558e +73ms
@openzeppelin:upgrades:core verifying deployment tx mined 0x704ccf5054e6c77ed09654bc78e3ab2a29f113e74ca3d894b4bdc82d8cc9558e +5s
@openzeppelin:upgrades:core waiting for deployment tx mined 0x704ccf5054e6c77ed09654bc78e3ab2a29f113e74ca3d894b4bdc82d8cc9558e +178ms
Unfortunately, I've been unable to produce an MRE; otherwise, I would share it. deployProxy
seems to work ok in hh coverage
in a fresh project.
Packages:
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@openzeppelin/hardhat-upgrades": "^1.17.0",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.2",
"hardhat": "^2.9.2",
"mocha": "^9.2.2",
"solidity-coverage": "^0.7.20",
"@openzeppelin/contracts-upgradeable": "4.3.3"
I'm hoping someone would be able to point me in the right direction, as I've come up empty-handed after endless hours of debugging. Thanks.