-
Notifications
You must be signed in to change notification settings - Fork 13
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
on_runtime_upgrade
is not working
#154
Comments
@shawntabrizi I have removed logger and added the actual migration script. After doing runtime upgrade, I am getting
When I try to hit |
Hey @ayushmishra2005 About the logging, you can add this line Is clear that your migration is running at least, as the result is some corrupted state, I am having a look at your migration and translate logic for the moment |
@al3mart Thanks for looking into it. I just want to tell you one more thing I haven't made any change in runtime. I just added above code in my pallet. I only changed spec_version in runtime. |
@al3mart Adding |
the migration code looks wrong to me: fn on_runtime_upgrade() -> frame_support::weights::Weight {
ProductInformation::<T>::translate::<Option<OldProduct>, _>(|_, p| Some(
p.map( |product| product.upgraded()).unwrap()
));
T::MaximumBlockWeight::get()
} It should be < ProductInformation::<T>::translate::<Option<OldProduct>, _>(|_, p| Some(
---
> ProductInformation::<T>::translate::<OldProduct, _>(|_, p| Some( If the translate fail to decode a value then it doesn't remove the original value. I think your issue is about not being able to show the log, the on_runtime_upgrade should should be executed. To be sure you could just write a value in another storage somewhere and see if the value is written. |
It worked @thiolliere . Great thanks. |
I am experimenting with storage migration. I have a
struct
I am able to run node using
RUST_LOG=runtime=debug ./node-template --dev -lexample=debug
successfully, store and get data using the below method:Now I want to add a new optional field
details
inProduct
and want to putNone
in exiting data.I added new field and a method
on_runtime_upgrade
indecl_module!
after following @shawntabrizi 's pull request paritytech/substrate#5058I wanted to check whether this method
on_runtime_upgrade
is getting executed on runtime upgrade or not.I changed runtime
spec_version
and followed forkless_upgrade. But I am not getting the above log after forkless runtime upgrade.Please let me know what I am missing. Please help me to fix this.
The text was updated successfully, but these errors were encountered: