Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation functions fail if contract has constructor args #654

Open
ericglau opened this issue Sep 13, 2022 · 1 comment
Open

Validation functions fail if contract has constructor args #654

ericglau opened this issue Sep 13, 2022 · 1 comment

Comments

@ericglau
Copy link
Member

If an implementation contract has a constructor that requirements arguments, running validateImplementation or validateUpgrade to validate that contract causes an error like the following:

Error: types/values length mismatch (count={"types":1,"values":0}, value={"types":[{"name":"forwarder","type":"address","indexed":null,"components":null,"arrayLength":null,"arrayChildren":null,"baseType":"address","_isParamType":true}],"values":[]}, code=INVALID_ARGUMENT, version=abi/5.7.0)
    at Logger.makeError (/myproject/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/myproject/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at AbiCoder.encode (/myproject/node_modules/@ethersproject/abi/src.ts/abi-coder.ts:101:20)
    at Interface._encodeParams (/myproject/node_modules/@ethersproject/abi/src.ts/interface.ts:323:31)
    at Interface.encodeDeploy (/myproject/node_modules/@ethersproject/abi/src.ts/interface.ts:327:21)
    at getDeployData (/myproject/node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy-impl.ts:49:45)
    at Proxy.validateImplementation (/myproject/node_modules/@openzeppelin/hardhat-upgrades/src/validate-implementation.ts:15:24)
    at main (/myproject/scripts/validate.js:12:3) {
  reason: 'types/values length mismatch',
  code: 'INVALID_ARGUMENT',
  count: { types: 1, values: 0 },
  value: { types: [ [ParamType] ], values: [] }
}

A workaround is to provide the constructorArgs option when running the validate function: e.g. {constructorArgs: ['myArg']}

But this should be fixed to not require args when performing only validations.

@ericglau ericglau added the bug label Sep 13, 2022
@frangio
Copy link
Contributor

frangio commented Sep 13, 2022

Related to #647

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants