openzeppelin-upgrades icon indicating copy to clipboard operation
openzeppelin-upgrades copied to clipboard

Add support for custom proxy factory

Open thegostep opened this issue 5 years ago • 3 comments

I've been playing around with various types of proxies and there is a fair bit of friction to putting them in prod due to poor testing infra.

Proxy examples: https://github.com/onboardmoney/solidity-version-proxy https://github.com/0age/Spawner

It would be great to be able to use the upgrades package and pass in a custom proxy factory

thegostep avatar Nov 19 '20 09:11 thegostep

We will be adding a beacon proxy like Dharma's in OpenZeppelin Contracts soon, so this is something we're interested in as well.

frangio avatar Nov 19 '20 15:11 frangio

Are there any updates so far? I'm playing around with the beacon proxy but I could not find any equivalents for deployProxy and upgradeProxy functions from the truffle upgrades plugin, which works with the beacon proxies.

kiliw avatar Feb 12 '21 11:02 kiliw

No updates on this yet. Some thoughts on how the implementation should proceed:

We will need to parameterize deployProxy and upgradeProxy with a structure describing how to deploy and interact with the custom proxy. We seem to need these operations:

  • deploy(admin: address, impl: address, data: bytes): Promise<address>
  • getCurrentImplementation(proxy: address): Promise<address>
  • upgrade(proxy: address, newImpl: address): Promise<void>

There may be another operation needed to check that an upgrade will be possible with the current provider signer (i.e. if it is the right admin for the proxy), to avoid deploying an implementation if the upgrade will not be able to proceed.

For beacon proxies it's kind of weird that upgrading a single one will end up upgrading multiple proxies, I wish there was some way to make this more explicit in the API...

frangio avatar Feb 12 '21 14:02 frangio