How is Admin Address Set in .openzeppelin files on local testnet?

Currently, when testing the deployProxy and upgradeProxy function, I am receiving this behavior that I can’t really understand. When I deploy a proxy, I understand that two contracts are deployed, one is the logic contract, which is deployed first, the second is the proxy contract that is deployed second and is pointed to the logic contract.

Then, I try to find out who the admin is by making a call to the smart contract, I get an error telling me that the admin address isn’t the address that I am calling from, so it reverts. This is the error I get:

Proxy admin is not the one registered in the network manifest

So I dug into the openzeppelin code where the upgrade proxy function is and where the error comes out, and I found that it makes a call to get the contracts storage and load the address from the admin slot. I did this same thing in my test environment and the address stored as the admin address is

0xd5e8aa91bda51688e6f3de82e52fb38e35298515

Which doesn’t make any sense as the network I deployed only had 10 addresses that were generated from a mnemonic

candy maple cake sugar pudding cream honey rich smooth crumble sweet treat

The addresses generated by my local ganache instance:

(0) 0x627306090abaB3A6e1400e9345bC60c78a8BEf57 (100 ETH)
(1) 0xf17f52151EbEF6C7334FAD080c5704D77216b732 (100 ETH)
(2) 0xC5fdf4076b8F3A5357c5E395ab970B5B54098Fef (100 ETH)
(3) 0x821aEa9a577a9b44299B9c15c88cf3087F3b5544 (100 ETH)
(4) 0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2 (100 ETH
(5) 0x2932b7A2355D6fecc4b5c0B6BD44cC31df247a2e (100 ETH)
(6) 0x2191eF87E392377ec08E7c08Eb105Ef5448eCED5 (100 ETH)
(7) 0x0F4F2Ac550A1b4e2280d04c21cEa7EBD822934b5 (100 ETH)
(8) 0x6330A553Fc93768F612722BB8c2eC78aC90B3bbc (100 ETH)
(9) 0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE (100 ETH)

This owner address is nowhere to be seen in the ganache accounts. Then I look at the unknown-1337.json file, and I see a structure that looks like this:

  "admin": {
    "address": "0xD5E8AA91BDa51688e6f3De82E52Fb38E35298515",
    "txHash": "0x7a6c8022312adfd088bbdcb25280cf9fddde2c8e9ff4c54ce367ae27c1b8a3c2"
  }

I don’t understand why the owner is getting set to address ending in 515 when that address isn’t anywhere in the build folder, or the addresses that are on this network that were prefunded with eth.

Any answer on where this address 0xD5E8AA91BDa51688e6f3De82E52Fb38E35298515 came from would be appreciated!

1 Like

Hi @elliot,

deployProxy actually deploys three contracts, the implementation contract, a ProxyAdmin (one per project per network) and the proxy. See the documentation for details: https://docs.openzeppelin.com/upgrades-plugins/1.x/#how-plugins-work

The admin is the ProxyAdmin contract (https://docs.openzeppelin.com/upgrades-plugins/1.x/faq#what-is-a-proxy-admin) which is the admin for your projects proxy contracts.

To learn more about the network files, please see the documentation: https://docs.openzeppelin.com/upgrades-plugins/1.x/network-files

1 Like