-
Notifications
You must be signed in to change notification settings - Fork 772
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
[FRAME] Pallet hook for the first time a pallet is added to the runtime #2762
Comments
This should be exposed to the runtime. So, that you can implement custom pallet initialization there. Genesis as initializing a pallet on a running chain is a chain specific operation that should be controlled on the runtime level. |
maybe this conversation happened before, but why should there be an I think a much nicer UX is the following interface: impl Hooks for Pallet {
/// Called when the pallet is being initialized for the first time.
///
/// Is called for all pallets at genesis, and also post genesis if the pallet is added
/// To the runtime mid-flight.
fn on_pallet_initialize() { ... }
} From a programmer's point of view, I think this is much better than two separate APIs. @liamaharon in any case, if this is still mentor-able, it should better explain what needs to be done. |
I mean the idea was more that this is controllable from the runtime side. At least this was my request. Inside the pallet you don't really have the data to initialize the pallet and it would be a bad design to try to forward the data there somehow. |
@bkchr so I misunderstood that this should be a pallet hook, we want to instead allow specifying some logic outside of the pallet which will be executed just once when the pallet is first added? |
Hi @liamaharon , I am curious about this issue. Could it be possible that I work on it as a learning process - still new on substrate? |
We probably want both. Aka on the runtime level and on the pallet level. Point being that when you add a pallet to the runtime, you probably want to set some storage items etc. However, you can not do this inside the pallet because you somehow would need to pass the data to the pallet.
Generally yes, if you are interested. |
I very much am. :) I just wanted to be transparent on my current knowledge on the framework. Thank you, as soon as it's assigned to me, I'll work on it - and I may drop few questions here! |
Right @bkchr so the primary benefit is so that it allows being specified in an environment with What do you think of creating a new pallet trait like
However, it seems the solution would be very similar to a migration with this proposed |
@kianenigma @bkchr @liamaharon what's the status of this issue? Is it ready to get hands on? Or there's still something to be worked around the definition of the issue? |
on_genesis
allows us to specify code to run per-pallet on genesis, and #1297 runs some code when new pallets are added to the runtime, but there's currently no way to write custom logic to execute when a pallet is added to the runtime after genesis.Request from Basti.
The text was updated successfully, but these errors were encountered: