OpenZeppelin / OpenZeppelin/openzeppelin-upgrades

Improve error message about wrong proxy admin when 0x0

Open
#295 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm trying to follow the instructions for using the upgrades plugin for hardhat. I have the exact same scripts (except with my contract instead of Box) shown here: https://docs.openzeppelin.com/upgrades-plugins/1.x/hardhat-upgrades#script-usage

If I deploy in the first script, then use the address from that script's log in the upgrade script, I get the following error:

$ hh run scripts/deploy.js 
Implementation V1 deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
$ hh run scripts/upgrade.js 
Error: Proxy admin is not the one registered in the network manifest
    at Proxy.upgradeProxy (/work/hardhat-test/node_modules/@openzeppelin/hardhat-upgrades/src/upgrade-proxy.ts:79:13)

If I combine the initial deploy and the upgrade in the same script it works fine (similar to the Usage in Tests section at the bottom of the page).

This only happens when using the default hardhat network VM. If I connect to a local network (ganache), the upgrade works fine.

Any help would be appreciated. Thanks!

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 with the reported stack location in src/upgrade-proxy.ts at line 79 and compare behavior between the default Hardhat network VM and a local Ganache network. Reproduce the separate deploy.js and upgrade.js runs using the linked Hardhat Upgrades documentation, then confirm that the proxy admin is resolved consistently and that the upgrade succeeds across both network setups.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.