-
Notifications
You must be signed in to change notification settings - Fork 286
Add redeployImplementation option
#804
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
Add redeployImplementation option
#804
Conversation
redeployImplementation optionredeployImplementation option, deprecate useDeployedImplementation
redeployImplementation option, deprecate useDeployedImplementationredeployImplementation option
| timeout: opts.timeout ?? 60e3, | ||
| pollingInterval: opts.pollingInterval ?? 5e3, | ||
| useDeployedImplementation: opts.useDeployedImplementation ?? true, | ||
| useDeployedImplementation: opts.useDeployedImplementation ?? false, |
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'm confused by a couple of things here.
- Why would the default change?
- Was the default really
true? I thought our default was always theonchangebehavior.
See my other comment. I think we should be returning an options object that is self-consistent. Can we return an object without the useDeployedImplementation field?
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 see now that if the user set useDeployedImplementation in their config we want to refer to that in the error message. This makes sense.
Perhaps the way it's implemented currently is the best option, let me know what you think. My comment was because I would expect the deprecated option to be handled in this location instead of in the other places.
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.
Re: original default being true - that was a bug but had no consequence because we never actually used the default value from withDefaults.
In deployImpl, we use the opts param instead of deployData.fullOpts, where only deployData.fullOpts was populated by withDefaults.
I agree we could remove useDeployedImplementation from withDefaults, but this function's return signature is currently Required<UpgradeOptions> so we would need to get around that.
Technically the default of redeployImplementation = onchange seems kind of pointless as well -- we could equally dictate that undefined means "on change" and not allow an explicit onchange value. It does help to make it clearer though. But (similar to useDeployedImplementation above) is there any benefit in setting redeployImplementation = onchange in withDefaults if we never use this default value?
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.
Leaving the defaults as-is but improved the way we consume fullOpts (coming from withDefaults) and opts
| if (opts.useDeployedImplementation && opts.redeployImplementation !== undefined) { | ||
| throw new UpgradesError( | ||
| 'The useDeployedImplementation and redeployImplementation options cannot both be set at the same time', | ||
| ); | ||
| } |
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 we need to be handling this differently... Possibly in the withDefaults function. Here we should be able to assume that options have "integrity".
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.
Consider the following:
User specifies useDeployedImplementation = true but does not specify redeployImplementation in their script, so it is undefined.
If we use withDefaults to treat redeployImplementation as being onchange, then that will ALWAYS conflict with useDeployedImplementation = true.
So useDeployedImplementation and redeployImplementation need to be mutually exclusive and we should detect this as above.
The only benefit of allowing these to have integrity would be to allow useDeployedImplementation = true and redeployImplementation = never at the same time, but there is no need for this.
|
Ideally, if the user specifies |
I don't think we should do this. Users may want to run |
Adds the following option:
redeployImplementation: ("always" | "never" | "onchange") Determines whether the implementation contract will be redeployed. Defaults to"onchange"."always", the implementation contract is always redeployed even if it was previously deployed with the same bytecode. This can be used with thesaltoption when deploying a proxy through OpenZeppelin Platform to ensure that the implementation contract is deployed with the same salt as the proxy."never", the implementation contract is never redeployed. If the implementation contract was not previously deployed or is not found in the network file, an error will be thrown."onchange", the implementation contract is redeployed only if the bytecode has changed from previous deployments.Deprecates
useDeployedImplementationwhich is equivalent toredeployImplementation = "never"