Skip to content

Commit

Permalink
fix phragmen migration
Browse files Browse the repository at this point in the history
  • Loading branch information
apopiak committed Jun 29, 2020
1 parent 36272c4 commit 50eb114
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,14 @@ impl<T: Trait> MigrateAccount<T::AccountId> for Module<T> {
decl_storage! {
trait Store for Module<T: Trait> as PhragmenElection {
pub VotesOf get(fn votes_of):
map hasher(opaque_blake2_256) T::AccountId => Vec<T::AccountId>;
map hasher(twox_64_concat) T::AccountId => Vec<T::AccountId>;
pub StakeOf get(fn stake_of):
map hasher(opaque_blake2_256) T::AccountId => BalanceOf<T>;
map hasher(twox_64_concat) T::AccountId => BalanceOf<T>;
}
}
}

// TODO: will not actually do any useful migration
// Note: only migrates the hasher, migration is completed in `migration.rs`
if deprecated::StakeOf::<T>::migrate_key_from_blake(a).is_some() {
deprecated::VotesOf::<T>::migrate_key_from_blake(a);
}
Expand Down
3 changes: 2 additions & 1 deletion frame/elections-phragmen/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ pub fn migrate<T: Trait>() {
{
if let Some(stake) = take_storage_item::<_, BalanceOf<T>, Twox64Concat>(b"PhragmenElection", b"StakeOf", &who) {
Voting::<T>::insert(who, (stake, votes));
sp_runtime::print("Phragmen: inserted Voting.");
}
sp_runtime::print("🕊️ Done Election Phragmen.");
}
sp_runtime::print("🕊️ Done Election Phragmen.");
}

0 comments on commit 50eb114

Please sign in to comment.