Execute upgrade using different signer

Hi, is it exists a way to execute upgrades.upgradeProxy using different ethers signer?
I am writing tests to be sure what the whole flow is working fine.
Here are these test steps:

  1. upgrades.deployProxy
  2. getting a proxy admin owner: upgrades.admin.getInstance -> adminInstance.owner
  3. the proxy admin owner must be equal to the default ethers signer which made the deployment
  4. transferring admin ownership: upgrades.admin.transferProxyAdminOwnership
  5. getting a proxy admin owner again. It must be equal the signer address what has been set during the previous step
  6. trying to upgrades.upgradeProxy the contract instance. Must to throw with error: "Ownable: caller is not the owner"

These six steps are fulfilled successfully.

But how to call upgrades.upgradeProxy using the new admin proxy owner to be sure that the upgrade feature will work after the proxy admin ownership transfer?

Also, I'm getting the following messages:

✘ 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 (transparent) proxy ownership not affected by admin proxy
✔ 0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9 (transparent) proxy ownership transfered through admin proxy
✔ 0x5FC8d32690cc91D4c39d9d3abcBD16989F875707 (transparent) proxy ownership transfered through admin proxy
✔ 0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6 (transparent) proxy ownership transfered through admin proxy
✔ 0x610178dA211FEF7D417bC0e6FeD39F05609AD788 (transparent) proxy ownership transfered through admin proxy

What does it mean?

You can use a different signer by passing in a contract factory that was set up with the signer that you want.

const ImplV2 = await ethers.getContractFactory('ImplV2', newOwner);
await upgrades.upgradeProxy(proxy, ImplV2);

Please let me know if you can get this to work.


Those messages are there to remind about some subtleties of proxy admins. In this case one of your proxies you deployed was using another proxy admin so the ownership transfership didn't affect it. If you used UUPS proxies they would also show up as not affected.

I understand this can get annoying, I'll make a note that we have to improve this.

2 Likes

Thank you! This method works.
Unfortunately, it does not obvious.
It will be better to explicitly define a signer using options.

1 Like

I agree. You can suscribe to this issue:

1 Like