-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Improve post and pre migration checks for pallet-membership #9746
Conversation
| ); | ||
|
|
||
| // Ensure nothing except the storage_version_key is stored in the new prefix. | ||
| assert!(new_pallet_prefix_iter.all(|key| key == storage_version_key)); |
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.
in the past we only ensured that the first key was sotrage_version_key, now we ensure it is the only one.
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.
tiny nit, but this doesn't check length and at this point we only expect one key under the new prefix, right? Would it be more accurate to do:
assert!(new_pallet_prefix_iter.next(), Some(storage_version_key));
assert!(new_pallet_prefix_iter.next(), None);
?
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.
yes it is true, but I was thinking if they change the name, maybe it is ok not to have anything stored at the new prefix.
| old_pallet_prefix.to_vec(), | ||
| |_| Ok(()), | ||
| ); | ||
| assert_eq!(old_pallet_prefix_iter.count(), 0); |
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 the past we only checked for the first key at the old prefix, and we accepted that it was the storage_version_key, now we ensure nothing remains there.
|
bot merge |
|
Waiting for commit status. |
|
Merge aborted: Checks failed for bbb6039 |
…ship-post-migration
|
bot merge |
|
Error: Github API says #9746 is not mergeable |
|
bot merge |
|
Waiting for commit status. |
…ship-post-migration
|
bot merge |
|
Waiting for commit status. |
some of the assertion weren't checking much, this is an improved version