-
Notifications
You must be signed in to change notification settings - Fork 739
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
[Deprecation] remove storage getters in FRAME #223
[Deprecation] remove storage getters in FRAME #223
Comments
Which storage getters? You mean the |
If yes, what you expect as replacement? Just a normal function? |
Yes, manually implemented if needed. |
@muraca will work on this. |
I have also found it easier to audit storage access by searching for I think the world would be better without it. |
Arguably it's just a matter of adding |
Hi folks! I have two questions:
|
That will not bring you that much as you can also do |
Needing to keep an eye for 2 patterns is still less than 3 🙈 |
I don't wanted to argue against this issue :P |
I have been having a lot of second doubt about this given some recent discussions elsewhere. I can see two arguments against getters:
The former is not a particularly strong argument, and if you really want to go down that rabbit whole, there is a lot of such code in FRAME and it is futile to pursue explicit-ness in an absolutist manner. The latter is a stronger argument, but I am having a hard time convincing myself that is is the right fit for everyone. If I/some Parity developers don't like getters, we can simply not use them internally. Reviewing external code would still be a pain for me, but that would be my problem. But, IFF we could gather the data to argue that majority of FRAME developers think similar to me, then we could argue that the readability of code improves across the ecosystem if we agree on one paradigm. |
FWIW I originally introduced this and I no longer use it prefering instead consistency of the |
I believe that there is a use case for getters, and that is that of publicity -- you may have a storage item that is private or crate-public, but you also want people to be able to publicly get the value under the storage item, so you expose the getter. In short, the |
@KiChjang for that you can manually implement a getter function. |
That's not a good argement. Many languages offers syntax sugar to generate getter and you can't just say those features should be removed because it is possible to manually write the equivalent code. I don't want to write those code. The fact that this feature is used in many places means people wants to use them. So why be the bad guy taking away a feature used by people? |
@xlc Having the feature does not come for free. Compared to using the So the question is not "people are using it; why remove it?" (though admittedly this can reasonably place a time limit on the deprecation timeline). It's instead "what is the benefit of the feature, and what cost does it bring?"; in this case the only real benefit appears to be the ability to have a public getter with all other access of the item (e.g. mutating) being restricted. The cost is code inconsistency:
As well as additional complexity in the pallet and substrate to support the feature. Personally, I'm unconvinced that the benefit outweighs the cost. Perhaps there are other unspecified benefits (if so it would be good to bring these up). If the feature is determined to be not worth the cost, then the points of deprecation and final removal (as well as a possible compatibility path like perhaps a |
Compatibility path will be very helpful. I can live without this feature. It is mostly I prefer to not touch code that aren’t broken. Proper deprecation is a must and more discussion with wider audiences will be great. |
We can make this be a pilot for learning a mature deprecation path. I know that this has also been discussed internally recently, @ggwpez might be able to chime in. At the moment, our communication is solely based on PRs and the
What else we can do? One thing that comes to mind is making sure such PRs make it into the Substate Developer Newsletter, maintained by @sacha-l, although I am sure he already takes all the PRs that are Moreover, while we have a few experts in this thread, it would be good to get a few more opinions. This could be a good task for @juangirini and @aaronbassett to take over: find the right means to do some kind of soft-voting within FRAME developers in the ecosystem to see what the sentiment is. |
Yea I think we can move the creation of this deprecation-process into its own issue @kianenigma, or? |
@ggwpez @kianenigma @aaronbassett I moved this conversation to a separate issue #182 |
If you mark something as deprecated, then you also have to remove all usage - otherwise the CI will complain. |
I'm fine with not following the deprecation checklist, due to the wide impact of this change |
Yea we can just start with our pallets one-by-one or doing rarely modified ones first and then adding the deprecation once we removed it here. |
Am not so convinced of this anymore. We are doing breaking changes to all our pallets for no obvious gain. |
100% we can do this is there are no other work left, which is clearly not the case. there are many CRITICAL open issues and people choose to break code and add more workload to everyone else instead |
AFAIK, we took the path of deprecation notice for this feature. I don't see how any pallet takes more than 15 min to update. |
yeah sure except people are making breaking changes and the breaking changes are merged |
Sounds like a problem of developers and reviewers. Let's point out those problems, not point fingers at a good initiative. |
Going forward, we should merge these without breaking change. The new CI warning you about it being a breaking change is enough deterrant to not want to break things needlessly. There is no one working on this who could have solved anything more important. This initiaitve is a simple one for juniors to get their first contributions into Polkadot, and our support and review of it is value. Putting a stop gap on this is also not going to solve anything. I spend a few minutes every week reviewing this, and other should do the same. In fact, the same CI system and semver-based release is one of those CRITICAL things that we have indeed solved ;) |
As per #3326 , removes pallet::getter macro usage from pallet-membership. The syntax StorageItem::<T, I>::get() should be used instead. Also converts some syntax to turbo and reimplements the removed getters, following #223 cc @muraca --------- Co-authored-by: Dónal Murray <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
…4839) As per #3326, removes pallet::getter macro usage from the pallet-insecure-randomness-collective-flip. The syntax `StorageItem::<T, I>::get()` should be used instead. Explicitly implements the getters that were removed as well, following #223 Also makes the storage values public and converts some syntax to turbo cc @muraca --------- Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
As per paritytech#3326 , removes pallet::getter macro usage from pallet-membership. The syntax StorageItem::<T, I>::get() should be used instead. Also converts some syntax to turbo and reimplements the removed getters, following paritytech#223 cc @muraca --------- Co-authored-by: Dónal Murray <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
…aritytech#4839) As per paritytech#3326, removes pallet::getter macro usage from the pallet-insecure-randomness-collective-flip. The syntax `StorageItem::<T, I>::get()` should be used instead. Explicitly implements the getters that were removed as well, following paritytech#223 Also makes the storage values public and converts some syntax to turbo cc @muraca --------- Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
As per paritytech#3326 , removes pallet::getter macro usage from pallet-membership. The syntax StorageItem::<T, I>::get() should be used instead. Also converts some syntax to turbo and reimplements the removed getters, following paritytech#223 cc @muraca --------- Co-authored-by: Dónal Murray <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
…aritytech#4839) As per paritytech#3326, removes pallet::getter macro usage from the pallet-insecure-randomness-collective-flip. The syntax `StorageItem::<T, I>::get()` should be used instead. Explicitly implements the getters that were removed as well, following paritytech#223 Also makes the storage values public and converts some syntax to turbo cc @muraca --------- Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
... or for now mark them as deprecated, and just remove all usage in substrate.
Tracking issue: #3326
The text was updated successfully, but these errors were encountered: