-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Migration for over locked accounts in phgragmen elections #10649
Migration for over locked accounts in phgragmen elections #10649
Conversation
pub fn migrate<T: Config>() -> Weight { | ||
let mut weight = 0; | ||
|
||
for (who, mut voter) in Voting::<T>::iter() { |
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 also use ::translate
.
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.
From my understanding translate would be overkill here since it would re-write every map entry, while in this case we only want to write storage entries that were in an invalid state. Additionally it seems non-idiomatic since it looks like it targets use cases where the stored type is being changed
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 think for the purposes of fixing this on our networks, it would be better to write a custom list of affected accounts, and directly address those versus iterating through all possible voters, as that kind of iteration migration is not really great for parachains or other runtimes where there is limited execution time.
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.
and for that, we should wait until the original patch is live, then we will know a final list of affected users.
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
…hub.com/paritytech/substrate into zeke-shawntabrizi-phragmen-free-balance
|
bot merge |
@emostov what is the plan here? I thought we are not going to merge this? |
@kianenigma we merged this, but are waiting to apply it on polkadot/kusama until the fix is enacted. I'll reopen this once ready paritytech/polkadot#4710 |
Ah I see this made its way into the polkadot release notes - will try and take it out |
…#10649) * use free balance rather than total balance * Docs * Migration for over-locked phrag voters * New line * comment * Update frame/elections-phragmen/src/migrations/v5.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Only set lock, don't remove it * delete commented out * docs * Update migration to just take a set of accounts Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
…#10649) * use free balance rather than total balance * Docs * Migration for over-locked phrag voters * New line * comment * Update frame/elections-phragmen/src/migrations/v5.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Only set lock, don't remove it * delete commented out * docs * Update migration to just take a set of accounts Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This PR adds a migration that will fix any accounts affected by the bug addressed in #10646