substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Deprecate individual hooks traits like `OnInitialize`

Open kianenigma opened this issue 2 years ago • 2 comments

because as far as I know, as as of FRAME v2, they are not really used in any meaningful way. I recall Gui mentioning this, and from myself scouting the code, I don't see a strong reason to have them either.

The only benefit of the current separation is that you could manually implement OnInitialize for your pallet, without using #[hooks], and not implement the other traits.

But, through the default #[hooks], a pallet will always implement all of the on_xxx functions anyways, so there is not much point in having these separate traits.

This would probably clean some of the trait bounds in frame-executive.

All in all, we should mark the OnInitialize, OnFinalize and anything else that's already in Hooks with #[deprecated], and stop using it in substrate. We should use Hooks instead.

kianenigma avatar Jul 27 '22 18:07 kianenigma

cc @wirednkod

kianenigma avatar Jul 30 '22 13:07 kianenigma

I'll take this issue. Thank you @kianenigma

wirednkod avatar Jul 30 '22 13:07 wirednkod

@wirednkod what's up?

kianenigma avatar Oct 03 '22 11:10 kianenigma