diff --git a/frame/democracy/src/migration.rs b/frame/democracy/src/migration.rs index 0881faecca8e2..8e0d16a3c946f 100644 --- a/frame/democracy/src/migration.rs +++ b/frame/democracy/src/migration.rs @@ -9,7 +9,7 @@ mod deprecated { use sp_runtime::RuntimeDebug; use sp_std::convert::TryFrom; - use crate::{Trait, ReferendumIndex, Conviction, vote_threshold::VoteThreshold}; + use crate::{Trait, BalanceOf, PropIndex, ReferendumIndex, Conviction, vote_threshold::VoteThreshold}; #[derive(Copy, Clone, Eq, PartialEq, Default, RuntimeDebug)] pub struct Vote { @@ -67,6 +67,9 @@ mod deprecated { pub ReferendumInfoOf get(fn referendum_info): map hasher(twox_64_concat) ReferendumIndex => Option>; + + pub DepositOf get(fn deposit_of): + map hasher(opaque_blake2_256) PropIndex => Option<(BalanceOf, Vec)>; } } } @@ -100,7 +103,10 @@ pub fn migrate_hasher() -> Weight { } sp_runtime::print("Democracy: Hasher: PublicProps"); for (p, h, _) in PublicProps::::get().into_iter() { - DepositOf::::migrate_key_from_blake(p); + // based on [democracy weights PR](https://github.com/paritytech/substrate/pull/5828/) + if let Some((balance, accounts)) = deprecated::DepositOf::::take(p) { + DepositOf::::insert(p, (accounts, balance)); + } Preimages::::migrate_key_from_blake(h); } // TODO: figure out actual weight