-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Deployments #273
base: master
Are you sure you want to change the base?
Custom Deployments #273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type { Deployment } from '@openzeppelin/upgrades-core'; | ||
import type { ContractFactory } from 'ethers'; | ||
export interface DeploymentExecutor { | ||
(factory: ContractFactory): Promise<HardhatDeployment>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this does not already return a "CoreDeployment"? In other words why do we need a HardhatDeployment
with a ContractTransaction
instead of the transaction hash.
I think the existence of intoCoreDeployment
should be unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I can't exactly recall why this was necessary, but I believe it had something to do with the transformation of the proxy deployment from
const proxy = await ProxyFactory.deploy(impl, adminAddress, data);
into
const proxy = await deploy(ProxyFactory, [impl, adminAddress, data]);
and its return values not matching up. Notice how we don't use intoCoreDeployment
on this particular line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, yes, I believe I recall why we needed HardhatDeployment
here is because at the time we pass the function onto the deployer, we do not actually have the transaction hash and the functionality of your code base requires a provider in order to fetch transaction by hash... Sorry if this isn't entirely clear just yet, but I will try again and see if I can remind myself exactly why this workaround was introduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd imagine the deploy
function that was originally in this file would have been a perfectly good default DeploymentExecutor
, returning the hash instead of the full ContractTransaction
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I insist on this is that we currently have duplication of this layer across the Hardhat and Truffle plugins but we will want to merge those soon, and using the transaction hash is a more agnostic way to represent a deployment, instead of the Ethers-specific ContractTransaction
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally fine with me. I prefer to return only the hash any way. Have made the necessary adjustments and it also made the code on our end much more attractive and easy to write.
import { defaultDeploy, DeploymentExecutor, intoCoreDeployment } from './utils/deploy'; | ||
|
||
export interface UpgradeOptions extends ValidationOptions { | ||
executor?: DeploymentExecutor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a "tx executor" and not only a deployment executor.
I'm thinking that for upgradeProxy
it should also take care of sending the upgrade
function call. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit, I will look into this!
Hey @frangio and thanks for your response. I will attempt to address your questions/comment, thinking that only 1 of the two will be possible. I am, however, running into some awkward inconveniences with the return value of |
@bh2smith I took a quick look at your PR. Having to manually fill in the values for a Regarding your ignoring the I imagine you weren't able to use your branch because this is a monorepo. Unfortunately I don't know if there is a way to overcome that. |
Thanks for the work on this front. Really looking forward to being able to pass in a custom deploy function. Ideally, I would be able to use the |
Yes, I would really hope we can make a move towards this ASAP!
Yes, this is only temporary so I can see that the authenticator is actually upgradable |
Yes, we are indeed! |
I have reverted the introduction of the temporary |
…upgrades into custom-deployment
Closes #167 This PR introduces minor changes to the `AllowListAuthenticator` making it upgradable and includes tests verifying upgradability. In particular: - removing `customInitiallyOwnable` as it is no longer used: Not yet sure how this will affect the `deployments` directory which still includes it. - Updating authenticator deployment script to deploy as proxy. - rename authenticator `owner` to `manager` because of name collision with proxy owner - introduce proxy.ts with helper methods to fetch implementation and owner address. - Include two unit tests: one verifying that upgrade is possible and the other to ensure preservation of storage. Note that the unit tests involving Authenticator's non-upgrade related functionality do not use the proxy deployment as specified in the migration scripts, so that manager must be set immediately after deployment. We had originally planned/hoped to use the `hardhat-upgrades` plugin and opened the following two PRs to `openzeppelin-upgrades`, but this plugin turned out to be unnecessary. - Custom Deployments: OpenZeppelin/openzeppelin-upgrades#273 - Manual Safety Override: OpenZeppelin/openzeppelin-upgrades#280 ### Test Plan Old + new unit and e2e tests.
This is something we're interested in but are not prioritizing at the moment. If anyone is interested in this feature for their setup let us know! |
Yes, I am looking forward to using this feature |
I love this feature, will this merge pass through? |
This branch is now 10 months old. I think it should be considered stale. But you are welcome to brush the dust off and take over. |
Addresses Issue #272 by allowing projects depending on this plugin to specify their own
deploy
function. If a deployment executor is not specified, then the initial (default) implementation is used as a fallback.Currently this remains untested apart from the fact that all existing tests still pass. Open to suggestions for testing!