OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
431 stars 200 forks source link

Error when running upgrade if there are contracts with constructors #1507

Closed spalladino closed 4 years ago

spalladino commented 4 years ago

Steps to reproduce:

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.

spalladino commented 4 years ago

Fixed in #1509