diff --git a/Cargo.lock b/Cargo.lock index 661abf0dcc..8e0d708c55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1887,6 +1887,35 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "collectives-polkadot-it" +version = "0.1.0" +dependencies = [ + "asset-hub-polkadot-runtime", + "collectives-polkadot-runtime", + "cumulus-pallet-xcmp-queue", + "frame-support", + "frame-system", + "integration-tests-common", + "pallet-assets", + "pallet-balances", + "pallet-core-fellowship", + "pallet-salary", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "collectives-polkadot-runtime" version = "1.0.0" @@ -1915,11 +1944,13 @@ dependencies = [ "pallet-balances", "pallet-collator-selection", "pallet-collective", + "pallet-core-fellowship", "pallet-multisig", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", "pallet-referenda", + "pallet-salary", "pallet-scheduler", "pallet-session", "pallet-timestamp", diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index 41033468cd..49fd807b6f 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -34,11 +34,12 @@ use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, - DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, - LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, - UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, + DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily, + EnsureXcmOrigin, FungiblesAdapter, HashedDescription, IsConcrete, LocalMint, NativeAsset, + NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, + WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -66,6 +67,8 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, + // Foreign locations alias into accounts according to a hash of their standard description. + HashedDescription>, ); /// Means for transacting the native currency on this chain. diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 564715ea22..956ada5ac3 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -34,11 +34,12 @@ use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, - DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, - LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, WithComputedOrigin, + DenyReserveTransferToRelayChain, DenyThenTry, DescribeFamily, DescribePalletTerminal, + EnsureXcmOrigin, FungiblesAdapter, HashedDescription, IsConcrete, LocalMint, NativeAsset, + NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, + WithComputedOrigin, }; use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; @@ -66,6 +67,9 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, + // Foreign chain account alias into local accounts according to a hash of their standard + // description. + HashedDescription>, ); /// Means for transacting the native currency on this chain. @@ -177,6 +181,9 @@ match_types! { pub type FellowsPlurality: impl Contains = { MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } }; + pub type FellowshipSalaryPallet: impl Contains = { + MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(64)) } + }; } /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly @@ -355,7 +362,11 @@ pub type Barrier = DenyThenTry< // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, // Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution. - AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>, + AllowExplicitUnpaidExecutionFrom<( + ParentOrParentsPlurality, + FellowsPlurality, + FellowshipSalaryPallet, + )>, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, ), @@ -498,3 +509,18 @@ impl pallet_assets::BenchmarkHelper for XcmBenchmarkHelper { MultiLocation { parents: 1, interior: X1(Parachain(id)) } } } + +#[test] +fn foreign_pallet_has_correct_local_account() { + use sp_core::crypto::{Ss58AddressFormat, Ss58Codec}; + use xcm_executor::traits::ConvertLocation; + + const COLLECTIVES_PARAID: u32 = 1001; + const FELLOWSHIP_SALARY_PALLET_ID: u8 = 64; + let fellowship_salary = + (Parent, Parachain(COLLECTIVES_PARAID), PalletInstance(FELLOWSHIP_SALARY_PALLET_ID)); + let account = LocationToAccountId::convert_location(&fellowship_salary.into()).unwrap(); + let polkadot = Ss58AddressFormat::try_from("polkadot").unwrap(); + let address = Ss58Codec::to_ss58check_with_version(&account, polkadot); + assert_eq!(address, "13w7NdvSR1Af8xsQTArDtZmVvjE8XhWNdL4yed3iFHrUNCnS"); +} diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 704876bc8b..0c80f4a217 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -36,6 +36,8 @@ pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/parityt 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" } +pallet-core-fellowship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-salary = { 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" } @@ -103,6 +105,8 @@ runtime-benchmarks = [ "pallet-preimage/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", "pallet-ranked-collective/runtime-benchmarks", + "pallet-core-fellowship/runtime-benchmarks", + "pallet-salary/runtime-benchmarks", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -131,6 +135,8 @@ try-runtime = [ "pallet-preimage/try-runtime", "pallet-referenda/try-runtime", "pallet-ranked-collective/try-runtime", + "pallet-core-fellowship/try-runtime", + "pallet-salary/try-runtime", ] std = [ "codec/std", @@ -187,4 +193,6 @@ std = [ "pallet-referenda/std", "pallet-ranked-collective/std", "substrate-wasm-builder", + "pallet-core-fellowship/std", + "pallet-salary/std", ] diff --git a/system-parachains/collectives/collectives-polkadot/src/constants.rs b/system-parachains/collectives/collectives-polkadot/src/constants.rs index 836235345e..8d0325844c 100644 --- a/system-parachains/collectives/collectives-polkadot/src/constants.rs +++ b/system-parachains/collectives/collectives-polkadot/src/constants.rs @@ -16,8 +16,8 @@ pub mod account { use frame_support::PalletId; - /// Relay Chain treasury pallet id, used to convert into AccountId - pub const RELAY_TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); + /// Polkadot treasury pallet id, used to convert into AccountId + pub const POLKADOT_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. diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index 22926d1d27..c8442c7c43 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -19,42 +19,38 @@ pub(crate) mod migration; mod origins; mod tracks; +use cumulus_primitives_core::Junction::GeneralIndex; +use frame_system::EnsureNever; pub use origins::{ - pallet_origins as pallet_fellowship_origins, Fellows, FellowshipCandidates, FellowshipExperts, - FellowshipMasters, + pallet_origins as pallet_fellowship_origins, Architects, EnsureCanPromoteTo, EnsureCanRetainAt, + EnsureFellowship, Fellows, Masters, Members, }; +use xcm_builder::{AliasesIntoAccountId32, LocatableAssetId, PayOverXcm}; use crate::{ - constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, BlockNumber, - FellowshipReferenda, GovernanceLocation, Preimage, RelayTreasuryAccount, Runtime, RuntimeCall, - RuntimeEvent, Scheduler, DAYS, + constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, FellowshipReferenda, + GovernanceLocation, PolkadotTreasuryAccount, Preimage, Runtime, RuntimeCall, RuntimeEvent, + Scheduler, DAYS, }; use frame_support::{ parameter_types, - traits::{EitherOf, MapSuccess, TryMapSuccess}, + traits::{EitherOf, EitherOfDiverse, MapSuccess}, }; 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 polkadot_runtime_constants::{time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX}; +use sp_core::{ConstU128, ConstU32}; +use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace}; 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_1: Rank = 1; // aka Members. 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_4: Rank = 4; // aka Architects. + pub const DAN_5: Rank = 5; pub const DAN_6: Rank = 6; pub const DAN_7: Rank = 7; // aka Masters. pub const DAN_8: Rank = 8; @@ -62,9 +58,6 @@ pub mod ranks { } 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); @@ -80,63 +73,146 @@ impl pallet_referenda::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; type Currency = Balances; + // Fellows can submit proposals. type SubmitOrigin = - pallet_ranked_collective::EnsureMember; - type CancelOrigin = FellowshipExperts; - type KillOrigin = FellowshipMasters; - type Slash = ToParentTreasury; + pallet_ranked_collective::EnsureMember; + type CancelOrigin = Architects; + type KillOrigin = Masters; + type Slash = ToParentTreasury; type Votes = pallet_ranked_collective::Votes; type Tally = pallet_ranked_collective::TallyOf; - type SubmissionDeposit = SubmissionDeposit; + type SubmissionDeposit = ConstU128<0>; type MaxQueued = ConstU32<100>; - type UndecidingTimeout = UndecidingTimeout; - type AlarmInterval = AlarmInterval; + type UndecidingTimeout = ConstU32<{ 7 * DAYS }>; + type AlarmInterval = ConstU32<1>; 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: TryMorph = |r: N::Type| -> Result { - r.checked_sub(&N::get()).ok_or(()) - } where N::Type: CheckedSub; -} - impl pallet_ranked_collective::Config for Runtime { type WeightInfo = weights::pallet_ranked_collective::WeightInfo; type RuntimeEvent = RuntimeEvent; - // Promotion is by any of: - // - Root can 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>, - EitherOf< - MapSuccess< - EnsureXcm>, - Replace>, - >, - TryMapSuccess>>, - >, - >; + // Promotions and the induction of new members are serviced by `FellowshipCore` pallet instance. + type PromoteOrigin = EnsureNever; // Demotion is by any of: // - Root can demote arbitrarily. // - the FellowshipAdmin origin (i.e. token holder referendum); - // - a vote by the rank two above the current rank. type DemoteOrigin = EitherOf< - frame_system::EnsureRootWithSuccess>, - EitherOf< - MapSuccess< - EnsureXcm>, - Replace>, - >, - TryMapSuccess>>, + frame_system::EnsureRootWithSuccess>, + MapSuccess< + EnsureXcm>, + Replace>, >, >; type Polls = FellowshipReferenda; - type MinRankOfClass = sp_runtime::traits::Identity; + type MinRankOfClass = tracks::MinRankOfClass; type VoteWeight = pallet_ranked_collective::Geometric; } + +pub type FellowshipCoreInstance = pallet_core_fellowship::Instance1; + +impl pallet_core_fellowship::Config for Runtime { + type WeightInfo = weights::pallet_core_fellowship::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type Members = pallet_ranked_collective::Pallet; + type Balance = Balance; + // Parameters are set by any of: + // - Root; + // - the FellowshipAdmin origin (i.e. token holder referendum); + // - a vote among all Fellows. + type ParamsOrigin = EitherOfDiverse< + EnsureXcm>, + Fellows, + >; + // Induction (creating a candidate) is by any of: + // - Root; + // - the FellowshipAdmin origin (i.e. token holder referendum); + // - a single Fellow; + // - a vote among all Members. + type InductOrigin = EitherOfDiverse< + EnsureXcm>, + EitherOfDiverse< + pallet_ranked_collective::EnsureMember< + Runtime, + FellowshipCollectiveInstance, + { ranks::DAN_3 }, + >, + Members, + >, + >; + // Approval (rank-retention) of a Member's current rank is by any of: + // - Root; + // - the FellowshipAdmin origin (i.e. token holder referendum); + // - a vote by the rank two above the current rank for all retention up to the Master rank. + type ApproveOrigin = EitherOf< + MapSuccess< + EnsureXcm>, + Replace>, + >, + EnsureCanRetainAt, + >; + // Promotion is by any of: + // - Root can promote arbitrarily. + // - the FellowshipAdmin origin (i.e. token holder referendum); + // - a vote by the rank two above the new rank for all promotions up to the Master rank. + type PromoteOrigin = EitherOf< + MapSuccess< + EnsureXcm>, + Replace>, + >, + EnsureCanPromoteTo, + >; + type EvidenceSize = ConstU32<65536>; +} + +pub type FellowshipSalaryInstance = pallet_salary::Instance1; + +use xcm::prelude::*; + +parameter_types! { + pub AssetHub: MultiLocation = (Parent, Parachain(1000)).into(); + pub AssetHubUsdtId: AssetId = (PalletInstance(50), GeneralIndex(1984)).into(); + pub UsdtAsset: LocatableAssetId = LocatableAssetId { + location: AssetHub::get(), + asset_id: AssetHubUsdtId::get(), + }; + // The interior location on AssetHub for the paying account. This is the Fellowship Salary + // pallet instance (which sits at index 64). This sovereign account will need funding. + pub Interior: InteriorMultiLocation = PalletInstance(64).into(); +} + +const USDT_UNITS: u128 = 1_000_000; + +/// [`PayOverXcm`] setup to pay the Fellowship salary on the AssetHub in USDT. +pub type FellowshipSalaryPaymaster = PayOverXcm< + Interior, + crate::xcm_config::XcmRouter, + crate::PolkadotXcm, + ConstU32<{ 6 * HOURS }>, + AccountId, + (), + ConvertToValue, + AliasesIntoAccountId32<(), AccountId>, +>; + +impl pallet_salary::Config for Runtime { + type WeightInfo = weights::pallet_salary::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type Paymaster = FellowshipSalaryPaymaster; + type Members = pallet_ranked_collective::Pallet; + + #[cfg(not(feature = "runtime-benchmarks"))] + type Salary = pallet_core_fellowship::Pallet; + #[cfg(feature = "runtime-benchmarks")] + type Salary = frame_support::traits::tokens::ConvertRank< + crate::impls::benchmarks::RankToSalary, + >; + // 15 days to register for a salary payment. + type RegistrationPeriod = ConstU32<{ 15 * DAYS }>; + // 15 days to claim the salary payment. + type PayoutPeriod = ConstU32<{ 15 * DAYS }>; + // Total monthly salary budget. + type Budget = ConstU128<{ 100_000 * USDT_UNITS }>; +} diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs index db778f38cb..4842f64d48 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs @@ -34,32 +34,62 @@ pub mod pallet_origins { #[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. + /// Origin aggregated through weighted votes of those with rank 1 or above; `Success` is 1. + Members, + /// Origin aggregated through weighted votes of those with rank 2 or above; `Success` is 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. + /// Origin aggregated through weighted votes of those with rank 3 or above; `Success` is 3. + Fellows, + /// Origin aggregated through weighted votes of those with rank 4 or above; `Success` is 4. + Architects, + /// Origin aggregated through weighted votes of those with rank 5 or above; `Success` is 5. Fellowship5Dan, - /// Origin commanded by rank 6 of the Polkadot Fellowship and with a success of 6. + /// Origin aggregated through weighted votes of those with rank 6 or above; `Success` is 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. + /// Origin aggregated through weighted votes of those with rank 7 or above; `Success` is 7. + Masters, + /// Origin aggregated through weighted votes of those with rank 8 or above; `Success` is 8. Fellowship8Dan, - /// Origin commanded by rank 9 of the Polkadot Fellowship and with a success of 9. + /// Origin aggregated through weighted votes of those with rank 9 or above; `Success` is 9. Fellowship9Dan, + + /// Origin aggregated through weighted votes of those with rank 3 or above when voting on + /// a fortnight-long track; `Success` is 1. + RetainAt1Dan, + /// Origin aggregated through weighted votes of those with rank 4 or above when voting on + /// a fortnight-long track; `Success` is 2. + RetainAt2Dan, + /// Origin aggregated through weighted votes of those with rank 5 or above when voting on + /// a fortnight-long track; `Success` is 3. + RetainAt3Dan, + /// Origin aggregated through weighted votes of those with rank 6 or above when voting on + /// a fortnight-long track; `Success` is 4. + RetainAt4Dan, + /// Origin aggregated through weighted votes of those with rank 7 or above when voting on + /// a fortnight-long track; `Success` is 5. + RetainAt5Dan, + /// Origin aggregated through weighted votes of those with rank 8 or above when voting on + /// a fortnight-long track; `Success` is 6. + RetainAt6Dan, + + /// Origin aggregated through weighted votes of those with rank 3 or above when voting on + /// a month-long track; `Success` is 1. + PromoteTo1Dan, + /// Origin aggregated through weighted votes of those with rank 4 or above when voting on + /// a month-long track; `Success` is 2. + PromoteTo2Dan, + /// Origin aggregated through weighted votes of those with rank 5 or above when voting on + /// a month-long track; `Success` is 3. + PromoteTo3Dan, + /// Origin aggregated through weighted votes of those with rank 6 or above when voting on + /// a month-long track; `Success` is 4. + PromoteTo4Dan, + /// Origin aggregated through weighted votes of those with rank 7 or above when voting on + /// a month-long track; `Success` is 5. + PromoteTo5Dan, + /// Origin aggregated through weighted votes of those with rank 8 or above when voting on + /// a month-long track; `Success` is 6. + PromoteTo6Dan, } macro_rules! decl_unit_ensures { @@ -93,10 +123,10 @@ pub mod pallet_origins { () => {} } decl_unit_ensures!( - FellowshipCandidates: Rank = ranks::CANDIDATES, + Members: Rank = ranks::DAN_1, Fellows: Rank = ranks::DAN_3, - FellowshipExperts: Rank = ranks::DAN_5, - FellowshipMasters: Rank = ranks::DAN_7, + Architects: Rank = ranks::DAN_4, + Masters: Rank = ranks::DAN_7, ); macro_rules! decl_ensure { @@ -132,17 +162,45 @@ pub mod pallet_origins { } } + // Fellowship origin indicating weighted voting from at least the rank of `Success` on a + // week-long track. decl_ensure! { pub type EnsureFellowship: EnsureOrigin { - Fellowship1Dan = ranks::DAN_1, + Members = ranks::DAN_1, Fellowship2Dan = ranks::DAN_2, - Fellowship3Dan = ranks::DAN_3, - Fellowship4Dan = ranks::DAN_4, + Fellows = ranks::DAN_3, + Architects = ranks::DAN_4, Fellowship5Dan = ranks::DAN_5, Fellowship6Dan = ranks::DAN_6, - Fellowship7Dan = ranks::DAN_7, + Masters = ranks::DAN_7, Fellowship8Dan = ranks::DAN_8, Fellowship9Dan = ranks::DAN_9, } } + + // Fellowship origin indicating weighted voting from at least the rank of `Success + 2` on + // a fortnight-long track; needed for Fellowship retention voting. + decl_ensure! { + pub type EnsureCanRetainAt: EnsureOrigin { + RetainAt1Dan = ranks::DAN_1, + RetainAt2Dan = ranks::DAN_2, + RetainAt3Dan = ranks::DAN_3, + RetainAt4Dan = ranks::DAN_4, + RetainAt5Dan = ranks::DAN_5, + RetainAt6Dan = ranks::DAN_6, + } + } + + // Fellowship origin indicating weighted voting from at least the rank of `Success + 2` on + // a month-long track; needed for Fellowship promotion voting. + decl_ensure! { + pub type EnsureCanPromoteTo: EnsureOrigin { + PromoteTo1Dan = ranks::DAN_1, + PromoteTo2Dan = ranks::DAN_2, + PromoteTo3Dan = ranks::DAN_3, + PromoteTo4Dan = ranks::DAN_4, + PromoteTo5Dan = ranks::DAN_5, + PromoteTo6Dan = ranks::DAN_6, + } + } } diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs index 1f72827948..d10a5273e3 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -16,8 +16,9 @@ //! Track configurations for Fellowship. -use crate::{Balance, BlockNumber, RuntimeOrigin, DAYS, DOLLARS, MINUTES}; -use sp_runtime::Perbill; +use crate::{Balance, BlockNumber, RuntimeOrigin, DAYS, DOLLARS, HOURS, MINUTES}; +use pallet_ranked_collective::Rank; +use sp_runtime::{traits::Convert, Perbill}; /// Referendum `TrackId` type. pub type TrackId = u16; @@ -26,57 +27,105 @@ pub type TrackId = u16; pub mod constants { use super::TrackId; - pub const CANDIDATES: TrackId = 0; + // Regular tracks (7 days) used for general operations. The required rank for voting is the + // same as that which is named (and also the track ID). 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 ARCHITECTS: TrackId = 4; + pub const ARCHITECTS_ADEPT: TrackId = 5; + pub const GRAND_ARCHITECTS: TrackId = 6; pub const MASTERS: TrackId = 7; - pub const SENIOR_MASTERS: TrackId = 8; + pub const MASTERS_CONSTANT: TrackId = 8; pub const GRAND_MASTERS: TrackId = 9; + + // Longer tracks (14 days) used for rank retention. These require a rank of two more than the + // grade at which they retain (as per the whitepaper). This works out as the track ID minus 8. + pub const RETAIN_AT_1DAN: TrackId = 11; + pub const RETAIN_AT_2DAN: TrackId = 12; + pub const RETAIN_AT_3DAN: TrackId = 13; + pub const RETAIN_AT_4DAN: TrackId = 14; + pub const RETAIN_AT_5DAN: TrackId = 15; + pub const RETAIN_AT_6DAN: TrackId = 16; + + // Longest tracks (30 days) used for promotions. These require a rank of two more than the + // grade to which they promote (as per the whitepaper). This works out as the track ID minus 18. + pub const PROMOTE_TO_1DAN: TrackId = 21; + pub const PROMOTE_TO_2DAN: TrackId = 22; + pub const PROMOTE_TO_3DAN: TrackId = 23; + pub const PROMOTE_TO_4DAN: TrackId = 24; + pub const PROMOTE_TO_5DAN: TrackId = 25; + pub const PROMOTE_TO_6DAN: TrackId = 26; +} + +/// Convert the track ID (defined above) into the minimum rank (i.e. fellowship Dan grade) required +/// to vote on the track. +pub struct MinRankOfClass; +impl Convert for MinRankOfClass { + fn convert(a: TrackId) -> Rank { + match a { + // Just a regular vote: the track ID is conveniently the same as the minimum rank. + regular @ 1..=9 => regular, + // A retention vote; the track ID turns out to be 8 more than the minimum required rank. + retention @ 11..=16 => retention - 8, + // A promotion vote; the track ID turns out to be 18 more than the minimum required rank. + promotion @ 21..=26 => promotion - 18, + _ => Rank::max_value(), + } + } } +const RETAIN_MAX_DECIDING: u32 = 25; +const RETAIN_DECISION_DEPOSIT: Balance = 5 * DOLLARS; +const RETAIN_PREPARE_PERIOD: BlockNumber = 0; +const RETAIN_DECISION_PERIOD: BlockNumber = 14 * DAYS; +const RETAIN_CONFIRM_PERIOD: BlockNumber = 1 * HOURS; +const RETAIN_MIN_ENACTMENT_PERIOD: BlockNumber = 0; +const RETAIN_MIN_APPROVAL: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(60), + ceil: Perbill::from_percent(100), +}; +const RETAIN_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(10), + ceil: Perbill::from_percent(100), +}; + +const PROMOTE_MAX_DECIDING: u32 = 10; +const PROMOTE_DECISION_DEPOSIT: Balance = 5 * DOLLARS; +const PROMOTE_PREPARE_PERIOD: BlockNumber = 0; +const PROMOTE_DECISION_PERIOD: BlockNumber = 30 * DAYS; +const PROMOTE_CONFIRM_PERIOD: BlockNumber = 1 * HOURS; +const PROMOTE_MIN_ENACTMENT_PERIOD: BlockNumber = 0; +const PROMOTE_MIN_APPROVAL: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(60), + ceil: Perbill::from_percent(100), +}; +const PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(10), + ceil: Perbill::from_percent(100), +}; + pub struct TracksInfo; impl pallet_referenda::TracksInfo for TracksInfo { type Id = TrackId; type RuntimeOrigin = ::PalletsOrigin; fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] { use constants as tracks; - static DATA: [(TrackId, pallet_referenda::TrackInfo); 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: 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), - }, - }, - ), + static DATA: [(TrackId, pallet_referenda::TrackInfo); 21] = [ ( tracks::MEMBERS, pallet_referenda::TrackInfo { name: "members", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -85,20 +134,20 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), ( tracks::PROFICIENTS, pallet_referenda::TrackInfo { - name: "proficients", + name: "proficient members", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -107,7 +156,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), @@ -116,11 +165,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -129,20 +178,20 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), ( - tracks::SENIOR_FELLOWS, + tracks::ARCHITECTS, pallet_referenda::TrackInfo { - name: "senior fellows", + name: "architects", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -151,20 +200,20 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), ( - tracks::EXPERTS, + tracks::ARCHITECTS_ADEPT, pallet_referenda::TrackInfo { - name: "experts", + name: "architects adept", max_deciding: 10, - decision_deposit: DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -173,20 +222,20 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), ( - tracks::SENIOR_EXPERTS, + tracks::GRAND_ARCHITECTS, pallet_referenda::TrackInfo { - name: "senior experts", + name: "grand architects", max_deciding: 10, - decision_deposit: DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -195,7 +244,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), @@ -204,11 +253,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -217,20 +266,20 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), ( - tracks::SENIOR_MASTERS, + tracks::MASTERS_CONSTANT, pallet_referenda::TrackInfo { - name: "senior masters", + name: "masters constant", max_deciding: 10, - decision_deposit: DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -239,7 +288,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), @@ -248,11 +297,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: DOLLARS, + decision_deposit: 5 * DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: MINUTES, + min_enactment_period: 5 * MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -261,10 +310,178 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(0), - ceil: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), }, }, ), + ( + tracks::RETAIN_AT_1DAN, + pallet_referenda::TrackInfo { + name: "retain at I Dan", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + tracks::RETAIN_AT_2DAN, + pallet_referenda::TrackInfo { + name: "retain at II Dan", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + tracks::RETAIN_AT_3DAN, + pallet_referenda::TrackInfo { + name: "retain at III Dan", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + tracks::RETAIN_AT_4DAN, + pallet_referenda::TrackInfo { + name: "retain at IV Dan", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + tracks::RETAIN_AT_5DAN, + pallet_referenda::TrackInfo { + name: "retain at V Dan", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + tracks::RETAIN_AT_6DAN, + pallet_referenda::TrackInfo { + name: "retain at VI Dan", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + tracks::PROMOTE_TO_1DAN, + pallet_referenda::TrackInfo { + name: "promote to I Dan", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::PROMOTE_TO_2DAN, + pallet_referenda::TrackInfo { + name: "promote to II Dan", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::PROMOTE_TO_3DAN, + pallet_referenda::TrackInfo { + name: "promote to III Dan", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::PROMOTE_TO_4DAN, + pallet_referenda::TrackInfo { + name: "promote to IV Dan", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::PROMOTE_TO_5DAN, + pallet_referenda::TrackInfo { + name: "promote to V Dan", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::PROMOTE_TO_6DAN, + pallet_referenda::TrackInfo { + name: "promote to VI Dan", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), ]; &DATA[..] } @@ -283,16 +500,30 @@ impl pallet_referenda::TracksInfo for TracksInfo { } match Origin::try_from(id.clone()) { - Ok(Origin::FellowshipCandidates) => Ok(tracks::CANDIDATES), - Ok(Origin::Fellowship1Dan) => Ok(tracks::MEMBERS), + Ok(Origin::Members) => 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::Fellows) => Ok(tracks::FELLOWS), + Ok(Origin::Architects) => Ok(tracks::ARCHITECTS), + Ok(Origin::Fellowship5Dan) => Ok(tracks::ARCHITECTS_ADEPT), + Ok(Origin::Fellowship6Dan) => Ok(tracks::GRAND_ARCHITECTS), + Ok(Origin::Masters) => Ok(tracks::MASTERS), + Ok(Origin::Fellowship8Dan) => Ok(tracks::MASTERS_CONSTANT), Ok(Origin::Fellowship9Dan) => Ok(tracks::GRAND_MASTERS), + + Ok(Origin::RetainAt1Dan) => Ok(tracks::RETAIN_AT_1DAN), + Ok(Origin::RetainAt2Dan) => Ok(tracks::RETAIN_AT_2DAN), + Ok(Origin::RetainAt3Dan) => Ok(tracks::RETAIN_AT_3DAN), + Ok(Origin::RetainAt4Dan) => Ok(tracks::RETAIN_AT_4DAN), + Ok(Origin::RetainAt5Dan) => Ok(tracks::RETAIN_AT_5DAN), + Ok(Origin::RetainAt6Dan) => Ok(tracks::RETAIN_AT_6DAN), + + Ok(Origin::PromoteTo1Dan) => Ok(tracks::PROMOTE_TO_1DAN), + Ok(Origin::PromoteTo2Dan) => Ok(tracks::PROMOTE_TO_2DAN), + Ok(Origin::PromoteTo3Dan) => Ok(tracks::PROMOTE_TO_3DAN), + Ok(Origin::PromoteTo4Dan) => Ok(tracks::PROMOTE_TO_4DAN), + Ok(Origin::PromoteTo5Dan) => Ok(tracks::PROMOTE_TO_5DAN), + Ok(Origin::PromoteTo6Dan) => Ok(tracks::PROMOTE_TO_6DAN), + _ => Err(()), } } diff --git a/system-parachains/collectives/collectives-polkadot/src/impls.rs b/system-parachains/collectives/collectives-polkadot/src/impls.rs index 3b45d2824d..6ccff8bda1 100644 --- a/system-parachains/collectives/collectives-polkadot/src/impls.rs +++ b/system-parachains/collectives/collectives-polkadot/src/impls.rs @@ -146,3 +146,23 @@ impl PrivilegeCmp for EqualOrGreatestRootCmp { } } } + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarks { + use super::*; + use frame_support::traits::fungible; + use pallet_ranked_collective::Rank; + use parachains_common::{AccountId, Balance}; + use sp_runtime::traits::Convert; + + /// Rank to salary conversion helper type.` + pub struct RankToSalary(PhantomData); + impl Convert for RankToSalary + where + Fungible: fungible::Inspect, + { + fn convert(r: Rank) -> Balance { + Balance::from(r).saturating_mul(Fungible::minimum_balance()) + } + } +} diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 3aed385e40..3177cc0241 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -477,7 +477,7 @@ parameter_types! { // 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(); + pub PolkadotTreasuryAccount: AccountId = constants::account::POLKADOT_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; @@ -490,7 +490,7 @@ impl pallet_alliance::Config for Runtime { type MembershipManager = RootOrAllianceTwoThirdsMajority; type AnnouncementOrigin = RootOrAllianceTwoThirdsMajority; type Currency = Balances; - type Slashed = ToParentTreasury; + type Slashed = ToParentTreasury; type InitializeMembers = AllianceMotion; type MembershipChanged = AllianceMotion; type RetirementPeriod = AllianceRetirementPeriod; @@ -599,6 +599,10 @@ construct_runtime!( // pub type FellowshipReferendaInstance = pallet_referenda::Instance1; FellowshipReferenda: pallet_referenda::::{Pallet, Call, Storage, Event} = 61, FellowshipOrigins: pallet_fellowship_origins::{Origin} = 62, + // pub type FellowshipCoreInstance = pallet_core_fellowship::Instance1; + FellowshipCore: pallet_core_fellowship::::{Pallet, Call, Storage, Event} = 63, + // pub type FellowshipSalaryInstance = pallet_salary::Instance1; + FellowshipSalary: pallet_salary::::{Pallet, Call, Storage, Event} = 64, } ); @@ -667,6 +671,8 @@ mod benches { [pallet_scheduler, Scheduler] [pallet_referenda, FellowshipReferenda] [pallet_ranked_collective, FellowshipCollective] + [pallet_core_fellowship, FellowshipCore] + [pallet_salary, FellowshipSalary] ); } diff --git a/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs b/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs index 34ed36e3b6..b0e4954991 100644 --- a/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs @@ -6,11 +6,13 @@ pub mod pallet_alliance; pub mod pallet_balances; pub mod pallet_collator_selection; pub mod pallet_collective; +pub mod pallet_core_fellowship; pub mod pallet_multisig; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_ranked_collective; pub mod pallet_referenda; +pub mod pallet_salary; pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; diff --git a/system-parachains/collectives/collectives-polkadot/src/weights/pallet_core_fellowship.rs b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_core_fellowship.rs new file mode 100644 index 0000000000..5330755bb9 --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_core_fellowship.rs @@ -0,0 +1,222 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_core_fellowship` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-19, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `cob`, CPU: `` +//! EXECUTION: None, 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_core_fellowship +// --extrinsic=* +// --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)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_core_fellowship`. +pub struct WeightInfo(PhantomData); +impl pallet_core_fellowship::WeightInfo for WeightInfo { + /// Storage: FellowshipCore Params (r:0 w:1) + /// Proof: FellowshipCore Params (max_values: Some(1), max_size: Some(364), added: 859, mode: MaxEncodedLen) + fn set_params() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 65_000_000 picoseconds. + Weight::from_parts(65_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCollective Members (r:1 w:1) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipCore Params (r:1 w:0) + /// Proof: FellowshipCore Params (max_values: Some(1), max_size: Some(364), added: 859, 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:0) + /// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: FellowshipCore MemberEvidence (r:1 w:1) + /// Proof: FellowshipCore MemberEvidence (max_values: None, max_size: Some(1067), added: 3542, mode: MaxEncodedLen) + fn bump_offboard() -> Weight { + // Proof Size summary in bytes: + // Measured: `1562` + // Estimated: `4532` + // Minimum execution time: 300_000_000 picoseconds. + Weight::from_parts(300_000_000, 0) + .saturating_add(Weight::from_parts(0, 4532)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCollective Members (r:1 w:1) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipCore Params (r:1 w:0) + /// Proof: FellowshipCore Params (max_values: Some(1), max_size: Some(364), added: 859, 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:0) + /// Proof: FellowshipCollective IdToIndex (max_values: None, max_size: Some(54), added: 2529, mode: MaxEncodedLen) + /// Storage: FellowshipCore MemberEvidence (r:1 w:1) + /// Proof: FellowshipCore MemberEvidence (max_values: None, max_size: Some(1067), added: 3542, mode: MaxEncodedLen) + fn bump_demote() -> Weight { + // Proof Size summary in bytes: + // Measured: `1672` + // Estimated: `4532` + // Minimum execution time: 339_000_000 picoseconds. + Weight::from_parts(339_000_000, 0) + .saturating_add(Weight::from_parts(0, 4532)) + .saturating_add(T::DbWeight::get().reads(6)) + .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: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + fn set_active() -> Weight { + // Proof Size summary in bytes: + // Measured: `427` + // Estimated: `3514` + // Minimum execution time: 150_000_000 picoseconds. + Weight::from_parts(150_000_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// 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 induct() -> Weight { + // Proof Size summary in bytes: + // Measured: `185` + // Estimated: `3514` + // Minimum execution time: 166_000_000 picoseconds. + Weight::from_parts(166_000_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: FellowshipCollective Members (r:1 w:1) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCore Params (r:1 w:0) + /// Proof: FellowshipCore Params (max_values: Some(1), max_size: Some(364), added: 859, mode: MaxEncodedLen) + /// Storage: FellowshipCollective MemberCount (r:1 w:1) + /// Proof: FellowshipCollective MemberCount (max_values: None, max_size: Some(14), added: 2489, mode: MaxEncodedLen) + /// Storage: FellowshipCore MemberEvidence (r:1 w:1) + /// Proof: FellowshipCore MemberEvidence (max_values: None, max_size: Some(1067), added: 3542, 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 promote() -> Weight { + // Proof Size summary in bytes: + // Measured: `1540` + // Estimated: `4532` + // Minimum execution time: 308_000_000 picoseconds. + Weight::from_parts(308_000_000, 0) + .saturating_add(Weight::from_parts(0, 4532)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCore MemberEvidence (r:0 w:1) + /// Proof: FellowshipCore MemberEvidence (max_values: None, max_size: Some(1067), added: 3542, mode: MaxEncodedLen) + fn offboard() -> Weight { + // Proof Size summary in bytes: + // Measured: `398` + // Estimated: `3514` + // Minimum execution time: 141_000_000 picoseconds. + Weight::from_parts(141_000_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + fn import() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `3514` + // Minimum execution time: 131_000_000 picoseconds. + Weight::from_parts(131_000_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipCore Member (r:1 w:1) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCore MemberEvidence (r:1 w:1) + /// Proof: FellowshipCore MemberEvidence (max_values: None, max_size: Some(1067), added: 3542, mode: MaxEncodedLen) + fn approve() -> Weight { + // Proof Size summary in bytes: + // Measured: `1518` + // Estimated: `4532` + // Minimum execution time: 198_000_000 picoseconds. + Weight::from_parts(198_000_000, 0) + .saturating_add(Weight::from_parts(0, 4532)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: FellowshipCore Member (r:1 w:0) + /// Proof: FellowshipCore Member (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) + /// Storage: FellowshipCore MemberEvidence (r:1 w:1) + /// Proof: FellowshipCore MemberEvidence (max_values: None, max_size: Some(1067), added: 3542, mode: MaxEncodedLen) + fn submit_evidence() -> Weight { + // Proof Size summary in bytes: + // Measured: `151` + // Estimated: `4532` + // Minimum execution time: 99_000_000 picoseconds. + Weight::from_parts(99_000_000, 0) + .saturating_add(Weight::from_parts(0, 4532)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/system-parachains/collectives/collectives-polkadot/src/weights/pallet_salary.rs b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_salary.rs new file mode 100644 index 0000000000..8933342638 --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_salary.rs @@ -0,0 +1,140 @@ + +//! Autogenerated weights for `pallet_salary` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-20, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `cob`, CPU: `` +//! EXECUTION: None, 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_salary +// --extrinsic=* +// --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)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_salary`. +pub struct WeightInfo(PhantomData); +impl pallet_salary::WeightInfo for WeightInfo { + /// Storage: FellowshipSalary Status (r:1 w:1) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + fn init() -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `1541` + // Minimum execution time: 127_000_000 picoseconds. + Weight::from_parts(127_000_000, 0) + .saturating_add(Weight::from_parts(0, 1541)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: FellowshipSalary Status (r:1 w:1) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + fn bump() -> Weight { + // Proof Size summary in bytes: + // Measured: `224` + // Estimated: `1541` + // Minimum execution time: 133_000_000 picoseconds. + Weight::from_parts(133_000_000, 0) + .saturating_add(Weight::from_parts(0, 1541)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: FellowshipSalary Status (r:1 w:0) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipSalary Claimant (r:1 w:1) + /// Proof: FellowshipSalary Claimant (max_values: None, max_size: Some(78), added: 2553, mode: MaxEncodedLen) + fn induct() -> Weight { + // Proof Size summary in bytes: + // Measured: `395` + // Estimated: `3543` + // Minimum execution time: 186_000_000 picoseconds. + Weight::from_parts(186_000_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: FellowshipSalary Status (r:1 w:1) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + /// Storage: FellowshipSalary Claimant (r:1 w:1) + /// Proof: FellowshipSalary Claimant (max_values: None, max_size: Some(78), added: 2553, mode: MaxEncodedLen) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `462` + // Estimated: `3543` + // Minimum execution time: 183_000_000 picoseconds. + Weight::from_parts(183_000_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: FellowshipSalary Status (r:1 w:1) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + /// Storage: FellowshipSalary Claimant (r:1 w:1) + /// Proof: FellowshipSalary Claimant (max_values: None, max_size: Some(78), added: 2553, mode: MaxEncodedLen) + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `565` + // Estimated: `3593` + // Minimum execution time: 628_000_000 picoseconds. + Weight::from_parts(628_000_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: FellowshipSalary Status (r:1 w:1) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + /// Storage: FellowshipSalary Claimant (r:1 w:1) + /// Proof: FellowshipSalary Claimant (max_values: None, max_size: Some(78), added: 2553, mode: MaxEncodedLen) + /// Storage: FellowshipCollective Members (r:1 w:0) + /// Proof: FellowshipCollective Members (max_values: None, max_size: Some(42), added: 2517, mode: MaxEncodedLen) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn payout_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `565` + // Estimated: `6196` + // Minimum execution time: 607_000_000 picoseconds. + Weight::from_parts(607_000_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: FellowshipSalary Status (r:1 w:1) + /// Proof: FellowshipSalary Status (max_values: Some(1), max_size: Some(56), added: 551, mode: MaxEncodedLen) + /// Storage: FellowshipSalary Claimant (r:1 w:1) + /// Proof: FellowshipSalary Claimant (max_values: None, max_size: Some(78), added: 2553, mode: MaxEncodedLen) + fn check_payment() -> Weight { + // Proof Size summary in bytes: + // Measured: `308` + // Estimated: `3543` + // Minimum execution time: 100_000_000 picoseconds. + Weight::from_parts(100_000_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs index 5401391143..3c95da27dd 100644 --- a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs +++ b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs @@ -187,6 +187,16 @@ impl Contains for SafeCallFilter { pallet_ranked_collective::Call::promote_member { .. } | pallet_ranked_collective::Call::demote_member { .. } | pallet_ranked_collective::Call::remove_member { .. }, + ) | RuntimeCall::FellowshipCore( + pallet_core_fellowship::Call::bump { .. } | + pallet_core_fellowship::Call::set_params { .. } | + pallet_core_fellowship::Call::set_active { .. } | + pallet_core_fellowship::Call::approve { .. } | + pallet_core_fellowship::Call::induct { .. } | + pallet_core_fellowship::Call::promote { .. } | + pallet_core_fellowship::Call::offboard { .. } | + pallet_core_fellowship::Call::submit_evidence { .. } | + pallet_core_fellowship::Call::import { .. }, ) ) }