-
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
Eternal storage #381
Eternal storage #381
Conversation
This is an interesting approach. In my opinion, though, it tries to be too general purpose, and kind of reimplements the EVM storage mechanism, which is already a mapping of keys to values. Upgrading a contract to one that shares the same storage variables (in the same order), and maybe adds new ones, should serve the same purpose for upgradeability. |
@frangio are you talking about something like If that's the case, how do you upgrade MyType in that scenario? Or are you referring to something like this https://blog.zeppelin.solutions/proxy-libraries-in-solidity-79fbe4b970fd ? |
No, I'm thinking of something lower level.
which if it is accessed behind a delegating proxy can be safely upgraded to something like
Using inheritance is just a shorthand way of getting the variables to line up. Sorry for the lack of detail, I can clarify further if needed. |
I see what you mean.
|
Yes, using inheritance would not be very maintainable. It should definitely not be the long term strategy. I think with the right tooling this approach to upgradeability can be very maintainable and safe to use. What gas costs are you referring to? I'm pretty sure the gas costs remain constant from upgrade to upgrade. The inheritance chain would be resolved and optimized by the compiler. |
I was thinking more about the gas cost when setting information. |
I don't think there is any kind of conclusion to be reached? I think we both have valid points. In the end it's just a matter if you want to merge this in OZ or not :) |
@SylTi what do you think about using an EternalStorage contract like:
If we have them all as internal variables is enough, then we can leave as responsibility of the dev to provide the get functions. |
I'm not sure of why you would want an eternal storage without gets? How do you use the data stored? |
@SylTi what about using this implementation ethereum/EIPs#930 ? |
Closing for now because we don't see this being a part of OpenZeppelin. |
Let's discuss this ;)