Proxy admin is not the one registered in the network manifest

Following the tutorial here, I’ve created MyToken.sol (see here), which is reproduced below:

// contracts/MyToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol";

contract MyToken is Initializable, ERC20UpgradeSafe, AccessControlUpgradeSafe {
    
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");

    function initialize(address admin, uint256 initialSupply) public initializer {
        __ERC20_init("MyToken", "MYT");
        __AccessControl_init_unchained();
        _mint(admin, initialSupply * (10 ** uint256(decimals())));
        _setupRole(BURNER_ROLE, admin);
        _setupRole(DEFAULT_ADMIN_ROLE, admin);
    }

    function burn(address from, uint256 amount) public {
       require(hasRole(BURNER_ROLE, msg.sender), "Caller is not a burner");
       _burn(from, amount);
   }

   function revokeRole(bytes32 role, address account) public override {
       require(
           role != DEFAULT_ADMIN_ROLE,
           "ModifiedAccessControl: cannot revoke default admin role"
       );
 
       super.revokeRole(role, account);
   }

}

and deployed as below:

// 1_deploy_mytoken.js
const MyToken = artifacts.require('MyToken');
 
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
 
module.exports = async function (deployer, network, accounts) {
  await deployProxy(MyToken, ['0x63e4C1725fEB9EDc83d7951cFeD6e0fC3132A26f', 1000], { deployer, unsafeAllowCustomTypes: true, initializer: 'initialize' });
};

Deployed on testnet using below:

npx truffle migrate --network rinkeby --skipDryRun

And the contract is successfully deployed (MyToken, ProxyAdmin, and AdminUpgradeabilityProxy). Checked in truffle console as well and works good.

Now I am adding a new function mint to MyTokenV2.sol in the last (after revokeRule function) as below:

// contracts/MyToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol";

contract MyTokenV2 is Initializable, ERC20UpgradeSafe, AccessControlUpgradeSafe {
    ...everything_as_per_MyToken...

   function mint(address to, uint256 amount) public virtual {
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "MyTokenV2: must have admin role to mint");
        _mint(to, amount);
   }
}

and migrating using:

// 2_upgrade_mytoken.js
const MyToken = artifacts.require('MyToken');
const MyTokenV2 = artifacts.require('MyTokenV2');
 
const { upgradeProxy } = require('@openzeppelin/truffle-upgrades');
 
module.exports = async function (deployer, network, accounts) {
  const myToken = await MyToken.deployed();
  await upgradeProxy(myToken.address, MyTokenV2, {from: '0x63e4C1725fEB9EDc83d7951cFeD6e0fC3132A26f ', deployer, unsafeAllowCustomTypes: true });
};

Now deploying using:

npx truffle migrate -f 2 --network rinkeby

am getting the error:

2_upgrade_mytoken.js
========================

Error: Proxy admin is not the one registered in the network manifest
    at upgradeProxy (/Users/name/projects/project-name/node_modules/@openzeppelin/truffle-upgrades/src/upgrade-proxy.ts:76:11)
    at module.exports (/Users/name/projects/project-name/migrations/2_upgrade_mytoken.js:9:3)
    at Migration._deploy (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:73:1)
    at Migration._load (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:55:1)
    at Migration.run (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:171:1)
    at Object.runMigrations (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at runMigrations (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:264:1)
    at setupDryRunEnvironmentThenRunMigrations (/Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:257:1)
    at /Users/name/projects/project-name/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:220:1
Truffle v5.1.50 (core: 5.1.50)
Node v14.13.1

In .openzeppelin/rinkeby.json, I have:

{
  "manifestVersion": "3.1",
  "impls": {
    "06533079dc4a3f40961f3e7e72470a3e48b1944dcc9a0679070354dde8f659a8": {
      "address": "0x3Cc0513C73fC340785e120F18Bc2D69d7c8c32B3",
      "txHash": "0xaa3e5e884404110a181cc9480fa714dec8ea2a924a6b4dce453f3d12b19295f94",
      "layout": {...
      }
  },
  "admin": {
    "address": "0xbcC3803B405c8854dDaE429828459b238f9B8402",
    "txHash": "0xf582c24235538ef27a26b0618ccd01998943f328b8a826bde0e285f72cddf54f"
  }
}

What I’m missing in 2_upgrade_mytoken.js? How to fix this? Thanks for the help!

1 Like

Hi @megatower66,

You don’t need the from argument in 2_upgrade_mytoken.js.
The owner of your ProxyAdmin contract will be the original account used to deploy (as I can’t see where you have changed this).

await upgradeProxy(myToken.address, MyTokenV2, {from: '0x63e4C1725fEB9EDc83d7951cFeD6e0fC3132A26f ', deployer, unsafeAllowCustomTypes: true });
};

I couldn’t find your ProxyAdmin you listed on Rinkeby:

The command line argument is --skip-dry-run, see: https://www.trufflesuite.com/docs/truffle/reference/truffle-commands#migrate

Using --skipDryRun doesn’t do anything on the command line.

$ npx truffle migrate --network rinkeby --skipDryRun
> Warning: possible unsupported (undocumented in help) command line option: --skipDryRun

I suggest skipping dry run in your truffle-config.js

    rinkeby: {
      provider: () => new HDWalletProvider(
        mnemonic, `https://eth-rinkeby.alchemyapi.io/v2/${alchemyApiKey}`
      ),
      network_id: 4,
      gasPrice: 10e9,
      skipDryRun: true
    }

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


I get the error when I try to do the upgrade with the dry-run simulation as it can’t find the ProxyAdmin. Notice that the Migrations show dry-run.

$ npx truffle migrate -f 2 --network rinkeby

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Migrations dry-run (simulation)
===============================
> Network name:    'rinkeby-fork'
> Network id:      4
> Block gas limit: 10000000 (0x989680)


2_upgrade_mytoken.js
====================

Error: Proxy admin is not the one registered in the network manifest

I was able to upgrade using:

npx truffle migrate -f 2 --network rinkeby --skip-dry-run

I recommend double checking that your public network files contain the correct addresses. I suspect that the dry run has overwritten the values.

I assume that this is only on Rinkeby and you can skip the dry run on mainnet.

Hi @megatower66,

I just wanted to check how you got on with this?