Hello, everyone.
I'm trying to deploy an UUPS contract (in docker environment using docker-compose) and encounter the timeout error:
TransactionMinedTimeout [Error]: Timed out waiting for implementation contract deployment to address 0x5FbDB2315678afecb367f032d93F642f64180aa3 with transaction 0x61702b0e4c4bb270e32eae9bb43158d174d21edeaf9d99eaec7feafae19a3e24
Full stacktrace is available in the README of the repository with the reproducible example.
For testing purposes the contract (named Empty in my example) is just an empty contract with UUPS and Ownable support generated on wizard.openzeppelin.com, and I'm also using a hard-coded private key to deploy the contract.
Code to reproduce
A minimal example to reproduce the issue is located here: https://github.com/yakovenkodenis/openzeppelin-upgrades-reproduction
// index.js
const { ethers, upgrades } = require('hardhat');
async function reproduce() {
const provider = new ethers.JsonRpcProvider('http://hardhat-node:8545', {
name: 'hardhat',
chainId: 31337,
});
const deployerWallet = new ethers.Wallet('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', provider); // this private key is hard-coded in hardhat.config.js
const walletBalance = await deployerWallet.provider?.getBalance(deployerWallet.address);
const EmptyFactory = await ethers.getContractFactory('Empty', deployerWallet);
const contract = (await upgrades.deployProxy(
EmptyFactory,
[],
{
kind: 'uups',
initializer: 'initialize',
},
));
}
reproduce();
Environment
The environment gets set up using docker compose (a hardhat node is a separate container).
The dependencies of the project:
"@nomicfoundation/hardhat-network-helpers": "^1.0.12",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@openzeppelin/contracts": "^5.3.0",
"@openzeppelin/contracts-upgradeable": "^5.3.0",
"@openzeppelin/hardhat-upgrades": "^3.9.0",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"dotenv": "^16.5.0",
"ethers": "^6.14.3",
"hardhat": "^2.24.1"
Is my setup is somehow incorrect? I can't really figure this out since in tests (and using ethers.getSigners()
) everything works smoothly (both localhost and hardhat network configurations) and without any issues, while trying to do the same (on the same network) using a provider not from ethers.getSigners, but still created from the same private key, I'm getting the timeout error.
PS: Looks like the issue was indeed with me not using ethers.getSigners()
.
However, the question remains: what if I want to use another provider (like a FallbackProvider
that is set up with both Infura and Alchemy endpoints), or even just my own provider created from a mnemonic or a private key sitting in the environment, is this possible?