-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Initializer must be reusable for upgrade Initializers #2901
Comments
Thanks for the suggestion @a-d-j-i. Looking at your PR (OpenZeppelin/openzeppelin-contracts-upgradeable#125), I'm not a fan of the name The idea would be that the modifier
One thing I find interesting in your linked code is that the modifier uses the condition function initializeV2() reinitializer(2) public {
__ERC20VotesUpgradeable_init(...);
} One challenge is that if we change Initializable it needs to be storage-compatible with the current version. This is technically doable because it currently has two booleans that could be converted into a We should discuss this quite a bit more so please don't submit any PRs yet. |
Ok, this was just an example, I will not insist with this PR. |
Let's leave open for discussion. |
🧐 Motivation
All upgradeables are taking some storage space to limit the execution if the Initializer twice.
When you upgrade a contract you need to initialize the new variables and is a good idea to reuse the storage used by Initializer.
📝 Details
I created an example of the main idea in: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/pull/125/files
The text was updated successfully, but these errors were encountered: