Create a project with two contracts, one with a constructor and one with initializer
Run oz deploy upgradeable on the contract with initializer
Run oz deploy regular on the contract with constructor
Run oz upgrade
The CLI will complain that one of the contracts has validation errors, since it has a constructor - which in this case is fine, since it was used in a regular deploy.
$ npx oz upgrade
? Pick a network development
Nothing to compile, all contracts are up to date.
- Contract WithConstructor or an ancestor has a constructor. Change it to an initializer function. See https://docs.openzeppelin.com/upgrades/2.6//writing-upgradeable#initializers.
One or more contracts have validation errors. Please review the items listed above and fix them, or run this command again with the --force option.
Running --force does not fix the issue, as it seems like the CLI attempts to push the non-upgradeable contracts.
$ npx oz upgrade --force
? Pick a network development
Nothing to compile, all contracts are up to date.
- Contract WithConstructor or an ancestor has a constructor. Change it to an initializer function. See https://docs.openzeppelin.com/upgrades/2.6//writing-upgradeable#initializers.
✖ Validating and deploying contract WithConstructor
WithConstructor deployment failed with error: invalid number value (arg="x", coderType="uint256", value={"from":"0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1","gas":5000000,"gasPrice":5000000000})
The CLI should compile the contracts, and run the validations only on the contracts to be offered to upgrade.
Steps to reproduce:
oz deploy upgradeable
on the contract with initializeroz deploy regular
on the contract with constructoroz upgrade
The CLI will complain that one of the contracts has validation errors, since it has a constructor - which in this case is fine, since it was used in a regular deploy.
Running
--force
does not fix the issue, as it seems like the CLI attempts topush
the non-upgradeable contracts.The CLI should compile the contracts, and run the validations only on the contracts to be offered to upgrade.