OpenZeppelin / OpenZeppelin/openzeppelin-upgrades

Type error when using verifyUpgrade with constructorArgs options

Open
#647 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
TypeScript
Stars
658
Forks
286
PR merge metrics
No merged PRs in 30d

Description

I'm trying to upgrade a contract that was initially deployed with a constructor on the implementation, and particularly, with arguments via the constructorArgs option. The new implementation will use the same pattern, but we're facing now that upgrades.verifyUpgrade() doesn't allow us to use constructorArgs as an option:

  Overload 1 of 2, '(origImplFactory: ContractFactory, newImplFactory: ContractFactory, opts?: ValidationOptions): Promise<void>', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'ContractFactory'.
  Overload 2 of 2, '(proxyOrBeaconAddress: ContractAddressOrInstance, newImplFactory: ContractFactory, opts?: ValidationOptions): Promise<...>', gave the following error.
    Argument of type '{ constructorArgs: string[]; }' is not assignable to parameter of type 'ValidationOptions'.
      Object literal may only specify known properties, and 'constructorArgs' does not exist in type 'ValidationOptions'.

Note that disabling the TypeScript check with // @ts-ignore: works, but I'd like to avoid this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TypeScript verifyUpgrade overloads and the ValidationOptions type named in the compiler error. Trace how constructorArgs is represented and consumed during upgrade verification, then confirm that the option is accepted by the public API and that verification still works with constructor arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.