This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Used CountedStorageMap in pallet-staking #10233
Used CountedStorageMap in pallet-staking #10233
Changes from 22 commits
662fffe
48a4825
da2d7ec
31f7bd7
a8c2f16
01a605d
2c192d8
c2f7577
b332858
d771e4a
e449fe5
65d7d02
b9d0a88
9b21bef
d79d380
16d6a44
190ec8e
41f8dae
3a0500f
fac8882
bf1bc0a
36115cb
de685ff
d07414f
256ac95
fa56998
a437c17
b7e8047
da0f59f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This is technically making this migration code WRONG. Either remove it completely, or make sure it is correct.
we don't enforce this now, but a correct way would be to make sure this migration code stays correct over time. That is, it should have its own storage items and not depend on the pallet types. In this case, you need to create (mock) storage types via
generate_storage_alias
and use them to set a correct value for the counters.Or, we need some special
set_counter
to set the counters upon migration, but I don't think we have this for now.If all of this is too much, with despair and sadness, I am also fine with just removing the migration code altogether. But the long term correct thing to do is as I said above.
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.
Could you help with the correct implementation details on how to write the migration code, I am still new to the Substrate repo.
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.
you can look into other use cases of
generate_storage_alias
and its documentation. This allows you to generate a storage value type that mimics the one that is being removed. In this case, you can create aand now you have
CounterForValidators
back in scope, and you can use it.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.
is staking pallet using the pallet macro in v7 ?
If so then the generate_storage_value can use a wrong pallet prefix.
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.
Is this question for me or @kianenigma
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.
yeah it was already migrated. Then the very pedantic course of action would be to accept the prefix as the argument of the migration function, but I will be fine with skipping it since the migration code is already at risk to becoming outdated (since it depends on
T: Config
). So the assumption is that whoever uses this migration code should test it, and we're good.