Companion for sub/7040 (#1719)

* Companion for sub/7040

* Fix duplicate type.

* Fix syntax

* Sync with latest changes.

* Add weight info.

* Fix build

* Fix some tests

* Fix build again.

* fix migration amounts.

* new migration

* Builds fine with dummy weights.

* fix build

* Add correct weight files.

* Fix to latest version

* remove unneeded upgrade.

* Update to latest again.

* "Update Substrate"

Co-authored-by: parity-processbot <>
This commit is contained in:
Kian Paimani
2021-01-20 14:43:34 +00:00
committed by GitHub
parent 73af2d5816
commit 2c0982d75e
5 changed files with 249 additions and 232 deletions
+17 -8
View File
@@ -474,13 +474,17 @@ impl pallet_collective::Config<CouncilCollective> for Runtime {
parameter_types! {
pub const CandidacyBond: Balance = 1 * DOLLARS;
pub const VotingBond: Balance = 5 * CENTS;
/// Daily council elections.
// 1 storage item created, key size is 32 bytes, value size is 16+16.
pub const VotingBondBase: Balance = deposit(1, 64);
// additional data per vote is 32 bytes (account id).
pub const VotingBondFactor: Balance = deposit(0, 32);
/// Daily council elections
pub const TermDuration: BlockNumber = 24 * HOURS;
pub const DesiredMembers: u32 = 19;
pub const DesiredRunnersUp: u32 = 19;
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
}
// Make sure that there are no more than MaxMembers members elected via phragmen.
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
@@ -491,9 +495,9 @@ impl pallet_elections_phragmen::Config for Runtime {
type InitializeMembers = Council;
type CurrencyToVote = frame_support::traits::U128CurrencyToVote;
type CandidacyBond = CandidacyBond;
type VotingBond = VotingBond;
type VotingBondBase = VotingBondBase;
type VotingBondFactor = VotingBondFactor;
type LoserCandidate = Treasury;
type BadReport = Treasury;
type KickedMember = Treasury;
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
@@ -943,10 +947,15 @@ impl frame_support::traits::OnRuntimeUpgrade for UpgradeSessionKeys {
}
}
pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
pub struct PhragmenElectionDepositRuntimeUpgrade;
impl pallet_elections_phragmen::migrations_3_0_0::V2ToV3 for PhragmenElectionDepositRuntimeUpgrade {
type AccountId = AccountId;
type Balance = Balance;
type Module = ElectionsPhragmen;
}
impl frame_support::traits::OnRuntimeUpgrade for PhragmenElectionDepositRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
0
pallet_elections_phragmen::migrations_3_0_0::apply::<Self>(5 * CENTS, DOLLARS)
}
}
@@ -1052,7 +1061,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllModules,
UpgradeSessionKeys,
(UpgradeSessionKeys, PhragmenElectionDepositRuntimeUpgrade)
>;
/// The payload being signed in the transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;