-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add ability for try runtime hooks to directly pass data #10824
Comments
I am interested in working on this. Where would you suggest would be a good place to start. |
I would start by modifying the trait functions signatures and docs here substrate/frame/support/src/traits/hooks.rs Lines 176 to 187 in 66ff3a5
and here substrate/frame/support/src/traits/hooks.rs Lines 263 to 274 in 66ff3a5
to roughly: fn pre_upgrade<O>() -> Result<O, &'static str> {}
fn post_upgrade<I>(_input: I) -> Result<(), &'static str> {} To prove to yourself it works, in the tests mod of Then you can go through pallets that have impls for Once that is done you will also need to create polkadot companion that updates the method signatures in polkadot. See here for instructions: https://github.com/paritytech/substrate/blob/master/docs/CONTRIBUTING.adoc#updating-polkadot-as-well |
Let me know if this sounds ok and you intend to start working on this so I can assign the issue to you. |
This sounds okay to me and I intend to start working on it. Thank you very much for the explanation, I have a clearer idea on what to do now. |
This is looking more complicated than I anticipated, I am considering dropping it. |
Hey @emostov, I'd like to give this one a go. |
@daanschutte Sounds good, let me know if you have any questions |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This one is turning out to be lot more complicated than I anticipated, and unfortunately I just don't have the time available at the moment to dedicate finding a solution. I'll keep following it since I'd really like to see the solution here but if someone else wants to pick it up in the meantime it may be resolved sooner. |
additionally, as @shawntabrizi pointed out in other mediums, we should assert that |
Here come the next challenger :) , I'm going to have a try. |
Currently, if a user of the hooks
fn pre_upgrade() -> Result<(), &'static str> {}
&fn post_upgrade() -> Result<(), &'static str> {}
wants to persist data between the two functions they must use runtime storage (see https://paritytech.github.io/substrate/master/frame_support/traits/trait.OnRuntimeUpgradeHelpersExt.html#method.get_temp_storage). This approach is suboptimal for users who may want to ensure that the storage root has not changed during the execution of either hook (ref: paritytech/polkadot#4772 (comment)).Instead, a user should be able to persist some information to help verify a migration has executed successfully without modifying the runtime state. A proposed approach is that the functions be modified to output and accept some data. For example the new hook signatures could something look like:
The text was updated successfully, but these errors were encountered: