Introduce Fellowship into Collectives (#2186)

* Fellowship into Collectives

* cargo.lock

* tracks alias

* allow to send Fellows origin over XCM

* update todos, remove duplication of type

* use Collectives location for Fellows body

* alias for ranks constants

* benchmarks

* proxy for Fellowship

* docs

* correct copyright date

* Apply suggestions from code review

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* rustfmt

* remove council, update origins

* renames

* remove tech committee from promote origin

* renames

* doc nits

* weights with new api

* sane weights for pallet_scheduler

* XCM tweaks for OpenGov (#2305)

* updated xcm configs for collectives and statemint

* remove xcm send from safe filter

* remove prod_or_fast

* remove empty line

* drop redundant aggregation

* remove match arm duplication

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
Muharem Ismailov
2023-03-21 14:10:37 +01:00
committed by GitHub
parent a2e55084b0
commit 7623aba639
24 changed files with 1914 additions and 113 deletions
+10 -15
View File
@@ -65,13 +65,16 @@ use parachains_common::{
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{KsmLocation, TrustBackedAssetsConvertedConcreteId, XcmConfig};
use xcm_config::{
FellowshipLocation, GovernanceLocation, KsmLocation, TrustBackedAssetsConvertedConcreteId,
XcmConfig,
};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
// Polkadot imports
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, IsVoiceOfBody};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::latest::BodyId;
use xcm_executor::XcmExecutor;
@@ -228,12 +231,10 @@ parameter_types! {
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
pub const MetadataDepositBase: Balance = deposit(1, 68);
pub const MetadataDepositPerByte: Balance = deposit(0, 1);
pub const ExecutiveBody: BodyId = BodyId::Executive;
}
/// We allow root and the Relay Chain council to execute privileged asset operations.
pub type AssetsForceOrigin =
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>>;
/// We allow root to execute privileged asset operations.
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
// Called "Trust Backed" assets because these are generally registered by some account, and users of
// the asset assume it has some claimed backing. The pallet is called `Assets` in
@@ -492,10 +493,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<(
IsMajorityOfBody<KsmLocation, ExecutiveBody>,
IsVoiceOfBody<KsmLocation, FellowsBodyId>,
)>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;
type ControllerOriginConverter = xcm_config::XcmOriginToTransactDispatchOrigin;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
@@ -543,13 +541,10 @@ parameter_types! {
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}
/// We allow root, the Relay Chain council and the StakingAdmin to execute privileged collator selection operations.
/// We allow root the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<(
IsMajorityOfBody<KsmLocation, ExecutiveBody>,
IsVoiceOfBody<KsmLocation, StakingAdminBodyId>,
)>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;
impl pallet_collator_selection::Config for Runtime {
@@ -52,6 +52,8 @@ parameter_types! {
pub TrustBackedAssetsPalletLocation: MultiLocation =
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub const FellowshipLocation: MultiLocation = MultiLocation::parent();
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
+18 -10
View File
@@ -94,14 +94,15 @@ use parachains_common::{
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{
DotLocation, TrustBackedAssetsConvertedConcreteId, XcmConfig, XcmOriginToTransactDispatchOrigin,
DotLocation, FellowshipLocation, GovernanceLocation, TrustBackedAssetsConvertedConcreteId,
XcmConfig, XcmOriginToTransactDispatchOrigin,
};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
// Polkadot imports
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::latest::BodyId;
use xcm_executor::XcmExecutor;
@@ -244,12 +245,10 @@ parameter_types! {
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
pub const MetadataDepositBase: Balance = deposit(1, 68);
pub const MetadataDepositPerByte: Balance = deposit(0, 1);
pub const ExecutiveBody: BodyId = BodyId::Executive;
}
/// We allow root and the Relay Chain council to execute privileged asset operations.
pub type AssetsForceOrigin =
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>>;
/// We allow root to execute privileged asset operations.
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
// Called "Trust Backed" assets because these are generally registered by some account, and users of
// the asset assume it has some claimed backing. The pallet is called `Assets` in
@@ -476,6 +475,11 @@ impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
parameter_types! {
// Fellows pluralistic body.
pub const FellowsBodyId: BodyId = BodyId::Technical;
}
impl cumulus_pallet_xcmp_queue::Config for Runtime {
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
@@ -485,7 +489,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type PriceForSiblingDelivery = ();
@@ -528,11 +532,15 @@ parameter_types! {
pub const MinCandidates: u32 = 5;
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const MaxInvulnerables: u32 = 100;
// `StakingAdmin` pluralistic body.
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin =
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>>;
/// We allow root and the `StakingAdmin` to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;
impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
@@ -52,6 +52,8 @@ parameter_types! {
pub TrustBackedAssetsPalletLocation: MultiLocation =
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
@@ -142,6 +144,9 @@ match_types! {
MultiLocation { parents: 1, interior: Here } |
MultiLocation { parents: 1, interior: X1(_) }
};
pub type FellowsPlurality: impl Contains<MultiLocation> = {
MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) }
};
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
@@ -176,7 +181,8 @@ impl Contains<RuntimeCall> for SafeCallFilter {
pallet_collator_selection::Call::set_desired_candidates { .. } |
pallet_collator_selection::Call::set_candidacy_bond { .. } |
pallet_collator_selection::Call::register_as_candidate { .. } |
pallet_collator_selection::Call::leave_intent { .. },
pallet_collator_selection::Call::leave_intent { .. } |
pallet_collator_selection::Call::set_invulnerables { .. },
) |
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::XcmpQueue(..) |
@@ -253,8 +259,8 @@ pub type Barrier = DenyThenTry<
(
// If the message is one that immediately attemps to pay for execution, then allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent and its plurality (i.e. governance bodies) gets free execution.
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
// Parent, its plurality (i.e. governance bodies) and Fellows plurality gets free execution.
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentOrSiblings>,
),
@@ -54,10 +54,12 @@ use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot,
};
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{
FellowshipLocation, GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin,
};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -67,12 +69,11 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
// XCM Imports
use crate::xcm_config::KsmRelayLocation;
use parachains_common::{
opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
// XCM Imports
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;
@@ -291,11 +292,15 @@ impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
// TODO: map gov2 origins here - after merge https://github.com/paritytech/cumulus/pull/1895
/// Privileged origin that represents Root or the majority of the Relay Chain Council.
pub type RootOrExecutiveSimpleMajority = EitherOfDiverse<
parameter_types! {
// Fellows pluralistic body.
pub const FellowsBodyId: BodyId = BodyId::Technical;
}
/// Privileged origin that represents Root or Fellows pluralistic body.
pub type RootOrFellows = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsMajorityOfBody<KsmRelayLocation, ExecutiveBody>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;
impl cumulus_pallet_xcmp_queue::Config for Runtime {
@@ -304,7 +309,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ChannelInfo = ParachainSystem;
type VersionWrapper = PolkadotXcm;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = RootOrExecutiveSimpleMajority;
type ControllerOrigin = RootOrFellows;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
type PriceForSiblingDelivery = ();
@@ -342,12 +347,15 @@ impl pallet_aura::Config for Runtime {
parameter_types! {
pub const PotId: PalletId = PalletId(*b"PotStake");
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const ExecutiveBody: BodyId = BodyId::Executive;
// StakingAdmin pluralistic body.
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}
// TODO: map gov2 origins here - after merge https://github.com/paritytech/cumulus/pull/1895
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = RootOrExecutiveSimpleMajority;
/// We allow root, the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;
impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
@@ -47,6 +47,8 @@ parameter_types! {
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
pub const FellowshipLocation: MultiLocation = MultiLocation::parent();
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
@@ -54,10 +54,12 @@ use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot,
};
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{
FellowshipLocation, GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin,
};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -67,12 +69,11 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
// XCM Imports
use crate::xcm_config::DotRelayLocation;
use parachains_common::{
opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
// XCM Imports
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;
@@ -291,10 +292,15 @@ impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {}
/// Privileged origin that represents Root or the majority of the Relay Chain Council.
pub type RootOrExecutiveSimpleMajority = EitherOfDiverse<
parameter_types! {
// Fellows pluralistic body.
pub const FellowsBodyId: BodyId = BodyId::Technical;
}
/// Privileged origin that represents Root or Fellows.
pub type RootOrFellows = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsMajorityOfBody<DotRelayLocation, ExecutiveBody>>,
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
>;
impl cumulus_pallet_xcmp_queue::Config for Runtime {
@@ -303,7 +309,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ChannelInfo = ParachainSystem;
type VersionWrapper = PolkadotXcm;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = RootOrExecutiveSimpleMajority;
type ControllerOrigin = RootOrFellows;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
type PriceForSiblingDelivery = ();
@@ -341,11 +347,15 @@ impl pallet_aura::Config for Runtime {
parameter_types! {
pub const PotId: PalletId = PalletId(*b"PotStake");
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const ExecutiveBody: BodyId = BodyId::Executive;
// StakingAdmin pluralistic body.
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = RootOrExecutiveSimpleMajority;
/// We allow root, the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;
impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
@@ -47,6 +47,8 @@ parameter_types! {
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
pub FellowshipLocation: MultiLocation = MultiLocation::new(1, Parachain(1001));
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
@@ -76,7 +76,6 @@ use parachains_common::{
opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;
/// The address format for describing accounts.
@@ -404,7 +403,6 @@ impl pallet_aura::Config for Runtime {
parameter_types! {
pub const PotId: PalletId = PalletId(*b"PotStake");
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const ExecutiveBody: BodyId = BodyId::Executive;
}
pub type CollatorSelectionUpdateOrigin = EnsureRoot<AccountId>;
@@ -26,13 +26,18 @@ pallet-authorship = { git = "https://github.com/paritytech/substrate", default-f
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-collective = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-referenda = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-ranked-collective = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -95,6 +100,10 @@ runtime-benchmarks = [
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-ranked-collective/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
@@ -119,6 +128,10 @@ try-runtime = [
"pallet-utility/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-preimage/try-runtime",
"pallet-referenda/try-runtime",
"pallet-ranked-collective/try-runtime",
]
std = [
"codec/std",
@@ -170,5 +183,9 @@ std = [
"pallet-collator-selection/std",
"parachain-info/std",
"parachains-common/std",
"pallet-scheduler/std",
"pallet-preimage/std",
"pallet-referenda/std",
"pallet-ranked-collective/std",
"substrate-wasm-builder",
]
@@ -15,12 +15,17 @@
pub mod account {
use frame_support::PalletId;
use sp_runtime::AccountId32;
/// Relay Chain treasury pallet id, used to convert into AccountId
pub const RELAY_TREASURY_PALL_ID: PalletId = PalletId(*b"py/trsry");
/// account used to temporarily deposit slashed imbalance before teleporting
pub const SLASHED_IMBALANCE_ACC_ID: AccountId32 = AccountId32::new([7u8; 32]);
pub const RELAY_TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry");
/// Alliance pallet ID.
/// It is used as a temporarily place to deposit a slashed imbalance
/// before the teleport to the Treasury.
pub const ALLIANCE_PALLET_ID: PalletId = PalletId(*b"py/allia");
/// Referenda pallet ID.
/// It is used as a temporarily place to deposit a slashed imbalance
/// before the teleport to the Treasury.
pub const REFERENDA_PALLET_ID: PalletId = PalletId(*b"py/refer");
}
pub mod currency {
@@ -0,0 +1,141 @@
// Copyright 2023 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus 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.
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! The Polkadot Technical Fellowship.
mod origins;
mod tracks;
pub use origins::{
pallet_origins as pallet_fellowship_origins, Fellows, FellowshipCandidates, FellowshipExperts,
FellowshipMasters,
};
use crate::{
constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, BlockNumber,
FellowshipReferenda, GovernanceLocation, Preimage, RelayTreasuryAccount, Runtime, RuntimeCall,
RuntimeEvent, Scheduler, DAYS,
};
use frame_support::{
parameter_types,
traits::{EitherOf, MapSuccess, TryMapSuccess},
};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_constants::xcm::body::FELLOWSHIP_ADMIN_INDEX;
use sp_arithmetic::traits::CheckedSub;
use sp_core::ConstU32;
use sp_runtime::{
morph_types,
traits::{AccountIdConversion, ConstU16, Replace, TypedGet},
};
use xcm::latest::BodyId;
use self::origins::EnsureFellowship;
/// The Fellowship members' ranks.
pub mod ranks {
use pallet_ranked_collective::Rank;
pub const CANDIDATES: Rank = 0;
pub const DAN_1: Rank = 1;
pub const DAN_2: Rank = 2;
pub const DAN_3: Rank = 3; // aka Fellows.
pub const DAN_4: Rank = 4;
pub const DAN_5: Rank = 5; // aka Experts.
pub const DAN_6: Rank = 6;
pub const DAN_7: Rank = 7; // aka Masters.
pub const DAN_8: Rank = 8;
pub const DAN_9: Rank = 9;
}
parameter_types! {
pub const AlarmInterval: BlockNumber = 1;
pub const SubmissionDeposit: Balance = 0;
pub const UndecidingTimeout: BlockNumber = 7 * DAYS;
// Referenda pallet account, used to temporarily deposit slashed imbalance before teleporting.
pub ReferendaPalletAccount: AccountId = constants::account::REFERENDA_PALLET_ID.into_account_truncating();
pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX);
}
impl pallet_fellowship_origins::Config for Runtime {}
pub type FellowshipReferendaInstance = pallet_referenda::Instance1;
impl pallet_referenda::Config<FellowshipReferendaInstance> for Runtime {
type WeightInfo = weights::pallet_referenda::WeightInfo<Runtime>;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
type Currency = Balances;
type SubmitOrigin =
pallet_ranked_collective::EnsureMember<Runtime, FellowshipCollectiveInstance, 1>;
type CancelOrigin = FellowshipExperts;
type KillOrigin = FellowshipMasters;
type Slash = ToParentTreasury<RelayTreasuryAccount, ReferendaPalletAccount, Runtime>;
type Votes = pallet_ranked_collective::Votes;
type Tally = pallet_ranked_collective::TallyOf<Runtime, FellowshipCollectiveInstance>;
type SubmissionDeposit = SubmissionDeposit;
type MaxQueued = ConstU32<100>;
type UndecidingTimeout = UndecidingTimeout;
type AlarmInterval = AlarmInterval;
type Tracks = 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<N: TypedGet>: TryMorph = |r: N::Type| -> Result<N::Type, ()> {
r.checked_sub(&N::get()).ok_or(())
} where N::Type: CheckedSub;
}
impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime {
type WeightInfo = weights::pallet_ranked_collective::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
// Promotion is by any of:
// - Root can promote arbitrarily.
// - the FellowshipAdmin origin (i.e. token holder referendum);
// - a vote by the rank *above* the new rank.
type PromoteOrigin = EitherOf<
frame_system::EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
EitherOf<
MapSuccess<
EnsureXcm<IsVoiceOfBody<GovernanceLocation, FellowshipAdminBodyId>>,
Replace<ConstU16<9>>,
>,
TryMapSuccess<EnsureFellowship, CheckedReduceBy<ConstU16<1>>>,
>,
>;
// 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<Self::AccountId, ConstU16<65535>>,
EitherOf<
MapSuccess<
EnsureXcm<IsVoiceOfBody<GovernanceLocation, FellowshipAdminBodyId>>,
Replace<ConstU16<9>>,
>,
TryMapSuccess<EnsureFellowship, CheckedReduceBy<ConstU16<2>>>,
>,
>;
type Polls = FellowshipReferenda;
type MinRankOfClass = sp_runtime::traits::Identity;
type VoteWeight = pallet_ranked_collective::Geometric;
}
@@ -0,0 +1,148 @@
// Copyright 2023 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus 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.
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Fellowship custom origins.
use super::ranks;
pub use pallet_origins::*;
#[frame_support::pallet]
pub mod pallet_origins {
use super::ranks;
use frame_support::pallet_prelude::*;
use pallet_ranked_collective::Rank;
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::pallet]
pub struct Pallet<T>(_);
#[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)]
#[pallet::origin]
pub enum Origin {
/// Origin commanded by any members of the Polkadot Fellowship (no Dan grade needed).
FellowshipCandidates,
/// 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<O: Into<Result<Origin, O>> + From<Origin>>
EnsureOrigin<O> for $name
{
type Success = $success_type;
fn try_origin(o: O) -> Result<Self::Success, O> {
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<O, ()> {
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!(
FellowshipCandidates: Rank = ranks::CANDIDATES,
Fellows: Rank = ranks::DAN_3,
FellowshipExperts: Rank = ranks::DAN_5,
FellowshipMasters: Rank = ranks::DAN_7,
);
macro_rules! decl_ensure {
(
$vis:vis type $name:ident: EnsureOrigin<Success = $success_type:ty> {
$( $item:ident = $success:expr, )*
}
) => {
$vis struct $name;
impl<O: Into<Result<Origin, O>> + From<Origin>>
EnsureOrigin<O> for $name
{
type Success = $success_type;
fn try_origin(o: O) -> Result<Self::Success, O> {
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<O, ()> {
// By convention the more privileged origins go later, so for greatest chance
// of success, we want the last one.
let _result: Result<O, ()> = Err(());
$(
let _result: Result<O, ()> = Ok(O::from(Origin::$item));
)*
_result
}
}
}
}
decl_ensure! {
pub type EnsureFellowship: EnsureOrigin<Success = Rank> {
Fellowship1Dan = ranks::DAN_1,
Fellowship2Dan = ranks::DAN_2,
Fellowship3Dan = ranks::DAN_3,
Fellowship4Dan = ranks::DAN_4,
Fellowship5Dan = ranks::DAN_5,
Fellowship6Dan = ranks::DAN_6,
Fellowship7Dan = ranks::DAN_7,
Fellowship8Dan = ranks::DAN_8,
Fellowship9Dan = ranks::DAN_9,
}
}
}
@@ -0,0 +1,300 @@
// Copyright 2023 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus 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.
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Track configurations for Fellowship.
use crate::{Balance, BlockNumber, RuntimeOrigin, DAYS, DOLLARS, MINUTES};
use sp_runtime::Perbill;
/// Referendum `TrackId` type.
pub type TrackId = u16;
/// Referendum track IDs.
pub mod constants {
use super::TrackId;
pub const CANDIDATES: TrackId = 0;
pub const MEMBERS: TrackId = 1;
pub const PROFICIENTS: TrackId = 2;
pub const FELLOWS: TrackId = 3;
pub const SENIOR_FELLOWS: TrackId = 4;
pub const EXPERTS: TrackId = 5;
pub const SENIOR_EXPERTS: TrackId = 6;
pub const MASTERS: TrackId = 7;
pub const SENIOR_MASTERS: TrackId = 8;
pub const GRAND_MASTERS: TrackId = 9;
}
pub struct TracksInfo;
impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
type Id = TrackId;
type RuntimeOrigin = <RuntimeOrigin as frame_support::traits::OriginTrait>::PalletsOrigin;
fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo<Balance, BlockNumber>)] {
use constants as tracks;
static DATA: [(TrackId, pallet_referenda::TrackInfo<Balance, BlockNumber>); 10] = [
(
tracks::CANDIDATES,
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),
},
},
),
(
tracks::MEMBERS,
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),
},
},
),
(
tracks::PROFICIENTS,
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),
},
},
),
(
tracks::FELLOWS,
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),
},
},
),
(
tracks::SENIOR_FELLOWS,
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),
},
},
),
(
tracks::EXPERTS,
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),
},
},
),
(
tracks::SENIOR_EXPERTS,
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),
},
},
),
(
tracks::MASTERS,
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),
},
},
),
(
tracks::SENIOR_MASTERS,
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),
},
},
),
(
tracks::GRAND_MASTERS,
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<Self::Id, ()> {
use super::origins::Origin;
use constants as tracks;
#[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(tracks::GRAND_MASTERS)
}
}
match Origin::try_from(id.clone()) {
Ok(Origin::FellowshipCandidates) => Ok(tracks::CANDIDATES),
Ok(Origin::Fellowship1Dan) => Ok(tracks::MEMBERS),
Ok(Origin::Fellowship2Dan) => Ok(tracks::PROFICIENTS),
Ok(Origin::Fellowship3Dan) | Ok(Origin::Fellows) => Ok(tracks::FELLOWS),
Ok(Origin::Fellowship4Dan) => Ok(tracks::SENIOR_FELLOWS),
Ok(Origin::Fellowship5Dan) | Ok(Origin::FellowshipExperts) => Ok(tracks::EXPERTS),
Ok(Origin::Fellowship6Dan) => Ok(tracks::SENIOR_EXPERTS),
Ok(Origin::Fellowship7Dan | Origin::FellowshipMasters) => Ok(tracks::MASTERS),
Ok(Origin::Fellowship8Dan) => Ok(tracks::SENIOR_MASTERS),
Ok(Origin::Fellowship9Dan) => Ok(tracks::GRAND_MASTERS),
_ => Err(()),
}
}
}
pallet_referenda::impl_tracksinfo_get!(TracksInfo, Balance, BlockNumber);
@@ -13,14 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::OriginCaller;
use frame_support::{
dispatch::{DispatchError, DispatchResultWithPostInfo},
log,
traits::{Currency, Get, Imbalance, OnUnbalanced, OriginTrait},
traits::{Currency, Get, Imbalance, OnUnbalanced, OriginTrait, PrivilegeCmp},
weights::Weight,
};
use pallet_alliance::{ProposalIndex, ProposalProvider};
use sp_std::{marker::PhantomData, prelude::*};
use parachains_common::impls::NegativeImbalance;
use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*};
use xcm::latest::{Fungibility, Junction, Parent};
type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
@@ -29,40 +31,38 @@ type ProposalOf<T, I> = <T as pallet_collective::Config<I>>::Proposal;
type HashOf<T> = <T as frame_system::Config>::Hash;
type NegativeImbalanceOf<T, I> = <<T as pallet_alliance::Config<I>>::Currency as Currency<
<T as frame_system::Config>::AccountId,
>>::NegativeImbalance;
type CurrencyOf<T, I> = <T as pallet_alliance::Config<I>>::Currency;
type BalanceOf<T, I> = <<T as pallet_alliance::Config<I>>::Currency as Currency<
<T as frame_system::Config>::AccountId,
>>::Balance;
/// Type alias to conveniently refer to the `Currency::Balance` associated type.
pub type BalanceOf<T> =
<pallet_balances::Pallet<T> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury account.
pub struct ToParentTreasury<TreasuryAcc, TempAcc, T, I = ()>(
PhantomData<(TreasuryAcc, TempAcc, T, I)>,
pub struct ToParentTreasury<TreasuryAccount, PalletAccount, T>(
PhantomData<(TreasuryAccount, PalletAccount, T)>,
);
impl<TreasuryAcc, TempAcc, T, I: 'static> OnUnbalanced<NegativeImbalanceOf<T, I>>
for ToParentTreasury<TreasuryAcc, TempAcc, T, I>
impl<TreasuryAccount, PalletAccount, T> OnUnbalanced<NegativeImbalance<T>>
for ToParentTreasury<TreasuryAccount, PalletAccount, T>
where
TreasuryAcc: Get<AccountIdOf<T>>,
TempAcc: Get<AccountIdOf<T>>,
T: pallet_xcm::Config + frame_system::Config + pallet_alliance::Config<I>,
[u8; 32]: From<AccountIdOf<T>>,
BalanceOf<T, I>: Into<Fungibility>,
T: pallet_balances::Config + pallet_xcm::Config + frame_system::Config,
<<T as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId: From<AccountIdOf<T>>,
[u8; 32]: From<<T as frame_system::Config>::AccountId>,
TreasuryAccount: Get<AccountIdOf<T>>,
PalletAccount: Get<AccountIdOf<T>>,
BalanceOf<T>: Into<Fungibility>,
{
fn on_unbalanced(amount: NegativeImbalanceOf<T, I>) {
let temp_account: AccountIdOf<T> = TempAcc::get();
let treasury_acc: AccountIdOf<T> = TreasuryAcc::get();
fn on_unbalanced(amount: NegativeImbalance<T>) {
let amount = match amount.drop_zero() {
Ok(..) => return,
Err(amount) => amount,
};
let imbalance = amount.peek();
let pallet_acc: AccountIdOf<T> = PalletAccount::get();
let treasury_acc: AccountIdOf<T> = TreasuryAccount::get();
<CurrencyOf<T, I>>::resolve_creating(&temp_account, amount);
<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc.clone(), amount);
let result = pallet_xcm::Pallet::<T>::teleport_assets(
<T as frame_system::Config>::RuntimeOrigin::signed(temp_account.into()),
let result = <pallet_xcm::Pallet<T>>::teleport_assets(
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
Box::new(Parent.into()),
Box::new(
Junction::AccountId32 { network: None, id: treasury_acc.into() }
@@ -131,3 +131,19 @@ where
pallet_collective::Pallet::<T, I>::proposal_of(proposal_hash)
}
}
/// Used to compare the privilege of an origin inside the scheduler.
pub struct EqualOrGreatestRootCmp;
impl PrivilegeCmp<OriginCaller> for EqualOrGreatestRootCmp {
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
if left == right {
return Some(Ordering::Equal)
}
match (left, right) {
// Root is greater than anything.
(OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater),
_ => None,
}
}
}
@@ -41,16 +41,19 @@ pub mod constants;
pub mod impls;
mod weights;
pub mod xcm_config;
// Fellowship configurations.
pub mod fellowship;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use impls::{AllianceProposalProvider, ToParentTreasury};
use fellowship::{pallet_fellowship_origins, Fellows};
use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, ToParentTreasury};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
ApplyExtrinsicResult, Perbill,
};
use sp_std::prelude::*;
@@ -75,16 +78,16 @@ use frame_system::{
pub use parachains_common as common;
use parachains_common::{
impls::DealWithFees, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index,
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_config::{DotLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
// Polkadot imports
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::latest::BodyId;
use xcm_executor::XcmExecutor;
@@ -115,9 +118,6 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
/// Privileged origin that represents Root or the majority of the Relay Chain Council.
pub type RootOrExecutiveSimpleMajority =
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>>;
/// Privileged origin that represents Root or more than two thirds of the Alliance.
pub type RootOrAllianceTwoThirdsMajority = EitherOfDiverse<
EnsureRoot<AccountId>,
@@ -285,6 +285,8 @@ pub enum ProxyType {
Collator,
/// Alliance proxy. Allows calls related to the Alliance.
Alliance,
/// Fellowship proxy. Allows calls related to the Fellowship.
Fellowship,
}
impl Default for ProxyType {
fn default() -> Self {
@@ -315,6 +317,13 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. }
),
ProxyType::Fellowship => matches!(
c,
RuntimeCall::FellowshipCollective { .. } |
RuntimeCall::FellowshipReferenda { .. } |
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. }
),
}
}
fn is_superset(&self, o: &Self) -> bool {
@@ -370,7 +379,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ChannelInfo = ParachainSystem;
type VersionWrapper = PolkadotXcm;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = RootOrExecutiveSimpleMajority;
type ControllerOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Fellows>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
type PriceForSiblingDelivery = ();
@@ -408,11 +417,15 @@ impl pallet_aura::Config for Runtime {
parameter_types! {
pub const PotId: PalletId = PalletId(*b"PotStake");
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const ExecutiveBody: BodyId = BodyId::Executive;
// `StakingAdmin` pluralistic body.
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = RootOrExecutiveSimpleMajority;
/// We allow root and the `StakingAdmin` to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
>;
impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
@@ -456,9 +469,10 @@ pub const MAX_ALLIES: u32 = 100;
parameter_types! {
pub const AllyDeposit: Balance = 1_000 * UNITS; // 1,000 DOT bond to join as an Ally
// account used to temporarily deposit slashed imbalance before teleporting
pub SlashedImbalanceAccId: AccountId = constants::account::SLASHED_IMBALANCE_ACC_ID.into();
pub RelayTreasuryAccId: AccountId = constants::account::RELAY_TREASURY_PALL_ID.into_account_truncating();
// The Alliance pallet account, used as a temporary place to deposit a slashed imbalance
// before the teleport to the Treasury.
pub AlliancePalletAccount: AccountId = constants::account::ALLIANCE_PALLET_ID.into_account_truncating();
pub RelayTreasuryAccount: AccountId = constants::account::RELAY_TREASURY_PALLET_ID.into_account_truncating();
// The number of blocks a member must wait between giving a retirement notice and retiring.
// Supposed to be greater than time required to `kick_member` with alliance motion.
pub const AllianceRetirementPeriod: BlockNumber = (90 * DAYS) + ALLIANCE_MOTION_DURATION;
@@ -471,7 +485,7 @@ impl pallet_alliance::Config for Runtime {
type MembershipManager = RootOrAllianceTwoThirdsMajority;
type AnnouncementOrigin = RootOrAllianceTwoThirdsMajority;
type Currency = Balances;
type Slashed = ToParentTreasury<RelayTreasuryAccId, SlashedImbalanceAccId, Runtime>;
type Slashed = ToParentTreasury<RelayTreasuryAccount, AlliancePalletAccount, Runtime>;
type InitializeMembers = AllianceMotion;
type MembershipChanged = AllianceMotion;
type RetirementPeriod = AllianceRetirementPeriod;
@@ -488,6 +502,47 @@ impl pallet_alliance::Config for Runtime {
type WeightInfo = weights::pallet_alliance::WeightInfo<Runtime>;
}
parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * RuntimeBlockWeights::get().max_block;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const MaxScheduledPerBlock: u32 = 50;
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const MaxScheduledPerBlock: u32 = 200;
}
impl pallet_scheduler::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
type OriginPrivilegeCmp = EqualOrGreatestRootCmp;
type Preimages = Preimage;
}
parameter_types! {
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
}
impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
@@ -524,10 +579,21 @@ construct_runtime!(
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 43,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 44,
// The main stage.
// The Alliance.
Alliance: pallet_alliance::{Pallet, Call, Storage, Event<T>, Config<T>} = 50,
AllianceMotion: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 51,
// The Fellowship.
// pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1;
FellowshipCollective: pallet_ranked_collective::<Instance1>::{Pallet, Call, Storage, Event<T>} = 60,
// pub type FellowshipReferendaInstance = pallet_referenda::Instance1;
FellowshipReferenda: pallet_referenda::<Instance1>::{Pallet, Call, Storage, Event<T>} = 61,
FellowshipOrigins: pallet_fellowship_origins::{Origin} = 62,
}
);
@@ -587,6 +653,10 @@ mod benches {
[pallet_alliance, Alliance]
[pallet_collective, AllianceMotion]
[pallet_xcm, PolkadotXcm]
[pallet_preimage, Preimage]
[pallet_scheduler, Scheduler]
[pallet_referenda, FellowshipReferenda]
[pallet_ranked_collective, FellowshipCollective]
);
}
@@ -7,7 +7,11 @@ pub mod pallet_balances;
pub mod pallet_collator_selection;
pub mod pallet_collective;
pub mod pallet_multisig;
pub mod pallet_preimage;
pub mod pallet_proxy;
pub mod pallet_ranked_collective;
pub mod pallet_referenda;
pub mod pallet_scheduler;
pub mod pallet_session;
pub mod pallet_timestamp;
pub mod pallet_utility;
@@ -0,0 +1,193 @@
//! Autogenerated weights for `pallet_preimage`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-03-06, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `cob`, CPU: `<UNKNOWN>`
//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024
// Executed Command:
// ./target/debug/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --steps=2
// --repeat=1
// --pallet=pallet_preimage
// --extrinsic=*
// --execution=native
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./parachains/runtimes/collectives/collectives-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_preimage`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 4194304]`.
fn note_preimage(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `175`
// Estimated: `3556`
// Minimum execution time: 316_000_000 picoseconds.
Weight::from_parts(152_722_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 4194304]`.
fn note_requested_preimage(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3556`
// Minimum execution time: 147_000_000 picoseconds.
Weight::from_parts(152_365_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 4194304]`.
fn note_no_deposit_preimage(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3556`
// Minimum execution time: 145_000_000 picoseconds.
Weight::from_parts(152_298_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen)
fn unnote_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `353`
// Estimated: `3556`
// Minimum execution time: 333_000_000 picoseconds.
Weight::from_parts(333_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen)
fn unnote_no_deposit_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `144`
// Estimated: `3556`
// Minimum execution time: 202_000_000 picoseconds.
Weight::from_parts(202_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
fn request_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `220`
// Estimated: `3556`
// Minimum execution time: 189_000_000 picoseconds.
Weight::from_parts(189_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
fn request_no_deposit_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `144`
// Estimated: `3556`
// Minimum execution time: 137_000_000 picoseconds.
Weight::from_parts(137_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
fn request_unnoted_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
// Estimated: `3556`
// Minimum execution time: 140_000_000 picoseconds.
Weight::from_parts(140_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
fn request_requested_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3556`
// Minimum execution time: 109_000_000 picoseconds.
Weight::from_parts(109_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
/// Proof: Preimage PreimageFor (max_values: None, max_size: Some(4194344), added: 4196819, mode: MaxEncodedLen)
fn unrequest_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `144`
// Estimated: `3556`
// Minimum execution time: 208_000_000 picoseconds.
Weight::from_parts(208_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
fn unrequest_unnoted_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3556`
// Minimum execution time: 117_000_000 picoseconds.
Weight::from_parts(117_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
fn unrequest_multi_referenced_preimage() -> Weight {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3556`
// Minimum execution time: 107_000_000 picoseconds.
Weight::from_parts(107_000_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,144 @@
//! Autogenerated weights for `pallet_ranked_collective`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-03-06, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `cob`, CPU: `<UNKNOWN>`
//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024
// Executed Command:
// ./target/debug/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --steps=2
// --repeat=1
// --pallet=pallet_ranked_collective
// --extrinsic=*
// --execution=native
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./parachains/runtimes/collectives/collectives-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_ranked_collective`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_ranked_collective::WeightInfo for WeightInfo<T> {
/// Storage: FellowshipCollective Members (r:1 w:1)
/// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:1)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IndexToId (r:0 w:1)
/// Proof: FellowshipCollective IndexToId (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IdToIndex (r:0 w:1)
/// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
fn add_member() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `6986`
// Minimum execution time: 129_000_000 picoseconds.
Weight::from_parts(129_000_000, 0)
.saturating_add(Weight::from_parts(0, 6986))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipCollective Members (r:1 w:1)
/// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:11 w:11)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IdToIndex (r:11 w:11)
/// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IndexToId (r:11 w:11)
/// Proof: FellowshipCollective IndexToId (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// The range of component `r` is `[0, 10]`.
fn remove_member(_r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `575 + r * (281 ±0)`
// Estimated: `89494`
// Minimum execution time: 325_000_000 picoseconds.
Weight::from_parts(1_695_000_000, 0)
.saturating_add(Weight::from_parts(0, 89494))
.saturating_add(T::DbWeight::get().reads(34))
.saturating_add(T::DbWeight::get().writes(34))
}
/// Storage: FellowshipCollective Members (r:1 w:1)
/// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:1)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IndexToId (r:0 w:1)
/// Proof: FellowshipCollective IndexToId (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IdToIndex (r:0 w:1)
/// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// The range of component `r` is `[0, 10]`.
fn promote_member(_r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `277 + r * (17 ±0)`
// Estimated: `6986`
// Minimum execution time: 206_000_000 picoseconds.
Weight::from_parts(450_000_000, 0)
.saturating_add(Weight::from_parts(0, 6986))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipCollective Members (r:1 w:1)
/// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:1)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IdToIndex (r:1 w:1)
/// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// Storage: FellowshipCollective IndexToId (r:1 w:1)
/// Proof: FellowshipCollective IndexToId (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen)
/// The range of component `r` is `[0, 10]`.
fn demote_member(_r: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `575 + r * (71 ±0)`
// Estimated: `14024`
// Minimum execution time: 309_000_000 picoseconds.
Weight::from_parts(449_000_000, 0)
.saturating_add(Weight::from_parts(0, 14024))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipCollective Members (r:1 w:0)
/// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective Voting (r:1 w:1)
/// Proof: FellowshipCollective Voting (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn vote() -> Weight {
// Proof Size summary in bytes:
// Measured: `665`
// Estimated: `328970`
// Minimum execution time: 536_000_000 picoseconds.
Weight::from_parts(536_000_000, 0)
.saturating_add(Weight::from_parts(0, 328970))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:0)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective VotingCleanup (r:1 w:0)
/// Proof: FellowshipCollective VotingCleanup (max_values: None, max_size: Some(114), added: 2589, mode: MaxEncodedLen)
/// Storage: FellowshipCollective Voting (r:100 w:100)
/// Proof: FellowshipCollective Voting (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
/// The range of component `n` is `[0, 100]`.
fn cleanup_poll(_n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `308 + n * (52 ±0)`
// Estimated: `262934`
// Minimum execution time: 246_000_000 picoseconds.
Weight::from_parts(1_572_000_000, 0)
.saturating_add(Weight::from_parts(0, 262934))
.saturating_add(T::DbWeight::get().reads(102))
.saturating_add(T::DbWeight::get().writes(100))
}
}
@@ -0,0 +1,522 @@
//! Autogenerated weights for `pallet_referenda`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-03-06, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `cob`, CPU: `<UNKNOWN>`
//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024
// Executed Command:
// ./target/debug/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --steps=2
// --repeat=1
// --pallet=pallet_referenda
// --extrinsic=*
// --execution=native
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./parachains/runtimes/collectives/collectives-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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_referenda::WeightInfo for WeightInfo<T> {
/// Storage: FellowshipCollective Members (r:1 w:0)
/// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda ReferendumCount (r:1 w:1)
/// Proof: FellowshipReferenda 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(155814), added: 158289, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda ReferendumInfoFor (r:0 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
fn submit() -> Weight {
// Proof Size summary in bytes:
// Measured: `322`
// Estimated: `164275`
// Minimum execution time: 283_000_000 picoseconds.
Weight::from_parts(283_000_000, 0)
.saturating_add(Weight::from_parts(0, 164275))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn place_decision_deposit_preparing() -> Weight {
// Proof Size summary in bytes:
// Measured: `430`
// Estimated: `321933`
// Minimum execution time: 472_000_000 picoseconds.
Weight::from_parts(472_000_000, 0)
.saturating_add(Weight::from_parts(0, 321933))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:0)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
fn place_decision_deposit_queued() -> Weight {
// Proof Size summary in bytes:
// Measured: `1941`
// Estimated: `12121`
// Minimum execution time: 547_000_000 picoseconds.
Weight::from_parts(547_000_000, 0)
.saturating_add(Weight::from_parts(0, 12121))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:0)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
fn place_decision_deposit_not_queued() -> Weight {
// Proof Size summary in bytes:
// Measured: `1982`
// Estimated: `12121`
// Minimum execution time: 555_000_000 picoseconds.
Weight::from_parts(555_000_000, 0)
.saturating_add(Weight::from_parts(0, 12121))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:1)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn place_decision_deposit_passing() -> Weight {
// Proof Size summary in bytes:
// Measured: `833`
// Estimated: `328891`
// Minimum execution time: 871_000_000 picoseconds.
Weight::from_parts(871_000_000, 0)
.saturating_add(Weight::from_parts(0, 328891))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:1)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
fn place_decision_deposit_failing() -> Weight {
// Proof Size summary in bytes:
// Measured: `643`
// Estimated: `11323`
// Minimum execution time: 460_000_000 picoseconds.
Weight::from_parts(460_000_000, 0)
.saturating_add(Weight::from_parts(0, 11323))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
fn refund_decision_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `381`
// Estimated: `4365`
// Minimum execution time: 281_000_000 picoseconds.
Weight::from_parts(281_000_000, 0)
.saturating_add(Weight::from_parts(0, 4365))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
fn refund_submission_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `199`
// Estimated: `4365`
// Minimum execution time: 172_000_000 picoseconds.
Weight::from_parts(172_000_000, 0)
.saturating_add(Weight::from_parts(0, 4365))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn cancel() -> Weight {
// Proof Size summary in bytes:
// Measured: `343`
// Estimated: `321933`
// Minimum execution time: 334_000_000 picoseconds.
Weight::from_parts(334_000_000, 0)
.saturating_add(Weight::from_parts(0, 321933))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// Storage: ParachainInfo ParachainId (r:1 w:0)
/// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
/// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
/// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
/// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
/// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: ParachainSystem HostConfiguration (r:1 w:0)
/// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
/// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: FellowshipReferenda MetadataOf (r:1 w:0)
/// Proof: FellowshipReferenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn kill() -> Weight {
// Proof Size summary in bytes:
// Measured: `581`
// Estimated: `342842`
// Minimum execution time: 1_580_000_000 picoseconds.
Weight::from_parts(1_580_000_000, 0)
.saturating_add(Weight::from_parts(0, 342842))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: FellowshipReferenda TrackQueue (r:1 w:0)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:1)
/// Proof: FellowshipReferenda 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: `140`
// Estimated: `7756`
// Minimum execution time: 203_000_000 picoseconds.
Weight::from_parts(203_000_000, 0)
.saturating_add(Weight::from_parts(0, 7756))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn one_fewer_deciding_failing() -> Weight {
// Proof Size summary in bytes:
// Measured: `3991`
// Estimated: `329689`
// Minimum execution time: 1_025_000_000 picoseconds.
Weight::from_parts(1_025_000_000, 0)
.saturating_add(Weight::from_parts(0, 329689))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn one_fewer_deciding_passing() -> Weight {
// Proof Size summary in bytes:
// Measured: `3991`
// Estimated: `329689`
// Minimum execution time: 1_076_000_000 picoseconds.
Weight::from_parts(1_076_000_000, 0)
.saturating_add(Weight::from_parts(0, 329689))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_requeued_insertion() -> Weight {
// Proof Size summary in bytes:
// Measured: `3589`
// Estimated: `167921`
// Minimum execution time: 621_000_000 picoseconds.
Weight::from_parts(621_000_000, 0)
.saturating_add(Weight::from_parts(0, 167921))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_requeued_slide() -> Weight {
// Proof Size summary in bytes:
// Measured: `3542`
// Estimated: `167921`
// Minimum execution time: 643_000_000 picoseconds.
Weight::from_parts(643_000_000, 0)
.saturating_add(Weight::from_parts(0, 167921))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:0)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_queued() -> Weight {
// Proof Size summary in bytes:
// Measured: `3528`
// Estimated: `171400`
// Minimum execution time: 704_000_000 picoseconds.
Weight::from_parts(704_000_000, 0)
.saturating_add(Weight::from_parts(0, 171400))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:0)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda TrackQueue (r:1 w:1)
/// Proof: FellowshipReferenda TrackQueue (max_values: None, max_size: Some(812), added: 3287, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_not_queued() -> Weight {
// Proof Size summary in bytes:
// Measured: `3583`
// Estimated: `171400`
// Minimum execution time: 695_000_000 picoseconds.
Weight::from_parts(695_000_000, 0)
.saturating_add(Weight::from_parts(0, 171400))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_no_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `295`
// Estimated: `163644`
// Minimum execution time: 259_000_000 picoseconds.
Weight::from_parts(259_000_000, 0)
.saturating_add(Weight::from_parts(0, 163644))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_preparing() -> Weight {
// Proof Size summary in bytes:
// Measured: `343`
// Estimated: `163644`
// Minimum execution time: 260_000_000 picoseconds.
Weight::from_parts(260_000_000, 0)
.saturating_add(Weight::from_parts(0, 163644))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
fn nudge_referendum_timed_out() -> Weight {
// Proof Size summary in bytes:
// Measured: `240`
// Estimated: `4365`
// Minimum execution time: 184_000_000 picoseconds.
Weight::from_parts(184_000_000, 0)
.saturating_add(Weight::from_parts(0, 4365))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:1)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_begin_deciding_failing() -> Weight {
// Proof Size summary in bytes:
// Measured: `611`
// Estimated: `170602`
// Minimum execution time: 445_000_000 picoseconds.
Weight::from_parts(445_000_000, 0)
.saturating_add(Weight::from_parts(0, 170602))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda DecidingCount (r:1 w:1)
/// Proof: FellowshipReferenda DecidingCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_begin_deciding_passing() -> Weight {
// Proof Size summary in bytes:
// Measured: `746`
// Estimated: `170602`
// Minimum execution time: 625_000_000 picoseconds.
Weight::from_parts(625_000_000, 0)
.saturating_add(Weight::from_parts(0, 170602))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_begin_confirming() -> Weight {
// Proof Size summary in bytes:
// Measured: `799`
// Estimated: `167123`
// Minimum execution time: 623_000_000 picoseconds.
Weight::from_parts(623_000_000, 0)
.saturating_add(Weight::from_parts(0, 167123))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_end_confirming() -> Weight {
// Proof Size summary in bytes:
// Measured: `782`
// Estimated: `167123`
// Minimum execution time: 580_000_000 picoseconds.
Weight::from_parts(580_000_000, 0)
.saturating_add(Weight::from_parts(0, 167123))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_continue_not_confirming() -> Weight {
// Proof Size summary in bytes:
// Measured: `799`
// Estimated: `167123`
// Minimum execution time: 595_000_000 picoseconds.
Weight::from_parts(595_000_000, 0)
.saturating_add(Weight::from_parts(0, 167123))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_continue_confirming() -> Weight {
// Proof Size summary in bytes:
// Measured: `803`
// Estimated: `167123`
// Minimum execution time: 556_000_000 picoseconds.
Weight::from_parts(556_000_000, 0)
.saturating_add(Weight::from_parts(0, 167123))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:2 w:2)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, 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: `803`
// Estimated: `328925`
// Minimum execution time: 704_000_000 picoseconds.
Weight::from_parts(704_000_000, 0)
.saturating_add(Weight::from_parts(0, 328925))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:1)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipCollective MemberCount (r:1 w:0)
/// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
fn nudge_referendum_rejected() -> Weight {
// Proof Size summary in bytes:
// Measured: `799`
// Estimated: `167123`
// Minimum execution time: 615_000_000 picoseconds.
Weight::from_parts(615_000_000, 0)
.saturating_add(Weight::from_parts(0, 167123))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:0)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: Preimage StatusFor (r:1 w:0)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda MetadataOf (r:0 w:1)
/// Proof: FellowshipReferenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn set_some_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `384`
// Estimated: `7921`
// Minimum execution time: 262_000_000 picoseconds.
Weight::from_parts(262_000_000, 0)
.saturating_add(Weight::from_parts(0, 7921))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: FellowshipReferenda ReferendumInfoFor (r:1 w:0)
/// Proof: FellowshipReferenda ReferendumInfoFor (max_values: None, max_size: Some(900), added: 3375, mode: MaxEncodedLen)
/// Storage: FellowshipReferenda MetadataOf (r:1 w:1)
/// Proof: FellowshipReferenda MetadataOf (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `317`
// Estimated: `7882`
// Minimum execution time: 223_000_000 picoseconds.
Weight::from_parts(223_000_000, 0)
.saturating_add(Weight::from_parts(0, 7882))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,188 @@
//! Autogenerated weights for `pallet_scheduler`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `cob`, CPU: `<UNKNOWN>`
//! EXECUTION: Some(Native), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024
// Executed Command:
// ./target/release/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --steps=50
// --repeat=20
// --pallet=pallet_scheduler
// --extrinsic=*
// --execution=native
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./parachains/runtimes/collectives/collectives-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_scheduler`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_scheduler::WeightInfo for WeightInfo<T> {
/// Storage: Scheduler IncompleteSince (r:1 w:1)
/// Proof: Scheduler IncompleteSince (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn service_agendas_base() -> Weight {
// Proof Size summary in bytes:
// Measured: `31`
// Estimated: `1489`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(3_000_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 200]`.
fn service_agenda_base(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109 + s * (177 ±0)`
// Estimated: `159279`
// Minimum execution time: 1_000_000 picoseconds.
Weight::from_parts(6_554_632, 0)
.saturating_add(Weight::from_parts(0, 159279))
// Standard Error: 3_795
.saturating_add(Weight::from_parts(293_040, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
fn service_task_base() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// 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 `s` is `[128, 4194304]`.
fn service_task_fetched(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `211 + s * (1 ±0)`
// Estimated: `7232 + s * (1 ±0)`
// Minimum execution time: 12_000_000 picoseconds.
Weight::from_parts(13_000_000, 0)
.saturating_add(Weight::from_parts(0, 7232))
// Standard Error: 2
.saturating_add(Weight::from_parts(506, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into()))
}
/// Storage: Scheduler Lookup (r:0 w:1)
/// Proof: Scheduler Lookup (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen)
fn service_task_named() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(3_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
fn service_task_periodic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn execute_dispatch_signed() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_000_000 picoseconds.
Weight::from_parts(1_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn execute_dispatch_unsigned() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_000_000 picoseconds.
Weight::from_parts(1_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 199]`.
fn schedule(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109 + s * (177 ±0)`
// Estimated: `159279`
// Minimum execution time: 6_000_000 picoseconds.
Weight::from_parts(10_397_360, 0)
.saturating_add(Weight::from_parts(0, 159279))
// Standard Error: 12_609
.saturating_add(Weight::from_parts(342_422, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
/// Storage: Scheduler Lookup (r:0 w:1)
/// Proof: Scheduler Lookup (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen)
/// The range of component `s` is `[1, 200]`.
fn cancel(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109 + s * (177 ±0)`
// Estimated: `159279`
// Minimum execution time: 9_000_000 picoseconds.
Weight::from_parts(24_399_340, 0)
.saturating_add(Weight::from_parts(0, 159279))
// Standard Error: 17_555
.saturating_add(Weight::from_parts(480_590, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Scheduler Lookup (r:1 w:1)
/// Proof: Scheduler Lookup (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
/// The range of component `s` is `[0, 199]`.
fn schedule_named(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `500 + s * (179 ±0)`
// Estimated: `162792`
// Minimum execution time: 7_000_000 picoseconds.
Weight::from_parts(9_819_325, 0)
.saturating_add(Weight::from_parts(0, 162792))
// Standard Error: 9_309
.saturating_add(Weight::from_parts(365_629, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: Scheduler Lookup (r:1 w:1)
/// Proof: Scheduler Lookup (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen)
/// Storage: Scheduler Agenda (r:1 w:1)
/// Proof: Scheduler Agenda (max_values: None, max_size: Some(155814), added: 158289, mode: MaxEncodedLen)
/// The range of component `s` is `[1, 200]`.
fn cancel_named(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `541 + s * (179 ±0)`
// Estimated: `162792`
// Minimum execution time: 11_000_000 picoseconds.
Weight::from_parts(19_693_473, 0)
.saturating_add(Weight::from_parts(0, 162792))
// Standard Error: 17_961
.saturating_add(Weight::from_parts(559_993, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
}
@@ -14,8 +14,8 @@
// limitations under the License.
use super::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
AccountId, AllPalletsWithSystem, Balances, Fellows, ParachainInfo, ParachainSystem,
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use frame_support::{
match_types, parameter_types,
@@ -32,10 +32,10 @@ use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
FixedWeightBounds, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
WithComputedOrigin,
FixedWeightBounds, IsConcrete, OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WithComputedOrigin,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
@@ -47,6 +47,7 @@ parameter_types! {
X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
pub const Local: MultiLocation = Here.into_location();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
@@ -104,6 +105,8 @@ parameter_types! {
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
// Fellows pluralistic body.
pub const FellowsBodyId: BodyId = BodyId::Technical;
}
match_types! {
@@ -179,6 +182,12 @@ impl Contains<RuntimeCall> for SafeCallFilter {
pallet_collective::Call::close_old_weight { .. } |
pallet_collective::Call::disapprove_proposal { .. } |
pallet_collective::Call::close { .. },
) |
RuntimeCall::FellowshipCollective(
pallet_ranked_collective::Call::add_member { .. } |
pallet_ranked_collective::Call::promote_member { .. } |
pallet_ranked_collective::Call::demote_member { .. } |
pallet_ranked_collective::Call::remove_member { .. },
) => true,
_ => false,
}
@@ -257,10 +266,13 @@ parameter_types! {
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
}
/// Type to convert the Fellows origin to a Plurality `MultiLocation` value.
pub type FellowsToPlurality = OriginToPluralityVoice<RuntimeOrigin, Fellows, FellowsBodyId>;
impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
// We only allow the Fellows to send messages.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, FellowsToPlurality>;
type XcmRouter = XcmRouter;
// We support local origins dispatching XCM executions in principle...
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;