I am using OZ Upgrades Plugin with truffle to deploy some smart contracts. I have used the script multiple times and it always worked, I just updated some packages and it is behaving in a strange manner now.
The script successfully deploys the Logic contract and the ProxyAdmin, but the deployed TransparentUpgradeableProxy has no code and then it fails.
See logs:
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Starting migrations...
======================
> Network name: 'kovan'
> Network id: 42
> Block gas limit: 12500000 (0xbebc20)
3_deploy_marketplace_proxy.js
=============================
Deploying 'LogicContract'
--------------------------------
> transaction hash: 0x0543ddc4d9015df818c8d81c22bb3d20a25e6584955993ec86fd5cdf8ce303a8
> Blocks: 2 Seconds: 9
> contract address: 0xeCF7Dd432F9FF6f7a9Ee3841DC7b885bfD3aDa5C
> block number: 27108304
> block timestamp: 1631103788
> account: 0x9A1DD23237304Bb78f2F4f8A389EaA0F2aF895B5
> balance: 1.956499268384216683
> gas used: 2983858 (0x2d87b2)
> gas price: 5 gwei
> value sent: 0 ETH
> total cost: 0.01491929 ETH
Pausing for 2 confirmations...
------------------------------
> confirmation number: 2 (block: 27108306)
Deploying 'ProxyAdmin'
----------------------
> transaction hash: 0x70c9e4c3712922e1cf9db0eff88ec7d247b06f52f0acfe0e064311e8326596a7
> Blocks: 2 Seconds: 13
> contract address: 0x9C6CD8b0C5A893FBA5E5065BAd9ed3118fAB1aaB
> block number: 27108309
> block timestamp: 1631103821
> account: 0x9A1DD23237304Bb78f2F4f8A389EaA0F2aF895B5
> balance: 1.954079168384216683
> gas used: 484020 (0x762b4)
> gas price: 5 gwei
> value sent: 0 ETH
> total cost: 0.0024201 ETH
Pausing for 2 confirmations...
------------------------------
> confirmation number: 1 (block: 27108311)
> confirmation number: 2 (block: 27108312)
Deploying 'TransparentUpgradeableProxy'
---------------------------------------
> transaction hash: 0xdd8c91e8fd3af06b79ec004f0ecd2b85aad4b93b7b28201a40db4cbf8eae81d7
Error: *** Deployment Failed ***
"TransparentUpgradeableProxy" -- Cannot create instance of TransparentUpgradeableProxy; no code at address 0x9F91009db9C67Ba42252D157f3126D79B5a6e8fE.
at /home/ayush/work/projects/smartcontracts/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.deploy (/home/ayush/work/projects/smartcontracts/node_modules/@openzeppelin/truffle-upgrades/src/utils/deploy.ts:9:48)
at deployProxy (/home/ayush/work/projects/smartcontracts/node_modules/@openzeppelin/truffle-upgrades/src/deploy-proxy.ts:63:9)
Truffle v5.4.9 (core: 5.4.9)
Node v16.1.0
Code to reproduce
await deployProxy(contract, args, { deployer, initializer: "initialize"});
Environment
Truffle v5.4.9 (core: 5.4.9)
Solidity - 0.5.9 (solc-js)
Node v16.1.0
Web3.js v1.5.2
package.json:
"dependencies": {
"@babel/polyfill": "^7.11.5",
"@openzeppelin/truffle-upgrades": "^1.9.1",
"@truffle/hdwallet-provider": "^1.5.0",
"axios": "^0.21.4",
"bignumber.js": "^9.0.1",
"bluebird": "^3.7.2",
"bn.js": "^5.2.0",
"dotenv": "^10.0.0",
"fast-csv": "^4.3.6",
"leveldown": "^6.0.1",
"linvodb3": "^3.26.0",
"minimist": "^1.2.5",
"truffle": "^5.4.9",
"web3": "^1.5.2"
},
"devDependencies": {
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.4",
"@babel/register": "^7.15.3",
"@openzeppelin/test-helpers": "^0.5.13",
"@truffle/debugger": "^9.1.14",
"chai": "^4.3.4",
"truffle-flattener": "^1.5.0"
}