Error: Deployment at 0x.. address is not registered

We are trying to prepare a contract for upgrade as we always do but get an error, here is our code:

VNFTxV4 = await ethers.getContractFactory("VNFTxV4");
  console.log("Preparing upgrade...");
  vnftxV4Address = await upgrades.prepareUpgrade(proxy, VNFTxV4, {
    unsafeAllowCustomTypes: true,
  });

:computer: Environment

Using hardhat-upgrades on osx

:memo:Details

the error I get is

Error: Deployment at address 0x4fEd51889672dcF22EDe6CD2421cF2aD74E1B287 is not registered

:1234: Code to reproduce

1 Like

Hi @surfer77,

I am sorry that you are having this issue.

I reproduced by removing my <network_name>.json file.

$ npx hardhat run --network rinkeby scripts/prepare_upgrade.js
Preparing upgrade...
Error: Deployment at address 0x71a939282aE70747A30007a857c6D7B664554846 is not registered
    at Manifest.getDeploymentFromAddress (/home/abcoathup/projects/forum/surfer77/node_modules/@openzeppelin/upgrades-core/src/manifest.ts:55:13)

What network are you deploying to?
Is your <network_name>.json file checked in if it is a public network?
Is the previous implementation 0x4fEd51889672dcF22EDe6CD2421cF2aD74E1B287 listed in <network_name>.json?

1 Like

Hi! we are trying to deploy to mainnet, the address you provided is not under implems, how should i add it?

It seems I am missing VNFTx3 in mainnet.json because not I was who deployed that version, I am trying to recreate it but any help is welcome as I don’t want to mess up the storage fields.

 "manifestVersion": "3.1",
 "impls": {
   "2576de311ef3c85ba4a60e05ae556342448e097e31b93a1a7516761c41593763": {
     "address": "0xaB03D275cc0a02b607992E5FD455Eb41aEd5fa91",
     "txHash": "0x8d3f3b1df52bfbf40d15f485ff25879745fece67e5d3a24183f39edf6050f561",
     "layout": {
       "storage": [
         {
           "contract": "Initiali```
1 Like

Hi @surfer77,

First I recommend adding your public <network_name>.json files to version control: https://docs.openzeppelin.com/upgrades-plugins/1.x/network-files#configuration-files-in-version-control

This is used to check the upgrade safety of your contract when you prepare the upgrade.

I recommend creating higher level tests to test the upgrade from one version to another to check for upgrade safety.

You may be able to deploy the original version to a public testnet and then copy this to <network_name>.json and update the addresses. Though I would like to confirm that this is the best approach.

1 Like

I made a duplicated post in same section and removed (we are on same project)

Yes we have the json file for first deployment and second version but missing the third.

Do you have any pointer on how is generated the keys for the impls object? I manage to recreate all the file but keys are different.

Also if we make sure about the storage order, could we just deploy the contract then call manually:
Function: upgrade(address proxy, address implementation)

or would there be potential issues?

Thanks

1 Like

The keys are the hash of the bytecode with the metadata part removed.

Yes, that would be fine, if you check the storage order and your new contract is upgrade safe according to the plugin.


Do you have the source code for the version that is missing? I can take a look if there’s something we can do for you to properly register an implementation in your network file.

2 Likes

Here is the issue for registering an implementation contract that is already deployed on chain:

I wasn’t able to implement it quickly, so I don’t know when we’ll be able to implement it.

2 Likes

Hi @Jules_Dourlens & @surfer77,

Just wanted to follow up and see if you were able to resolve?

Hi @Jules_Dourlens & @surfer77,

We have found an error in Upgrades Plugins for Truffle and Hardhat. Users of the flag unsafeAllowCustomTypes should update their dependencies to the latest version.

See post for more details: Problem in Upgrades Plugins for users of unsafeAllowCustomTypes.

Hey Thanks for reaching out, yeah I managed to make it back manually and we updated too for future releases :wink:
Thanks

1 Like