-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
/// # Note on Hooks Order | ||
/// | ||
/// Pallet [`Hooks`] (e.g. `on_initialize`) are currently executed in *reverse* declaration order | ||
/// (see https://github.com/paritytech/substrate/issues/6280). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be more precise we should also say that frame_system is executed first, no matter its position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm thinking again I don't know where we should write about the frame_system stuff, it is about frame-executive implementation. Maybe it worth mentioning here anyway ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should finally fix this? WDYT @thiolliere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So on_initialize
should be executed in declaration order, while for on_finalize
I would actually expect reverse
declaration order, right?. Basically mimicing PL constructor / destructor semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't such an order make sense in order to allow one pallet to depend on another pallet, including potential state changes? If not, why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I opened the fix #10043
about on_finalize in reverse order I don't know, I feel like we currently never had the need, and also that if such needs emerge then we should probably introduce a more fine-grained configuration of order of hooks.
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Given that the main fix PR is already open and has 1 approve, we can skip this. Reopne if you think otherwise @apopiak |
Though we'll need to document the change. |
Clarify
Hooks
execution order.