-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
// Remove the old `StorageVersion` type. | ||
frame_support::storage::unhashed::kill(&frame_support::storage::storage_prefix( | ||
Pallet::<T, I>::name().as_bytes(), | ||
"StorageVersion".as_bytes(), | ||
)); |
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.
// Remove the old `StorageVersion` type. | |
frame_support::storage::unhashed::kill(&frame_support::storage::storage_prefix( | |
Pallet::<T, I>::name().as_bytes(), | |
"StorageVersion".as_bytes(), | |
)); |
Should have a proper storage version now since it is at version 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.
This is also wrong. The key is not StorageVersion
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 was old code. AFAIK it should do no harm.
Inactive::<T, I>::put(&pot); | ||
T::Currency::reactivate(deactivated); | ||
T::Currency::deactivate(pot); | ||
Deactivated::<T, I>::put(&pot); |
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.
Also kill the Inactive
here as cleanup?
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.
I'm actually unsure what the implications are for changing the logic here. Is it simply just reverting code?
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.
Its undoing and fixing the fund-deactivation since it was faultily implemented the first time.
IIUC on the next run the Deactivated
will be zero, so the whole pot will be deactivate
d, which is fine since the foregoing balances migration will reset all deactivated funds.
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.
Also kill the
Inactive
here as cleanup?
Let's delete it in a migration so that it happens once, not in on_init
.
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.
since it was faultily implemented the first time.
What's the case case where the old logic was wrong?
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.
Incorrect logic was in crowdloan where a datatype was being misused. See paritytech/polkadot#6471
InactiveIssuance::<T, I>::kill(); | ||
|
||
// Set storage version to `0`. | ||
StorageVersion::new(0).put::<Pallet<T, I>>(); |
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.
@ggwpez If we're at version 1 now, then it doesn't quite make sense to regress and go back to version 0? Or are we really treating this all as a revert?
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.
It is a trick so that the MigrateToTrackInactive
v0 -> v1
migration can run again.
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.
Can we not just write a proper migration for this? And introduce storage Version 2?
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.
0 is defined as "not tracking InactiveIssuance
", 1 is defined as "tracking InactiveIssuance
". In Polkadot/Kusama mainnet (which are already at version 1), we are migrating back to 0 and thus no longer tracking InactiveIssuance
, and then migrating back to 1 (and thus tracking it, this time correctly). There are no new alterations to storage formats or indeed state transition semantics, and thus it makes no sense to introduce new StorageVersion
s which would in all manner be exactly equivalent to the existing StorageVersion
s. The only thing we are doing is mending state.
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, from the PoV of Polkadot/Kusama this makes sense. However, we should write these migrations in a generic way so that other downstream users (e.g. parachain teams) can use them as well.
There could at least have been some docs on what this migration does and that it should be executed before the other migration.
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.
Left a little questions, but looks good!
* Improve inactive fund tracking * Resetting migration * Fix * Update frame/balances/src/migration.rs
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-37/1736/1 |
* Improve inactive fund tracking * Resetting migration * Fix * Update frame/balances/src/migration.rs
* Improve inactive fund tracking * Resetting migration * Fix * Update frame/balances/src/migration.rs
TODO