Closed ashWhiteHat closed 3 years ago
Looks like the old code used 0
as a default and your new code makes it an option. I believe this is related to whether you use OptionQuery
or ValueQuery
but I don't know much more about it.
Indeed, you can read more about it at https://crates.parity.io/frame_support/storage/types/trait.QueryKindTrait.html
I think you need to change the definition of the storage item.
#[pallet::storage]
#[pallet::getter(fn thing1)]
- pub type Thing1<T: Config> = StorageValue<_, u32>;
+ pub type Thing1<T: Config> = StorageValue<_, u32, ValueQuery>;
Something like that.
Thank you for the answer! It worked well. I created PR for this updating. https://github.com/substrate-developer-hub/recipes/pull/450 Thank you!
What I did
I updated the
sum-storage
pallet to FRAME v2. https://github.com/NoCtrlZ/recipes/blob/master/pallets/sum-storage/src/lib.rsError
The error occurred when I tried to run the test. https://github.com/NoCtrlZ/recipes/blob/master/pallets/sum-storage/src/tests.rs
Question
I have a question about
StorageValue
. DoesStorageValue
getter method return theNone
? It seems the function returnsQueryKind::Query
here.Thank you.