-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Include EIP-5267 discovery in EIP-712 #3969
Conversation
Note that in 5.0 we should do the following breaking change: -bytes32 private immutable _TYPE_HASH = ...
+bytes32 private constant _TYPE_HASH = ... It is breaking because in the upgradeable version this is transpiled to a "live" storage slot (it shouldn't) |
🦋 Changeset detectedLatest commit: 2918dcc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The storage error is caused by the absence of gaps for EIP712 to grow into. This will not be an issue in the upgradeable contracts. We should run that checks after the transpilation |
I have a slightly bigger issue/question I want to raise in addition to the above comments. The current upgradeable version of EIP712 is not efficient. The domain separator cache is removed, which is necessary because the implementation contract doesn't know the address of the proxy (needed for This all sounds like a good opportunity to properly make Note: The key thing we would need to do is to add annotations on all immutable variables:
( |
Co-authored-by: Francisco <fg@frang.io>
The issue with #aed5659 is that it will break the storage layout by removing variables (and expanding the gap) which the upgrades plugin does not currently support :/ |
We will fix this with a manual patch with placeholder variables. I've renamed variables to camel case. |
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 looks good. Once we merge we should check in the upgradeable repo to confirm we're getting the results we expected.
Co-authored-by: Francisco <fg@frang.io>
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.
LGTM
Will this be adopted in the future? (Passing |
Can you elaborate on what you mean here? |
Correct me if I'm wrong. Proxies can not utilize the logic in the constructor of implementation contract.
|
This is not correct. A proxy can definitely use immutable variables defined in its implementation contract. However, there is a caveat, in that the values of those immutable variables will be set when the implementation is deployed (in its constructor), and will be shared by all proxies that use that implementation contract. In the OpenZeppelin Upgrades Plugins, the reason we discourage immutable variables in upgradeable contracts and disallow them by default is that this behavior may be unexpected. But the In the case of EIP712, with this PR the name and version will be set as immutables in the implementation contract. The proxy will then use those immutable values. The domain separator is also cached as an immutable, but in |
Thanks for the correction! I agree. I think the point I was trying to make was
What I was trying to achieve is that multiple proxy contracts can use the same implementation contract but with different immutable variables initialized when deploying the proxy contracts just like those state varaibles initialized in the proxy contract's It's a contradiction because immutable variables must be initialized in constructor. To initialize immutable variables when deploying proxy contracts, they must be initialized in the proxy's constructor. But proxy contract itself can not be upgradeaded. So It is impossible to have immutable variables initialized when deploying proxy contract when making them upgradeable in the future. In that regard, it's really no difference in defining a function returning a constant and an immutable variable. |
That's correct.
This will not be possible with this version of EIP712. Is this ability important to you? |
Fixes #3968
Fixes LIB-633
Note: the changes to
EIP712.sol
will require a re-initialization to set the_NAME
and_VERSION
variables. This will be a sensitive operation, as the re initialization risks changing the domain separator.PR Checklist