From 777580616684f8a9c8b197465040a08069531b66 Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 10 Feb 2023 17:12:50 +0000 Subject: [PATCH 01/26] OpenGov for Polkadot --- Cargo.lock | 5 + runtime/polkadot/Cargo.toml | 18 +++ runtime/polkadot/constants/src/lib.rs | 1 + runtime/polkadot/src/lib.rs | 187 +++----------------------- runtime/polkadot/src/weights/mod.rs | 5 + 5 files changed, 51 insertions(+), 165 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cbf00ac48ae6..54f5ab8c1206 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7410,6 +7410,7 @@ dependencies = [ "pallet-bounties", "pallet-child-bounties", "pallet-collective", + "pallet-conviction-voting", "pallet-democracy", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", @@ -7428,6 +7429,8 @@ dependencies = [ "pallet-offences-benchmarking", "pallet-preimage", "pallet-proxy", + "pallet-ranked-collective", + "pallet-referenda", "pallet-scheduler", "pallet-session", "pallet-session-benchmarking", @@ -7440,6 +7443,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", + "pallet-whitelist", "pallet-xcm", "parity-scale-codec", "polkadot-primitives", @@ -7454,6 +7458,7 @@ dependencies = [ "serde_json", "smallvec", "sp-api", + "sp-arithmetic", "sp-authority-discovery", "sp-beefy", "sp-block-builder", diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index 91e35f774405..4e4506f82b7f 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -27,6 +27,7 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", d sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -44,6 +45,7 @@ pallet-child-bounties = { git = "https://github.com/paritytech/substrate", branc pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-transaction-payment-rpc-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 } @@ -60,6 +62,8 @@ pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/sub 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-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 } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -71,6 +75,7 @@ polkadot-runtime-constants = { package = "polkadot-runtime-constants", path = ". pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-treasury = { 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-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -124,6 +129,7 @@ std = [ "tx-pool-api/std", "block-builder-api/std", "offchain-primitives/std", + "sp-arithmetic/std", "sp-std/std", "sp-mmr-primitives/std", "frame-support/std", @@ -134,6 +140,7 @@ std = [ "pallet-balances/std", "pallet-bounties/std", "pallet-child-bounties/std", + "pallet-conviction-voting/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", @@ -152,6 +159,8 @@ std = [ "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", + "pallet-ranked-collective/std", + "pallet-referenda/std", "pallet-scheduler/std", "pallet-session/std", "pallet-staking/std", @@ -160,6 +169,7 @@ std = [ "pallet-tips/std", "pallet-babe/std", "pallet-vesting/std", + "pallet-whitelist/std", "pallet-utility/std", "sp-runtime/std", "sp-staking/std", @@ -192,6 +202,7 @@ runtime-benchmarks = [ "pallet-bags-list/runtime-benchmarks", "pallet-balances/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", @@ -207,6 +218,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-staking/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", @@ -216,6 +229,7 @@ runtime-benchmarks = [ "pallet-tips/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", + "pallet-whitelist/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "pallet-offences-benchmarking/runtime-benchmarks", "pallet-session-benchmarking/runtime-benchmarks", @@ -236,6 +250,7 @@ try-runtime = [ "pallet-bags-list/try-runtime", "pallet-bounties/try-runtime", "pallet-child-bounties/try-runtime", + "pallet-conviction-voting/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", "pallet-elections-phragmen/try-runtime", @@ -252,6 +267,8 @@ try-runtime = [ "pallet-offences/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", + "pallet-ranked-collective/try-runtime", + "pallet-referenda/try-runtime", "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-staking/try-runtime", @@ -260,6 +277,7 @@ try-runtime = [ "pallet-tips/try-runtime", "pallet-babe/try-runtime", "pallet-vesting/try-runtime", + "pallet-whitelist/try-runtime", "pallet-utility/try-runtime", "pallet-xcm/try-runtime", ] diff --git a/runtime/polkadot/constants/src/lib.rs b/runtime/polkadot/constants/src/lib.rs index 68b2fdcd306e..7624c8a0b0b0 100644 --- a/runtime/polkadot/constants/src/lib.rs +++ b/runtime/polkadot/constants/src/lib.rs @@ -29,6 +29,7 @@ pub mod currency { pub const UNITS: Balance = 10_000_000_000; pub const DOLLARS: Balance = UNITS; // 10_000_000_000 + pub const GRAND: Balance = DOLLARS * 1_000; // 10_000_000_000 pub const CENTS: Balance = DOLLARS / 100; // 100_000_000 pub const MILLICENTS: Balance = CENTS / 1_000; // 100_000 diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index fc371688a3f3..82feb29b28a9 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -99,6 +99,13 @@ mod weights; mod bag_thresholds; +// Governance configurations. +pub mod governance; +use governance::{ + old::CouncilCollective, pallet_custom_origins, AuctionAdmin, Fellows, GeneralAdmin, LeaseAdmin, + StakingAdmin, Treasurer, TreasurySpender, +}; + pub mod xcm_config; impl_runtime_weights!(polkadot_runtime_constants); @@ -650,170 +657,6 @@ impl pallet_identity::Config for Runtime { type WeightInfo = weights::pallet_identity::WeightInfo; } -parameter_types! { - pub LaunchPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 1, "DOT_LAUNCH_PERIOD"); - pub VotingPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 1 * MINUTES, "DOT_VOTING_PERIOD"); - pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "DOT_FAST_TRACK_VOTING_PERIOD"); - pub const MinimumDeposit: Balance = 100 * DOLLARS; - pub EnactmentPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 1, "DOT_ENACTMENT_PERIOD"); - pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "DOT_COOLOFF_PERIOD"); - pub const InstantAllowed: bool = true; - pub const MaxVotes: u32 = 100; - pub const MaxProposals: u32 = 100; -} - -impl pallet_democracy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type EnactmentPeriod = EnactmentPeriod; - type VoteLockingPeriod = EnactmentPeriod; - type LaunchPeriod = LaunchPeriod; - type VotingPeriod = VotingPeriod; - type MinimumDeposit = MinimumDeposit; - /// A straight majority of the council can decide what their next motion is. - type ExternalOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - frame_system::EnsureRoot, - >; - /// A 60% super-majority can have the next scheduled referendum be a straight majority-carries vote. - type ExternalMajorityOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - frame_system::EnsureRoot, - >; - /// A unanimous council can have the next scheduled referendum be a straight default-carries - /// (NTB) vote. - type ExternalDefaultOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - frame_system::EnsureRoot, - >; - /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote - /// be tabled immediately and with a shorter voting/enactment period. - type FastTrackOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - frame_system::EnsureRoot, - >; - type InstantOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - frame_system::EnsureRoot, - >; - type InstantAllowed = InstantAllowed; - type FastTrackVotingPeriod = FastTrackVotingPeriod; - // To cancel a proposal which has been passed, 2/3 of the council must agree to it. - type CancellationOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, - >; - // To cancel a proposal before it has been passed, the technical committee must be unanimous or - // Root must agree. - type CancelProposalOrigin = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, - >; - type BlacklistOrigin = EnsureRoot; - // Any single technical committee member may veto a coming council proposal, however they can - // only do it once and it lasts only for the cooloff period. - type VetoOrigin = pallet_collective::EnsureMember; - type CooloffPeriod = CooloffPeriod; - type Slash = Treasury; - type Scheduler = Scheduler; - type PalletsOrigin = OriginCaller; - type MaxVotes = MaxVotes; - type WeightInfo = weights::pallet_democracy::WeightInfo; - type MaxProposals = MaxProposals; - type Preimages = Preimage; - type MaxDeposits = ConstU32<100>; - type MaxBlacklisted = ConstU32<100>; -} - -parameter_types! { - pub CouncilMotionDuration: BlockNumber = prod_or_fast!(7 * DAYS, 2 * MINUTES, "DOT_MOTION_DURATION"); - pub const CouncilMaxProposals: u32 = 100; - pub const CouncilMaxMembers: u32 = 100; -} - -pub type CouncilCollective = pallet_collective::Instance1; -impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = CouncilMotionDuration; - type MaxProposals = CouncilMaxProposals; - type MaxMembers = CouncilMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective_council::WeightInfo; -} - -parameter_types! { - pub const CandidacyBond: Balance = 100 * DOLLARS; - // 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); - /// Weekly council elections; scaling up to monthly eventually. - pub TermDuration: BlockNumber = prod_or_fast!(7 * DAYS, 2 * MINUTES, "DOT_TERM_DURATION"); - /// 13 members initially, to be increased to 23 eventually. - pub const DesiredMembers: u32 = 13; - pub const DesiredRunnersUp: u32 = 20; - pub const MaxVoters: u32 = 10 * 1000; - pub const MaxVotesPerVoter: u32 = 16; - pub const MaxCandidates: u32 = 1000; - pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; -} -// Make sure that there are no more than `MaxMembers` members elected via phragmen. -const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); - -impl pallet_elections_phragmen::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type PalletId = PhragmenElectionPalletId; - type Currency = Balances; - type ChangeMembers = Council; - type InitializeMembers = Council; - type CurrencyToVote = frame_support::traits::U128CurrencyToVote; - type CandidacyBond = CandidacyBond; - type VotingBondBase = VotingBondBase; - type VotingBondFactor = VotingBondFactor; - type LoserCandidate = Treasury; - type KickedMember = Treasury; - type DesiredMembers = DesiredMembers; - type DesiredRunnersUp = DesiredRunnersUp; - type TermDuration = TermDuration; - type MaxVoters = MaxVoters; - type MaxVotesPerVoter = MaxVotesPerVoter; - type MaxCandidates = MaxCandidates; - type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; -} - -parameter_types! { - pub const TechnicalMotionDuration: BlockNumber = 7 * DAYS; - pub const TechnicalMaxProposals: u32 = 100; - pub const TechnicalMaxMembers: u32 = 100; -} - -pub type TechnicalCollective = pallet_collective::Instance2; -impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = TechnicalMotionDuration; - type MaxProposals = TechnicalMaxProposals; - type MaxMembers = TechnicalMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; -} - -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 MembershipInitialized = TechnicalCommittee; - type MembershipChanged = TechnicalCommittee; - type MaxMembers = TechnicalMaxMembers; - type WeightInfo = weights::pallet_membership::WeightInfo; -} - parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 100 * DOLLARS; @@ -1500,7 +1343,7 @@ construct_runtime! { ImOnline: pallet_im_online::{Pallet, Call, Storage, Event, ValidateUnsigned, Config} = 12, AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 13, - // Governance stuff. + // Old governance stuff. Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 14, Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 16, @@ -1508,6 +1351,19 @@ construct_runtime! { TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 18, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 19, + // OpenGov stuff. + 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} = 24, @@ -2136,6 +1992,7 @@ sp_api::impl_runtime_apis! { #[cfg(test)] mod test_fees { use super::*; + use crate::governance::old::*; use frame_support::{dispatch::GetDispatchInfo, weights::WeightToFee as WeightToFeeT}; use keyring::Sr25519Keyring::{Alice, Charlie}; use pallet_transaction_payment::Multiplier; diff --git a/runtime/polkadot/src/weights/mod.rs b/runtime/polkadot/src/weights/mod.rs index cef8d5d00aa0..9e7111d806df 100644 --- a/runtime/polkadot/src/weights/mod.rs +++ b/runtime/polkadot/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; @@ -35,6 +36,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; @@ -43,6 +47,7 @@ pub mod pallet_tips; pub mod pallet_treasury; pub mod pallet_utility; pub mod pallet_vesting; +pub mod pallet_whitelist; pub mod pallet_xcm; pub mod runtime_common_auctions; pub mod runtime_common_claims; From e44fb687866bb84dbe4cfd0db6729da85a515826 Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 10 Feb 2023 17:43:17 +0000 Subject: [PATCH 02/26] Integrate OpenGov into XCM --- runtime/kusama/src/lib.rs | 9 ++--- runtime/polkadot/src/lib.rs | 59 +++++++----------------------- runtime/polkadot/src/xcm_config.rs | 25 ++++++++++--- 3 files changed, 38 insertions(+), 55 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index a5a0658b5e99..69c6e7da48f4 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -223,7 +223,8 @@ impl pallet_scheduler::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = EitherOf, AuctionAdmin>; + // TODO: Think more carefully and possibly replace with lower privilege origin. + type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; type OriginPrivilegeCmp = OriginPrivilegeCmp; @@ -597,10 +598,8 @@ impl pallet_fast_unstake::Config for Runtime { type Currency = Balances; type BatchSize = frame_support::traits::ConstU32<64>; type Deposit = frame_support::traits::ConstU128<{ CENTS * 100 }>; - type ControlOrigin = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionAtLeast, - >; + // TODO: Check if this is low-privilege and maybe consider GeneralAdmin instead. + type ControlOrigin = EnsureRoot; type Staking = Staking; type MaxErasToCheckPerBlock = ConstU32<1>; #[cfg(feature = "runtime-benchmarks")] diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 82feb29b28a9..0ee5a8fc08ed 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -42,7 +42,7 @@ use frame_support::{ construct_runtime, parameter_types, traits::{ ConstU32, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, - PrivilegeCmp, WithdrawReasons, + PrivilegeCmp, WithdrawReasons, EitherOf, }, weights::ConstantMultiplier, PalletId, RuntimeDebug, @@ -144,11 +144,6 @@ pub fn native_version() -> NativeVersion { NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } -type MoreThanHalfCouncil = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionMoreThan, ->; - parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const SS58Prefix: u8 = 0; @@ -188,11 +183,6 @@ parameter_types! { 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; @@ -222,7 +212,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; @@ -492,10 +482,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 = EitherOf, StakingAdmin>; type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; type MaxElectingVoters = MaxElectingVoters; type MaxElectableTargets = MaxElectableTargets; @@ -553,11 +540,6 @@ parameter_types! { pub const MaxNominations: u32 = ::LIMIT as u32; } -type StakingAdminOrigin = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionAtLeast, ->; - pub struct EraPayout; impl pallet_staking::EraPayout for EraPayout { fn era_payout( @@ -599,7 +581,7 @@ impl pallet_staking::Config for Runtime { type SessionsPerEra = SessionsPerEra; type BondingDuration = BondingDuration; type SlashDeferDuration = SlashDeferDuration; - type AdminOrigin = StakingAdminOrigin; + type AdminOrigin = StakingAdmin; type SessionInterface = Self; type EraPayout = EraPayout; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; @@ -621,10 +603,8 @@ impl pallet_fast_unstake::Config for Runtime { type Currency = Balances; type BatchSize = frame_support::traits::ConstU32<16>; type Deposit = frame_support::traits::ConstU128<{ UNITS }>; - type ControlOrigin = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionAtLeast, - >; + // TODO: Check if this is low-privilege and maybe consider GeneralAdmin instead. + type ControlOrigin = EnsureRoot; type Staking = Staking; type MaxErasToCheckPerBlock = ConstU32<1>; #[cfg(feature = "runtime-benchmarks")] @@ -652,8 +632,8 @@ impl pallet_identity::Config for Runtime { type MaxAdditionalFields = MaxAdditionalFields; type MaxRegistrars = MaxRegistrars; type Slashed = Treasury; - type ForceOrigin = MoreThanHalfCouncil; - type RegistrarOrigin = MoreThanHalfCouncil; + type ForceOrigin = EitherOf, GeneralAdmin>; + type RegistrarOrigin = EitherOf, GeneralAdmin>; type WeightInfo = weights::pallet_identity::WeightInfo; } @@ -677,16 +657,11 @@ parameter_types! { pub const RootSpendOriginMaxAmount: Balance = Balance::MAX; } -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 = EitherOfDiverse, Treasurer>; + type RejectOrigin = EitherOfDiverse, Treasurer>; type RuntimeEvent = RuntimeEvent; type OnSlash = Treasury; type ProposalBond = ProposalBond; @@ -698,7 +673,7 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = Bounties; type MaxApprovals = MaxApprovals; type WeightInfo = weights::pallet_treasury::WeightInfo; - type SpendOrigin = frame_system::EnsureRootWithSuccess; + type SpendOrigin = TreasurySpender; } parameter_types! { @@ -883,8 +858,7 @@ impl claims::Config for Runtime { type VestingSchedule = Vesting; type Prefix = Prefix; /// At least 3/4 of the council must agree to a claim move before it can happen. - type MoveClaimOrigin = - pallet_collective::EnsureProportionAtLeast; + type MoveClaimOrigin = EnsureRoot; type WeightInfo = weights::runtime_common_claims::WeightInfo; } @@ -1214,7 +1188,7 @@ impl slots::Config for Runtime { type Registrar = Registrar; type LeasePeriod = LeasePeriod; type LeaseOffset = LeaseOffset; - type ForceOrigin = MoreThanHalfCouncil; + type ForceOrigin = EitherOf, LeaseAdmin>; type WeightInfo = weights::runtime_common_slots::WeightInfo; } @@ -1250,11 +1224,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 +1231,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; } diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 4f817093703a..469381349579 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -17,8 +17,8 @@ //! XCM configuration for Polkadot. use super::{ - parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, ParaId, - Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmPallet, + parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Fellows, ParaId, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmPallet, StakingAdmin, }; use frame_support::{ match_types, parameter_types, @@ -33,7 +33,7 @@ use xcm_builder::{ AllowTopLevelPaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, MintLocation, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, OriginToPluralityVoice, }; use xcm_executor::traits::WithOriginFilter; @@ -339,6 +339,10 @@ impl xcm_executor::Config for XcmConfig { parameter_types! { pub const CouncilBodyId: BodyId = BodyId::Executive; + // StakingAdmin pluralistic body. + pub const StakingAdminBodyId: BodyId = BodyId::Defense; + // Fellows pluralistic body. + pub const FellowsBodyId: BodyId = BodyId::Technical; } #[cfg(feature = "runtime-benchmarks")] @@ -353,12 +357,23 @@ pub type CouncilToPlurality = BackingToPlurality< CouncilBodyId, >; -/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location -/// of this chain. +/// Type to convert the `StakingAdmin` origin to a Plurality `MultiLocation` value. +pub type StakingAdminToPlurality = + OriginToPluralityVoice; + +/// Type to convert the Fellows origin to a Plurality `MultiLocation` value. +pub type FellowsToPlurality = OriginToPluralityVoice; + +/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an interior location +/// of this chain for a destination chain. pub type LocalOriginToLocation = ( // We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the // `Unit` body. CouncilToPlurality, + // StakingAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value. + StakingAdminToPlurality, + // Fellows origin to be used in XCM as a corresponding Plurality `MultiLocation` value. + FellowsToPlurality, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 SignedToAccountId32, ); From 9d50725734c626d2e169f064aaefe799c0c248c0 Mon Sep 17 00:00:00 2001 From: Gav Date: Fri, 10 Feb 2023 17:46:25 +0000 Subject: [PATCH 03/26] Formatting --- runtime/polkadot/src/lib.rs | 4 ++-- runtime/polkadot/src/xcm_config.rs | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 0ee5a8fc08ed..a88c76c4947f 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -41,8 +41,8 @@ use frame_election_provider_support::{generate_solution_type, onchain, Sequentia use frame_support::{ construct_runtime, parameter_types, traits::{ - ConstU32, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, - PrivilegeCmp, WithdrawReasons, EitherOf, + ConstU32, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, + PrivilegeCmp, WithdrawReasons, }, weights::ConstantMultiplier, PalletId, RuntimeDebug, diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 469381349579..b0e0551f80db 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -17,8 +17,9 @@ //! XCM configuration for Polkadot. use super::{ - parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Fellows, ParaId, - Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmPallet, StakingAdmin, + parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Fellows, + ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, + XcmPallet, }; use frame_support::{ match_types, parameter_types, @@ -32,8 +33,9 @@ use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, - IsConcrete, MintLocation, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, OriginToPluralityVoice, + IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, + WithComputedOrigin, }; use xcm_executor::traits::WithOriginFilter; From a82433321a1fd0234cca1e507d595a1a7e22acf9 Mon Sep 17 00:00:00 2001 From: Gav Date: Sat, 11 Feb 2023 18:10:28 +0100 Subject: [PATCH 04/26] Missing files --- runtime/polkadot/src/governance/fellowship.rs | 369 ++++++++++++++++++ runtime/polkadot/src/governance/mod.rs | 96 +++++ runtime/polkadot/src/governance/old.rs | 184 +++++++++ runtime/polkadot/src/governance/origins.rs | 194 +++++++++ runtime/polkadot/src/governance/tracks.rs | 320 +++++++++++++++ .../src/weights/pallet_conviction_voting.rs | 125 ++++++ .../src/weights/pallet_ranked_collective.rs | 120 ++++++ .../pallet_referenda_fellowship_referenda.rs | 306 +++++++++++++++ .../src/weights/pallet_referenda_referenda.rs | 305 +++++++++++++++ .../polkadot/src/weights/pallet_whitelist.rs | 86 ++++ 10 files changed, 2105 insertions(+) create mode 100644 runtime/polkadot/src/governance/fellowship.rs create mode 100644 runtime/polkadot/src/governance/mod.rs create mode 100644 runtime/polkadot/src/governance/old.rs create mode 100644 runtime/polkadot/src/governance/origins.rs create mode 100644 runtime/polkadot/src/governance/tracks.rs create mode 100644 runtime/polkadot/src/weights/pallet_conviction_voting.rs create mode 100644 runtime/polkadot/src/weights/pallet_ranked_collective.rs create mode 100644 runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs create mode 100644 runtime/polkadot/src/weights/pallet_referenda_referenda.rs create mode 100644 runtime/polkadot/src/weights/pallet_whitelist.rs diff --git a/runtime/polkadot/src/governance/fellowship.rs b/runtime/polkadot/src/governance/fellowship.rs new file mode 100644 index 000000000000..5cd5d30e2f2f --- /dev/null +++ b/runtime/polkadot/src/governance/fellowship.rs @@ -0,0 +1,369 @@ +// 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, DOLLARS}; + +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 * DOLLARS, + 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), + }, + }, + ), + ( + 1u16, + pallet_referenda::TrackInfo { + name: "members", + max_deciding: 10, + decision_deposit: 10 * DOLLARS, + 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), + }, + }, + ), + ( + 2u16, + pallet_referenda::TrackInfo { + name: "proficients", + max_deciding: 10, + decision_deposit: 10 * DOLLARS, + 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), + }, + }, + ), + ( + 3u16, + pallet_referenda::TrackInfo { + name: "fellows", + max_deciding: 10, + decision_deposit: 10 * DOLLARS, + 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 * DOLLARS, + 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), + }, + }, + ), + ( + 5u16, + pallet_referenda::TrackInfo { + name: "experts", + max_deciding: 10, + decision_deposit: 1 * DOLLARS, + 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), + }, + }, + ), + ( + 6u16, + pallet_referenda::TrackInfo { + name: "senior experts", + max_deciding: 10, + decision_deposit: 1 * DOLLARS, + 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), + }, + }, + ), + ( + 7u16, + pallet_referenda::TrackInfo { + name: "masters", + max_deciding: 10, + decision_deposit: 1 * DOLLARS, + 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), + }, + }, + ), + ( + 8u16, + pallet_referenda::TrackInfo { + name: "senior masters", + max_deciding: 10, + decision_deposit: 1 * DOLLARS, + 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), + }, + }, + ), + ( + 9u16, + pallet_referenda::TrackInfo { + name: "grand masters", + max_deciding: 10, + decision_deposit: 1 * DOLLARS, + 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), + }, + }, + ), + ]; + &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; + type Preimages = Preimage; +} + +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/polkadot/src/governance/mod.rs b/runtime/polkadot/src/governance/mod.rs new file mode 100644 index 000000000000..fb167d085ae1 --- /dev/null +++ b/runtime/polkadot/src/governance/mod.rs @@ -0,0 +1,96 @@ +// 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 . + +//! 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, Treasurer, 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::tokens::currency::ActiveIssuanceOf; + type Polls = Referenda; +} + +parameter_types! { + pub const AlarmInterval: BlockNumber = 1; + pub const SubmissionDeposit: Balance = 1 * DOLLARS; + pub const UndecidingTimeout: BlockNumber = 14 * 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 Preimages = 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 = EitherOf, ReferendumCanceller>; + type KillOrigin = EitherOf, 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; + type Preimages = Preimage; +} diff --git a/runtime/polkadot/src/governance/old.rs b/runtime/polkadot/src/governance/old.rs new file mode 100644 index 000000000000..7b409a35dc3e --- /dev/null +++ b/runtime/polkadot/src/governance/old.rs @@ -0,0 +1,184 @@ +// 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 . + +//! Old governance configurations for the Kusama runtime. + +use crate::*; +use frame_support::{parameter_types, traits::EitherOfDiverse}; + +parameter_types! { + pub LaunchPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 1, "DOT_LAUNCH_PERIOD"); + pub VotingPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 1 * MINUTES, "DOT_VOTING_PERIOD"); + pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "DOT_FAST_TRACK_VOTING_PERIOD"); + pub const MinimumDeposit: Balance = 100 * DOLLARS; + pub EnactmentPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 1, "DOT_ENACTMENT_PERIOD"); + pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "DOT_COOLOFF_PERIOD"); + pub const InstantAllowed: bool = true; + pub const MaxVotes: u32 = 100; + pub const MaxProposals: u32 = 100; +} + +impl pallet_democracy::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type EnactmentPeriod = EnactmentPeriod; + type VoteLockingPeriod = EnactmentPeriod; + type LaunchPeriod = LaunchPeriod; + type VotingPeriod = VotingPeriod; + type MinimumDeposit = MinimumDeposit; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + frame_system::EnsureRoot, + >; + /// A 60% super-majority can have the next scheduled referendum be a straight majority-carries vote. + type ExternalMajorityOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + frame_system::EnsureRoot, + >; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + frame_system::EnsureRoot, + >; + /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote + /// be tabled immediately and with a shorter voting/enactment period. + type FastTrackOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + frame_system::EnsureRoot, + >; + type InstantOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + frame_system::EnsureRoot, + >; + type InstantAllowed = InstantAllowed; + type FastTrackVotingPeriod = FastTrackVotingPeriod; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, + >; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, + >; + type BlacklistOrigin = EnsureRoot; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cooloff period. + type VetoOrigin = pallet_collective::EnsureMember; + type CooloffPeriod = CooloffPeriod; + type Slash = Treasury; + type Scheduler = Scheduler; + type PalletsOrigin = OriginCaller; + type MaxVotes = MaxVotes; + type WeightInfo = weights::pallet_democracy::WeightInfo; + type MaxProposals = MaxProposals; + type Preimages = Preimage; + type MaxDeposits = ConstU32<100>; + type MaxBlacklisted = ConstU32<100>; +} + +parameter_types! { + pub CouncilMotionDuration: BlockNumber = prod_or_fast!(7 * DAYS, 2 * MINUTES, "DOT_MOTION_DURATION"); + pub const CouncilMaxProposals: u32 = 100; + pub const CouncilMaxMembers: u32 = 100; +} + +pub type CouncilCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type MaxMembers = CouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective_council::WeightInfo; +} + +parameter_types! { + pub const CandidacyBond: Balance = 100 * DOLLARS; + // 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); + /// Weekly council elections; scaling up to monthly eventually. + pub TermDuration: BlockNumber = prod_or_fast!(7 * DAYS, 2 * MINUTES, "DOT_TERM_DURATION"); + /// 13 members initially, to be increased to 23 eventually. + pub const DesiredMembers: u32 = 13; + pub const DesiredRunnersUp: u32 = 20; + pub const MaxVoters: u32 = 10 * 1000; + pub const MaxVotesPerVoter: u32 = 16; + pub const MaxCandidates: u32 = 1000; + pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; +} +// Make sure that there are no more than `MaxMembers` members elected via phragmen. +const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); + +impl pallet_elections_phragmen::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type PalletId = PhragmenElectionPalletId; + type Currency = Balances; + type ChangeMembers = Council; + type InitializeMembers = Council; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type CandidacyBond = CandidacyBond; + type VotingBondBase = VotingBondBase; + type VotingBondFactor = VotingBondFactor; + type LoserCandidate = Treasury; + type KickedMember = Treasury; + type DesiredMembers = DesiredMembers; + type DesiredRunnersUp = DesiredRunnersUp; + type TermDuration = TermDuration; + type MaxVoters = MaxVoters; + type MaxVotesPerVoter = MaxVotesPerVoter; + type MaxCandidates = MaxCandidates; + type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; +} + +parameter_types! { + pub const TechnicalMotionDuration: BlockNumber = 7 * DAYS; + pub const TechnicalMaxProposals: u32 = 100; + pub const TechnicalMaxMembers: u32 = 100; +} + +pub type TechnicalCollective = pallet_collective::Instance2; +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = TechnicalMotionDuration; + type MaxProposals = TechnicalMaxProposals; + type MaxMembers = TechnicalMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; +} + +impl pallet_membership::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddOrigin = EnsureRoot; + type RemoveOrigin = EnsureRoot; + type SwapOrigin = EnsureRoot; + type ResetOrigin = EnsureRoot; + type PrimeOrigin = EnsureRoot; + type MembershipInitialized = TechnicalCommittee; + type MembershipChanged = TechnicalCommittee; + type MaxMembers = TechnicalMaxMembers; + type WeightInfo = weights::pallet_membership::WeightInfo; +} diff --git a/runtime/polkadot/src/governance/origins.rs b/runtime/polkadot/src/governance/origins.rs new file mode 100644 index 000000000000..a7b0b569c527 --- /dev/null +++ b/runtime/polkadot/src/governance/origins.rs @@ -0,0 +1,194 @@ +// 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, DOLLARS, GRAND}; + 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, + Treasurer, + 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 * DOLLARS, + BigTipper = 1 * GRAND, + SmallSpender = 10 * GRAND, + MediumSpender = 100 * GRAND, + BigSpender = 1_000 * GRAND, + Treasurer = 10_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/polkadot/src/governance/tracks.rs b/runtime/polkadot/src/governance/tracks.rs new file mode 100644 index 000000000000..bac1c354f145 --- /dev/null +++ b/runtime/polkadot/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(5), percent(50)); + +const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15] = [ + ( + 0, + pallet_referenda::TrackInfo { + name: "root", + max_deciding: 1, + decision_deposit: 100 * GRAND, + prepare_period: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 24 * HOURS, + min_enactment_period: 24 * HOURS, + min_approval: APP_ROOT, + min_support: SUP_ROOT, + }, + ), + ( + 1, + pallet_referenda::TrackInfo { + name: "whitelisted_caller", + max_deciding: 100, + decision_deposit: 10 * GRAND, + prepare_period: 30 * MINUTES, + decision_period: 28 * DAYS, + confirm_period: 10 * MINUTES, + min_enactment_period: 10 * 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: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 3 * HOURS, + min_enactment_period: 10 * MINUTES, + min_approval: APP_STAKING_ADMIN, + min_support: SUP_STAKING_ADMIN, + }, + ), + ( + 11, + pallet_referenda::TrackInfo { + name: "treasurer", + max_deciding: 10, + decision_deposit: 1 * GRAND, + prepare_period: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 3 * HOURS, + min_enactment_period: 24 * HOURS, + min_approval: APP_TREASURER, + min_support: SUP_TREASURER, + }, + ), + ( + 12, + pallet_referenda::TrackInfo { + name: "lease_admin", + max_deciding: 10, + decision_deposit: 5 * GRAND, + prepare_period: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 3 * HOURS, + min_enactment_period: 10 * MINUTES, + 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: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 3 * HOURS, + min_enactment_period: 10 * MINUTES, + 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: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 3 * HOURS, + min_enactment_period: 10 * MINUTES, + 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: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 3 * HOURS, + min_enactment_period: 10 * MINUTES, + min_approval: APP_AUCTION_ADMIN, + min_support: SUP_AUCTION_ADMIN, + }, + ), + ( + 20, + pallet_referenda::TrackInfo { + name: "referendum_canceller", + max_deciding: 1_000, + decision_deposit: 10 * GRAND, + prepare_period: 2 * HOURS, + decision_period: 7 * 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: 2 * HOURS, + 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: 1 * DOLLARS, + prepare_period: 1 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 10 * MINUTES, + min_enactment_period: 1 * MINUTES, + min_approval: APP_SMALL_TIPPER, + min_support: SUP_SMALL_TIPPER, + }, + ), + ( + 31, + pallet_referenda::TrackInfo { + name: "big_tipper", + max_deciding: 100, + decision_deposit: 10 * DOLLARS, + prepare_period: 10 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 1 * HOURS, + min_enactment_period: 10 * MINUTES, + min_approval: APP_BIG_TIPPER, + min_support: SUP_BIG_TIPPER, + }, + ), + ( + 32, + pallet_referenda::TrackInfo { + name: "small_spender", + max_deciding: 50, + decision_deposit: 100 * DOLLARS, + prepare_period: 4 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 12 * HOURS, + min_enactment_period: 24 * HOURS, + min_approval: APP_SMALL_SPENDER, + min_support: SUP_SMALL_SPENDER, + }, + ), + ( + 33, + pallet_referenda::TrackInfo { + name: "medium_spender", + max_deciding: 50, + decision_deposit: 200 * DOLLARS, + prepare_period: 4 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 24 * HOURS, + min_enactment_period: 24 * HOURS, + min_approval: APP_MEDIUM_SPENDER, + min_support: SUP_MEDIUM_SPENDER, + }, + ), + ( + 34, + pallet_referenda::TrackInfo { + name: "big_spender", + max_deciding: 50, + decision_deposit: 400 * DOLLARS, + prepare_period: 4 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 48 * HOURS, + min_enactment_period: 24 * HOURS, + 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/polkadot/src/weights/pallet_conviction_voting.rs b/runtime/polkadot/src/weights/pallet_conviction_voting.rs new file mode 100644 index 000000000000..c61d1775a58d --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_conviction_voting.rs @@ -0,0 +1,125 @@ +// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_conviction_voting +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --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:1 w:1) + fn vote_new() -> Weight { + // Minimum execution time: 176_250 nanoseconds. + Weight::from_ref_time(183_105_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // 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 { + // Minimum execution time: 239_904 nanoseconds. + Weight::from_ref_time(248_494_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + // 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 { + // Minimum execution time: 209_359 nanoseconds. + Weight::from_ref_time(222_154_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: ConvictionVoting VotingFor (r:1 w:1) + // Storage: Referenda ReferendumInfoFor (r:1 w:0) + fn remove_other_vote() -> Weight { + // Minimum execution time: 103_052 nanoseconds. + Weight::from_ref_time(107_461_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // 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 { + // Minimum execution time: 102_070 nanoseconds. + Weight::from_ref_time(1_776_040_090) + // Standard Error: 149_833 + .saturating_add(Weight::from_ref_time(38_268_419).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + } + // 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 { + // Minimum execution time: 75_841 nanoseconds. + Weight::from_ref_time(1_698_737_760) + // Standard Error: 145_937 + .saturating_add(Weight::from_ref_time(38_386_704).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + } + // Storage: ConvictionVoting VotingFor (r:1 w:1) + // Storage: ConvictionVoting ClassLocksFor (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn unlock() -> Weight { + // Minimum execution time: 130_072 nanoseconds. + Weight::from_ref_time(132_988_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/polkadot/src/weights/pallet_ranked_collective.rs b/runtime/polkadot/src/weights/pallet_ranked_collective.rs new file mode 100644 index 000000000000..e7f16e5ebdeb --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_ranked_collective.rs @@ -0,0 +1,120 @@ +// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_ranked_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --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 { + // Minimum execution time: 21_687 nanoseconds. + Weight::from_ref_time(22_505_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // 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 { + // Minimum execution time: 32_770 nanoseconds. + Weight::from_ref_time(34_644_917) + // Standard Error: 15_325 + .saturating_add(Weight::from_ref_time(11_355_769).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) + } + // 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 { + // Minimum execution time: 23_990 nanoseconds. + Weight::from_ref_time(25_072_856) + // Standard Error: 5_793 + .saturating_add(Weight::from_ref_time(404_905).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // 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 { + // Minimum execution time: 32_952 nanoseconds. + Weight::from_ref_time(35_465_453) + // Standard Error: 16_850 + .saturating_add(Weight::from_ref_time(671_524).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // 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 { + // Minimum execution time: 50_688 nanoseconds. + Weight::from_ref_time(51_397_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:0) + // Storage: FellowshipCollective VotingCleanup (r:1 w:0) + // Storage: FellowshipCollective Voting (r:0 w:2) + /// The range of component `n` is `[0, 100]`. + fn cleanup_poll(n: u32, ) -> Weight { + // Minimum execution time: 15_422 nanoseconds. + Weight::from_ref_time(18_535_259) + // Standard Error: 2_621 + .saturating_add(Weight::from_ref_time(1_164_868).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } +} diff --git a/runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs b/runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs new file mode 100644 index 000000000000..63af860b5c98 --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs @@ -0,0 +1,306 @@ +// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_referenda +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --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 { + // Minimum execution time: 33_277 nanoseconds. + Weight::from_ref_time(33_960_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + fn place_decision_deposit_preparing() -> Weight { + // Minimum execution time: 53_029 nanoseconds. + Weight::from_ref_time(54_668_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // 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 { + // Minimum execution time: 90_942 nanoseconds. + Weight::from_ref_time(102_908_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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 { + // Minimum execution time: 93_418 nanoseconds. + Weight::from_ref_time(102_043_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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 { + // Minimum execution time: 204_407 nanoseconds. + Weight::from_ref_time(221_043_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // 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 { + // Minimum execution time: 46_345 nanoseconds. + Weight::from_ref_time(48_000_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + fn refund_decision_deposit() -> Weight { + // Minimum execution time: 32_528 nanoseconds. + Weight::from_ref_time(33_923_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + fn refund_submission_deposit() -> Weight { + // Minimum execution time: 21_065 nanoseconds. + Weight::from_ref_time(21_947_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + fn cancel() -> Weight { + // Minimum execution time: 41_541 nanoseconds. + Weight::from_ref_time(43_091_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + fn kill() -> Weight { + // Minimum execution time: 75_008 nanoseconds. + Weight::from_ref_time(77_437_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: FellowshipReferenda TrackQueue (r:1 w:0) + // Storage: FellowshipReferenda DecidingCount (r:1 w:1) + fn one_fewer_deciding_queue_empty() -> Weight { + // Minimum execution time: 10_620 nanoseconds. + Weight::from_ref_time(11_309_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // 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 { + // Minimum execution time: 167_988 nanoseconds. + Weight::from_ref_time(179_043_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // 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 { + // Minimum execution time: 171_829 nanoseconds. + Weight::from_ref_time(183_097_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: FellowshipReferenda TrackQueue (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:0) + fn nudge_referendum_requeued_insertion() -> Weight { + // Minimum execution time: 99_225 nanoseconds. + Weight::from_ref_time(109_234_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: FellowshipReferenda TrackQueue (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:0) + fn nudge_referendum_requeued_slide() -> Weight { + // Minimum execution time: 100_605 nanoseconds. + Weight::from_ref_time(109_740_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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:0) + fn nudge_referendum_queued() -> Weight { + // Minimum execution time: 105_414 nanoseconds. + Weight::from_ref_time(112_810_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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:0) + fn nudge_referendum_not_queued() -> Weight { + // Minimum execution time: 100_969 nanoseconds. + Weight::from_ref_time(114_514_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_no_deposit() -> Weight { + // Minimum execution time: 29_982 nanoseconds. + Weight::from_ref_time(31_303_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_preparing() -> Weight { + // Minimum execution time: 30_756 nanoseconds. + Weight::from_ref_time(31_875_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) + fn nudge_referendum_timed_out() -> Weight { + // Minimum execution time: 22_922 nanoseconds. + Weight::from_ref_time(23_811_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // 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 { + // Minimum execution time: 42_030 nanoseconds. + Weight::from_ref_time(43_505_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // 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 { + // Minimum execution time: 95_523 nanoseconds. + Weight::from_ref_time(102_104_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // 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 { + // Minimum execution time: 166_858 nanoseconds. + Weight::from_ref_time(190_720_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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 { + // Minimum execution time: 165_354 nanoseconds. + Weight::from_ref_time(185_408_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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 { + // Minimum execution time: 167_797 nanoseconds. + Weight::from_ref_time(182_086_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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 { + // Minimum execution time: 87_123 nanoseconds. + Weight::from_ref_time(94_538_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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) + fn nudge_referendum_approved() -> Weight { + // Minimum execution time: 177_202 nanoseconds. + Weight::from_ref_time(194_662_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // 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 { + // Minimum execution time: 154_150 nanoseconds. + Weight::from_ref_time(185_014_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + fn set_some_metadata() -> Weight { + Weight::from_parts(20_490_000, 5407) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + fn clear_metadata() -> Weight { + Weight::from_parts(19_917_000, 5368) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/runtime/polkadot/src/weights/pallet_referenda_referenda.rs b/runtime/polkadot/src/weights/pallet_referenda_referenda.rs new file mode 100644 index 000000000000..cb86cee7aa97 --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_referenda_referenda.rs @@ -0,0 +1,305 @@ +// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_referenda +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --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 { + // Minimum execution time: 38_444 nanoseconds. + Weight::from_ref_time(40_157_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + fn place_decision_deposit_preparing() -> Weight { + // Minimum execution time: 52_464 nanoseconds. + Weight::from_ref_time(53_840_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // 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 { + // Minimum execution time: 59_684 nanoseconds. + Weight::from_ref_time(62_639_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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 { + // Minimum execution time: 59_614 nanoseconds. + Weight::from_ref_time(61_921_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Referenda DecidingCount (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:2 w:2) + fn place_decision_deposit_passing() -> Weight { + // Minimum execution time: 67_948 nanoseconds. + Weight::from_ref_time(69_857_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Referenda DecidingCount (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + fn place_decision_deposit_failing() -> Weight { + // Minimum execution time: 46_712 nanoseconds. + Weight::from_ref_time(47_618_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + fn refund_decision_deposit() -> Weight { + // Minimum execution time: 31_886 nanoseconds. + Weight::from_ref_time(33_383_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + fn refund_submission_deposit() -> Weight { + // Minimum execution time: 31_464 nanoseconds. + Weight::from_ref_time(32_332_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + fn cancel() -> Weight { + // Minimum execution time: 40_661 nanoseconds. + Weight::from_ref_time(42_037_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + fn kill() -> Weight { + // Minimum execution time: 87_937 nanoseconds. + Weight::from_ref_time(90_171_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Referenda TrackQueue (r:1 w:0) + // Storage: Referenda DecidingCount (r:1 w:1) + fn one_fewer_deciding_queue_empty() -> Weight { + // Minimum execution time: 10_962 nanoseconds. + Weight::from_ref_time(11_292_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Referenda TrackQueue (r:1 w:1) + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:2 w:2) + fn one_fewer_deciding_failing() -> Weight { + // Minimum execution time: 123_968 nanoseconds. + Weight::from_ref_time(132_776_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Referenda TrackQueue (r:1 w:1) + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:2 w:2) + fn one_fewer_deciding_passing() -> Weight { + // Minimum execution time: 124_456 nanoseconds. + Weight::from_ref_time(133_803_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Referenda TrackQueue (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:0) + fn nudge_referendum_requeued_insertion() -> Weight { + // Minimum execution time: 67_800 nanoseconds. + Weight::from_ref_time(72_433_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Referenda TrackQueue (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:0) + fn nudge_referendum_requeued_slide() -> Weight { + // Minimum execution time: 67_119 nanoseconds. + Weight::from_ref_time(72_291_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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:0) + fn nudge_referendum_queued() -> Weight { + // Minimum execution time: 69_519 nanoseconds. + Weight::from_ref_time(75_088_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // 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:0) + fn nudge_referendum_not_queued() -> Weight { + // Minimum execution time: 68_612 nanoseconds. + Weight::from_ref_time(75_595_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_no_deposit() -> Weight { + // Minimum execution time: 29_767 nanoseconds. + Weight::from_ref_time(30_670_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_preparing() -> Weight { + // Minimum execution time: 30_082 nanoseconds. + Weight::from_ref_time(31_089_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + fn nudge_referendum_timed_out() -> Weight { + // Minimum execution time: 22_203 nanoseconds. + Weight::from_ref_time(23_408_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Referenda DecidingCount (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_begin_deciding_failing() -> Weight { + // Minimum execution time: 42_086 nanoseconds. + Weight::from_ref_time(44_532_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Referenda DecidingCount (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_begin_deciding_passing() -> Weight { + // Minimum execution time: 44_254 nanoseconds. + Weight::from_ref_time(45_996_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_begin_confirming() -> Weight { + // Minimum execution time: 40_864 nanoseconds. + Weight::from_ref_time(42_518_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_end_confirming() -> Weight { + // Minimum execution time: 41_997 nanoseconds. + Weight::from_ref_time(43_555_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_continue_not_confirming() -> Weight { + // Minimum execution time: 39_163 nanoseconds. + Weight::from_ref_time(40_633_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_continue_confirming() -> Weight { + // Minimum execution time: 38_260 nanoseconds. + Weight::from_ref_time(39_494_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: Scheduler Lookup (r:1 w:1) + fn nudge_referendum_approved() -> Weight { + // Minimum execution time: 51_267 nanoseconds. + Weight::from_ref_time(54_875_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: Referenda ReferendumInfoFor (r:1 w:1) + // Storage: Balances InactiveIssuance (r:1 w:0) + // Storage: Scheduler Agenda (r:1 w:1) + fn nudge_referendum_rejected() -> Weight { + // Minimum execution time: 41_099 nanoseconds. + Weight::from_ref_time(43_408_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + fn set_some_metadata() -> Weight { + Weight::from_parts(20_490_000, 5407) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + fn clear_metadata() -> Weight { + Weight::from_parts(19_917_000, 5368) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} diff --git a/runtime/polkadot/src/weights/pallet_whitelist.rs b/runtime/polkadot/src/weights/pallet_whitelist.rs new file mode 100644 index 000000000000..788f466f1ac9 --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_whitelist.rs @@ -0,0 +1,86 @@ +// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_whitelist +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --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 { + // Minimum execution time: 24_174 nanoseconds. + Weight::from_ref_time(25_019_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Whitelist WhitelistedCall (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + fn remove_whitelisted_call() -> Weight { + // Minimum execution time: 22_530 nanoseconds. + Weight::from_ref_time(23_064_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: Whitelist WhitelistedCall (r:1 w:1) + // Storage: Preimage PreimageFor (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `n` is `[1, 4194294]`. + fn dispatch_whitelisted_call(n: u32, ) -> Weight { + // Minimum execution time: 32_957 nanoseconds. + Weight::from_ref_time(33_403_000) + // Standard Error: 4 + .saturating_add(Weight::from_ref_time(1_543).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: Whitelist WhitelistedCall (r:1 w:1) + // Storage: Preimage StatusFor (r:1 w:1) + /// The range of component `n` is `[1, 10000]`. + fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight { + // Minimum execution time: 26_062 nanoseconds. + Weight::from_ref_time(26_997_169) + // Standard Error: 6 + .saturating_add(Weight::from_ref_time(1_906).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} From 5efe4856be3718c51c1f7a8e481fe60511f96916 Mon Sep 17 00:00:00 2001 From: Gav Date: Sun, 12 Feb 2023 12:18:39 +0100 Subject: [PATCH 05/26] Remove Gov1 from Kusama --- node/service/src/chain_spec.rs | 16 -- runtime/kusama/src/governance/fellowship.rs | 13 +- runtime/kusama/src/governance/mod.rs | 3 - runtime/kusama/src/governance/old.rs | 174 -------------------- runtime/kusama/src/lib.rs | 51 +----- runtime/kusama/src/xcm_config.rs | 66 +------- runtime/polkadot/src/xcm_config.rs | 14 +- 7 files changed, 20 insertions(+), 317 deletions(-) delete mode 100644 runtime/kusama/src/governance/old.rs diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index 12b65c7ba853..f867cf97ca7d 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -743,14 +743,6 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC slash_reward_fraction: Perbill::from_percent(10), ..Default::default() }, - phragmen_election: Default::default(), - democracy: Default::default(), - council: kusama::CouncilConfig { members: vec![], phantom: Default::default() }, - technical_committee: kusama::TechnicalCommitteeConfig { - members: vec![], - phantom: Default::default(), - }, - technical_membership: Default::default(), babe: kusama::BabeConfig { authorities: Default::default(), epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG), @@ -1442,14 +1434,6 @@ pub fn kusama_testnet_genesis( slash_reward_fraction: Perbill::from_percent(10), ..Default::default() }, - phragmen_election: Default::default(), - democracy: kusama::DemocracyConfig::default(), - council: kusama::CouncilConfig { members: vec![], phantom: Default::default() }, - technical_committee: kusama::TechnicalCommitteeConfig { - members: vec![], - phantom: Default::default(), - }, - technical_membership: Default::default(), babe: kusama::BabeConfig { authorities: Default::default(), epoch_config: Some(kusama::BABE_GENESIS_EPOCH_CONFIG), diff --git a/runtime/kusama/src/governance/fellowship.rs b/runtime/kusama/src/governance/fellowship.rs index 6d01780ebc0c..3e5acf0b4f5f 100644 --- a/runtime/kusama/src/governance/fellowship.rs +++ b/runtime/kusama/src/governance/fellowship.rs @@ -335,18 +335,7 @@ impl pallet_ranked_collective::Config for Runtime // - 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>, - >, - >, + frame_system::EnsureRootWithSuccess>, EitherOf< MapSuccess>>, TryMapSuccess>>, diff --git a/runtime/kusama/src/governance/mod.rs b/runtime/kusama/src/governance/mod.rs index c2db914f647e..d7812e39d7a1 100644 --- a/runtime/kusama/src/governance/mod.rs +++ b/runtime/kusama/src/governance/mod.rs @@ -23,9 +23,6 @@ use frame_support::{ }; use frame_system::EnsureRootWithSuccess; -// Old governance configurations. -pub mod old; - mod origins; pub use origins::{ pallet_custom_origins, AuctionAdmin, Fellows, FellowshipAdmin, FellowshipExperts, diff --git a/runtime/kusama/src/governance/old.rs b/runtime/kusama/src/governance/old.rs deleted file mode 100644 index e71a4e600be7..000000000000 --- a/runtime/kusama/src/governance/old.rs +++ /dev/null @@ -1,174 +0,0 @@ -// 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 . - -//! Old governance configurations for the Kusama runtime. - -use crate::*; -use frame_support::{parameter_types, traits::EitherOfDiverse}; - -parameter_types! { - pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD"); - pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD"); - pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD"); - pub const MinimumDeposit: Balance = 100 * CENTS; - pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD"); - pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD"); - pub const InstantAllowed: bool = true; - pub const MaxVotes: u32 = 100; - pub const MaxProposals: u32 = 100; -} - -impl pallet_democracy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type EnactmentPeriod = EnactmentPeriod; - type VoteLockingPeriod = EnactmentPeriod; - type LaunchPeriod = LaunchPeriod; - type VotingPeriod = VotingPeriod; - type MinimumDeposit = MinimumDeposit; - /// A straight majority of the council can decide what their next motion is. - type ExternalOrigin = - pallet_collective::EnsureProportionAtLeast; - /// A majority can have the next scheduled referendum be a straight majority-carries vote. - type ExternalMajorityOrigin = - pallet_collective::EnsureProportionAtLeast; - /// A unanimous council can have the next scheduled referendum be a straight default-carries - /// (NTB) vote. - type ExternalDefaultOrigin = - pallet_collective::EnsureProportionAtLeast; - /// Two thirds of the technical committee can have an `ExternalMajority/ExternalDefault` vote - /// be tabled immediately and with a shorter voting/enactment period. - type FastTrackOrigin = - pallet_collective::EnsureProportionAtLeast; - type InstantOrigin = - pallet_collective::EnsureProportionAtLeast; - type InstantAllowed = InstantAllowed; - type FastTrackVotingPeriod = FastTrackVotingPeriod; - // To cancel a proposal which has been passed, 2/3 of the council must agree to it. - type CancellationOrigin = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionAtLeast, - >; - type BlacklistOrigin = EnsureRoot; - // To cancel a proposal before it has been passed, the technical committee must be unanimous or - // Root must agree. - type CancelProposalOrigin = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionAtLeast, - >; - // Any single technical committee member may veto a coming council proposal, however they can - // only do it once and it lasts only for the cooloff period. - type VetoOrigin = pallet_collective::EnsureMember; - type CooloffPeriod = CooloffPeriod; - type Slash = Treasury; - type Scheduler = Scheduler; - type PalletsOrigin = OriginCaller; - type MaxVotes = MaxVotes; - type WeightInfo = weights::pallet_democracy::WeightInfo; - type MaxProposals = MaxProposals; - type Preimages = Preimage; - type MaxDeposits = ConstU32<100>; - type MaxBlacklisted = ConstU32<100>; -} - -parameter_types! { - pub CouncilMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); - pub const CouncilMaxProposals: u32 = 100; - pub const CouncilMaxMembers: u32 = 100; -} - -pub type CouncilCollective = pallet_collective::Instance1; -impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = CouncilMotionDuration; - type MaxProposals = CouncilMaxProposals; - type MaxMembers = CouncilMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective_council::WeightInfo; -} - -parameter_types! { - pub const CandidacyBond: Balance = 100 * CENTS; - // 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 TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "KSM_TERM_DURATION"); - pub const DesiredMembers: u32 = 19; - pub const DesiredRunnersUp: u32 = 19; - pub const MaxVotesPerVoter: u32 = 16; - pub const MaxVoters: u32 = 10 * 1000; - pub const MaxCandidates: u32 = 1000; - pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; -} - -// Make sure that there are no more than `MaxMembers` members elected via Phragmen. -const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); - -impl pallet_elections_phragmen::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type ChangeMembers = Council; - type InitializeMembers = Council; - type CurrencyToVote = frame_support::traits::U128CurrencyToVote; - type CandidacyBond = CandidacyBond; - type VotingBondBase = VotingBondBase; - type VotingBondFactor = VotingBondFactor; - type LoserCandidate = Treasury; - type KickedMember = Treasury; - type DesiredMembers = DesiredMembers; - type DesiredRunnersUp = DesiredRunnersUp; - type TermDuration = TermDuration; - type MaxVoters = MaxVoters; - type MaxCandidates = MaxCandidates; - type MaxVotesPerVoter = MaxVotesPerVoter; - type PalletId = PhragmenElectionPalletId; - type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; -} - -parameter_types! { - pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION"); - pub const TechnicalMaxProposals: u32 = 100; - pub const TechnicalMaxMembers: u32 = 100; -} - -pub type TechnicalCollective = pallet_collective::Instance2; -impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = TechnicalMotionDuration; - type MaxProposals = TechnicalMaxProposals; - type MaxMembers = TechnicalMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo; -} - -impl pallet_membership::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AddOrigin = EnsureRoot; - type RemoveOrigin = EnsureRoot; - type SwapOrigin = EnsureRoot; - type ResetOrigin = EnsureRoot; - type PrimeOrigin = EnsureRoot; - type MembershipInitialized = TechnicalCommittee; - type MembershipChanged = TechnicalCommittee; - type MaxMembers = TechnicalMaxMembers; - type WeightInfo = weights::pallet_membership::WeightInfo; -} diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 69c6e7da48f4..fef2182997a8 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -54,7 +54,7 @@ use frame_support::{ construct_runtime, parameter_types, traits::{ ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, - LockIdentifier, PrivilegeCmp, StorageMapShim, WithdrawReasons, + PrivilegeCmp, StorageMapShim, WithdrawReasons, }, weights::ConstantMultiplier, PalletId, RuntimeDebug, @@ -79,7 +79,6 @@ use sp_staking::SessionIndex; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use static_assertions::const_assert; pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; @@ -106,8 +105,8 @@ pub mod xcm_config; // Governance configurations. pub mod governance; use governance::{ - old::CouncilCollective, pallet_custom_origins, AuctionAdmin, Fellows, GeneralAdmin, LeaseAdmin, - StakingAdmin, Treasurer, TreasurySpender, + pallet_custom_origins, AuctionAdmin, Fellows, GeneralAdmin, LeaseAdmin, StakingAdmin, + Treasurer, TreasurySpender, }; #[cfg(test)] @@ -206,11 +205,6 @@ impl PrivilegeCmp for OriginPrivilegeCmp { match (left, right) { // Root is greater than anything. (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), - // Check which one has more yes votes. - ( - OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), - OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), - ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), // For every other origin we don't care, as they are not used for `ScheduleOrigin`. _ => None, } @@ -683,17 +677,6 @@ impl pallet_child_bounties::Config for Runtime { type WeightInfo = weights::pallet_child_bounties::WeightInfo; } -impl pallet_tips::Config for Runtime { - type MaximumReasonLength = MaximumReasonLength; - type DataDepositPerByte = DataDepositPerByte; - type Tippers = PhragmenElection; - type TipCountdown = TipCountdown; - type TipFindersFee = TipFindersFee; - type TipReportDepositBase = TipReportDepositBase; - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_tips::WeightInfo; -} - impl pallet_offences::Config for Runtime { type RuntimeEvent = RuntimeEvent; type IdentificationTuple = pallet_session::historical::IdentificationTuple; @@ -996,15 +979,9 @@ impl InstanceFilter for ProxyType { RuntimeCall::Session(..) | RuntimeCall::Grandpa(..) | RuntimeCall::ImOnline(..) | - RuntimeCall::Democracy(..) | - RuntimeCall::Council(..) | - RuntimeCall::TechnicalCommittee(..) | - RuntimeCall::PhragmenElection(..) | - RuntimeCall::TechnicalMembership(..) | RuntimeCall::Treasury(..) | RuntimeCall::Bounties(..) | RuntimeCall::ChildBounties(..) | - RuntimeCall::Tips(..) | RuntimeCall::ConvictionVoting(..) | RuntimeCall::Referenda(..) | RuntimeCall::FellowshipCollective(..) | @@ -1041,12 +1018,9 @@ impl InstanceFilter for ProxyType { ), ProxyType::Governance => matches!( c, - RuntimeCall::Democracy(..) | - RuntimeCall::Council(..) | RuntimeCall::TechnicalCommittee(..) | - RuntimeCall::PhragmenElection(..) | - RuntimeCall::Treasury(..) | + RuntimeCall::Treasury(..) | RuntimeCall::Bounties(..) | - RuntimeCall::Tips(..) | RuntimeCall::Utility(..) | + RuntimeCall::Utility(..) | RuntimeCall::ChildBounties(..) | // OpenGov calls RuntimeCall::ConvictionVoting(..) | @@ -1352,13 +1326,7 @@ construct_runtime! { AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 12, // 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, - PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, - 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; @@ -1406,9 +1374,6 @@ construct_runtime! { Bounties: pallet_bounties::{Pallet, Call, Storage, Event} = 35, ChildBounties: pallet_child_bounties = 40, - // Tips module. - Tips: pallet_tips::{Pallet, Call, Storage, Event} = 36, - // Election pallet. Only works with staking, but placed here to maintain indices. ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event, ValidateUnsigned} = 37, @@ -1538,11 +1503,7 @@ mod benches { [frame_benchmarking::baseline, Baseline::] [pallet_bounties, Bounties] [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] [frame_election_provider_support, ElectionProviderBench::] [pallet_fast_unstake, FastUnstake] @@ -1550,7 +1511,6 @@ mod benches { [pallet_identity, Identity] [pallet_im_online, ImOnline] [pallet_indices, Indices] - [pallet_membership, TechnicalMembership] [pallet_multisig, Multisig] [pallet_nomination_pools, NominationPoolsBench::] [pallet_offences, OffencesBench::] @@ -1565,7 +1525,6 @@ mod benches { [pallet_staking, Staking] [frame_system, SystemBench::] [pallet_timestamp, Timestamp] - [pallet_tips, Tips] [pallet_treasury, Treasury] [pallet_utility, Utility] [pallet_vesting, Vesting] diff --git a/runtime/kusama/src/xcm_config.rs b/runtime/kusama/src/xcm_config.rs index f46eca0c8189..b5d13c49e4f1 100644 --- a/runtime/kusama/src/xcm_config.rs +++ b/runtime/kusama/src/xcm_config.rs @@ -17,9 +17,8 @@ //! XCM configurations for the Kusama runtime. use super::{ - parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Fellows, - ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, - XcmPallet, + parachains_origin, AccountId, AllPalletsWithSystem, Balances, Fellows, ParaId, Runtime, + RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, XcmPallet, }; use frame_support::{ match_types, parameter_types, @@ -31,8 +30,8 @@ use sp_core::ConstU32; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality, - ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, + ChildParachainConvertsVia, ChildSystemParachainAsSuperuser, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, @@ -200,49 +199,6 @@ impl Contains for SafeCallFilter { RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::Grandpa(..) | RuntimeCall::ImOnline(..) | - RuntimeCall::Democracy( - pallet_democracy::Call::second { .. } | - pallet_democracy::Call::vote { .. } | - pallet_democracy::Call::emergency_cancel { .. } | - pallet_democracy::Call::fast_track { .. } | - pallet_democracy::Call::veto_external { .. } | - pallet_democracy::Call::cancel_referendum { .. } | - pallet_democracy::Call::delegate { .. } | - pallet_democracy::Call::undelegate { .. } | - pallet_democracy::Call::clear_public_proposals { .. } | - pallet_democracy::Call::unlock { .. } | - pallet_democracy::Call::remove_vote { .. } | - pallet_democracy::Call::remove_other_vote { .. } | - pallet_democracy::Call::blacklist { .. } | - pallet_democracy::Call::cancel_proposal { .. }, - ) | - RuntimeCall::Council( - pallet_collective::Call::vote { .. } | - pallet_collective::Call::close_old_weight { .. } | - pallet_collective::Call::disapprove_proposal { .. } | - pallet_collective::Call::close { .. }, - ) | - RuntimeCall::TechnicalCommittee( - pallet_collective::Call::vote { .. } | - pallet_collective::Call::close_old_weight { .. } | - pallet_collective::Call::disapprove_proposal { .. } | - pallet_collective::Call::close { .. }, - ) | - RuntimeCall::PhragmenElection( - pallet_elections_phragmen::Call::remove_voter { .. } | - pallet_elections_phragmen::Call::submit_candidacy { .. } | - pallet_elections_phragmen::Call::renounce_candidacy { .. } | - pallet_elections_phragmen::Call::remove_member { .. } | - pallet_elections_phragmen::Call::clean_defunct_voters { .. }, - ) | - RuntimeCall::TechnicalMembership( - pallet_membership::Call::add_member { .. } | - pallet_membership::Call::remove_member { .. } | - pallet_membership::Call::swap_member { .. } | - pallet_membership::Call::change_key { .. } | - pallet_membership::Call::set_prime { .. } | - pallet_membership::Call::clear_prime { .. }, - ) | RuntimeCall::Treasury(..) | RuntimeCall::ConvictionVoting(..) | RuntimeCall::Referenda( @@ -377,7 +333,6 @@ impl xcm_executor::Config for XcmConfig { } parameter_types! { - pub const CouncilBodyId: BodyId = BodyId::Executive; // StakingAdmin pluralistic body. pub const StakingAdminBodyId: BodyId = BodyId::Defense; // Fellows pluralistic body. @@ -389,19 +344,9 @@ parameter_types! { pub ReachableDest: Option = Some(Parachain(1000).into()); } -/// Type to convert the council origin to a Plurality `MultiLocation` value. -pub type CouncilToPlurality = BackingToPlurality< - RuntimeOrigin, - pallet_collective::Origin, - CouncilBodyId, ->; - /// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location /// of this chain. pub type LocalOriginToLocation = ( - // We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the - // `Unit` body. - CouncilToPlurality, // And a usual Signed origin to be used in XCM as a corresponding AccountId32 SignedToAccountId32, ); @@ -416,9 +361,6 @@ pub type FellowsToPlurality = OriginToPluralityVoice; +/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location +/// of this chain. +pub type LocalOriginToLocation = ( + CouncilToPlurality, + // And a usual Signed origin to be used in XCM as a corresponding AccountId32 + SignedToAccountId32, +); + /// Type to convert the `StakingAdmin` origin to a Plurality `MultiLocation` value. pub type StakingAdminToPlurality = OriginToPluralityVoice; @@ -368,7 +376,7 @@ pub type FellowsToPlurality = OriginToPluralityVoice, ); impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // Only allow the council to send messages. - type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; + type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally... type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; From 93ccc3306ae3e257ec2e7adb2d1e662c4af01fe9 Mon Sep 17 00:00:00 2001 From: Gav Date: Sun, 12 Feb 2023 13:11:40 +0100 Subject: [PATCH 06/26] Fixes --- runtime/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index a88c76c4947f..0c200ca05389 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -581,7 +581,7 @@ impl pallet_staking::Config for Runtime { type SessionsPerEra = SessionsPerEra; type BondingDuration = BondingDuration; type SlashDeferDuration = SlashDeferDuration; - type AdminOrigin = StakingAdmin; + type AdminOrigin = EitherOf, StakingAdmin>; type SessionInterface = Self; type EraPayout = EraPayout; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; From 1e5595e14dbe22add8ab54a3cbb17cb72372f30a Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Mon, 13 Feb 2023 08:37:22 +0100 Subject: [PATCH 07/26] Update runtime/polkadot/src/governance/origins.rs Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com> --- runtime/polkadot/src/governance/origins.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/origins.rs b/runtime/polkadot/src/governance/origins.rs index a7b0b569c527..24ad739cca1c 100644 --- a/runtime/polkadot/src/governance/origins.rs +++ b/runtime/polkadot/src/governance/origins.rs @@ -32,7 +32,7 @@ pub mod pallet_custom_origins { #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] #[pallet::origin] pub enum Origin { - /// Origin for cancelling slashes. + /// Origin able to cancel slashes and manage minimum commission. StakingAdmin, /// Origin for spending (any amount of) funds. Treasurer, From 1dd65471d4ebad0e09abd96e1bf9e7d80cd8dd35 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 13 Feb 2023 08:40:08 +0100 Subject: [PATCH 08/26] Revert scheduler origin changes --- runtime/kusama/src/lib.rs | 3 +-- runtime/polkadot/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index fef2182997a8..2d1e4e0f79e6 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -217,8 +217,7 @@ impl pallet_scheduler::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; - // TODO: Think more carefully and possibly replace with lower privilege origin. - type ScheduleOrigin = EnsureRoot; + type ScheduleOrigin = EitherOf, AuctionAdmin>; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; type OriginPrivilegeCmp = OriginPrivilegeCmp; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 0c200ca05389..c5199c701361 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -212,7 +212,7 @@ impl pallet_scheduler::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = EnsureRoot; + type ScheduleOrigin = EitherOf, AuctionAdmin>;s type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; type OriginPrivilegeCmp = OriginPrivilegeCmp; From 8b789a3b2374aa9c662d615242cbe17a1ebca10f Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 13 Feb 2023 08:40:18 +0100 Subject: [PATCH 09/26] Fixes --- runtime/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index c5199c701361..55b4451839e6 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -212,7 +212,7 @@ impl pallet_scheduler::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = EitherOf, AuctionAdmin>;s + type ScheduleOrigin = EitherOf, AuctionAdmin>; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; type OriginPrivilegeCmp = OriginPrivilegeCmp; From 61a9d4ce5adcb267c6ae9c63ba7cf2dbcbc7d2e3 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 13 Feb 2023 08:41:09 +0100 Subject: [PATCH 10/26] Docs --- runtime/kusama/src/lib.rs | 2 ++ runtime/polkadot/src/lib.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 2d1e4e0f79e6..448120d4c11f 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -217,6 +217,8 @@ impl pallet_scheduler::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; + // The goal of having ScheduleOrigin include AuctionAdmin is to allow the auctions track of + // OpenGov to schedule periodic auctions. type ScheduleOrigin = EitherOf, AuctionAdmin>; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 55b4451839e6..34a61ffdd150 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -212,6 +212,8 @@ impl pallet_scheduler::Config for Runtime { type PalletsOrigin = OriginCaller; type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; + // The goal of having ScheduleOrigin include AuctionAdmin is to allow the auctions track of + // OpenGov to schedule periodic auctions. type ScheduleOrigin = EitherOf, AuctionAdmin>; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = weights::pallet_scheduler::WeightInfo; From 5801157a0b303198af251137b46b46941a32d63c Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 13 Feb 2023 08:43:21 +0100 Subject: [PATCH 11/26] Remove todo --- runtime/kusama/src/lib.rs | 1 - runtime/polkadot/src/lib.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 448120d4c11f..0a4c5032efd1 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -593,7 +593,6 @@ impl pallet_fast_unstake::Config for Runtime { type Currency = Balances; type BatchSize = frame_support::traits::ConstU32<64>; type Deposit = frame_support::traits::ConstU128<{ CENTS * 100 }>; - // TODO: Check if this is low-privilege and maybe consider GeneralAdmin instead. type ControlOrigin = EnsureRoot; type Staking = Staking; type MaxErasToCheckPerBlock = ConstU32<1>; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 34a61ffdd150..8b3d25207670 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -605,7 +605,6 @@ impl pallet_fast_unstake::Config for Runtime { type Currency = Balances; type BatchSize = frame_support::traits::ConstU32<16>; type Deposit = frame_support::traits::ConstU128<{ UNITS }>; - // TODO: Check if this is low-privilege and maybe consider GeneralAdmin instead. type ControlOrigin = EnsureRoot; type Staking = Staking; type MaxErasToCheckPerBlock = ConstU32<1>; From 8a0cfe74e4081fa2d93f442648f7d08b414f3ce5 Mon Sep 17 00:00:00 2001 From: Gav Date: Mon, 13 Feb 2023 08:46:26 +0100 Subject: [PATCH 12/26] Docs --- runtime/polkadot/src/governance/origins.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime/polkadot/src/governance/origins.rs b/runtime/polkadot/src/governance/origins.rs index 24ad739cca1c..fee22cdb761c 100644 --- a/runtime/polkadot/src/governance/origins.rs +++ b/runtime/polkadot/src/governance/origins.rs @@ -34,7 +34,8 @@ pub mod pallet_custom_origins { pub enum Origin { /// Origin able to cancel slashes and manage minimum commission. StakingAdmin, - /// Origin for spending (any amount of) funds. + /// Origin for spending up to $10,000,000 DOT from the treasury as well as generally + /// administering it. Treasurer, /// Origin for managing the composition of the fellowship. FellowshipAdmin, @@ -48,15 +49,15 @@ pub mod pallet_custom_origins { ReferendumCanceller, /// Origin able to kill referenda. ReferendumKiller, - /// Origin able to spend up to 1 KSM from the treasury at once. + /// Origin able to spend around $250 from the treasury at once. SmallTipper, - /// Origin able to spend up to 5 KSM from the treasury at once. + /// Origin able to spend around $1,000 from the treasury at once. BigTipper, - /// Origin able to spend up to 50 KSM from the treasury at once. + /// Origin able to spend around $10,000 from the treasury at once. SmallSpender, - /// Origin able to spend up to 500 KSM from the treasury at once. + /// Origin able to spend around $100,000 from the treasury at once. MediumSpender, - /// Origin able to spend up to 5,000 KSM from the treasury at once. + /// Origin able to spend up to $1,000,000 DOT from the treasury at once. BigSpender, /// Origin able to dispatch a whitelisted call. WhitelistedCaller, From ae2ad9b3bdca05be5d70048cd7bb575de1b9996e Mon Sep 17 00:00:00 2001 From: Muharem Ismailov Date: Wed, 15 Feb 2023 16:56:03 +0100 Subject: [PATCH 13/26] Move Fellowship to Collectives (#6718) * FellowshipAdmin origin over xcm * accept Fellows origin from Collectives * remove Fellowship * remove unreachable arm --- Cargo.lock | 1 - runtime/polkadot/Cargo.toml | 4 - runtime/polkadot/constants/src/lib.rs | 12 + runtime/polkadot/src/governance/fellowship.rs | 369 ------------------ runtime/polkadot/src/governance/mod.rs | 26 +- runtime/polkadot/src/governance/origins.rs | 44 --- runtime/polkadot/src/governance/tracks.rs | 1 - runtime/polkadot/src/lib.rs | 16 +- runtime/polkadot/src/weights/mod.rs | 2 - .../src/weights/pallet_ranked_collective.rs | 120 ------ .../pallet_referenda_fellowship_referenda.rs | 306 --------------- runtime/polkadot/src/xcm_config.rs | 25 +- 12 files changed, 45 insertions(+), 881 deletions(-) delete mode 100644 runtime/polkadot/src/governance/fellowship.rs delete mode 100644 runtime/polkadot/src/weights/pallet_ranked_collective.rs delete mode 100644 runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs diff --git a/Cargo.lock b/Cargo.lock index b9ccf3cca877..2107637edaee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7429,7 +7429,6 @@ dependencies = [ "pallet-offences-benchmarking", "pallet-preimage", "pallet-proxy", - "pallet-ranked-collective", "pallet-referenda", "pallet-scheduler", "pallet-session", diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index 4e4506f82b7f..8be388166db7 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -62,7 +62,6 @@ pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/sub 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-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 } @@ -159,7 +158,6 @@ std = [ "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", - "pallet-ranked-collective/std", "pallet-referenda/std", "pallet-scheduler/std", "pallet-session/std", @@ -218,7 +216,6 @@ 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-staking/runtime-benchmarks", @@ -267,7 +264,6 @@ try-runtime = [ "pallet-offences/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", - "pallet-ranked-collective/try-runtime", "pallet-referenda/try-runtime", "pallet-scheduler/try-runtime", "pallet-session/try-runtime", diff --git a/runtime/polkadot/constants/src/lib.rs b/runtime/polkadot/constants/src/lib.rs index 7624c8a0b0b0..ecb4fcdddc24 100644 --- a/runtime/polkadot/constants/src/lib.rs +++ b/runtime/polkadot/constants/src/lib.rs @@ -99,6 +99,18 @@ pub mod fee { } } +/// XCM protocol related constants. +pub mod xcm { + /// Pluralistic bodies existing within the consensus. + pub mod body { + // Preallocated for the Root body. + #[allow(dead_code)] + const ROOT_INDEX: u32 = 0; + // The bodies corresponding to the Polkadot OpenGov Origins. + pub const FELLOWSHIP_ADMIN_INDEX: u32 = 1; + } +} + #[cfg(test)] mod tests { use super::{ diff --git a/runtime/polkadot/src/governance/fellowship.rs b/runtime/polkadot/src/governance/fellowship.rs deleted file mode 100644 index 5cd5d30e2f2f..000000000000 --- a/runtime/polkadot/src/governance/fellowship.rs +++ /dev/null @@ -1,369 +0,0 @@ -// 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, DOLLARS}; - -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 * DOLLARS, - 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), - }, - }, - ), - ( - 1u16, - pallet_referenda::TrackInfo { - name: "members", - max_deciding: 10, - decision_deposit: 10 * DOLLARS, - 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), - }, - }, - ), - ( - 2u16, - pallet_referenda::TrackInfo { - name: "proficients", - max_deciding: 10, - decision_deposit: 10 * DOLLARS, - 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), - }, - }, - ), - ( - 3u16, - pallet_referenda::TrackInfo { - name: "fellows", - max_deciding: 10, - decision_deposit: 10 * DOLLARS, - 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 * DOLLARS, - 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), - }, - }, - ), - ( - 5u16, - pallet_referenda::TrackInfo { - name: "experts", - max_deciding: 10, - decision_deposit: 1 * DOLLARS, - 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), - }, - }, - ), - ( - 6u16, - pallet_referenda::TrackInfo { - name: "senior experts", - max_deciding: 10, - decision_deposit: 1 * DOLLARS, - 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), - }, - }, - ), - ( - 7u16, - pallet_referenda::TrackInfo { - name: "masters", - max_deciding: 10, - decision_deposit: 1 * DOLLARS, - 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), - }, - }, - ), - ( - 8u16, - pallet_referenda::TrackInfo { - name: "senior masters", - max_deciding: 10, - decision_deposit: 1 * DOLLARS, - 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), - }, - }, - ), - ( - 9u16, - pallet_referenda::TrackInfo { - name: "grand masters", - max_deciding: 10, - decision_deposit: 1 * DOLLARS, - 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), - }, - }, - ), - ]; - &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; - type Preimages = Preimage; -} - -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/polkadot/src/governance/mod.rs b/runtime/polkadot/src/governance/mod.rs index fb167d085ae1..187a7fb49531 100644 --- a/runtime/polkadot/src/governance/mod.rs +++ b/runtime/polkadot/src/governance/mod.rs @@ -17,25 +17,22 @@ //! New governance configurations for the Kusama runtime. use super::*; -use frame_support::{ - parameter_types, - traits::{ConstU16, EitherOf}, -}; +use crate::xcm_config::CollectivesLocation; +use frame_support::{parameter_types, traits::EitherOf}; use frame_system::EnsureRootWithSuccess; +use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; +use xcm::latest::BodyId; // 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, Treasurer, WhitelistedCaller, + pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin, + ReferendumCanceller, ReferendumKiller, Spender, StakingAdmin, Treasurer, WhitelistedCaller, }; mod tracks; pub use tracks::TracksInfo; -mod fellowship; -pub use fellowship::{FellowshipCollectiveInstance, FellowshipReferendaInstance}; parameter_types! { pub const VoteLockingPeriod: BlockNumber = 7 * DAYS; @@ -65,12 +62,19 @@ pub type TreasurySpender = EitherOf impl origins::pallet_custom_origins::Config for Runtime {} +parameter_types! { + // Fellows pluralistic body. + pub const FellowsBodyId: BodyId = BodyId::Technical; +} + impl pallet_whitelist::Config for Runtime { type WeightInfo = weights::pallet_whitelist::WeightInfo; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; - type WhitelistOrigin = - EitherOf>, Fellows>; + type WhitelistOrigin = EitherOfDiverse< + EnsureRoot, + EnsureXcm>, + >; type DispatchWhitelistedOrigin = EitherOf, WhitelistedCaller>; type Preimages = Preimage; } diff --git a/runtime/polkadot/src/governance/origins.rs b/runtime/polkadot/src/governance/origins.rs index fee22cdb761c..2b5e1dd94f2f 100644 --- a/runtime/polkadot/src/governance/origins.rs +++ b/runtime/polkadot/src/governance/origins.rs @@ -61,32 +61,6 @@ pub mod pallet_custom_origins { 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 { @@ -129,10 +103,6 @@ pub mod pallet_custom_origins { ReferendumCanceller, ReferendumKiller, WhitelistedCaller, - FellowshipInitiates: u16 = 0, - Fellows: u16 = 3, - FellowshipExperts: u16 = 5, - FellowshipMasters: u16 = 7, ); macro_rules! decl_ensure { @@ -178,18 +148,4 @@ pub mod pallet_custom_origins { Treasurer = 10_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/polkadot/src/governance/tracks.rs b/runtime/polkadot/src/governance/tracks.rs index bac1c354f145..e30f6f9bf6bf 100644 --- a/runtime/polkadot/src/governance/tracks.rs +++ b/runtime/polkadot/src/governance/tracks.rs @@ -310,7 +310,6 @@ impl pallet_referenda::TracksInfo for TracksInfo { origins::Origin::SmallSpender => Ok(32), origins::Origin::MediumSpender => Ok(33), origins::Origin::BigSpender => Ok(34), - _ => Err(()), } } else { Err(()) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 8b3d25207670..708d5cf503d0 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -102,8 +102,8 @@ mod bag_thresholds; // Governance configurations. pub mod governance; use governance::{ - old::CouncilCollective, pallet_custom_origins, AuctionAdmin, Fellows, GeneralAdmin, LeaseAdmin, - StakingAdmin, Treasurer, TreasurySpender, + old::CouncilCollective, pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, + LeaseAdmin, StakingAdmin, Treasurer, TreasurySpender, }; pub mod xcm_config; @@ -1324,16 +1324,8 @@ construct_runtime! { // OpenGov stuff. 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, + Origins: pallet_custom_origins::{Origin} = 22, + Whitelist: pallet_whitelist::{Pallet, Call, Storage, Event} = 23, // Claims. Usable initially. Claims: claims::{Pallet, Call, Storage, Event, Config, ValidateUnsigned} = 24, diff --git a/runtime/polkadot/src/weights/mod.rs b/runtime/polkadot/src/weights/mod.rs index 9e7111d806df..c24da310bd3b 100644 --- a/runtime/polkadot/src/weights/mod.rs +++ b/runtime/polkadot/src/weights/mod.rs @@ -36,8 +36,6 @@ 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; diff --git a/runtime/polkadot/src/weights/pallet_ranked_collective.rs b/runtime/polkadot/src/weights/pallet_ranked_collective.rs deleted file mode 100644 index e7f16e5ebdeb..000000000000 --- a/runtime/polkadot/src/weights/pallet_ranked_collective.rs +++ /dev/null @@ -1,120 +0,0 @@ -// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=kusama-dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_ranked_collective -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --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 { - // Minimum execution time: 21_687 nanoseconds. - Weight::from_ref_time(22_505_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // 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 { - // Minimum execution time: 32_770 nanoseconds. - Weight::from_ref_time(34_644_917) - // Standard Error: 15_325 - .saturating_add(Weight::from_ref_time(11_355_769).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into()))) - } - // 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 { - // Minimum execution time: 23_990 nanoseconds. - Weight::from_ref_time(25_072_856) - // Standard Error: 5_793 - .saturating_add(Weight::from_ref_time(404_905).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // 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 { - // Minimum execution time: 32_952 nanoseconds. - Weight::from_ref_time(35_465_453) - // Standard Error: 16_850 - .saturating_add(Weight::from_ref_time(671_524).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // 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 { - // Minimum execution time: 50_688 nanoseconds. - Weight::from_ref_time(51_397_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:0) - // Storage: FellowshipCollective VotingCleanup (r:1 w:0) - // Storage: FellowshipCollective Voting (r:0 w:2) - /// The range of component `n` is `[0, 100]`. - fn cleanup_poll(n: u32, ) -> Weight { - // Minimum execution time: 15_422 nanoseconds. - Weight::from_ref_time(18_535_259) - // Standard Error: 2_621 - .saturating_add(Weight::from_ref_time(1_164_868).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - } -} diff --git a/runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs b/runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs deleted file mode 100644 index 63af860b5c98..000000000000 --- a/runtime/polkadot/src/weights/pallet_referenda_fellowship_referenda.rs +++ /dev/null @@ -1,306 +0,0 @@ -// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=kusama-dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_referenda -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --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 { - // Minimum execution time: 33_277 nanoseconds. - Weight::from_ref_time(33_960_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) - fn place_decision_deposit_preparing() -> Weight { - // Minimum execution time: 53_029 nanoseconds. - Weight::from_ref_time(54_668_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // 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 { - // Minimum execution time: 90_942 nanoseconds. - Weight::from_ref_time(102_908_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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 { - // Minimum execution time: 93_418 nanoseconds. - Weight::from_ref_time(102_043_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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 { - // Minimum execution time: 204_407 nanoseconds. - Weight::from_ref_time(221_043_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // 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 { - // Minimum execution time: 46_345 nanoseconds. - Weight::from_ref_time(48_000_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - fn refund_decision_deposit() -> Weight { - // Minimum execution time: 32_528 nanoseconds. - Weight::from_ref_time(33_923_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - fn refund_submission_deposit() -> Weight { - // Minimum execution time: 21_065 nanoseconds. - Weight::from_ref_time(21_947_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) - fn cancel() -> Weight { - // Minimum execution time: 41_541 nanoseconds. - Weight::from_ref_time(43_091_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) - fn kill() -> Weight { - // Minimum execution time: 75_008 nanoseconds. - Weight::from_ref_time(77_437_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: FellowshipReferenda TrackQueue (r:1 w:0) - // Storage: FellowshipReferenda DecidingCount (r:1 w:1) - fn one_fewer_deciding_queue_empty() -> Weight { - // Minimum execution time: 10_620 nanoseconds. - Weight::from_ref_time(11_309_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // 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 { - // Minimum execution time: 167_988 nanoseconds. - Weight::from_ref_time(179_043_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // 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 { - // Minimum execution time: 171_829 nanoseconds. - Weight::from_ref_time(183_097_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: FellowshipReferenda TrackQueue (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:0) - fn nudge_referendum_requeued_insertion() -> Weight { - // Minimum execution time: 99_225 nanoseconds. - Weight::from_ref_time(109_234_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: FellowshipReferenda TrackQueue (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:0) - fn nudge_referendum_requeued_slide() -> Weight { - // Minimum execution time: 100_605 nanoseconds. - Weight::from_ref_time(109_740_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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:0) - fn nudge_referendum_queued() -> Weight { - // Minimum execution time: 105_414 nanoseconds. - Weight::from_ref_time(112_810_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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:0) - fn nudge_referendum_not_queued() -> Weight { - // Minimum execution time: 100_969 nanoseconds. - Weight::from_ref_time(114_514_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_no_deposit() -> Weight { - // Minimum execution time: 29_982 nanoseconds. - Weight::from_ref_time(31_303_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_preparing() -> Weight { - // Minimum execution time: 30_756 nanoseconds. - Weight::from_ref_time(31_875_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1) - fn nudge_referendum_timed_out() -> Weight { - // Minimum execution time: 22_922 nanoseconds. - Weight::from_ref_time(23_811_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // 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 { - // Minimum execution time: 42_030 nanoseconds. - Weight::from_ref_time(43_505_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // 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 { - // Minimum execution time: 95_523 nanoseconds. - Weight::from_ref_time(102_104_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // 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 { - // Minimum execution time: 166_858 nanoseconds. - Weight::from_ref_time(190_720_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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 { - // Minimum execution time: 165_354 nanoseconds. - Weight::from_ref_time(185_408_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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 { - // Minimum execution time: 167_797 nanoseconds. - Weight::from_ref_time(182_086_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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 { - // Minimum execution time: 87_123 nanoseconds. - Weight::from_ref_time(94_538_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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) - fn nudge_referendum_approved() -> Weight { - // Minimum execution time: 177_202 nanoseconds. - Weight::from_ref_time(194_662_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // 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 { - // Minimum execution time: 154_150 nanoseconds. - Weight::from_ref_time(185_014_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - fn set_some_metadata() -> Weight { - Weight::from_parts(20_490_000, 5407) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - fn clear_metadata() -> Weight { - Weight::from_parts(19_917_000, 5368) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } -} diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 4cb1862e7bf0..4a1f2b57a71a 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -17,15 +17,16 @@ //! XCM configuration for Polkadot. use super::{ - parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, Fellows, - ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, WeightToFee, - XcmPallet, + parachains_origin, AccountId, AllPalletsWithSystem, Balances, CouncilCollective, + FellowshipAdmin, ParaId, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, StakingAdmin, + WeightToFee, XcmPallet, }; use frame_support::{ match_types, parameter_types, traits::{Contains, Everything, Nothing}, weights::Weight, }; +use polkadot_runtime_constants::xcm::body::FELLOWSHIP_ADMIN_INDEX; use runtime_common::{paras_registrar, xcm_sender, ToAuthor}; use sp_core::ConstU32; use xcm::latest::prelude::*; @@ -113,7 +114,8 @@ pub type XcmRouter = ( parameter_types! { pub const Dot: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }); pub const DotForStatemint: (MultiAssetFilter, MultiLocation) = (Dot::get(), Parachain(1000).into_location()); - pub const DotForCollectives: (MultiAssetFilter, MultiLocation) = (Dot::get(), Parachain(1001).into_location()); + pub const CollectivesLocation: MultiLocation = Parachain(1001).into_location(); + pub const DotForCollectives: (MultiAssetFilter, MultiLocation) = (Dot::get(), CollectivesLocation::get()); pub const MaxAssetsIntoHolding: u32 = 64; } @@ -343,8 +345,8 @@ parameter_types! { pub const CouncilBodyId: BodyId = BodyId::Executive; // StakingAdmin pluralistic body. pub const StakingAdminBodyId: BodyId = BodyId::Defense; - // Fellows pluralistic body. - pub const FellowsBodyId: BodyId = BodyId::Technical; + // FellowshipAdmin pluralistic body. + pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX); } #[cfg(feature = "runtime-benchmarks")] @@ -371,8 +373,9 @@ pub type LocalOriginToLocation = ( pub type StakingAdminToPlurality = OriginToPluralityVoice; -/// Type to convert the Fellows origin to a Plurality `MultiLocation` value. -pub type FellowsToPlurality = OriginToPluralityVoice; +/// Type to convert the FellowshipAdmin origin to a Plurality `MultiLocation` value. +pub type FellowshipAdminToPlurality = + OriginToPluralityVoice; /// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an interior location /// of this chain for a destination chain. @@ -382,13 +385,13 @@ pub type LocalPalletOriginToLocation = ( CouncilToPlurality, // StakingAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value. StakingAdminToPlurality, - // Fellows origin to be used in XCM as a corresponding Plurality `MultiLocation` value. - FellowsToPlurality, + // FellowshipAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value. + FellowshipAdminToPlurality, ); impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; - // Only allow the council to send messages. + // We only allow the root, the council, the fellowship admin and the staking admin to send messages. type SendXcmOrigin = xcm_builder::EnsureXcmOrigin; type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally... From b8e250a4f3089ec0bfb2ddc232edca1327dd5e03 Mon Sep 17 00:00:00 2001 From: muharem Date: Thu, 16 Feb 2023 04:51:28 +0100 Subject: [PATCH 14/26] define benchmarks --- runtime/polkadot/src/governance/mod.rs | 2 +- runtime/polkadot/src/lib.rs | 3 + runtime/polkadot/src/weights/mod.rs | 2 +- .../polkadot/src/weights/pallet_referenda.rs | 520 ++++++++++++++++++ .../src/weights/pallet_referenda_referenda.rs | 305 ---------- 5 files changed, 525 insertions(+), 307 deletions(-) create mode 100644 runtime/polkadot/src/weights/pallet_referenda.rs delete mode 100644 runtime/polkadot/src/weights/pallet_referenda_referenda.rs diff --git a/runtime/polkadot/src/governance/mod.rs b/runtime/polkadot/src/governance/mod.rs index 187a7fb49531..92ed1444467d 100644 --- a/runtime/polkadot/src/governance/mod.rs +++ b/runtime/polkadot/src/governance/mod.rs @@ -80,7 +80,7 @@ impl pallet_whitelist::Config for Runtime { } impl pallet_referenda::Config for Runtime { - type WeightInfo = weights::pallet_referenda_referenda::WeightInfo; + type WeightInfo = weights::pallet_referenda::WeightInfo; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 708d5cf503d0..4c8f785fdeeb 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1500,6 +1500,9 @@ mod benches { [pallet_treasury, Treasury] [pallet_utility, Utility] [pallet_vesting, Vesting] + [pallet_conviction_voting, ConvictionVoting] + [pallet_referenda, Referenda] + [pallet_whitelist, Whitelist] // XCM [pallet_xcm, XcmPallet] ); diff --git a/runtime/polkadot/src/weights/mod.rs b/runtime/polkadot/src/weights/mod.rs index c24da310bd3b..f14ee2eef6fc 100644 --- a/runtime/polkadot/src/weights/mod.rs +++ b/runtime/polkadot/src/weights/mod.rs @@ -36,7 +36,7 @@ pub mod pallet_multisig; pub mod pallet_nomination_pools; pub mod pallet_preimage; pub mod pallet_proxy; -pub mod pallet_referenda_referenda; +pub mod pallet_referenda; pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_staking; diff --git a/runtime/polkadot/src/weights/pallet_referenda.rs b/runtime/polkadot/src/weights/pallet_referenda.rs new file mode 100644 index 000000000000..4afbca9a10c4 --- /dev/null +++ b/runtime/polkadot/src/weights/pallet_referenda.rs @@ -0,0 +1,520 @@ +// 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: 2023-02-16, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `cob`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/polkadot +// benchmark +// pallet +// --chain=polkadot-dev +// --steps=2 +// --repeat=1 +// --pallet=pallet_referenda +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/polkadot/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) + /// Proof: Referenda ReferendumCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:0 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + fn submit() -> Weight { + // Proof Size summary in bytes: + // Measured: `290` + // Estimated: `41937` + // Minimum execution time: 50_000 nanoseconds. + Weight::from_ref_time(50_000_000) + .saturating_add(Weight::from_proof_size(41937)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn place_decision_deposit_preparing() -> Weight { + // Proof Size summary in bytes: + // Measured: `575` + // Estimated: `86287` + // Minimum execution time: 61_000 nanoseconds. + Weight::from_ref_time(61_000_000) + .saturating_add(Weight::from_proof_size(86287)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:0) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + fn place_decision_deposit_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3203` + // Estimated: `10387` + // Minimum execution time: 50_000 nanoseconds. + Weight::from_ref_time(50_000_000) + .saturating_add(Weight::from_proof_size(10387)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:0) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + fn place_decision_deposit_not_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3223` + // Estimated: `10387` + // Minimum execution time: 50_000 nanoseconds. + Weight::from_ref_time(50_000_000) + .saturating_add(Weight::from_proof_size(10387)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:1) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn place_decision_deposit_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `575` + // Estimated: `89287` + // Minimum execution time: 78_000 nanoseconds. + Weight::from_ref_time(78_000_000) + .saturating_add(Weight::from_proof_size(89287)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:1) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + fn place_decision_deposit_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `482` + // Estimated: `6411` + // Minimum execution time: 47_000 nanoseconds. + Weight::from_ref_time(47_000_000) + .saturating_add(Weight::from_proof_size(6411)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + fn refund_decision_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `415` + // Estimated: `3411` + // Minimum execution time: 42_000 nanoseconds. + Weight::from_ref_time(42_000_000) + .saturating_add(Weight::from_proof_size(3411)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + fn refund_submission_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `405` + // Estimated: `3411` + // Minimum execution time: 34_000 nanoseconds. + Weight::from_ref_time(34_000_000) + .saturating_add(Weight::from_proof_size(3411)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn cancel() -> Weight { + // Proof Size summary in bytes: + // Measured: `451` + // Estimated: `86287` + // Minimum execution time: 49_000 nanoseconds. + Weight::from_ref_time(49_000_000) + .saturating_add(Weight::from_proof_size(86287)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + /// Storage: Referenda MetadataOf (r:1 w:0) + /// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + fn kill() -> Weight { + // Proof Size summary in bytes: + // Measured: `756` + // Estimated: `88814` + // Minimum execution time: 132_000 nanoseconds. + Weight::from_ref_time(132_000_000) + .saturating_add(Weight::from_proof_size(88814)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Referenda TrackQueue (r:1 w:0) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:1) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + fn one_fewer_deciding_queue_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `174` + // Estimated: `6976` + // Minimum execution time: 12_000 nanoseconds. + Weight::from_ref_time(12_000_000) + .saturating_add(Weight::from_proof_size(6976)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn one_fewer_deciding_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `3972` + // Estimated: `91285` + // Minimum execution time: 128_000 nanoseconds. + Weight::from_ref_time(128_000_000) + .saturating_add(Weight::from_proof_size(91285)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn one_fewer_deciding_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `3972` + // Estimated: `91285` + // Minimum execution time: 130_000 nanoseconds. + Weight::from_ref_time(130_000_000) + .saturating_add(Weight::from_proof_size(91285)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:0) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_requeued_insertion() -> Weight { + // Proof Size summary in bytes: + // Measured: `3990` + // Estimated: `49336` + // Minimum execution time: 65_000 nanoseconds. + Weight::from_ref_time(65_000_000) + .saturating_add(Weight::from_proof_size(49336)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:0) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_requeued_slide() -> Weight { + // Proof Size summary in bytes: + // Measured: `3990` + // Estimated: `49336` + // Minimum execution time: 68_000 nanoseconds. + Weight::from_ref_time(68_000_000) + .saturating_add(Weight::from_proof_size(49336)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:0) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:0) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3964` + // Estimated: `51825` + // Minimum execution time: 65_000 nanoseconds. + Weight::from_ref_time(65_000_000) + .saturating_add(Weight::from_proof_size(51825)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:0) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Referenda TrackQueue (r:1 w:1) + /// Proof: Referenda TrackQueue (max_values: None, max_size: Some(2012), added: 4487, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:0) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_not_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `3984` + // Estimated: `51825` + // Minimum execution time: 68_000 nanoseconds. + Weight::from_ref_time(68_000_000) + .saturating_add(Weight::from_proof_size(51825)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_no_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `403` + // Estimated: `44849` + // Minimum execution time: 32_000 nanoseconds. + Weight::from_ref_time(32_000_000) + .saturating_add(Weight::from_proof_size(44849)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_preparing() -> Weight { + // Proof Size summary in bytes: + // Measured: `451` + // Estimated: `44849` + // Minimum execution time: 30_000 nanoseconds. + Weight::from_ref_time(30_000_000) + .saturating_add(Weight::from_proof_size(44849)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + fn nudge_referendum_timed_out() -> Weight { + // Proof Size summary in bytes: + // Measured: `310` + // Estimated: `3411` + // Minimum execution time: 19_000 nanoseconds. + Weight::from_ref_time(19_000_000) + .saturating_add(Weight::from_proof_size(3411)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:1) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_begin_deciding_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `451` + // Estimated: `47849` + // Minimum execution time: 40_000 nanoseconds. + Weight::from_ref_time(40_000_000) + .saturating_add(Weight::from_proof_size(47849)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda DecidingCount (r:1 w:1) + /// Proof: Referenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_begin_deciding_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `451` + // Estimated: `47849` + // Minimum execution time: 44_000 nanoseconds. + Weight::from_ref_time(44_000_000) + .saturating_add(Weight::from_proof_size(47849)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_begin_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `504` + // Estimated: `45360` + // Minimum execution time: 35_000 nanoseconds. + Weight::from_ref_time(35_000_000) + .saturating_add(Weight::from_proof_size(45360)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_end_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `487` + // Estimated: `45360` + // Minimum execution time: 37_000 nanoseconds. + Weight::from_ref_time(37_000_000) + .saturating_add(Weight::from_proof_size(45360)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_continue_not_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `504` + // Estimated: `45360` + // Minimum execution time: 32_000 nanoseconds. + Weight::from_ref_time(32_000_000) + .saturating_add(Weight::from_proof_size(45360)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_continue_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `508` + // Estimated: `45360` + // Minimum execution time: 31_000 nanoseconds. + Weight::from_ref_time(31_000_000) + .saturating_add(Weight::from_proof_size(45360)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + /// Storage: Scheduler Lookup (r:1 w:1) + /// Proof: Scheduler Lookup (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + fn nudge_referendum_approved() -> Weight { + // Proof Size summary in bytes: + // Measured: `508` + // Estimated: `89321` + // Minimum execution time: 50_000 nanoseconds. + Weight::from_ref_time(50_000_000) + .saturating_add(Weight::from_proof_size(89321)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Balances InactiveIssuance (r:1 w:0) + /// Proof: Balances InactiveIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + fn nudge_referendum_rejected() -> Weight { + // Proof Size summary in bytes: + // Measured: `504` + // Estimated: `45360` + // Minimum execution time: 37_000 nanoseconds. + Weight::from_ref_time(37_000_000) + .saturating_add(Weight::from_proof_size(45360)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:0) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Preimage StatusFor (r:1 w:0) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) + /// Storage: Referenda MetadataOf (r:0 w:1) + /// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + fn set_some_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `454` + // Estimated: `5977` + // Minimum execution time: 26_000 nanoseconds. + Weight::from_ref_time(26_000_000) + .saturating_add(Weight::from_proof_size(5977)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Referenda ReferendumInfoFor (r:1 w:0) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Referenda MetadataOf (r:1 w:1) + /// Proof: Referenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `387` + // Estimated: `5938` + // Minimum execution time: 22_000 nanoseconds. + Weight::from_ref_time(22_000_000) + .saturating_add(Weight::from_proof_size(5938)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/polkadot/src/weights/pallet_referenda_referenda.rs b/runtime/polkadot/src/weights/pallet_referenda_referenda.rs deleted file mode 100644 index cb86cee7aa97..000000000000 --- a/runtime/polkadot/src/weights/pallet_referenda_referenda.rs +++ /dev/null @@ -1,305 +0,0 @@ -// 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: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=kusama-dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_referenda -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --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 { - // Minimum execution time: 38_444 nanoseconds. - Weight::from_ref_time(40_157_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) - fn place_decision_deposit_preparing() -> Weight { - // Minimum execution time: 52_464 nanoseconds. - Weight::from_ref_time(53_840_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // 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 { - // Minimum execution time: 59_684 nanoseconds. - Weight::from_ref_time(62_639_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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 { - // Minimum execution time: 59_614 nanoseconds. - Weight::from_ref_time(61_921_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Referenda DecidingCount (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:2 w:2) - fn place_decision_deposit_passing() -> Weight { - // Minimum execution time: 67_948 nanoseconds. - Weight::from_ref_time(69_857_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Referenda DecidingCount (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - fn place_decision_deposit_failing() -> Weight { - // Minimum execution time: 46_712 nanoseconds. - Weight::from_ref_time(47_618_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - fn refund_decision_deposit() -> Weight { - // Minimum execution time: 31_886 nanoseconds. - Weight::from_ref_time(33_383_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - fn refund_submission_deposit() -> Weight { - // Minimum execution time: 31_464 nanoseconds. - Weight::from_ref_time(32_332_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) - fn cancel() -> Weight { - // Minimum execution time: 40_661 nanoseconds. - Weight::from_ref_time(42_037_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) - fn kill() -> Weight { - // Minimum execution time: 87_937 nanoseconds. - Weight::from_ref_time(90_171_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Referenda TrackQueue (r:1 w:0) - // Storage: Referenda DecidingCount (r:1 w:1) - fn one_fewer_deciding_queue_empty() -> Weight { - // Minimum execution time: 10_962 nanoseconds. - Weight::from_ref_time(11_292_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Referenda TrackQueue (r:1 w:1) - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:2 w:2) - fn one_fewer_deciding_failing() -> Weight { - // Minimum execution time: 123_968 nanoseconds. - Weight::from_ref_time(132_776_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: Referenda TrackQueue (r:1 w:1) - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:2 w:2) - fn one_fewer_deciding_passing() -> Weight { - // Minimum execution time: 124_456 nanoseconds. - Weight::from_ref_time(133_803_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Referenda TrackQueue (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:0) - fn nudge_referendum_requeued_insertion() -> Weight { - // Minimum execution time: 67_800 nanoseconds. - Weight::from_ref_time(72_433_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Referenda TrackQueue (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:0) - fn nudge_referendum_requeued_slide() -> Weight { - // Minimum execution time: 67_119 nanoseconds. - Weight::from_ref_time(72_291_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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:0) - fn nudge_referendum_queued() -> Weight { - // Minimum execution time: 69_519 nanoseconds. - Weight::from_ref_time(75_088_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // 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:0) - fn nudge_referendum_not_queued() -> Weight { - // Minimum execution time: 68_612 nanoseconds. - Weight::from_ref_time(75_595_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_no_deposit() -> Weight { - // Minimum execution time: 29_767 nanoseconds. - Weight::from_ref_time(30_670_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_preparing() -> Weight { - // Minimum execution time: 30_082 nanoseconds. - Weight::from_ref_time(31_089_000) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - fn nudge_referendum_timed_out() -> Weight { - // Minimum execution time: 22_203 nanoseconds. - Weight::from_ref_time(23_408_000) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Referenda DecidingCount (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_begin_deciding_failing() -> Weight { - // Minimum execution time: 42_086 nanoseconds. - Weight::from_ref_time(44_532_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Referenda DecidingCount (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_begin_deciding_passing() -> Weight { - // Minimum execution time: 44_254 nanoseconds. - Weight::from_ref_time(45_996_000) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_begin_confirming() -> Weight { - // Minimum execution time: 40_864 nanoseconds. - Weight::from_ref_time(42_518_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_end_confirming() -> Weight { - // Minimum execution time: 41_997 nanoseconds. - Weight::from_ref_time(43_555_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_continue_not_confirming() -> Weight { - // Minimum execution time: 39_163 nanoseconds. - Weight::from_ref_time(40_633_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_continue_confirming() -> Weight { - // Minimum execution time: 38_260 nanoseconds. - Weight::from_ref_time(39_494_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Scheduler Lookup (r:1 w:1) - fn nudge_referendum_approved() -> Weight { - // Minimum execution time: 51_267 nanoseconds. - Weight::from_ref_time(54_875_000) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Balances InactiveIssuance (r:1 w:0) - // Storage: Scheduler Agenda (r:1 w:1) - fn nudge_referendum_rejected() -> Weight { - // Minimum execution time: 41_099 nanoseconds. - Weight::from_ref_time(43_408_000) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - fn set_some_metadata() -> Weight { - Weight::from_parts(20_490_000, 5407) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - fn clear_metadata() -> Weight { - Weight::from_parts(19_917_000, 5368) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } -} From d754468002a4791bc823054cf945c698de05db2d Mon Sep 17 00:00:00 2001 From: muharem Date: Thu, 16 Feb 2023 06:03:18 +0100 Subject: [PATCH 15/26] correct comment for DOLLARS constant --- runtime/polkadot/constants/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/constants/src/lib.rs b/runtime/polkadot/constants/src/lib.rs index ecb4fcdddc24..03178328e12d 100644 --- a/runtime/polkadot/constants/src/lib.rs +++ b/runtime/polkadot/constants/src/lib.rs @@ -29,7 +29,7 @@ pub mod currency { pub const UNITS: Balance = 10_000_000_000; pub const DOLLARS: Balance = UNITS; // 10_000_000_000 - pub const GRAND: Balance = DOLLARS * 1_000; // 10_000_000_000 + pub const GRAND: Balance = DOLLARS * 1_000; // 10_000_000_000_000 pub const CENTS: Balance = DOLLARS / 100; // 100_000_000 pub const MILLICENTS: Balance = CENTS / 1_000; // 100_000 From 8266b6a36f021a930f4f6d996559c0f22e61d226 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Thu, 16 Feb 2023 19:16:18 +0100 Subject: [PATCH 16/26] Add OpenGov Calls to Proxy Definitions (#6729) * add opengov calls to proxy definitions * fix build --- runtime/polkadot/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 4c8f785fdeeb..279af1d67acc 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1004,6 +1004,9 @@ impl InstanceFilter for ProxyType { RuntimeCall::Bounties(..) | RuntimeCall::ChildBounties(..) | RuntimeCall::Tips(..) | + RuntimeCall::ConvictionVoting(..) | + RuntimeCall::Referenda(..) | + RuntimeCall::Whitelist(..) | RuntimeCall::Claims(..) | RuntimeCall::Vesting(pallet_vesting::Call::vest{..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest_other{..}) | @@ -1032,7 +1035,10 @@ impl InstanceFilter for ProxyType { RuntimeCall::Treasury(..) | RuntimeCall::Bounties(..) | RuntimeCall::Tips(..) | RuntimeCall::Utility(..) | - RuntimeCall::ChildBounties(..) + RuntimeCall::ChildBounties(..) | + RuntimeCall::ConvictionVoting(..) | + RuntimeCall::Referenda(..) | + RuntimeCall::Whitelist(..) ), ProxyType::Staking => { matches!( From 4f0e3c5572a177a12809b3f3658bc6a2667a424e Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:03:56 +0100 Subject: [PATCH 17/26] Update runtime/polkadot/src/governance/mod.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- runtime/polkadot/src/governance/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/mod.rs b/runtime/polkadot/src/governance/mod.rs index 92ed1444467d..fa45e25a7f19 100644 --- a/runtime/polkadot/src/governance/mod.rs +++ b/runtime/polkadot/src/governance/mod.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! New governance configurations for the Kusama runtime. +//! New governance configurations for the Polkadot runtime. use super::*; use crate::xcm_config::CollectivesLocation; From 46390e9baaa2de6ef33f5659fc9f24f07b4af187 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:04:04 +0100 Subject: [PATCH 18/26] Update runtime/polkadot/src/governance/tracks.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- runtime/polkadot/src/governance/tracks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/tracks.rs b/runtime/polkadot/src/governance/tracks.rs index e30f6f9bf6bf..862ab79c73a6 100644 --- a/runtime/polkadot/src/governance/tracks.rs +++ b/runtime/polkadot/src/governance/tracks.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Parity Technologies (UK) Ltd. +// Copyright 2023 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify From a13c87f686733300866378a93ad803bf615475a9 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:04:13 +0100 Subject: [PATCH 19/26] Update runtime/polkadot/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- runtime/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 279af1d67acc..269a363615c0 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -858,7 +858,7 @@ impl claims::Config for Runtime { type RuntimeEvent = RuntimeEvent; type VestingSchedule = Vesting; type Prefix = Prefix; - /// At least 3/4 of the council must agree to a claim move before it can happen. + /// Only Root can move a claim. type MoveClaimOrigin = EnsureRoot; type WeightInfo = weights::runtime_common_claims::WeightInfo; } From c82efaa4404e8f8abdbb199977ac7bc1a51d38c7 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:04:20 +0100 Subject: [PATCH 20/26] Update runtime/polkadot/src/governance/origins.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- runtime/polkadot/src/governance/origins.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/origins.rs b/runtime/polkadot/src/governance/origins.rs index 2b5e1dd94f2f..0cf5834d1f49 100644 --- a/runtime/polkadot/src/governance/origins.rs +++ b/runtime/polkadot/src/governance/origins.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Parity Technologies (UK) Ltd. +// Copyright 2023 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify From 3b4bf5b56d1da7f55278d7a3bcd1c908f2db216d Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:04:29 +0100 Subject: [PATCH 21/26] Update runtime/polkadot/src/governance/mod.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- runtime/polkadot/src/governance/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/mod.rs b/runtime/polkadot/src/governance/mod.rs index fa45e25a7f19..a595db33203f 100644 --- a/runtime/polkadot/src/governance/mod.rs +++ b/runtime/polkadot/src/governance/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Parity Technologies (UK) Ltd. +// Copyright 2023 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify From 9cbffa42bb0a9ddd90517895ef7a50c95e40678a Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:05:19 +0100 Subject: [PATCH 22/26] Update old.rs --- runtime/polkadot/src/governance/old.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/old.rs b/runtime/polkadot/src/governance/old.rs index 4e15c9f14b80..a5398089c6b6 100644 --- a/runtime/polkadot/src/governance/old.rs +++ b/runtime/polkadot/src/governance/old.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Parity Technologies (UK) Ltd. +// Copyright 2023 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot is free software: you can redistribute it and/or modify From 2a980ba2c1ab16d76ecd889f49c7989b5c60341a Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Sat, 25 Feb 2023 00:06:02 +0100 Subject: [PATCH 23/26] Update old.rs --- runtime/polkadot/src/governance/old.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/governance/old.rs b/runtime/polkadot/src/governance/old.rs index a5398089c6b6..c114b6d00f2d 100644 --- a/runtime/polkadot/src/governance/old.rs +++ b/runtime/polkadot/src/governance/old.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! Old governance configurations for the Kusama runtime. +//! Old governance configurations for the Polkadot runtime. use crate::*; use frame_support::{parameter_types, traits::EitherOfDiverse}; From 97e7f75c4bd116071fd73f49b56225a85fae6d2b Mon Sep 17 00:00:00 2001 From: muharem Date: Tue, 7 Mar 2023 13:55:53 +0100 Subject: [PATCH 24/26] weights with new api --- .../src/weights/pallet_conviction_voting.rs | 171 +++++++----- .../polkadot/src/weights/pallet_referenda.rs | 244 +++++++++--------- .../polkadot/src/weights/pallet_whitelist.rs | 84 +++--- 3 files changed, 284 insertions(+), 215 deletions(-) diff --git a/runtime/polkadot/src/weights/pallet_conviction_voting.rs b/runtime/polkadot/src/weights/pallet_conviction_voting.rs index c61d1775a58d..82f6ea3acb83 100644 --- a/runtime/polkadot/src/weights/pallet_conviction_voting.rs +++ b/runtime/polkadot/src/weights/pallet_conviction_voting.rs @@ -16,23 +16,24 @@ //! Autogenerated weights for `pallet_conviction_voting` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 +//! DATE: 2023-03-07, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `cob`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// ./target/release/polkadot // benchmark // pallet -// --chain=kusama-dev -// --steps=50 -// --repeat=20 +// --chain=polkadot-dev +// --steps=2 +// --repeat=1 // --pallet=pallet_conviction_voting // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --header=./file_header.txt -// --output=./runtime/kusama/src/weights/ +// --output=./runtime/polkadot/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -44,81 +45,127 @@ 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:1 w:1) + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: ConvictionVoting VotingFor (r:1 w:1) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: ConvictionVoting ClassLocksFor (r:1 w:1) + /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(311), added: 2786, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:1 w:1) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) fn vote_new() -> Weight { - // Minimum execution time: 176_250 nanoseconds. - Weight::from_ref_time(183_105_000) + // Proof Size summary in bytes: + // Measured: `13612` + // Estimated: `86075` + // Minimum execution time: 174_000_000 picoseconds. + Weight::from_parts(174_000_000, 0) + .saturating_add(Weight::from_parts(0, 86075)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } - // 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) + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: ConvictionVoting VotingFor (r:1 w:1) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: ConvictionVoting ClassLocksFor (r:1 w:1) + /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(311), added: 2786, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) fn vote_existing() -> Weight { - // Minimum execution time: 239_904 nanoseconds. - Weight::from_ref_time(248_494_000) + // Proof Size summary in bytes: + // Measured: `14364` + // Estimated: `127513` + // Minimum execution time: 240_000_000 picoseconds. + Weight::from_parts(240_000_000, 0) + .saturating_add(Weight::from_parts(0, 127513)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(6)) } - // Storage: ConvictionVoting VotingFor (r:1 w:1) - // Storage: Referenda ReferendumInfoFor (r:1 w:1) - // Storage: Scheduler Agenda (r:2 w:2) + /// Storage: ConvictionVoting VotingFor (r:1 w:1) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:1 w:1) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) fn remove_vote() -> Weight { - // Minimum execution time: 209_359 nanoseconds. - Weight::from_ref_time(222_154_000) + // Proof Size summary in bytes: + // Measured: `14084` + // Estimated: `118973` + // Minimum execution time: 219_000_000 picoseconds. + Weight::from_parts(219_000_000, 0) + .saturating_add(Weight::from_parts(0, 118973)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } - // Storage: ConvictionVoting VotingFor (r:1 w:1) - // Storage: Referenda ReferendumInfoFor (r:1 w:0) + /// Storage: ConvictionVoting VotingFor (r:1 w:1) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:1 w:0) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) fn remove_other_vote() -> Weight { - // Minimum execution time: 103_052 nanoseconds. - Weight::from_ref_time(107_461_000) + // Proof Size summary in bytes: + // Measured: `13139` + // Estimated: `35107` + // Minimum execution time: 109_000_000 picoseconds. + Weight::from_parts(109_000_000, 0) + .saturating_add(Weight::from_parts(0, 35107)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } - // 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) + /// Storage: ConvictionVoting VotingFor (r:2 w:2) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:512 w:512) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) + /// Storage: ConvictionVoting ClassLocksFor (r:1 w:1) + /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(311), added: 2786, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) /// The range of component `r` is `[0, 512]`. - fn delegate(r: u32, ) -> Weight { - // Minimum execution time: 102_070 nanoseconds. - Weight::from_ref_time(1_776_040_090) - // Standard Error: 149_833 - .saturating_add(Weight::from_ref_time(38_268_419).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(6)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + fn delegate(_r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `272 + r * (427 ±0)` + // Estimated: `1900250` + // Minimum execution time: 86_000_000 picoseconds. + Weight::from_parts(27_182_000_000, 0) + .saturating_add(Weight::from_parts(0, 1900250)) + .saturating_add(T::DbWeight::get().reads(518)) + .saturating_add(T::DbWeight::get().writes(518)) } - // Storage: ConvictionVoting VotingFor (r:2 w:2) - // Storage: Referenda ReferendumInfoFor (r:10 w:10) - // Storage: Scheduler Agenda (r:2 w:2) + /// Storage: ConvictionVoting VotingFor (r:2 w:2) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: Referenda ReferendumInfoFor (r:512 w:512) + /// Proof: Referenda ReferendumInfoFor (max_values: None, max_size: Some(936), added: 3411, mode: MaxEncodedLen) + /// Storage: Scheduler Agenda (r:2 w:2) + /// Proof: Scheduler Agenda (max_values: None, max_size: Some(38963), added: 41438, mode: MaxEncodedLen) /// The range of component `r` is `[0, 512]`. - fn undelegate(r: u32, ) -> Weight { - // Minimum execution time: 75_841 nanoseconds. - Weight::from_ref_time(1_698_737_760) - // Standard Error: 145_937 - .saturating_add(Weight::from_ref_time(38_386_704).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) - .saturating_add(T::DbWeight::get().writes(4)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(r.into()))) + fn undelegate(_r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `470 + r * (426 ±0)` + // Estimated: `1891710` + // Minimum execution time: 59_000_000 picoseconds. + Weight::from_parts(27_242_000_000, 0) + .saturating_add(Weight::from_parts(0, 1891710)) + .saturating_add(T::DbWeight::get().reads(516)) + .saturating_add(T::DbWeight::get().writes(516)) } - // Storage: ConvictionVoting VotingFor (r:1 w:1) - // Storage: ConvictionVoting ClassLocksFor (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) + /// Storage: ConvictionVoting VotingFor (r:1 w:1) + /// Proof: ConvictionVoting VotingFor (max_values: None, max_size: Some(27241), added: 29716, mode: MaxEncodedLen) + /// Storage: ConvictionVoting ClassLocksFor (r:1 w:1) + /// Proof: ConvictionVoting ClassLocksFor (max_values: None, max_size: Some(311), added: 2786, mode: MaxEncodedLen) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) fn unlock() -> Weight { - // Minimum execution time: 130_072 nanoseconds. - Weight::from_ref_time(132_988_000) + // Proof Size summary in bytes: + // Measured: `12385` + // Estimated: `39246` + // Minimum execution time: 121_000_000 picoseconds. + Weight::from_parts(121_000_000, 0) + .saturating_add(Weight::from_parts(0, 39246)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } diff --git a/runtime/polkadot/src/weights/pallet_referenda.rs b/runtime/polkadot/src/weights/pallet_referenda.rs index 4afbca9a10c4..5ebe89b6948b 100644 --- a/runtime/polkadot/src/weights/pallet_referenda.rs +++ b/runtime/polkadot/src/weights/pallet_referenda.rs @@ -16,7 +16,7 @@ //! Autogenerated weights for `pallet_referenda` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-16, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-07, STEPS: `1`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `cob`, CPU: `` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 @@ -26,7 +26,7 @@ // benchmark // pallet // --chain=polkadot-dev -// --steps=2 +// --steps=1 // --repeat=1 // --pallet=pallet_referenda // --extrinsic=* @@ -54,10 +54,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn submit() -> Weight { // Proof Size summary in bytes: // Measured: `290` - // Estimated: `41937` - // Minimum execution time: 50_000 nanoseconds. - Weight::from_ref_time(50_000_000) - .saturating_add(Weight::from_proof_size(41937)) + // Estimated: `43917` + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) + .saturating_add(Weight::from_parts(0, 43917)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -68,10 +68,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn place_decision_deposit_preparing() -> Weight { // Proof Size summary in bytes: // Measured: `575` - // Estimated: `86287` - // Minimum execution time: 61_000 nanoseconds. - Weight::from_ref_time(61_000_000) - .saturating_add(Weight::from_proof_size(86287)) + // Estimated: `88267` + // Minimum execution time: 64_000_000 picoseconds. + Weight::from_parts(64_000_000, 0) + .saturating_add(Weight::from_parts(0, 88267)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -84,10 +84,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn place_decision_deposit_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3203` - // Estimated: `10387` - // Minimum execution time: 50_000 nanoseconds. - Weight::from_ref_time(50_000_000) - .saturating_add(Weight::from_proof_size(10387)) + // Estimated: `13357` + // Minimum execution time: 82_000_000 picoseconds. + Weight::from_parts(82_000_000, 0) + .saturating_add(Weight::from_parts(0, 13357)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -100,10 +100,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn place_decision_deposit_not_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3223` - // Estimated: `10387` - // Minimum execution time: 50_000 nanoseconds. - Weight::from_ref_time(50_000_000) - .saturating_add(Weight::from_proof_size(10387)) + // Estimated: `13357` + // Minimum execution time: 59_000_000 picoseconds. + Weight::from_parts(59_000_000, 0) + .saturating_add(Weight::from_parts(0, 13357)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -118,10 +118,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn place_decision_deposit_passing() -> Weight { // Proof Size summary in bytes: // Measured: `575` - // Estimated: `89287` - // Minimum execution time: 78_000 nanoseconds. - Weight::from_ref_time(78_000_000) - .saturating_add(Weight::from_proof_size(89287)) + // Estimated: `93247` + // Minimum execution time: 142_000_000 picoseconds. + Weight::from_parts(142_000_000, 0) + .saturating_add(Weight::from_parts(0, 93247)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -134,10 +134,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn place_decision_deposit_failing() -> Weight { // Proof Size summary in bytes: // Measured: `482` - // Estimated: `6411` - // Minimum execution time: 47_000 nanoseconds. - Weight::from_ref_time(47_000_000) - .saturating_add(Weight::from_proof_size(6411)) + // Estimated: `9381` + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) + .saturating_add(Weight::from_parts(0, 9381)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -146,10 +146,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn refund_decision_deposit() -> Weight { // Proof Size summary in bytes: // Measured: `415` - // Estimated: `3411` - // Minimum execution time: 42_000 nanoseconds. - Weight::from_ref_time(42_000_000) - .saturating_add(Weight::from_proof_size(3411)) + // Estimated: `4401` + // Minimum execution time: 35_000_000 picoseconds. + Weight::from_parts(35_000_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -158,10 +158,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn refund_submission_deposit() -> Weight { // Proof Size summary in bytes: // Measured: `405` - // Estimated: `3411` - // Minimum execution time: 34_000 nanoseconds. - Weight::from_ref_time(34_000_000) - .saturating_add(Weight::from_proof_size(3411)) + // Estimated: `4401` + // Minimum execution time: 36_000_000 picoseconds. + Weight::from_parts(36_000_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -172,10 +172,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn cancel() -> Weight { // Proof Size summary in bytes: // Measured: `451` - // Estimated: `86287` - // Minimum execution time: 49_000 nanoseconds. - Weight::from_ref_time(49_000_000) - .saturating_add(Weight::from_proof_size(86287)) + // Estimated: `88267` + // Minimum execution time: 52_000_000 picoseconds. + Weight::from_parts(52_000_000, 0) + .saturating_add(Weight::from_parts(0, 88267)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -188,10 +188,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn kill() -> Weight { // Proof Size summary in bytes: // Measured: `756` - // Estimated: `88814` - // Minimum execution time: 132_000 nanoseconds. - Weight::from_ref_time(132_000_000) - .saturating_add(Weight::from_proof_size(88814)) + // Estimated: `91784` + // Minimum execution time: 141_000_000 picoseconds. + Weight::from_parts(141_000_000, 0) + .saturating_add(Weight::from_parts(0, 91784)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -202,10 +202,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn one_fewer_deciding_queue_empty() -> Weight { // Proof Size summary in bytes: // Measured: `174` - // Estimated: `6976` - // Minimum execution time: 12_000 nanoseconds. - Weight::from_ref_time(12_000_000) - .saturating_add(Weight::from_proof_size(6976)) + // Estimated: `8956` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(12_000_000, 0) + .saturating_add(Weight::from_parts(0, 8956)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -220,10 +220,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn one_fewer_deciding_failing() -> Weight { // Proof Size summary in bytes: // Measured: `3972` - // Estimated: `91285` - // Minimum execution time: 128_000 nanoseconds. - Weight::from_ref_time(128_000_000) - .saturating_add(Weight::from_proof_size(91285)) + // Estimated: `95245` + // Minimum execution time: 139_000_000 picoseconds. + Weight::from_parts(139_000_000, 0) + .saturating_add(Weight::from_parts(0, 95245)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -238,10 +238,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn one_fewer_deciding_passing() -> Weight { // Proof Size summary in bytes: // Measured: `3972` - // Estimated: `91285` - // Minimum execution time: 130_000 nanoseconds. - Weight::from_ref_time(130_000_000) - .saturating_add(Weight::from_proof_size(91285)) + // Estimated: `95245` + // Minimum execution time: 153_000_000 picoseconds. + Weight::from_parts(153_000_000, 0) + .saturating_add(Weight::from_parts(0, 95245)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -254,10 +254,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_requeued_insertion() -> Weight { // Proof Size summary in bytes: // Measured: `3990` - // Estimated: `49336` - // Minimum execution time: 65_000 nanoseconds. - Weight::from_ref_time(65_000_000) - .saturating_add(Weight::from_proof_size(49336)) + // Estimated: `52306` + // Minimum execution time: 82_000_000 picoseconds. + Weight::from_parts(82_000_000, 0) + .saturating_add(Weight::from_parts(0, 52306)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -270,10 +270,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_requeued_slide() -> Weight { // Proof Size summary in bytes: // Measured: `3990` - // Estimated: `49336` - // Minimum execution time: 68_000 nanoseconds. - Weight::from_ref_time(68_000_000) - .saturating_add(Weight::from_proof_size(49336)) + // Estimated: `52306` + // Minimum execution time: 76_000_000 picoseconds. + Weight::from_parts(76_000_000, 0) + .saturating_add(Weight::from_parts(0, 52306)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -288,10 +288,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3964` - // Estimated: `51825` - // Minimum execution time: 65_000 nanoseconds. - Weight::from_ref_time(65_000_000) - .saturating_add(Weight::from_proof_size(51825)) + // Estimated: `55785` + // Minimum execution time: 108_000_000 picoseconds. + Weight::from_parts(108_000_000, 0) + .saturating_add(Weight::from_parts(0, 55785)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -306,10 +306,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_not_queued() -> Weight { // Proof Size summary in bytes: // Measured: `3984` - // Estimated: `51825` - // Minimum execution time: 68_000 nanoseconds. - Weight::from_ref_time(68_000_000) - .saturating_add(Weight::from_proof_size(51825)) + // Estimated: `55785` + // Minimum execution time: 85_000_000 picoseconds. + Weight::from_parts(85_000_000, 0) + .saturating_add(Weight::from_parts(0, 55785)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -320,10 +320,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_no_deposit() -> Weight { // Proof Size summary in bytes: // Measured: `403` - // Estimated: `44849` - // Minimum execution time: 32_000 nanoseconds. - Weight::from_ref_time(32_000_000) - .saturating_add(Weight::from_proof_size(44849)) + // Estimated: `46829` + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(37_000_000, 0) + .saturating_add(Weight::from_parts(0, 46829)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -334,10 +334,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_preparing() -> Weight { // Proof Size summary in bytes: // Measured: `451` - // Estimated: `44849` - // Minimum execution time: 30_000 nanoseconds. - Weight::from_ref_time(30_000_000) - .saturating_add(Weight::from_proof_size(44849)) + // Estimated: `46829` + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(33_000_000, 0) + .saturating_add(Weight::from_parts(0, 46829)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -346,10 +346,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_timed_out() -> Weight { // Proof Size summary in bytes: // Measured: `310` - // Estimated: `3411` - // Minimum execution time: 19_000 nanoseconds. - Weight::from_ref_time(19_000_000) - .saturating_add(Weight::from_proof_size(3411)) + // Estimated: `4401` + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(22_000_000, 0) + .saturating_add(Weight::from_parts(0, 4401)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -364,10 +364,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_begin_deciding_failing() -> Weight { // Proof Size summary in bytes: // Measured: `451` - // Estimated: `47849` - // Minimum execution time: 40_000 nanoseconds. - Weight::from_ref_time(40_000_000) - .saturating_add(Weight::from_proof_size(47849)) + // Estimated: `51809` + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(46_000_000, 0) + .saturating_add(Weight::from_parts(0, 51809)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -382,10 +382,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_begin_deciding_passing() -> Weight { // Proof Size summary in bytes: // Measured: `451` - // Estimated: `47849` - // Minimum execution time: 44_000 nanoseconds. - Weight::from_ref_time(44_000_000) - .saturating_add(Weight::from_proof_size(47849)) + // Estimated: `51809` + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(49_000_000, 0) + .saturating_add(Weight::from_parts(0, 51809)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -398,10 +398,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_begin_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `504` - // Estimated: `45360` - // Minimum execution time: 35_000 nanoseconds. - Weight::from_ref_time(35_000_000) - .saturating_add(Weight::from_proof_size(45360)) + // Estimated: `48330` + // Minimum execution time: 39_000_000 picoseconds. + Weight::from_parts(39_000_000, 0) + .saturating_add(Weight::from_parts(0, 48330)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -414,10 +414,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_end_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `487` - // Estimated: `45360` - // Minimum execution time: 37_000 nanoseconds. - Weight::from_ref_time(37_000_000) - .saturating_add(Weight::from_proof_size(45360)) + // Estimated: `48330` + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(41_000_000, 0) + .saturating_add(Weight::from_parts(0, 48330)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -430,10 +430,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_continue_not_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `504` - // Estimated: `45360` - // Minimum execution time: 32_000 nanoseconds. - Weight::from_ref_time(32_000_000) - .saturating_add(Weight::from_proof_size(45360)) + // Estimated: `48330` + // Minimum execution time: 34_000_000 picoseconds. + Weight::from_parts(34_000_000, 0) + .saturating_add(Weight::from_parts(0, 48330)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -446,10 +446,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_continue_confirming() -> Weight { // Proof Size summary in bytes: // Measured: `508` - // Estimated: `45360` - // Minimum execution time: 31_000 nanoseconds. - Weight::from_ref_time(31_000_000) - .saturating_add(Weight::from_proof_size(45360)) + // Estimated: `48330` + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(32_000_000, 0) + .saturating_add(Weight::from_parts(0, 48330)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -464,10 +464,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_approved() -> Weight { // Proof Size summary in bytes: // Measured: `508` - // Estimated: `89321` - // Minimum execution time: 50_000 nanoseconds. - Weight::from_ref_time(50_000_000) - .saturating_add(Weight::from_proof_size(89321)) + // Estimated: `93281` + // Minimum execution time: 73_000_000 picoseconds. + Weight::from_parts(73_000_000, 0) + .saturating_add(Weight::from_parts(0, 93281)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -480,10 +480,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn nudge_referendum_rejected() -> Weight { // Proof Size summary in bytes: // Measured: `504` - // Estimated: `45360` - // Minimum execution time: 37_000 nanoseconds. - Weight::from_ref_time(37_000_000) - .saturating_add(Weight::from_proof_size(45360)) + // Estimated: `48330` + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(40_000_000, 0) + .saturating_add(Weight::from_parts(0, 48330)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -496,10 +496,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn set_some_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `454` - // Estimated: `5977` - // Minimum execution time: 26_000 nanoseconds. - Weight::from_ref_time(26_000_000) - .saturating_add(Weight::from_proof_size(5977)) + // Estimated: `7957` + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) + .saturating_add(Weight::from_parts(0, 7957)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -510,10 +510,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { fn clear_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `387` - // Estimated: `5938` - // Minimum execution time: 22_000 nanoseconds. - Weight::from_ref_time(22_000_000) - .saturating_add(Weight::from_proof_size(5938)) + // Estimated: `7918` + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(22_000_000, 0) + .saturating_add(Weight::from_parts(0, 7918)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/polkadot/src/weights/pallet_whitelist.rs b/runtime/polkadot/src/weights/pallet_whitelist.rs index 788f466f1ac9..552d0df1890b 100644 --- a/runtime/polkadot/src/weights/pallet_whitelist.rs +++ b/runtime/polkadot/src/weights/pallet_whitelist.rs @@ -16,23 +16,24 @@ //! Autogenerated weights for `pallet_whitelist` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 +//! DATE: 2023-03-07, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `cob`, CPU: `` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// ./target/release/polkadot // benchmark // pallet -// --chain=kusama-dev -// --steps=50 -// --repeat=20 +// --chain=polkadot-dev +// --steps=2 +// --repeat=1 // --pallet=pallet_whitelist // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --header=./file_header.txt -// --output=./runtime/kusama/src/weights/ +// --output=./runtime/polkadot/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -44,42 +45,63 @@ 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) + /// Storage: Whitelist WhitelistedCall (r:1 w:1) + /// Proof: Whitelist WhitelistedCall (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn whitelist_call() -> Weight { - // Minimum execution time: 24_174 nanoseconds. - Weight::from_ref_time(25_019_000) + // Proof Size summary in bytes: + // Measured: `118` + // Estimated: `7061` + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(33_000_000, 0) + .saturating_add(Weight::from_parts(0, 7061)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } - // Storage: Whitelist WhitelistedCall (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Whitelist WhitelistedCall (r:1 w:1) + /// Proof: Whitelist WhitelistedCall (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) fn remove_whitelisted_call() -> Weight { - // Minimum execution time: 22_530 nanoseconds. - Weight::from_ref_time(23_064_000) + // Proof Size summary in bytes: + // Measured: `247` + // Estimated: `7061` + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(24_000_000, 0) + .saturating_add(Weight::from_parts(0, 7061)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } - // Storage: Whitelist WhitelistedCall (r:1 w:1) - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Whitelist WhitelistedCall (r:1 w:1) + /// Proof: Whitelist WhitelistedCall (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Preimage PreimageFor (r:1 w:1) + /// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: Measured) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) /// The range of component `n` is `[1, 4194294]`. - fn dispatch_whitelisted_call(n: u32, ) -> Weight { - // Minimum execution time: 32_957 nanoseconds. - Weight::from_ref_time(33_403_000) - // Standard Error: 4 - .saturating_add(Weight::from_ref_time(1_543).saturating_mul(n.into())) + fn dispatch_whitelisted_call(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `311 + n * (1 ±0)` + // Estimated: `4205175` + // Minimum execution time: 43_000_000 picoseconds. + Weight::from_parts(4_138_000_000, 0) + .saturating_add(Weight::from_parts(0, 4205175)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } - // Storage: Whitelist WhitelistedCall (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) + /// Storage: Whitelist WhitelistedCall (r:1 w:1) + /// Proof: Whitelist WhitelistedCall (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen) + /// Storage: Preimage StatusFor (r:1 w:1) + /// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen) /// The range of component `n` is `[1, 10000]`. - fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight { - // Minimum execution time: 26_062 nanoseconds. - Weight::from_ref_time(26_997_169) - // Standard Error: 6 - .saturating_add(Weight::from_ref_time(1_906).saturating_mul(n.into())) + fn dispatch_whitelisted_call_with_preimage(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `247` + // Estimated: `7061` + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(45_000_000, 0) + .saturating_add(Weight::from_parts(0, 7061)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } From c2b8e5afaa2a54678ab4434396ed76c1009ef5bc Mon Sep 17 00:00:00 2001 From: Muharem Ismailov Date: Thu, 16 Mar 2023 14:45:44 +0100 Subject: [PATCH 25/26] XCM tweaks for OpenGov (#6855) * pass xcm origin, allow unpaid form Collectives and Fellows, whitelist call * unpaid execution only for Fellows * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * rename const namespace to system_parachains * remove prod_or_fast --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- runtime/polkadot/constants/src/lib.rs | 8 ++++++++ runtime/polkadot/src/xcm_config.rs | 26 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/runtime/polkadot/constants/src/lib.rs b/runtime/polkadot/constants/src/lib.rs index 03178328e12d..6aec6768e889 100644 --- a/runtime/polkadot/constants/src/lib.rs +++ b/runtime/polkadot/constants/src/lib.rs @@ -111,6 +111,14 @@ pub mod xcm { } } +/// System Parachains. +pub mod system_parachain { + /// Statemint parachain ID. + pub const STATEMINT_ID: u32 = 1000; + /// Collectives parachain ID. + pub const COLLECTIVES_ID: u32 = 1001; +} + #[cfg(test)] mod tests { use super::{ diff --git a/runtime/polkadot/src/xcm_config.rs b/runtime/polkadot/src/xcm_config.rs index 4a1f2b57a71a..d853b27132c7 100644 --- a/runtime/polkadot/src/xcm_config.rs +++ b/runtime/polkadot/src/xcm_config.rs @@ -26,15 +26,16 @@ use frame_support::{ traits::{Contains, Everything, Nothing}, weights::Weight, }; -use polkadot_runtime_constants::xcm::body::FELLOWSHIP_ADMIN_INDEX; +use pallet_xcm::XcmPassthrough; +use polkadot_runtime_constants::{system_parachain::*, xcm::body::FELLOWSHIP_ADMIN_INDEX}; use runtime_common::{paras_registrar, xcm_sender, ToAuthor}; use sp_core::ConstU32; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, BackingToPlurality, ChildParachainAsNative, - ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, - IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, BackingToPlurality, + ChildParachainAsNative, ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, + FixedWeightBounds, IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, }; @@ -94,6 +95,8 @@ type LocalOriginConverter = ( // If the origin kind is `Native` and the XCM origin is the `AccountId32` location, then it can // be expressed using the `Signed` origin variant. SignedAccountId32AsNative, + // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. + XcmPassthrough, ); parameter_types! { @@ -113,8 +116,8 @@ pub type XcmRouter = ( parameter_types! { pub const Dot: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }); - pub const DotForStatemint: (MultiAssetFilter, MultiLocation) = (Dot::get(), Parachain(1000).into_location()); - pub const CollectivesLocation: MultiLocation = Parachain(1001).into_location(); + pub const DotForStatemint: (MultiAssetFilter, MultiLocation) = (Dot::get(), Parachain(STATEMINT_ID).into_location()); + pub const CollectivesLocation: MultiLocation = Parachain(COLLECTIVES_ID).into_location(); pub const DotForCollectives: (MultiAssetFilter, MultiLocation) = (Dot::get(), CollectivesLocation::get()); pub const MaxAssetsIntoHolding: u32 = 64; } @@ -127,6 +130,10 @@ match_types! { pub type OnlyParachains: impl Contains = { MultiLocation { parents: 0, interior: X1(Parachain(_)) } }; + pub type CollectivesOrFellows: impl Contains = { + MultiLocation { parents: 0, interior: X1(Parachain(COLLECTIVES_ID)) } | + MultiLocation { parents: 0, interior: X2(Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }) } + }; } /// The barriers one of which must be passed for an XCM message to be executed. @@ -141,6 +148,8 @@ pub type Barrier = ( AllowTopLevelPaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, + // Collectives and Fellows plurality get free execution. + AllowExplicitUnpaidExecutionFrom, ), UniversalLocation, ConstU32<8>, @@ -304,7 +313,8 @@ impl Contains for SafeCallFilter { ) | RuntimeCall::XcmPallet(pallet_xcm::Call::limited_reserve_transfer_assets { .. - }) => true, + }) | + RuntimeCall::Whitelist(pallet_whitelist::Call::whitelist_call { .. }) => true, _ => false, } } From fda6c7c5e0b1cbd30890529756d319a524d0ad5e Mon Sep 17 00:00:00 2001 From: muharem Date: Tue, 21 Mar 2023 13:38:15 +0100 Subject: [PATCH 26/26] remove unused import --- runtime/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index c51a95207935..cf1bb606fcac 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -47,7 +47,7 @@ use frame_support::{ weights::ConstantMultiplier, PalletId, RuntimeDebug, }; -use frame_system::{EnsureRoot, EnsureWithSuccess}; +use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical as session_historical;