diff --git a/Cargo.lock b/Cargo.lock
index 3bb5a38a9429..758835d455ed 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3224,6 +3224,7 @@ dependencies = [
"pallet-bounties",
"pallet-child-bounties",
"pallet-collective",
+ "pallet-conviction-voting",
"pallet-democracy",
"pallet-election-provider-multi-phase",
"pallet-election-provider-support-benchmarking",
@@ -3243,7 +3244,9 @@ dependencies = [
"pallet-offences-benchmarking",
"pallet-preimage",
"pallet-proxy",
+ "pallet-ranked-collective",
"pallet-recovery",
+ "pallet-referenda",
"pallet-scheduler",
"pallet-session",
"pallet-session-benchmarking",
@@ -3257,6 +3260,7 @@ dependencies = [
"pallet-treasury",
"pallet-utility",
"pallet-vesting",
+ "pallet-whitelist",
"pallet-xcm",
"pallet-xcm-benchmarks",
"parity-scale-codec",
@@ -5045,6 +5049,23 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-conviction-voting"
+version = "4.0.0-dev"
+source = "git+https://github.com/paritytech/substrate?branch=master#dbb72f3fd98253b72c0090375b738b9d00995090"
+dependencies = [
+ "assert_matches",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-democracy"
version = "4.0.0-dev"
@@ -5411,6 +5432,24 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-ranked-collective"
+version = "4.0.0-dev"
+source = "git+https://github.com/paritytech/substrate?branch=master#dbb72f3fd98253b72c0090375b738b9d00995090"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "log",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-arithmetic",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-recovery"
version = "4.0.0-dev"
@@ -5426,6 +5465,24 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-referenda"
+version = "4.0.0-dev"
+source = "git+https://github.com/paritytech/substrate?branch=master#dbb72f3fd98253b72c0090375b738b9d00995090"
+dependencies = [
+ "assert_matches",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-arithmetic",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-scheduler"
version = "4.0.0-dev"
@@ -5677,6 +5734,21 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-whitelist"
+version = "4.0.0-dev"
+source = "git+https://github.com/paritytech/substrate?branch=master#dbb72f3fd98253b72c0090375b738b9d00995090"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-api",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-xcm"
version = "0.9.29"
diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml
index 9eddf926cde0..ee9d859b84b3 100644
--- a/runtime/kusama/Cargo.toml
+++ b/runtime/kusama/Cargo.toml
@@ -47,6 +47,7 @@ pallet-transaction-payment = { git = "https://github.com/paritytech/substrate",
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+pallet-conviction-voting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -63,7 +64,9 @@ pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", bra
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+pallet-ranked-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+pallet-referenda = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -77,6 +80,7 @@ pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "maste
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
+pallet-whitelist = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true }
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -142,6 +146,7 @@ std = [
"pallet-transaction-payment/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-collective/std",
+ "pallet-conviction-voting/std",
"pallet-elections-phragmen/std",
"pallet-election-provider-multi-phase/std",
"pallet-fast-unstake/std",
@@ -158,7 +163,9 @@ std = [
"pallet-offences/std",
"pallet-preimage/std",
"pallet-proxy/std",
+ "pallet-ranked-collective/std",
"pallet-recovery/std",
+ "pallet-referenda/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-society/std",
@@ -169,6 +176,7 @@ std = [
"pallet-treasury/std",
"pallet-utility/std",
"pallet-vesting/std",
+ "pallet-whitelist/std",
"pallet-babe/std",
"pallet-xcm/std",
"sp-mmr-primitives/std",
@@ -204,6 +212,7 @@ runtime-benchmarks = [
"pallet-bounties/runtime-benchmarks",
"pallet-child-bounties/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
+ "pallet-conviction-voting/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-elections-phragmen/runtime-benchmarks",
"pallet-election-provider-multi-phase/runtime-benchmarks",
@@ -220,6 +229,8 @@ runtime-benchmarks = [
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
+ "pallet-ranked-collective/runtime-benchmarks",
+ "pallet-referenda/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-society/runtime-benchmarks",
"pallet-recovery/runtime-benchmarks",
@@ -231,6 +242,7 @@ runtime-benchmarks = [
"pallet-vesting/runtime-benchmarks",
"pallet-offences-benchmarking/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
+ "pallet-whitelist/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"hex-literal",
@@ -252,6 +264,7 @@ try-runtime = [
"pallet-child-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-collective/try-runtime",
+ "pallet-conviction-voting/try-runtime",
"pallet-elections-phragmen/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-fast-unstake/try-runtime",
@@ -267,7 +280,9 @@ try-runtime = [
"pallet-offences/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
+ "pallet-ranked-collective/try-runtime",
"pallet-recovery/try-runtime",
+ "pallet-referenda/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-society/try-runtime",
@@ -277,6 +292,7 @@ try-runtime = [
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-vesting/try-runtime",
+ "pallet-whitelist/try-runtime",
"pallet-babe/try-runtime",
"pallet-xcm/try-runtime",
"runtime-common/try-runtime",
diff --git a/runtime/kusama/constants/src/lib.rs b/runtime/kusama/constants/src/lib.rs
index 719f42c235c2..a8d047241b24 100644
--- a/runtime/kusama/constants/src/lib.rs
+++ b/runtime/kusama/constants/src/lib.rs
@@ -27,7 +27,8 @@ pub mod currency {
pub const UNITS: Balance = 1_000_000_000_000;
pub const CENTS: Balance = UNITS / 30_000;
- pub const GRAND: Balance = CENTS * 100_000;
+ pub const QUID: Balance = CENTS * 100;
+ pub const GRAND: Balance = QUID * 1_000;
pub const MILLICENTS: Balance = CENTS / 1_000;
pub const fn deposit(items: u32, bytes: u32) -> Balance {
diff --git a/runtime/kusama/src/governance/fellowship.rs b/runtime/kusama/src/governance/fellowship.rs
new file mode 100644
index 000000000000..66e2f6ee6d58
--- /dev/null
+++ b/runtime/kusama/src/governance/fellowship.rs
@@ -0,0 +1,368 @@
+// Copyright 2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Elements of governance concerning the Polkadot Fellowship. This is only a temporary arrangement
+//! since the Polkadot Fellowship belongs under the Polkadot Relay. However, that is not yet in
+//! place, so until then it will need to live here. Once it is in place and there exists a bridge
+//! between Polkadot/Kusama then this code can be removed.
+
+use frame_support::traits::{MapSuccess, TryMapSuccess};
+use sp_arithmetic::traits::CheckedSub;
+use sp_runtime::{
+ morph_types,
+ traits::{ConstU16, Replace, TypedGet},
+};
+
+use super::*;
+use crate::{DAYS, QUID};
+
+parameter_types! {
+ pub const AlarmInterval: BlockNumber = 1;
+ pub const SubmissionDeposit: Balance = 0;
+ pub const UndecidingTimeout: BlockNumber = 7 * DAYS;
+}
+
+pub struct TracksInfo;
+impl pallet_referenda::TracksInfo for TracksInfo {
+ type Id = u16;
+ type RuntimeOrigin = ::PalletsOrigin;
+ fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] {
+ static DATA: [(u16, pallet_referenda::TrackInfo); 10] = [
+ (
+ 0u16,
+ pallet_referenda::TrackInfo {
+ name: "candidates",
+ max_deciding: 10,
+ decision_deposit: 100 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 1u16,
+ pallet_referenda::TrackInfo {
+ name: "members",
+ max_deciding: 10,
+ decision_deposit: 10 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 2u16,
+ pallet_referenda::TrackInfo {
+ name: "proficients",
+ max_deciding: 10,
+ decision_deposit: 10 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 3u16,
+ pallet_referenda::TrackInfo {
+ name: "fellows",
+ max_deciding: 10,
+ decision_deposit: 10 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 1 * MINUTES,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 4u16,
+ pallet_referenda::TrackInfo {
+ name: "senior fellows",
+ max_deciding: 10,
+ decision_deposit: 10 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 5u16,
+ pallet_referenda::TrackInfo {
+ name: "experts",
+ max_deciding: 10,
+ decision_deposit: 1 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 6u16,
+ pallet_referenda::TrackInfo {
+ name: "senior experts",
+ max_deciding: 10,
+ decision_deposit: 1 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 7u16,
+ pallet_referenda::TrackInfo {
+ name: "masters",
+ max_deciding: 10,
+ decision_deposit: 1 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 8u16,
+ pallet_referenda::TrackInfo {
+ name: "senior masters",
+ max_deciding: 10,
+ decision_deposit: 1 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ 9u16,
+ pallet_referenda::TrackInfo {
+ name: "grand masters",
+ max_deciding: 10,
+ decision_deposit: 1 * QUID,
+ prepare_period: 30 * MINUTES,
+ decision_period: 7 * DAYS,
+ confirm_period: 30 * MINUTES,
+ min_enactment_period: 4,
+ min_approval: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(50),
+ ceil: Perbill::from_percent(100),
+ },
+ min_support: pallet_referenda::Curve::LinearDecreasing {
+ length: Perbill::from_percent(100),
+ floor: Perbill::from_percent(0),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ ];
+ &DATA[..]
+ }
+ fn track_for(id: &Self::RuntimeOrigin) -> Result {
+ use super::origins::Origin;
+
+ #[cfg(feature = "runtime-benchmarks")]
+ {
+ // For benchmarks, we enable a root origin.
+ // It is important that this is not available in production!
+ let root: Self::RuntimeOrigin = frame_system::RawOrigin::Root.into();
+ if &root == id {
+ return Ok(9)
+ }
+ }
+
+ match Origin::try_from(id.clone()) {
+ Ok(Origin::FellowshipInitiates) => Ok(0),
+ Ok(Origin::Fellowship1Dan) => Ok(1),
+ Ok(Origin::Fellowship2Dan) => Ok(2),
+ Ok(Origin::Fellowship3Dan) | Ok(Origin::Fellows) => Ok(3),
+ Ok(Origin::Fellowship4Dan) => Ok(4),
+ Ok(Origin::Fellowship5Dan) | Ok(Origin::FellowshipExperts) => Ok(5),
+ Ok(Origin::Fellowship6Dan) => Ok(6),
+ Ok(Origin::Fellowship7Dan | Origin::FellowshipMasters) => Ok(7),
+ Ok(Origin::Fellowship8Dan) => Ok(8),
+ Ok(Origin::Fellowship9Dan) => Ok(9),
+ _ => Err(()),
+ }
+ }
+}
+pallet_referenda::impl_tracksinfo_get!(TracksInfo, Balance, BlockNumber);
+
+pub type FellowshipReferendaInstance = pallet_referenda::Instance2;
+
+impl pallet_referenda::Config for Runtime {
+ type WeightInfo = weights::pallet_referenda_fellowship_referenda::WeightInfo;
+ type RuntimeCall = RuntimeCall;
+ type RuntimeEvent = RuntimeEvent;
+ type Scheduler = Scheduler;
+ type Currency = Balances;
+ type SubmitOrigin =
+ pallet_ranked_collective::EnsureMember;
+ type CancelOrigin = FellowshipExperts;
+ type KillOrigin = FellowshipMasters;
+ type Slash = Treasury;
+ type Votes = pallet_ranked_collective::Votes;
+ type Tally = pallet_ranked_collective::TallyOf;
+ type SubmissionDeposit = SubmissionDeposit;
+ type MaxQueued = ConstU32<100>;
+ type UndecidingTimeout = UndecidingTimeout;
+ type AlarmInterval = AlarmInterval;
+ type Tracks = TracksInfo;
+}
+
+pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1;
+
+morph_types! {
+ /// A `TryMorph` implementation to reduce a scalar by a particular amount, checking for
+ /// underflow.
+ pub type CheckedReduceBy: TryMorph = |r: N::Type| -> Result {
+ r.checked_sub(&N::get()).ok_or(())
+ } where N::Type: CheckedSub;
+}
+
+impl pallet_ranked_collective::Config for Runtime {
+ type WeightInfo = weights::pallet_ranked_collective::WeightInfo;
+ type RuntimeEvent = RuntimeEvent;
+ // Promotion is by any of:
+ // - Root can demote arbitrarily.
+ // - the FellowshipAdmin origin (i.e. token holder referendum);
+ // - a vote by the rank *above* the new rank.
+ type PromoteOrigin = EitherOf<
+ EitherOf<
+ frame_system::EnsureRootWithSuccess>,
+ MapSuccess<
+ pallet_collective::EnsureProportionAtLeast<
+ Self::AccountId,
+ super::old::TechnicalCollective,
+ 2,
+ 3,
+ >,
+ Replace>,
+ >,
+ >,
+ EitherOf<
+ MapSuccess>>,
+ TryMapSuccess>>,
+ >,
+ >;
+ // Demotion is by any of:
+ // - Root can demote arbitrarily.
+ // - the FellowshipAdmin origin (i.e. token holder referendum);
+ // - a vote by the rank two above the current rank.
+ type DemoteOrigin = EitherOf<
+ frame_system::EnsureRootWithSuccess>,
+ EitherOf<
+ MapSuccess>>,
+ TryMapSuccess>>,
+ >,
+ >;
+ type Polls = FellowshipReferenda;
+ type MinRankOfClass = sp_runtime::traits::Identity;
+ type VoteWeight = pallet_ranked_collective::Geometric;
+}
diff --git a/runtime/kusama/src/governance/mod.rs b/runtime/kusama/src/governance/mod.rs
index 27aa07a4795b..4dbf375f67f0 100644
--- a/runtime/kusama/src/governance/mod.rs
+++ b/runtime/kusama/src/governance/mod.rs
@@ -14,7 +14,81 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see .
-//! Governance configurations for the Kusama runtime.
+//! New governance configurations for the Kusama runtime.
+
+use super::*;
+use frame_support::{
+ parameter_types,
+ traits::{ConstU16, EitherOf},
+};
+use frame_system::EnsureRootWithSuccess;
// Old governance configurations.
pub mod old;
+
+mod origins;
+pub use origins::{
+ pallet_custom_origins, AuctionAdmin, Fellows, FellowshipAdmin, FellowshipExperts,
+ FellowshipInitiates, FellowshipMasters, GeneralAdmin, LeaseAdmin, ReferendumCanceller,
+ ReferendumKiller, Spender, StakingAdmin, WhitelistedCaller,
+};
+mod tracks;
+pub use tracks::TracksInfo;
+mod fellowship;
+pub use fellowship::{FellowshipCollectiveInstance, FellowshipReferendaInstance};
+
+parameter_types! {
+ pub const VoteLockingPeriod: BlockNumber = 7 * DAYS;
+}
+
+impl pallet_conviction_voting::Config for Runtime {
+ type WeightInfo = weights::pallet_conviction_voting::WeightInfo;
+ type RuntimeEvent = RuntimeEvent;
+ type Currency = Balances;
+ type VoteLockingPeriod = VoteLockingPeriod;
+ type MaxVotes = ConstU32<512>;
+ type MaxTurnout = frame_support::traits::TotalIssuanceOf;
+ type Polls = Referenda;
+}
+
+parameter_types! {
+ pub const AlarmInterval: BlockNumber = 1;
+ pub const SubmissionDeposit: Balance = 100 * UNITS;
+ pub const UndecidingTimeout: BlockNumber = 28 * DAYS;
+}
+
+parameter_types! {
+ pub const MaxBalance: Balance = Balance::max_value();
+}
+pub type TreasurySpender = EitherOf, Spender>;
+
+impl origins::pallet_custom_origins::Config for Runtime {}
+
+impl pallet_whitelist::Config for Runtime {
+ type WeightInfo = weights::pallet_whitelist::WeightInfo;
+ type RuntimeCall = RuntimeCall;
+ type RuntimeEvent = RuntimeEvent;
+ type WhitelistOrigin =
+ EitherOf>, Fellows>;
+ type DispatchWhitelistedOrigin = EitherOf, WhitelistedCaller>;
+ type PreimageProvider = Preimage;
+}
+
+impl pallet_referenda::Config for Runtime {
+ type WeightInfo = weights::pallet_referenda_referenda::WeightInfo;
+ type RuntimeCall = RuntimeCall;
+ type RuntimeEvent = RuntimeEvent;
+ type Scheduler = Scheduler;
+ type Currency = Balances;
+ type SubmitOrigin = frame_system::EnsureSigned;
+ type CancelOrigin = ReferendumCanceller;
+ type KillOrigin = ReferendumKiller;
+ type Slash = Treasury;
+ type Votes = pallet_conviction_voting::VotesOf;
+ type Tally = pallet_conviction_voting::TallyOf;
+ type SubmissionDeposit = SubmissionDeposit;
+ type MaxQueued = ConstU32<100>;
+ type UndecidingTimeout = UndecidingTimeout;
+ type AlarmInterval = AlarmInterval;
+ type Tracks = TracksInfo;
+}
diff --git a/runtime/kusama/src/governance/old.rs b/runtime/kusama/src/governance/old.rs
index 371b88dcd443..c16ca5eddd7a 100644
--- a/runtime/kusama/src/governance/old.rs
+++ b/runtime/kusama/src/governance/old.rs
@@ -160,11 +160,11 @@ impl pallet_collective::Config for Runtime {
impl pallet_membership::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
- type AddOrigin = MoreThanHalfCouncil;
- type RemoveOrigin = MoreThanHalfCouncil;
- type SwapOrigin = MoreThanHalfCouncil;
- type ResetOrigin = MoreThanHalfCouncil;
- type PrimeOrigin = MoreThanHalfCouncil;
+ type AddOrigin = EnsureRoot;
+ type RemoveOrigin = EnsureRoot;
+ type SwapOrigin = EnsureRoot;
+ type ResetOrigin = EnsureRoot;
+ type PrimeOrigin = EnsureRoot;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = TechnicalMaxMembers;
diff --git a/runtime/kusama/src/governance/origins.rs b/runtime/kusama/src/governance/origins.rs
new file mode 100644
index 000000000000..be8c44430f46
--- /dev/null
+++ b/runtime/kusama/src/governance/origins.rs
@@ -0,0 +1,192 @@
+// Copyright 2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Custom origins for governance interventions.
+
+pub use pallet_custom_origins::*;
+
+#[frame_support::pallet]
+pub mod pallet_custom_origins {
+ use crate::{Balance, GRAND, QUID};
+ use frame_support::pallet_prelude::*;
+
+ #[pallet::config]
+ pub trait Config: frame_system::Config {}
+
+ #[pallet::pallet]
+ pub struct Pallet(_);
+
+ #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)]
+ #[pallet::origin]
+ pub enum Origin {
+ /// Origin for cancelling slashes.
+ StakingAdmin,
+ /// Origin for spending (any amount of) funds.
+ Treasurer,
+ /// Origin for managing the composition of the fellowship.
+ FellowshipAdmin,
+ /// Origin for managing the registrar.
+ GeneralAdmin,
+ /// Origin for starting auctions.
+ AuctionAdmin,
+ /// Origin able to force slot leases.
+ LeaseAdmin,
+ /// Origin able to cancel referenda.
+ ReferendumCanceller,
+ /// Origin able to kill referenda.
+ ReferendumKiller,
+ /// Origin able to spend up to 1 KSM from the treasury at once.
+ SmallTipper,
+ /// Origin able to spend up to 5 KSM from the treasury at once.
+ BigTipper,
+ /// Origin able to spend up to 50 KSM from the treasury at once.
+ SmallSpender,
+ /// Origin able to spend up to 500 KSM from the treasury at once.
+ MediumSpender,
+ /// Origin able to spend up to 5,000 KSM from the treasury at once.
+ BigSpender,
+ /// Origin able to dispatch a whitelisted call.
+ WhitelistedCaller,
+ /// Origin commanded by any members of the Polkadot Fellowship (no Dan grade needed).
+ FellowshipInitiates,
+ /// Origin commanded by Polkadot Fellows (3rd Dan fellows or greater).
+ Fellows,
+ /// Origin commanded by Polkadot Experts (5th Dan fellows or greater).
+ FellowshipExperts,
+ /// Origin commanded by Polkadot Masters (7th Dan fellows of greater).
+ FellowshipMasters,
+ /// Origin commanded by rank 1 of the Polkadot Fellowship and with a success of 1.
+ Fellowship1Dan,
+ /// Origin commanded by rank 2 of the Polkadot Fellowship and with a success of 2.
+ Fellowship2Dan,
+ /// Origin commanded by rank 3 of the Polkadot Fellowship and with a success of 3.
+ Fellowship3Dan,
+ /// Origin commanded by rank 4 of the Polkadot Fellowship and with a success of 4.
+ Fellowship4Dan,
+ /// Origin commanded by rank 5 of the Polkadot Fellowship and with a success of 5.
+ Fellowship5Dan,
+ /// Origin commanded by rank 6 of the Polkadot Fellowship and with a success of 6.
+ Fellowship6Dan,
+ /// Origin commanded by rank 7 of the Polkadot Fellowship and with a success of 7.
+ Fellowship7Dan,
+ /// Origin commanded by rank 8 of the Polkadot Fellowship and with a success of 8.
+ Fellowship8Dan,
+ /// Origin commanded by rank 9 of the Polkadot Fellowship and with a success of 9.
+ Fellowship9Dan,
+ }
+
+ macro_rules! decl_unit_ensures {
+ ( $name:ident: $success_type:ty = $success:expr ) => {
+ pub struct $name;
+ impl> + From>
+ EnsureOrigin for $name
+ {
+ type Success = $success_type;
+ fn try_origin(o: O) -> Result {
+ o.into().and_then(|o| match o {
+ Origin::$name => Ok($success),
+ r => Err(O::from(r)),
+ })
+ }
+ #[cfg(feature = "runtime-benchmarks")]
+ fn try_successful_origin() -> Result {
+ Ok(O::from(Origin::$name))
+ }
+ }
+ };
+ ( $name:ident ) => { decl_unit_ensures! { $name : () = () } };
+ ( $name:ident: $success_type:ty = $success:expr, $( $rest:tt )* ) => {
+ decl_unit_ensures! { $name: $success_type = $success }
+ decl_unit_ensures! { $( $rest )* }
+ };
+ ( $name:ident, $( $rest:tt )* ) => {
+ decl_unit_ensures! { $name }
+ decl_unit_ensures! { $( $rest )* }
+ };
+ () => {}
+ }
+ decl_unit_ensures!(
+ StakingAdmin,
+ FellowshipAdmin,
+ GeneralAdmin,
+ AuctionAdmin,
+ LeaseAdmin,
+ ReferendumCanceller,
+ ReferendumKiller,
+ WhitelistedCaller,
+ FellowshipInitiates: u16 = 0,
+ Fellows: u16 = 3,
+ FellowshipExperts: u16 = 5,
+ FellowshipMasters: u16 = 7,
+ );
+
+ macro_rules! decl_ensure {
+ (
+ $vis:vis type $name:ident: EnsureOrigin {
+ $( $item:ident = $success:expr, )*
+ }
+ ) => {
+ $vis struct $name;
+ impl> + From>
+ EnsureOrigin for $name
+ {
+ type Success = $success_type;
+ fn try_origin(o: O) -> Result {
+ o.into().and_then(|o| match o {
+ $(
+ Origin::$item => Ok($success),
+ )*
+ r => Err(O::from(r)),
+ })
+ }
+ #[cfg(feature = "runtime-benchmarks")]
+ fn try_successful_origin() -> Result {
+ // By convention the more privileged origins go later, so for greatest chance
+ // of success, we want the last one.
+ let _result: Result = Err(());
+ $(
+ let _result: Result = Ok(O::from(Origin::$item));
+ )*
+ _result
+ }
+ }
+ }
+ }
+
+ decl_ensure! {
+ pub type Spender: EnsureOrigin {
+ SmallTipper = 250 * QUID,
+ BigTipper = 1 * GRAND,
+ SmallSpender = 10 * GRAND,
+ MediumSpender = 100 * GRAND,
+ BigSpender = 1_000 * GRAND,
+ }
+ }
+
+ decl_ensure! {
+ pub type EnsureFellowship: EnsureOrigin {
+ Fellowship1Dan = 1,
+ Fellowship2Dan = 2,
+ Fellowship3Dan = 3,
+ Fellowship4Dan = 4,
+ Fellowship5Dan = 5,
+ Fellowship6Dan = 6,
+ Fellowship7Dan = 7,
+ Fellowship8Dan = 8,
+ Fellowship9Dan = 9,
+ }
+ }
+}
diff --git a/runtime/kusama/src/governance/tracks.rs b/runtime/kusama/src/governance/tracks.rs
new file mode 100644
index 000000000000..fd1c94118507
--- /dev/null
+++ b/runtime/kusama/src/governance/tracks.rs
@@ -0,0 +1,320 @@
+// Copyright 2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Track configurations for governance.
+
+use super::*;
+
+const fn percent(x: i32) -> sp_arithmetic::FixedI64 {
+ sp_arithmetic::FixedI64::from_rational(x as u128, 100)
+}
+use pallet_referenda::Curve;
+const APP_ROOT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
+const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
+const APP_STAKING_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
+const SUP_STAKING_ADMIN: Curve =
+ Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
+const APP_TREASURER: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
+const SUP_TREASURER: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
+const APP_FELLOWSHIP_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
+const SUP_FELLOWSHIP_ADMIN: Curve =
+ Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
+const APP_GENERAL_ADMIN: Curve =
+ Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
+const SUP_GENERAL_ADMIN: Curve =
+ Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50));
+const APP_AUCTION_ADMIN: Curve =
+ Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
+const SUP_AUCTION_ADMIN: Curve =
+ Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50));
+const APP_LEASE_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
+const SUP_LEASE_ADMIN: Curve = Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
+const APP_REFERENDUM_CANCELLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
+const SUP_REFERENDUM_CANCELLER: Curve =
+ Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
+const APP_REFERENDUM_KILLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
+const SUP_REFERENDUM_KILLER: Curve =
+ Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
+const APP_SMALL_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
+const SUP_SMALL_TIPPER: Curve = Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(50));
+const APP_BIG_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
+const SUP_BIG_TIPPER: Curve = Curve::make_reciprocal(8, 28, percent(1), percent(0), percent(50));
+const APP_SMALL_SPENDER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
+const SUP_SMALL_SPENDER: Curve =
+ Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
+const APP_MEDIUM_SPENDER: Curve = Curve::make_linear(23, 28, percent(50), percent(100));
+const SUP_MEDIUM_SPENDER: Curve =
+ Curve::make_reciprocal(16, 28, percent(1), percent(0), percent(50));
+const APP_BIG_SPENDER: Curve = Curve::make_linear(28, 28, percent(50), percent(100));
+const SUP_BIG_SPENDER: Curve = Curve::make_reciprocal(20, 28, percent(1), percent(0), percent(50));
+const APP_WHITELISTED_CALLER: Curve =
+ Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
+const SUP_WHITELISTED_CALLER: Curve =
+ Curve::make_reciprocal(1, 28, percent(20), percent(10), percent(50));
+
+const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15] = [
+ (
+ 0,
+ pallet_referenda::TrackInfo {
+ name: "root",
+ max_deciding: 1,
+ decision_deposit: 1_000 * GRAND,
+ prepare_period: 3 * HOURS,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 3 * HOURS,
+ min_approval: APP_ROOT,
+ min_support: SUP_ROOT,
+ },
+ ),
+ (
+ 1,
+ pallet_referenda::TrackInfo {
+ name: "whitelisted_caller",
+ max_deciding: 10,
+ decision_deposit: 10_000 * GRAND,
+ prepare_period: 3 * HOURS,
+ decision_period: 28 * DAYS,
+ confirm_period: 10 * MINUTES,
+ min_enactment_period: 30 * MINUTES,
+ min_approval: APP_WHITELISTED_CALLER,
+ min_support: SUP_WHITELISTED_CALLER,
+ },
+ ),
+ (
+ 10,
+ pallet_referenda::TrackInfo {
+ name: "staking_admin",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 2 * DAYS,
+ min_approval: APP_STAKING_ADMIN,
+ min_support: SUP_STAKING_ADMIN,
+ },
+ ),
+ (
+ 11,
+ pallet_referenda::TrackInfo {
+ name: "treasurer",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 2 * DAYS,
+ min_approval: APP_TREASURER,
+ min_support: SUP_TREASURER,
+ },
+ ),
+ (
+ 12,
+ pallet_referenda::TrackInfo {
+ name: "lease_admin",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 2 * DAYS,
+ min_approval: APP_LEASE_ADMIN,
+ min_support: SUP_LEASE_ADMIN,
+ },
+ ),
+ (
+ 13,
+ pallet_referenda::TrackInfo {
+ name: "fellowship_admin",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 2 * DAYS,
+ min_approval: APP_FELLOWSHIP_ADMIN,
+ min_support: SUP_FELLOWSHIP_ADMIN,
+ },
+ ),
+ (
+ 14,
+ pallet_referenda::TrackInfo {
+ name: "general_admin",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 2 * DAYS,
+ min_approval: APP_GENERAL_ADMIN,
+ min_support: SUP_GENERAL_ADMIN,
+ },
+ ),
+ (
+ 15,
+ pallet_referenda::TrackInfo {
+ name: "auction_admin",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 2 * DAYS,
+ min_approval: APP_AUCTION_ADMIN,
+ min_support: SUP_AUCTION_ADMIN,
+ },
+ ),
+ (
+ 20,
+ pallet_referenda::TrackInfo {
+ name: "referendum_canceller",
+ max_deciding: 1_000,
+ decision_deposit: 50 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 10 * MINUTES,
+ min_approval: APP_REFERENDUM_CANCELLER,
+ min_support: SUP_REFERENDUM_CANCELLER,
+ },
+ ),
+ (
+ 21,
+ pallet_referenda::TrackInfo {
+ name: "referendum_killer",
+ max_deciding: 1_000,
+ decision_deposit: 50 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 10 * MINUTES,
+ min_approval: APP_REFERENDUM_KILLER,
+ min_support: SUP_REFERENDUM_KILLER,
+ },
+ ),
+ (
+ 30,
+ pallet_referenda::TrackInfo {
+ name: "small_tipper",
+ max_deciding: 200,
+ decision_deposit: 5 * QUID,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 3 * HOURS,
+ min_enactment_period: 28 * DAYS,
+ min_approval: APP_SMALL_TIPPER,
+ min_support: SUP_SMALL_TIPPER,
+ },
+ ),
+ (
+ 31,
+ pallet_referenda::TrackInfo {
+ name: "big_tipper",
+ max_deciding: 100,
+ decision_deposit: 50 * QUID,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 6 * HOURS,
+ min_enactment_period: 28 * DAYS,
+ min_approval: APP_BIG_TIPPER,
+ min_support: SUP_BIG_TIPPER,
+ },
+ ),
+ (
+ 32,
+ pallet_referenda::TrackInfo {
+ name: "small_spender",
+ max_deciding: 50,
+ decision_deposit: 500 * QUID,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 12 * HOURS,
+ min_enactment_period: 28 * DAYS,
+ min_approval: APP_SMALL_SPENDER,
+ min_support: SUP_SMALL_SPENDER,
+ },
+ ),
+ (
+ 33,
+ pallet_referenda::TrackInfo {
+ name: "medium_spender",
+ max_deciding: 20,
+ decision_deposit: 1_500 * QUID,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 28 * DAYS,
+ min_approval: APP_MEDIUM_SPENDER,
+ min_support: SUP_MEDIUM_SPENDER,
+ },
+ ),
+ (
+ 34,
+ pallet_referenda::TrackInfo {
+ name: "big_spender",
+ max_deciding: 10,
+ decision_deposit: 5 * GRAND,
+ prepare_period: 4,
+ decision_period: 28 * DAYS,
+ confirm_period: 48 * HOURS,
+ min_enactment_period: 28 * DAYS,
+ min_approval: APP_BIG_SPENDER,
+ min_support: SUP_BIG_SPENDER,
+ },
+ ),
+];
+
+pub struct TracksInfo;
+impl pallet_referenda::TracksInfo for TracksInfo {
+ type Id = u16;
+ type RuntimeOrigin = ::PalletsOrigin;
+ fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] {
+ &TRACKS_DATA[..]
+ }
+ fn track_for(id: &Self::RuntimeOrigin) -> Result {
+ if let Ok(system_origin) = frame_system::RawOrigin::try_from(id.clone()) {
+ match system_origin {
+ frame_system::RawOrigin::Root => Ok(0),
+ _ => Err(()),
+ }
+ } else if let Ok(custom_origin) = origins::Origin::try_from(id.clone()) {
+ match custom_origin {
+ origins::Origin::WhitelistedCaller => Ok(1),
+ // General admin
+ origins::Origin::StakingAdmin => Ok(10),
+ origins::Origin::Treasurer => Ok(11),
+ origins::Origin::LeaseAdmin => Ok(12),
+ origins::Origin::FellowshipAdmin => Ok(13),
+ origins::Origin::GeneralAdmin => Ok(14),
+ origins::Origin::AuctionAdmin => Ok(15),
+ // Referendum admins
+ origins::Origin::ReferendumCanceller => Ok(20),
+ origins::Origin::ReferendumKiller => Ok(21),
+ // Limited treasury spenders
+ origins::Origin::SmallTipper => Ok(30),
+ origins::Origin::BigTipper => Ok(31),
+ origins::Origin::SmallSpender => Ok(32),
+ origins::Origin::MediumSpender => Ok(33),
+ origins::Origin::BigSpender => Ok(34),
+ _ => Err(()),
+ }
+ } else {
+ Err(())
+ }
+ }
+}
+pallet_referenda::impl_tracksinfo_get!(TracksInfo, Balance, BlockNumber);
diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs
index 1a68b4d1e819..48762d5e67ec 100644
--- a/runtime/kusama/src/lib.rs
+++ b/runtime/kusama/src/lib.rs
@@ -51,8 +51,8 @@ use frame_election_provider_support::{
use frame_support::{
construct_runtime, parameter_types,
traits::{
- ConstU32, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
- PrivilegeCmp,
+ ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem,
+ LockIdentifier, PrivilegeCmp,
},
weights::ConstantMultiplier,
PalletId, RuntimeDebug,
@@ -103,7 +103,10 @@ pub mod xcm_config;
// Governance configurations.
pub mod governance;
-use governance::old::CouncilCollective;
+use governance::{
+ old::CouncilCollective, pallet_custom_origins, AuctionAdmin, GeneralAdmin, LeaseAdmin,
+ StakingAdmin, TreasurySpender,
+};
#[cfg(test)]
mod tests;
@@ -143,10 +146,13 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
-type MoreThanHalfCouncil = EitherOfDiverse<
- EnsureRoot,
- pallet_collective::EnsureProportionMoreThan,
->;
+/// We currently allow all calls.
+pub struct BaseFilter;
+impl Contains for BaseFilter {
+ fn contains(_c: &RuntimeCall) -> bool {
+ true
+ }
+}
parameter_types! {
pub const Version: RuntimeVersion = VERSION;
@@ -181,17 +187,11 @@ impl frame_system::Config for Runtime {
}
parameter_types! {
- pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) *
- BlockWeights::get().max_block;
+ pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
pub const MaxScheduledPerBlock: u32 = 50;
pub const NoPreimagePostponement: Option = Some(10);
}
-type ScheduleOrigin = EitherOfDiverse<
- EnsureRoot,
- pallet_collective::EnsureProportionAtLeast,
->;
-
/// Used the compare the privilege of an origin inside the scheduler.
pub struct OriginPrivilegeCmp;
@@ -221,7 +221,7 @@ impl pallet_scheduler::Config for Runtime {
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
- type ScheduleOrigin = ScheduleOrigin;
+ type ScheduleOrigin = EnsureRoot;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = weights::pallet_scheduler::WeightInfo;
type OriginPrivilegeCmp = OriginPrivilegeCmp;
@@ -239,7 +239,7 @@ impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
- type ManagerOrigin = EnsureRoot;
+ type ManagerOrigin = EnsureRoot; // This might be too strong a requirenent?
type MaxSize = PreimageMaxSize;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
@@ -488,10 +488,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
(),
>;
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
- type ForceOrigin = EitherOfDiverse<
- EnsureRoot,
- pallet_collective::EnsureProportionAtLeast,
- >;
+ type ForceOrigin = StakingAdmin;
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo;
type MaxElectingVoters = MaxElectingVoters;
type MaxElectableTargets = MaxElectableTargets;
@@ -585,11 +582,6 @@ parameter_types! {
pub const MaxNominations: u32 = ::LIMIT as u32;
}
-type SlashCancelOrigin = EitherOfDiverse<
- EnsureRoot,
- pallet_collective::EnsureProportionAtLeast,
->;
-
impl pallet_staking::Config for Runtime {
type MaxNominations = MaxNominations;
type Currency = Balances;
@@ -605,8 +597,8 @@ impl pallet_staking::Config for Runtime {
type SessionsPerEra = SessionsPerEra;
type BondingDuration = BondingDuration;
type SlashDeferDuration = SlashDeferDuration;
- // A majority of the council or root can cancel the slash.
- type SlashCancelOrigin = SlashCancelOrigin;
+ // The staking admin or root can cancel the slash.
+ type SlashCancelOrigin = EitherOf, StakingAdmin>;
type SessionInterface = Self;
type EraPayout = EraPayout;
type NextNewSession = Session;
@@ -651,16 +643,11 @@ parameter_types! {
pub const MaxPeerDataEncodingSize: u32 = 1_000;
}
-type ApproveOrigin = EitherOfDiverse<
- EnsureRoot,
- pallet_collective::EnsureProportionAtLeast,
->;
-
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
- type ApproveOrigin = ApproveOrigin;
- type RejectOrigin = MoreThanHalfCouncil;
+ type ApproveOrigin = EnsureRoot;
+ type RejectOrigin = EnsureRoot;
type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
@@ -672,7 +659,7 @@ impl pallet_treasury::Config for Runtime {
type MaxApprovals = MaxApprovals;
type WeightInfo = weights::pallet_treasury::WeightInfo;
type SpendFunds = Bounties;
- type SpendOrigin = frame_support::traits::NeverEnsureOrigin;
+ type SpendOrigin = TreasurySpender;
}
parameter_types! {
@@ -843,8 +830,7 @@ impl claims::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting;
type Prefix = Prefix;
- type MoveClaimOrigin =
- pallet_collective::EnsureProportionMoreThan;
+ type MoveClaimOrigin = EnsureRoot;
type WeightInfo = weights::runtime_common_claims::WeightInfo;
}
@@ -868,8 +854,8 @@ impl pallet_identity::Config for Runtime {
type MaxAdditionalFields = MaxAdditionalFields;
type MaxRegistrars = MaxRegistrars;
type Slashed = Treasury;
- type ForceOrigin = MoreThanHalfCouncil;
- type RegistrarOrigin = MoreThanHalfCouncil;
+ type ForceOrigin = GeneralAdmin;
+ type RegistrarOrigin = GeneralAdmin;
type WeightInfo = weights::pallet_identity::WeightInfo;
}
@@ -917,11 +903,11 @@ impl pallet_recovery::Config for Runtime {
}
parameter_types! {
- pub const CandidateDeposit: Balance = 1000 * CENTS;
- pub const WrongSideDeduction: Balance = 200 * CENTS;
+ pub const CandidateDeposit: Balance = 10 * QUID;
+ pub const WrongSideDeduction: Balance = 2 * QUID;
pub const MaxStrikes: u32 = 10;
pub const RotationPeriod: BlockNumber = 7 * DAYS;
- pub const PeriodSpend: Balance = 50000 * CENTS;
+ pub const PeriodSpend: Balance = 500 * QUID;
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxCandidateIntake: u32 = 1;
@@ -939,8 +925,7 @@ impl pallet_society::Config for Runtime {
type MembershipChanged = ();
type RotationPeriod = RotationPeriod;
type MaxLockDuration = MaxLockDuration;
- type FounderSetOrigin =
- pallet_collective::EnsureProportionMoreThan;
+ type FounderSetOrigin = EnsureRoot;
type SuspensionJudgementOrigin = pallet_society::EnsureFounder;
type ChallengePeriod = ChallengePeriod;
type MaxCandidateIntake = MaxCandidateIntake;
@@ -1217,13 +1202,13 @@ impl slots::Config for Runtime {
type Registrar = Registrar;
type LeasePeriod = LeasePeriod;
type LeaseOffset = ();
- type ForceOrigin = MoreThanHalfCouncil;
+ type ForceOrigin = LeaseAdmin;
type WeightInfo = weights::runtime_common_slots::WeightInfo;
}
parameter_types! {
pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
- pub const SubmissionDeposit: Balance = 3 * GRAND; // ~ 10 KSM
+ pub const OldSubmissionDeposit: Balance = 3 * GRAND; // ~ 10 KSM
pub const MinContribution: Balance = 3_000 * CENTS; // ~ .1 KSM
pub const RemoveKeysLimit: u32 = 1000;
// Allow 32 bytes for an additional memo to a crowdloan.
@@ -1233,7 +1218,7 @@ parameter_types! {
impl crowdloan::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type PalletId = CrowdloanId;
- type SubmissionDeposit = SubmissionDeposit;
+ type SubmissionDeposit = OldSubmissionDeposit;
type MinContribution = MinContribution;
type RemoveKeysLimit = RemoveKeysLimit;
type Registrar = Registrar;
@@ -1250,11 +1235,6 @@ parameter_types! {
pub const SampleLength: BlockNumber = 2 * MINUTES;
}
-type AuctionInitiate = EitherOfDiverse<
- EnsureRoot,
- pallet_collective::EnsureProportionAtLeast,
->;
-
impl auctions::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Leaser = Slots;
@@ -1262,7 +1242,7 @@ impl auctions::Config for Runtime {
type EndingPeriod = EndingPeriod;
type SampleLength = SampleLength;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo;
- type InitiateOrigin = AuctionInitiate;
+ type InitiateOrigin = AuctionAdmin;
type WeightInfo = weights::runtime_common_auctions::WeightInfo;
}
@@ -1281,7 +1261,7 @@ impl pallet_gilt::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type CurrencyBalance = Balance;
- type AdminOrigin = MoreThanHalfCouncil;
+ type AdminOrigin = EnsureRoot;
type Deficit = (); // Mint
type Surplus = (); // Burn
type IgnoredIssuance = IgnoredIssuance;
@@ -1346,7 +1326,7 @@ construct_runtime! {
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 11,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12,
- // Governance stuff; uncallable initially.
+ // Governance stuff.
Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13,
Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14,
TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15,
@@ -1354,6 +1334,19 @@ construct_runtime! {
TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17,
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18,
+ ConvictionVoting: pallet_conviction_voting::{Pallet, Call, Storage, Event} = 20,
+ Referenda: pallet_referenda::{Pallet, Call, Storage, Event} = 21,
+// pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1;
+ FellowshipCollective: pallet_ranked_collective::::{
+ Pallet, Call, Storage, Event
+ } = 22,
+// pub type FellowshipReferendaInstance = pallet_referenda::Instance2;
+ FellowshipReferenda: pallet_referenda::::{
+ Pallet, Call, Storage, Event
+ } = 23,
+ Origins: pallet_custom_origins::{Origin} = 43,
+ Whitelist: pallet_whitelist::{Pallet, Call, Storage, Event} = 44,
+
// Claims. Usable initially.
Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 19,
@@ -1513,6 +1506,7 @@ mod benches {
[pallet_child_bounties, ChildBounties]
[pallet_collective, Council]
[pallet_collective, TechnicalCommittee]
+ [pallet_conviction_voting, ConvictionVoting]
[pallet_democracy, Democracy]
[pallet_elections_phragmen, PhragmenElection]
[pallet_election_provider_multi_phase, ElectionProviderMultiPhase]
@@ -1528,7 +1522,10 @@ mod benches {
[pallet_offences, OffencesBench::]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
+ [pallet_ranked_collective, FellowshipCollective]
[pallet_recovery, Recovery]
+ [pallet_referenda, Referenda]
+ [pallet_referenda, FellowshipReferenda]
[pallet_scheduler, Scheduler]
[pallet_session, SessionBench::]
[pallet_staking, Staking]
@@ -1538,6 +1535,7 @@ mod benches {
[pallet_treasury, Treasury]
[pallet_utility, Utility]
[pallet_vesting, Vesting]
+ [pallet_whitelist, Whitelist]
// XCM
[pallet_xcm_benchmarks::fungible, pallet_xcm_benchmarks::fungible::Pallet::]
[pallet_xcm_benchmarks::generic, pallet_xcm_benchmarks::generic::Pallet::]
diff --git a/runtime/kusama/src/weights/mod.rs b/runtime/kusama/src/weights/mod.rs
index 4f8eb7d453d2..2f9e2d35c211 100644
--- a/runtime/kusama/src/weights/mod.rs
+++ b/runtime/kusama/src/weights/mod.rs
@@ -23,6 +23,7 @@ pub mod pallet_bounties;
pub mod pallet_child_bounties;
pub mod pallet_collective_council;
pub mod pallet_collective_technical_committee;
+pub mod pallet_conviction_voting;
pub mod pallet_democracy;
pub mod pallet_election_provider_multi_phase;
pub mod pallet_elections_phragmen;
@@ -36,6 +37,9 @@ pub mod pallet_multisig;
pub mod pallet_nomination_pools;
pub mod pallet_preimage;
pub mod pallet_proxy;
+pub mod pallet_ranked_collective;
+pub mod pallet_referenda_fellowship_referenda;
+pub mod pallet_referenda_referenda;
pub mod pallet_scheduler;
pub mod pallet_session;
pub mod pallet_staking;
@@ -44,6 +48,7 @@ pub mod pallet_tips;
pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
+pub mod pallet_whitelist;
pub mod runtime_common_auctions;
pub mod runtime_common_claims;
pub mod runtime_common_crowdloan;
diff --git a/runtime/kusama/src/weights/pallet_collective_council.rs b/runtime/kusama/src/weights/pallet_collective_council.rs
index b59c6ff54ceb..8fe7d12e04b5 100644
--- a/runtime/kusama/src/weights/pallet_collective_council.rs
+++ b/runtime/kusama/src/weights/pallet_collective_council.rs
@@ -27,7 +27,6 @@
// --chain=kusama-dev
// --steps=50
// --repeat=20
-// --pallet=pallet_collective
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
diff --git a/runtime/kusama/src/weights/pallet_collective_technical_committee.rs b/runtime/kusama/src/weights/pallet_collective_technical_committee.rs
index 6ec788ec0fd5..149a26d54b0e 100644
--- a/runtime/kusama/src/weights/pallet_collective_technical_committee.rs
+++ b/runtime/kusama/src/weights/pallet_collective_technical_committee.rs
@@ -27,7 +27,6 @@
// --chain=kusama-dev
// --steps=50
// --repeat=20
-// --pallet=pallet_collective
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
diff --git a/runtime/kusama/src/weights/pallet_conviction_voting.rs b/runtime/kusama/src/weights/pallet_conviction_voting.rs
new file mode 100644
index 000000000000..fbbb0d6529b5
--- /dev/null
+++ b/runtime/kusama/src/weights/pallet_conviction_voting.rs
@@ -0,0 +1,119 @@
+// Copyright 2017-2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+//! Autogenerated weights for `pallet_conviction_voting`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-09-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
+
+// Executed Command:
+// /home/benchbot/cargo_target_dir/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --pallet=pallet_conviction_voting
+// --chain=kusama-dev
+// --header=./file_header.txt
+// --output=./runtime/kusama/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions for `pallet_conviction_voting`.
+pub struct WeightInfo(PhantomData);
+impl pallet_conviction_voting::WeightInfo for WeightInfo {
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: ConvictionVoting VotingFor (r:1 w:1)
+ // Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
+ // Storage: Balances Locks (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn vote_new() -> Weight {
+ Weight::from_ref_time(5_652_326_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(6 as u64))
+ .saturating_add(T::DbWeight::get().writes(6 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: ConvictionVoting VotingFor (r:1 w:1)
+ // Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
+ // Storage: Balances Locks (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn vote_existing() -> Weight {
+ Weight::from_ref_time(509_859_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(6 as u64))
+ .saturating_add(T::DbWeight::get().writes(6 as u64))
+ }
+ // Storage: ConvictionVoting VotingFor (r:1 w:1)
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn remove_vote() -> Weight {
+ Weight::from_ref_time(486_638_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: ConvictionVoting VotingFor (r:1 w:1)
+ // Storage: Referenda ReferendumInfoFor (r:1 w:0)
+ fn remove_other_vote() -> Weight {
+ Weight::from_ref_time(74_517_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: ConvictionVoting VotingFor (r:2 w:2)
+ // Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
+ // Storage: Balances Locks (r:1 w:1)
+ // Storage: Referenda ReferendumInfoFor (r:10 w:10)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ /// The range of component `r` is `[0, 512]`.
+ fn delegate(r: u32, ) -> Weight {
+ Weight::from_ref_time(78_376_000 as u64)
+ // Standard Error: 2_253_708
+ .saturating_add(Weight::from_ref_time(221_428_037 as u64).saturating_mul(r as u64))
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64)))
+ }
+ // Storage: ConvictionVoting VotingFor (r:2 w:2)
+ // Storage: Referenda ReferendumInfoFor (r:10 w:10)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ /// The range of component `r` is `[0, 512]`.
+ fn undelegate(r: u32, ) -> Weight {
+ Weight::from_ref_time(55_946_000 as u64)
+ // Standard Error: 2_268_396
+ .saturating_add(Weight::from_ref_time(221_648_859 as u64).saturating_mul(r as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(r as u64)))
+ }
+ // Storage: ConvictionVoting VotingFor (r:1 w:1)
+ // Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
+ // Storage: Balances Locks (r:1 w:1)
+ fn unlock() -> Weight {
+ Weight::from_ref_time(93_068_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+}
diff --git a/runtime/kusama/src/weights/pallet_ranked_collective.rs b/runtime/kusama/src/weights/pallet_ranked_collective.rs
new file mode 100644
index 000000000000..33b62a7db764
--- /dev/null
+++ b/runtime/kusama/src/weights/pallet_ranked_collective.rs
@@ -0,0 +1,116 @@
+// Copyright 2017-2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+//! Autogenerated weights for `pallet_ranked_collective`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-09-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
+
+// Executed Command:
+// /home/benchbot/cargo_target_dir/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --pallet=pallet_ranked_collective
+// --chain=kusama-dev
+// --header=./file_header.txt
+// --output=./runtime/kusama/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions for `pallet_ranked_collective`.
+pub struct WeightInfo(PhantomData);
+impl pallet_ranked_collective::WeightInfo for WeightInfo {
+ // Storage: FellowshipCollective Members (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:1)
+ // Storage: FellowshipCollective IndexToId (r:0 w:1)
+ // Storage: FellowshipCollective IdToIndex (r:0 w:1)
+ fn add_member() -> Weight {
+ Weight::from_ref_time(20_797_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipCollective Members (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:1)
+ // Storage: FellowshipCollective IdToIndex (r:1 w:1)
+ // Storage: FellowshipCollective IndexToId (r:1 w:1)
+ /// The range of component `r` is `[0, 10]`.
+ fn remove_member(r: u32, ) -> Weight {
+ Weight::from_ref_time(30_196_000 as u64)
+ // Standard Error: 10_539
+ .saturating_add(Weight::from_ref_time(9_633_382 as u64).saturating_mul(r as u64))
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(r as u64)))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(r as u64)))
+ }
+ // Storage: FellowshipCollective Members (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:1)
+ // Storage: FellowshipCollective IndexToId (r:0 w:1)
+ // Storage: FellowshipCollective IdToIndex (r:0 w:1)
+ /// The range of component `r` is `[0, 10]`.
+ fn promote_member(r: u32, ) -> Weight {
+ Weight::from_ref_time(21_958_000 as u64)
+ // Standard Error: 3_398
+ .saturating_add(Weight::from_ref_time(527_087 as u64).saturating_mul(r as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipCollective Members (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:1)
+ // Storage: FellowshipCollective IdToIndex (r:1 w:1)
+ // Storage: FellowshipCollective IndexToId (r:1 w:1)
+ /// The range of component `r` is `[0, 10]`.
+ fn demote_member(r: u32, ) -> Weight {
+ Weight::from_ref_time(29_934_000 as u64)
+ // Standard Error: 11_453
+ .saturating_add(Weight::from_ref_time(884_044 as u64).saturating_mul(r as u64))
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipCollective Members (r:1 w:0)
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective Voting (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn vote() -> Weight {
+ Weight::from_ref_time(45_989_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(5 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:0)
+ // Storage: FellowshipCollective VotingCleanup (r:1 w:0)
+ // Storage: FellowshipCollective Voting (r:0 w:1)
+ /// The range of component `n` is `[1, 100]`.
+ fn cleanup_poll(n: u32, ) -> Weight {
+ Weight::from_ref_time(17_842_000 as u64)
+ // Standard Error: 733
+ .saturating_add(Weight::from_ref_time(892_322 as u64).saturating_mul(n as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(n as u64)))
+ }
+}
diff --git a/runtime/kusama/src/weights/pallet_referenda_fellowship_referenda.rs b/runtime/kusama/src/weights/pallet_referenda_fellowship_referenda.rs
new file mode 100644
index 000000000000..ca52d8044bbf
--- /dev/null
+++ b/runtime/kusama/src/weights/pallet_referenda_fellowship_referenda.rs
@@ -0,0 +1,264 @@
+// Copyright 2017-2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+//! Autogenerated weights for `pallet_referenda`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-09-30, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
+
+// Executed Command:
+// /home/benchbot/cargo_target_dir/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --pallet=pallet_referenda
+// --chain=kusama-dev
+// --header=./file_header.txt
+// --output=./runtime/kusama/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::Weight};
+use sp_std::marker::PhantomData;
+
+/// Weight functions for `pallet_referenda`.
+pub struct WeightInfo(PhantomData);
+impl pallet_referenda::WeightInfo for WeightInfo {
+ // Storage: FellowshipCollective Members (r:1 w:0)
+ // Storage: FellowshipReferenda ReferendumCount (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:0 w:1)
+ fn submit() -> Weight {
+ Weight::from_ref_time(32_438_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn place_decision_deposit_preparing() -> Weight {
+ Weight::from_ref_time(48_476_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:0)
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ fn place_decision_deposit_queued() -> Weight {
+ Weight::from_ref_time(94_751_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:0)
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ fn place_decision_deposit_not_queued() -> Weight {
+ Weight::from_ref_time(94_975_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn place_decision_deposit_passing() -> Weight {
+ Weight::from_ref_time(194_931_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(5 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ fn place_decision_deposit_failing() -> Weight {
+ Weight::from_ref_time(42_888_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ fn refund_decision_deposit() -> Weight {
+ Weight::from_ref_time(30_949_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn cancel() -> Weight {
+ Weight::from_ref_time(38_960_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn kill() -> Weight {
+ Weight::from_ref_time(67_836_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:0)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:1)
+ fn one_fewer_deciding_queue_empty() -> Weight {
+ Weight::from_ref_time(11_204_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn one_fewer_deciding_failing() -> Weight {
+ Weight::from_ref_time(224_465_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(5 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn one_fewer_deciding_passing() -> Weight {
+ Weight::from_ref_time(224_764_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(5 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_requeued_insertion() -> Weight {
+ Weight::from_ref_time(91_727_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_requeued_slide() -> Weight {
+ Weight::from_ref_time(91_868_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:0)
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_queued() -> Weight {
+ Weight::from_ref_time(94_520_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:0)
+ // Storage: FellowshipReferenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_not_queued() -> Weight {
+ Weight::from_ref_time(93_483_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_no_deposit() -> Weight {
+ Weight::from_ref_time(29_294_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_preparing() -> Weight {
+ Weight::from_ref_time(30_363_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ fn nudge_referendum_timed_out() -> Weight {
+ Weight::from_ref_time(22_703_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_begin_deciding_failing() -> Weight {
+ Weight::from_ref_time(40_760_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipReferenda DecidingCount (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_begin_deciding_passing() -> Weight {
+ Weight::from_ref_time(91_300_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_begin_confirming() -> Weight {
+ Weight::from_ref_time(165_577_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_end_confirming() -> Weight {
+ Weight::from_ref_time(166_188_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_continue_not_confirming() -> Weight {
+ Weight::from_ref_time(159_324_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_continue_confirming() -> Weight {
+ Weight::from_ref_time(82_615_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ // Storage: Scheduler Lookup (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ fn nudge_referendum_approved() -> Weight {
+ Weight::from_ref_time(185_354_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(6 as u64))
+ .saturating_add(T::DbWeight::get().writes(5 as u64))
+ }
+ // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
+ // Storage: FellowshipCollective MemberCount (r:1 w:0)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_rejected() -> Weight {
+ Weight::from_ref_time(165_963_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+}
diff --git a/runtime/kusama/src/weights/pallet_referenda_referenda.rs b/runtime/kusama/src/weights/pallet_referenda_referenda.rs
new file mode 100644
index 000000000000..8d8fc6ecbd61
--- /dev/null
+++ b/runtime/kusama/src/weights/pallet_referenda_referenda.rs
@@ -0,0 +1,251 @@
+// Copyright 2017-2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+//! Autogenerated weights for `pallet_referenda`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-09-30, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
+
+// Executed Command:
+// /home/benchbot/cargo_target_dir/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --pallet=pallet_referenda
+// --chain=kusama-dev
+// --header=./file_header.txt
+// --output=./runtime/kusama/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::Weight};
+use sp_std::marker::PhantomData;
+
+/// Weight functions for `pallet_referenda`.
+pub struct WeightInfo(PhantomData);
+impl pallet_referenda::WeightInfo for WeightInfo {
+ // Storage: Referenda ReferendumCount (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ // Storage: Referenda ReferendumInfoFor (r:0 w:1)
+ fn submit() -> Weight {
+ Weight::from_ref_time(37_366_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn place_decision_deposit_preparing() -> Weight {
+ Weight::from_ref_time(47_931_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:0)
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ fn place_decision_deposit_queued() -> Weight {
+ Weight::from_ref_time(48_799_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:0)
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ fn place_decision_deposit_not_queued() -> Weight {
+ Weight::from_ref_time(48_899_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn place_decision_deposit_passing() -> Weight {
+ Weight::from_ref_time(61_981_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:1)
+ fn place_decision_deposit_failing() -> Weight {
+ Weight::from_ref_time(42_318_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ fn refund_decision_deposit() -> Weight {
+ Weight::from_ref_time(30_391_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn cancel() -> Weight {
+ Weight::from_ref_time(38_601_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn kill() -> Weight {
+ Weight::from_ref_time(78_111_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda TrackQueue (r:1 w:0)
+ // Storage: Referenda DecidingCount (r:1 w:1)
+ fn one_fewer_deciding_queue_empty() -> Weight {
+ Weight::from_ref_time(11_132_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn one_fewer_deciding_failing() -> Weight {
+ Weight::from_ref_time(161_624_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ fn one_fewer_deciding_passing() -> Weight {
+ Weight::from_ref_time(167_193_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(4 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_requeued_insertion() -> Weight {
+ Weight::from_ref_time(44_257_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_requeued_slide() -> Weight {
+ Weight::from_ref_time(43_981_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:0)
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_queued() -> Weight {
+ Weight::from_ref_time(45_931_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:0)
+ // Storage: Referenda TrackQueue (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_not_queued() -> Weight {
+ Weight::from_ref_time(45_854_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(4 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_no_deposit() -> Weight {
+ Weight::from_ref_time(28_641_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_preparing() -> Weight {
+ Weight::from_ref_time(29_629_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ fn nudge_referendum_timed_out() -> Weight {
+ Weight::from_ref_time(21_852_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_begin_deciding_failing() -> Weight {
+ Weight::from_ref_time(41_478_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Referenda DecidingCount (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_begin_deciding_passing() -> Weight {
+ Weight::from_ref_time(44_198_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_begin_confirming() -> Weight {
+ Weight::from_ref_time(38_978_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_end_confirming() -> Weight {
+ Weight::from_ref_time(40_123_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_continue_not_confirming() -> Weight {
+ Weight::from_ref_time(36_868_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_continue_confirming() -> Weight {
+ Weight::from_ref_time(36_835_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:2 w:2)
+ // Storage: Scheduler Lookup (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ fn nudge_referendum_approved() -> Weight {
+ Weight::from_ref_time(56_130_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(5 as u64))
+ .saturating_add(T::DbWeight::get().writes(5 as u64))
+ }
+ // Storage: Referenda ReferendumInfoFor (r:1 w:1)
+ // Storage: Scheduler Agenda (r:1 w:1)
+ fn nudge_referendum_rejected() -> Weight {
+ Weight::from_ref_time(38_997_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+}
diff --git a/runtime/kusama/src/weights/pallet_whitelist.rs b/runtime/kusama/src/weights/pallet_whitelist.rs
new file mode 100644
index 000000000000..5e7dcf8f75b3
--- /dev/null
+++ b/runtime/kusama/src/weights/pallet_whitelist.rs
@@ -0,0 +1,82 @@
+// Copyright 2017-2022 Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+//! Autogenerated weights for `pallet_whitelist`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-09-18, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
+
+// Executed Command:
+// /home/benchbot/cargo_target_dir/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --pallet=pallet_whitelist
+// --chain=kusama-dev
+// --header=./file_header.txt
+// --output=./runtime/kusama/src/weights/
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions for `pallet_whitelist`.
+pub struct WeightInfo(PhantomData);
+impl pallet_whitelist::WeightInfo for WeightInfo {
+ // Storage: Whitelist WhitelistedCall (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ fn whitelist_call() -> Weight {
+ Weight::from_ref_time(21_808_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
+ // Storage: Whitelist WhitelistedCall (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ // Storage: Preimage PreimageFor (r:0 w:1)
+ fn remove_whitelisted_call() -> Weight {
+ Weight::from_ref_time(24_193_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Whitelist WhitelistedCall (r:1 w:1)
+ // Storage: Preimage PreimageFor (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ fn dispatch_whitelisted_call() -> Weight {
+ Weight::from_ref_time(7_327_364_000 as u64)
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+ // Storage: Whitelist WhitelistedCall (r:1 w:1)
+ // Storage: Preimage StatusFor (r:1 w:1)
+ // Storage: Preimage PreimageFor (r:0 w:1)
+ /// The range of component `n` is `[1, 10000]`.
+ fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight {
+ Weight::from_ref_time(26_992_000 as u64)
+ // Standard Error: 4
+ .saturating_add(Weight::from_ref_time(1_621 as u64).saturating_mul(n as u64))
+ .saturating_add(T::DbWeight::get().reads(2 as u64))
+ .saturating_add(T::DbWeight::get().writes(3 as u64))
+ }
+}
diff --git a/xcm/pallet-xcm-benchmarks/Cargo.toml b/xcm/pallet-xcm-benchmarks/Cargo.toml
index b14dd3301346..5c48219a6d1e 100644
--- a/xcm/pallet-xcm-benchmarks/Cargo.toml
+++ b/xcm/pallet-xcm-benchmarks/Cargo.toml
@@ -14,9 +14,9 @@ frame-support = { default-features = false, branch = "master", git = "https://gi
frame-system = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
sp-runtime = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
sp-std = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
-xcm-executor = { path = "../xcm-executor", default-features = false, features = ["runtime-benchmarks"] }
+xcm-executor = { path = "../xcm-executor", default-features = false }
frame-benchmarking = { default-features = false, branch = "master", git = "https://github.com/paritytech/substrate" }
-xcm = { path = "..", default-features = false, features = ["runtime-benchmarks"] }
+xcm = { path = "..", default-features = false }
log = "0.4.17"
[dev-dependencies]
@@ -44,6 +44,8 @@ std = [
"sp-std/std"
]
runtime-benchmarks = [
+ "xcm/runtime-benchmarks",
+ "xcm-executor/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/mod.rs b/xcm/pallet-xcm-benchmarks/src/fungible/mod.rs
index 1acf61cf0010..a7fd0e99fd8e 100644
--- a/xcm/pallet-xcm-benchmarks/src/fungible/mod.rs
+++ b/xcm/pallet-xcm-benchmarks/src/fungible/mod.rs
@@ -18,6 +18,7 @@
pub use pallet::*;
+#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
#[cfg(test)]
mod mock;
diff --git a/xcm/pallet-xcm-benchmarks/src/generic/mod.rs b/xcm/pallet-xcm-benchmarks/src/generic/mod.rs
index adf31fb207f2..de347a537be2 100644
--- a/xcm/pallet-xcm-benchmarks/src/generic/mod.rs
+++ b/xcm/pallet-xcm-benchmarks/src/generic/mod.rs
@@ -1,5 +1,6 @@
pub use pallet::*;
+#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
#[cfg(test)]
mod mock;