Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Make
TransparentUpgradeableProxy
deploy itsProxyAdmin
and optimize proxy interfaces #4382Make
TransparentUpgradeableProxy
deploy itsProxyAdmin
and optimize proxy interfaces #4382Changes from all commits
a4215ca
9d39cf0
2acbf84
e48fa5a
d999991
03c2cf5
f570cdc
0303cc7
347fac0
9de9ce8
34381f6
bff3bc7
d9e192e
2dd7c05
62bbd7b
b71fc98
2e0c396
ca99577
909fe1d
d01100a
b425a38
d4f5535
6e48769
0f479c6
853dc83
864be51
9349f30
cd1ac92
c4d49a4
6e95dac
4d3bb2f
c37cab0
5c77c03
ff6a70e
223d840
66a3ebf
be31da2
802def2
a22e182
dc040f1
4b9ec42
22698a6
60123c7
9f18301
75ea1de
08ad9b5
7e5c33b
703659e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Hey i just stumbled over this change when reviewing v5 and was wondering if it wouldn't make sense to have an overload with
ProxyAdmin _admin
instead ofaddress initialOwner
.This way one could easily reuse a single ProxyAdmin for multiple contracts.
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.
This used ti be the case in v4. We decided to change that.
In v4, the admin was stored in storage, which means that any call going trough the proxy would have to load that value, costing 2100 gas.
We wanted to reduce that gas cost, and so we decided to make the admin immutable. That means that it is not possible for a proxy to change which admin it uses. You could change the value stored in the ERC-1967 slot, but that would have no effect.
That means that if multiple proxy use the same ProxyAdmin, then you can separate the ownership. You may be able to change who owns the ProxyAdmin, but every proxy that point to it will share the same owner, forever.
That is why we decided to make the
TransparentUpgradeableProxy <> ProxyAdmin
a 1-to-1 relationship.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.
Agree with @Amxx.
We agreed that it's better to reduce the SLOAD cost in the proxy than allowing to reuse ProxyAdmins. The tradeoff is fine because this not only increases deployment costs but reduces every proxy interaction cost. Consider regular proxy interactions are more frequent (potentially millions of times) than admin interactions.
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 just stumbled upon this while deploying a proxy using v5. Being used to the v4 behavior, I wrongly passed in a proxy admin making the deployment unusable. As far as I could tell, this change is not documented in any changelog. I think that it would be good to add this to the v5 changelog.
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.
Thanks for sharing @danhper! The change is documented on both OZ upgrades plugins and OZ Contracts (see Proxy section). Though I know it's counterintuitive, we strongly advice users to be careful about major releases.
We'd be happy to hear suggestions on how to improve the way we communicate these changes.