The upgrade and your user transfers are separate transactions so don’t happen simultaneously. The important thing is to appropriately test your upgrade.
Before you upgrade you should:
Create and run automated tests to check the upgrade locally
Depending what version of OpenZeppelin CLI you are using, you can just use npx oz upgrade, though given network congestion and gas prices you may be better to break it down into push (to push the logic contract) and upgrade (to update the proxy to use the new logic contract) transactions. (At the time of writing standard was 40 Gwei: https://www.ethgasstation.info/)
@abcoathup I tried to push first and encountered a below error:
? Pick a network mainnet
- Variable _roles (AccessControlUpgradeSafe) contains a struct or enum. These are not automatically checked for storage compatibility in the current version. See https://docs.openzeppelin.com/upgrades/2.6//writing-upgradeable#modifying-your-contracts for more info.
✖ Validating and deploying contract TestToken
TestToken deployment failed with error: The contract code couldn't be stored, please check your gas limit.
Even though it failed with an error, the contract is successfully deployed on mainnet.
I would recommend also testing any transactions on a public testnet so that you can calculate the cost and use https://www.ethgasstation.info/ for gas prices.
When I change skipDryRun to false, it always throws below error:
Migrations dry-run (simulation)
===============================
> Network name: 'development-fork'
> Network id: 1
> Block gas limit: 6721975 (0x6691b7)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> block number: 10514145
> block timestamp: 1595486045
> account: 0x56CC12Ee7c43218D7558B31E575169c3A63d55B3
> balance: 99.999692996
> gas used: 153502 (0x2579e)
> gas price: 2 gwei
> value sent: 0 ETH
> total cost: 0.000307004 ETH
-------------------------------------
> Total cost: 0.000307004 ETH
2_deploy_testtoken.js
=====================
Error: Given network 'development-fork' is not defined in your networks.js file
at Object.loadNetworkConfig (/Users/ronak/Developer/projects/test/testtoken_upgradable/node_modules/@openzeppelin/cli/src/models/config/NetworkConfig.ts:84:39)
at Object.<anonymous> (/Users/ronak/Developer/projects/test/testtoken_upgradable/node_modules/@openzeppelin/cli/src/models/config/ConfigManager.ts:33:71)
at Generator.next (<anonymous>)
at /Users/ronak/Developer/projects/test/testtoken_upgradable/node_modules/@openzeppelin/cli/lib/models/config/ConfigManager.js:8:71
at new Promise (<anonymous>)
at __awaiter (/Users/ronak/Developer/projects/test/testtoken_upgradable/node_modules/@openzeppelin/cli/lib/models/config/ConfigManager.js:4:12)
at Object.initNetworkConfiguration (/Users/ronak/Developer/projects/test/testtoken_upgradable/node_modules/@openzeppelin/cli/lib/models/config/ConfigManager.js:33:16)
at deployer.then (/Users/ronak/Developer/projects/test/testtoken_upgradable/migrations/2_deploy_testtoken.js:18:55)
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/index.js:64:1
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deferredchain.js:20:1
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.1.31 (core: 5.1.31)
Node v10.20.1
The issue is, it tries to find the development-fork network in network.js file and can’t find. If I try to add the same in network.js, it throws below error:
It looks like we can’t use the Truffle dry run feature in this type of setup as it is trying to access development-fork in network.js which would be the OpenZeppelin network configuration but you are using truffle-config.js.
Is it possible to manually write mainnet.json file contents for TestToken implementation contract which is already successfully deployed but oz failed to write in mainnet.json ?