mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 16:21:02 +00:00
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:
@@ -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>;
|
||||
|
||||
@@ -43,74 +43,74 @@ use sp_std::marker::PhantomData;
|
||||
/// Weight functions for pallet_elections_phragmen.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightInfo<T> {
|
||||
fn vote(v: u32, ) -> Weight {
|
||||
(86_473_000 as Weight)
|
||||
// Standard Error: 9_000
|
||||
.saturating_add((199_000 as Weight).saturating_mul(v as Weight))
|
||||
fn vote_equal(v: u32, ) -> Weight {
|
||||
(54_923_000 as Weight)
|
||||
.saturating_add((324_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn vote_update(v: u32, ) -> Weight {
|
||||
(53_531_000 as Weight)
|
||||
// Standard Error: 8_000
|
||||
.saturating_add((126_000 as Weight).saturating_mul(v as Weight))
|
||||
fn vote_more(v: u32, ) -> Weight {
|
||||
(83_389_000 as Weight)
|
||||
.saturating_add((341_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn vote_less(v: u32, ) -> Weight {
|
||||
(78_865_000 as Weight)
|
||||
.saturating_add((343_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn remove_voter() -> Weight {
|
||||
(69_725_000 as Weight)
|
||||
(72_370_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((1_673_000 as Weight).saturating_mul(c as Weight))
|
||||
// Standard Error: 53_000
|
||||
.saturating_add((33_921_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_696_000 as Weight).saturating_mul(c as Weight))
|
||||
// Standard Error: 12_000
|
||||
.saturating_add((33_906_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(6 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn submit_candidacy(c: u32, ) -> Weight {
|
||||
(70_603_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((276_000 as Weight).saturating_mul(c as Weight))
|
||||
(68_455_000 as Weight)
|
||||
.saturating_add((370_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn renounce_candidacy_candidate(c: u32, ) -> Weight {
|
||||
(42_985_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((140_000 as Weight).saturating_mul(c as Weight))
|
||||
(54_009_000 as Weight)
|
||||
.saturating_add((200_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn renounce_candidacy_members() -> Weight {
|
||||
(76_320_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
(84_797_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn renounce_candidacy_runners_up() -> Weight {
|
||||
(46_198_000 as Weight)
|
||||
(59_095_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn remove_member_with_replacement() -> Weight {
|
||||
(115_357_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
(132_820_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
fn remove_member_wrong_refund() -> Weight {
|
||||
(8_869_000 as Weight)
|
||||
(8_551_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((151_754_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
|
||||
}
|
||||
fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((134_602_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add((111_037_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((7_150_000 as Weight).saturating_mul(e as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user