Revert occurs when upgrading transparent proxy from Foundry

Not sure if I should open a new thread for this but I'm running into a similar issue when trying to Deploy and Upgrade a TransparentProxy using Foundry and OpenZeppelin 5.0.

Deployment Script:

I am using as the owner the Proxy: 0x50Ef443c406b05025C3faBA716bAFCe345b1b7CB

TransparentProxy Deployment tx: https://arbiscan.io/tx/0x551e0f10e40163d04ba6dcec898222e494d8dffd8ff50a5c92b26aa303e0d1e5#eventlog

Looking into the AdminChanged event I can see:
newAdmin : 0x50Ef443c406b05025C3faBA716bAFCe345b1b7CB
That it's the same address as the owner that I use in the deployProxy function.

That's why I believe that when I run the following command:

address autolayerReferalsProxyAddress = 0x69ad4c9E77110D98A284664db2FE4c970CBbEc28;

    Options memory opts;
    opts.referenceContract = "AutoLayerReferals.sol";

    Upgrades.upgradeProxy(
        autolayerReferalsProxyAddress,
        "AutoLayerReferals.sol",
        "",
        opts
    );

Runs into the following error:

Because either the ProxyAdmin wasn't deployed correctly or the admin wasn't set correctly.

Hi @urrizaGlue,

  1. From the source code of your deployed proxy https://arbiscan.io/address/0x69ad4c9e77110d98a284664db2fe4c970cbbec28#code, it looks like the proxy is using OpenZeppelin Contracts v4. If you intended to use v5, check that you have the correct version of the library installed and check your remappings.txt -- see https://docs.openzeppelin.com/upgrades-plugins/1.x/foundry-upgrades#installation. Note that deploying proxies from v4 is not supported by the Foundry Upgrades plugin.
  2. If using OpenZeppelin Contracts v5, the second parameter should be the initial owner, not an existing proxy admin. See https://docs.openzeppelin.com/upgrades-plugins/1.x/api-foundry-upgrades#Upgrades-Upgrades-deployTransparentProxy-string-address-bytes- . The transparent proxy will deploy its own proxy admin, owned by the initial owner.
  3. The error that you are getting looks like an issue with using Foundry Upgrades with OpenZeppelin Contracts v4, which was fixed in https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades/releases/tag/v0.3.2.

Hi @ericglau,

  1. I have reinstaled the OpenZeppelin Contracts to be sure that I'm on v5 (I believe that I was already) and I have updated my remappings.txt (which was missing that changes that you pointed out).
  2. Although the variable name is proxyAdminAddress, as you can see it's the address 0x50Ef443c406b05025C3faBA716bAFCe345b1b7CB that it's an EOA. The name is proxyAdminAddress because before writing this post the only way that I found to make it work is pre-deploying a ProxyAdmin address and using it's address as the second parameter of the deployTransparentProxy function, but I wanted to avoid this use)
  3. Nice!

It works perfectly now! It seems that one of my remappings was messing everything up and although I have v5 of OpenZeppelin contracts, other instaled libraries were using the v4.

Just another question, when using Proxies with Foundry, is there any folder where I can find the deployment addresses? (I have searched for the .openzeppelin one but it doesn't seem to be there)

Thank you so much!

1 Like

To be clear, when using OpenZeppelin Contracts v5, the second parameter for deployTransparentProxy should indeed be an EOA, not a pre-deployed proxy admin address.

Just another question, when using Proxies with Foundry, is there any folder where I can find the deployment addresses? (I have searched for the .openzeppelin one but it doesn't seem to be there)

The Foundry Upgrades plugin does not keep track of deployment addresses. You would need to track these manually. You might be able to find them under the broadcast directory, which is created by Foundry as it broadcasts your deployments/transactions.