Setting the from address for a proxy deployment in a test

I am using the Truffle upgrades plugin, "@openzeppelin/truffle-upgrades": "^1.0.2". The problem I’m facing is that for every proxy deployment in my tests (ProxyAdmin, AdminUpgradeabilityProxy), I cannot specify the from address.

The issue with this is that I want to programmatically call the ProxyAdmin contract with my admin account. By using the plugin’s default deployer, it selects a different deployer address than what Truffle is returning me.

This is the current code that I am using in my tests:

const zToken = await deployProxy(MockToken, ["token", "TOKEN"]);

This is the ideal code, with a from option:

const zToken = await deployProxy(MockToken, ["token", "TOKEN"], {from: owner});

Is there currently a workaround for this problem?

:computer: Environment

"@openzeppelin/truffle-upgrades": "^1.0.2"
"truffle": "^5.1.43"

:memo:Details

:1234: Code to reproduce

1 Like

Hi @ken,

Welcome to the community :wave:

deployProxy uses the default account (accounts[0]) to deploy the implementation contract, the ProxyAdmin and the proxy.

There currently isn’t a way to specify the account being used to do this deployment but we also don’t have access other than via the API ( admin.changeAdminForProxy and admin.transferProxyAdminOwnership) to interact with the ProxyAdmin.

Can you share some more details on what you are trying to test on the ProxyAdmin?

Hi @abcoathup

Thanks for your help! I think that answers my question. What I am going to do is to call deployProxy then transfer the ownership to the address I want to test with.

The requirement is that I need to test with a specific address, which is why this was a headache. Would be amazing if there was an option to specify this in the future. Nonetheless we can mark this as solved

1 Like

Hi @ken,

Feedback on the OpenZeppelin Upgrades plugins (including the documentation: https://docs.openzeppelin.com/upgrades-plugins/1.x/) is greatly appreciated.

If you have a moment it would be great if you could introduce yourself.

Hi @ken,

Based on your feedbacl, I created the following issue: https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/181