Deploying Upgrades Failing - Caller is not the owner (except yes, it is...?)

Hello.

I am having another issue with the hardhat upgrades plug in, this one is stranger than the last.

I encountered this issue working on my own, commercial, live project, which is an NFT project that should receive many upgrades over the course of it's life.

I attempted to deploy an upgrade this morning providing a UX feature upgrade, but the tx stalled for two hours so I replaced the tx with a new one in metamask.

Now, I'm not sure why that tx failed, but now when I attempt to demonstrate to myself that upgradeProxy is working, I get the error execution reverted: Ownable: caller is not the owner.

The precise flow where I'm receiving this error is:

  1. Deploy a copy (source copied from existing mainnet etherscan reviewed code) of my original smart contract to the Goerli testnet (works)
  2. Log the address of the above deployed and use hardhat-verify to verify the implementation, proxy, and link the proxy, implementation, and admin
  3. Insert the address of the proxy (currently: 0x8c6d5Cc5c95E32626c5A1F45A6a2c5Ec9b789B3A) into an upgrade script as follows:
async function upgrade() {
  const oldImplementation = await ethers.getContractFactory(
    "v2"
  );
  const newImplementation = await ethers.getContractFactory(
    "v3"
  );
  console.log("deploying new implementation");
  await upgrades.validateUpgrade(
    "0x8c6d5Cc5c95E32626c5A1F45A6a2c5Ec9b789B3A",
    oldImplementation
  );
  const deployedUpgrade = await upgrades.upgradeProxy(
    "0x8c6d5Cc5c95E32626c5A1F45A6a2c5Ec9b789B3A",
    oldImplementation
  );
  await deployedUpgrade .deployed();
  console.log("deployed to: ", deployedUpgrade .address);
}

upgrade().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
  1. Run the script

At this point, I encounter the previously mentioned error, caller is not owner.

The exact same private key is used for the accounts to deploy to goerli in both scripts, so the account isn't changing.

I've reviewed the docs and don't see any gotchas, any ideas what I'm doing wrong here?

What is the address of this account that you're using?

The proxy at the address that you shared is connected to this ProxyAdmin instance. The owner of that instance is 0x2F4F92162510C2400236Ebb20e7d37423dd78282. Is this the account?

Hi Frangio,

I have used two accounts while troubleshooting this.
I recently tested with the account with the public key: 0x31AE2c2cAEC2Bc9211cC6E55D73Dc3e874BaBdbb

However, I do have access to the account:
0x2F4F92162510C2400236Ebb20e7d37423dd78282 and typically use it for deployments, especially for client work.

I would expect that the address that I used to initially deploy a proxy would be the same marked as the owner of the proxy, the address linked should have used 0x31AE2c2cAEC2Bc9211cC6E55D73Dc3e874BaBdbb to deploy.

Does the hardhat-upgrades plugin save a public key in the .openzeppelin folder?

I will retest with the wallet 0x2F4F92162510C2400236Ebb20e7d37423dd78282.

The hardhat-upgrades plugin will deploy a ProxyAdmin instance and reuse it for subsequent deploys on the same network. If you want a new ProxyAdmin instance you would need to delete the admin field on the network's file under .openzeppelin, or just the entire file (assuming its contents are not so important given that it's testnet).

Currently we have no way of requesting to use a different ProxyAdmin instance.