-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Use namespaced storage for upgradeable contracts #4534
Conversation
🦋 Changeset detectedLatest commit: 8972612 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 |
Updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
I uploaded the result of this transpilation to a branch in openzeppelin-contracts-upgradeable so we can review the resulting changes: OpenZeppelin/openzeppelin-contracts-upgradeable@d16ec78 |
The latest results are in OpenZeppelin/openzeppelin-contracts-upgradeable@3b8d9b1. What changed was the location of initializer functions, and the latest updates to zero out the least significant byte in the location. |
With this change OpenZeppelin upgradeable contracts should now be compatible with EIP-2535 Diamonds. Would be great to see an implementation of it in OpenZeppelin. |
This PR configures the transpiler to use namespaces instead of gaps in the upgradeable code.
There are two changes to the code that I found necessary. In one case, the transpiled code resulted in a stack too deep compilation error, I assume because the
$
storage pointer takes up a place in the stack. In another case, I had to change apublic immutable
variable into a private variable, because immutables without an override get converted to storage variables and the namespace transformation enforces storage variables to be private. This implies that we can't use public immutables in the codebase in general.The transpiler code can be found in OpenZeppelin/openzeppelin-transpiler#127.
Fixes #2964