-
Notifications
You must be signed in to change notification settings - Fork 769
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
pallet-example-basic
: Missing Hooks
#6701
base: master
Are you sure you want to change the base?
pallet-example-basic
: Missing Hooks
#6701
Conversation
User @rainbow-promise, please sign the CLA here. |
Hello @ggwpez A few questions:
|
#[pallet::storage] | ||
pub(super) type Dummy<T: Config> = StorageValue<_, T::Balance>; |
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.
Instead of deleting them, please do something interesting with it as an example.
As this is an example pallet: it should showcase some sensible things that can be done with storage items etc. And it should document these things so that a beginner can understand it.
} | ||
|
||
fn on_poll(_n: BlockNumberFor<T>, _weight: &mut WeightMeter) { | ||
unimplemented!() |
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 it isn't so good to have unimplemented
here and also other places.
If user wants to experiment and modify the function and execute some tests then it will trigger everywhere.
If think it is better to just have an inner comment //
} | ||
} | ||
*/ |
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.
why removed? it is a good example.
@@ -169,7 +173,7 @@ fn counted_map_works() { | |||
assert_eq!(CountedMap::<Test>::count(), 1); | |||
}) | |||
} | |||
|
|||
*/ |
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 remove it completely or keep it.
Resolves #6398
Proposed Implementation
pre_upgrade
: Retrieve and assert the on-chain storage version, returning an emptyVec
.on_runtime_upgrade
: Clear all storage items and raise the on-chainStorageVersion
to 1.post_upgrade
: Assert the new on-chain storage version.Notes
The
try-state
hook validates invariants in the storage items, as the pallet contains trivial logic this will be leftunimplemented()