diff --git a/CHANGELOG.md b/CHANGELOG.md index 11953cd12b..8f82fdf6f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Added + +- The Secretary Program ([polkadot-fellows/runtimes#347](https://github.com/polkadot-fellows/runtimes/pull/347)) + ## [1.3.4] 01.11.2024 ### Changed @@ -439,4 +445,4 @@ Note: This release only affects the following runtimes and is not a full system - Assets `destroy_accounts` releases the deposit ([paritytech/substrate#14443](https://github.com/paritytech/substrate/pull/14443)) - Update Polkadot Collectives to use `limited_teleport_assets` for automatic slash handling, as - `teleport_assets` is deprecated and caused a failing integration test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46)) + `teleport_assets` is deprecated and caused a failing integration test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46)) \ No newline at end of file diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/impls.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/impls.rs index 68a3bfb318..049004706c 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/impls.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/impls.rs @@ -267,8 +267,9 @@ pub mod tx_payment { // The error should not occur since swap was quoted before. Err((refund, _)) => { match T::Assets::settle(who, debt, Preservation::Expendable) { - Ok(dust) => - ensure!(dust.peek().is_zero(), InvalidTransaction::Payment), + Ok(dust) => { + ensure!(dust.peek().is_zero(), InvalidTransaction::Payment) + }, // The error should not occur as the `debt` was just withdrawn // above. Err(_) => return Err(InvalidTransaction::Payment.into()), 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 a485abd6cb..d53a646bd7 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 @@ -227,6 +227,8 @@ parameter_types! { pub XcmAssetFeesReceiver: Option = Authorship::author(); } +/// Location type to determine the Technical Fellowship related +/// pallets for use in XCM. pub struct FellowshipEntities; impl Contains for FellowshipEntities { fn contains(location: &Location) -> bool { @@ -259,6 +261,8 @@ impl Contains for FellowshipEntities { } } +/// Location type to determine the Ambassador Collective +/// pallets for use in XCM. pub struct AmbassadorEntities; impl Contains for AmbassadorEntities { fn contains(location: &Location) -> bool { @@ -285,6 +289,26 @@ impl Contains for AmbassadorEntities { } } +/// Location type to determine the Secretary Collective related +/// pallets for use in XCM. +pub struct SecretaryEntities; +impl Contains for SecretaryEntities { + fn contains(location: &Location) -> bool { + matches!( + location.unpack(), + ( + 1, + [ + Parachain(system_parachain::COLLECTIVES_ID), + PalletInstance( + collectives_polkadot_runtime_constants::SECRETARY_SALARY_PALLET_INDEX + ) + ] + ) + ) + } +} + pub struct ParentOrParentsPlurality; impl Contains for ParentOrParentsPlurality { fn contains(location: &Location) -> bool { @@ -314,6 +338,7 @@ pub type Barrier = TrailingSetTopicAsId< Equals, Equals, AmbassadorEntities, + SecretaryEntities, )>, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, @@ -340,6 +365,7 @@ pub type WaivedLocations = ( Equals, FellowshipEntities, AmbassadorEntities, + SecretaryEntities, ); /// Cases where a remote origin is accepted as trusted Teleporter for a given asset: diff --git a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs index 7fe81f8019..155366b22d 100644 --- a/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/constants/src/lib.rs @@ -27,3 +27,6 @@ pub const AMBASSADOR_SALARY_PALLET_INDEX: u8 = 74; /// Polkadot Ambassador Treasury pallet instance. pub const AMBASSADOR_TREASURY_PALLET_INDEX: u8 = 75; + +/// Polkadot Secretary Salary pallet instance. +pub const SECRETARY_SALARY_PALLET_INDEX: u8 = 81; diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index c8ccd42bd3..b79d9f38b7 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -46,6 +46,9 @@ pub mod xcm_config; pub mod fellowship; pub use ambassador::pallet_ambassador_origins; +// Secretary Configuration +pub mod secretary; + use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use fellowship::{pallet_fellowship_origins, Fellows}; @@ -314,6 +317,8 @@ pub enum ProxyType { Fellowship, /// Ambassador proxy. Allows calls related to the Ambassador Program. Ambassador, + /// Secretary proxy. Allows calls related to the Secretary collective + Secretary, } impl Default for ProxyType { fn default() -> Self { @@ -362,6 +367,13 @@ impl InstanceFilter for ProxyType { RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } ), + ProxyType::Secretary => matches!( + c, + RuntimeCall::SecretaryCollective { .. } | + RuntimeCall::SecretarySalary { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } + ), } } fn is_superset(&self, o: &Self) -> bool { @@ -744,6 +756,12 @@ construct_runtime!( AmbassadorCore: pallet_core_fellowship:: = 73, AmbassadorSalary: pallet_salary:: = 74, AmbassadorTreasury: pallet_treasury:: = 75, + + // The Secretary Collective + // pub type SecretaryCollectiveInstance = pallet_ranked_collective::instance3; + SecretaryCollective: pallet_ranked_collective:: = 80, + // pub type SecretarySalaryInstance = pallet_salary::Instance3; + SecretarySalary: pallet_salary:: = 81, } ); @@ -823,6 +841,8 @@ mod benches { [pallet_core_fellowship, AmbassadorCore] [pallet_salary, AmbassadorSalary] [pallet_treasury, AmbassadorTreasury] + [pallet_ranked_collective, SecretaryCollective] + [pallet_salary, SecretarySalary] ); } diff --git a/system-parachains/collectives/collectives-polkadot/src/secretary/mod.rs b/system-parachains/collectives/collectives-polkadot/src/secretary/mod.rs new file mode 100644 index 0000000000..769f0ed531 --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/src/secretary/mod.rs @@ -0,0 +1,195 @@ +// Copyright (C) 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 . + +//! The Polkadot Secretary Collective. + +use core::marker::PhantomData; + +use crate::{fellowship::FellowshipAdminBodyId, *}; +use frame_support::{ + parameter_types, + traits::{tokens::GetSalary, EitherOf, MapSuccess, PalletInfoAccess, PollStatus, Polling}, +}; +use frame_system::{pallet_prelude::BlockNumberFor, EnsureRootWithSuccess}; +use pallet_ranked_collective::{MemberIndex, TallyOf, Votes}; +use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; +use polkadot_runtime_constants::time::HOURS; +use sp_core::{ConstU128, ConstU32}; +use sp_runtime::{ + traits::{ConstU16, ConvertToValue, Identity, Replace}, + DispatchError, +}; + +use xcm::prelude::*; +use xcm_builder::{AliasesIntoAccountId32, PayOverXcm}; + +use self::xcm_config::AssetHubUsdt; + +/// The Secretary members' ranks. +pub mod ranks { + use pallet_ranked_collective::Rank; + + pub const SECRETARY_CANDIDATE: Rank = 0; + pub const SECRETARY: Rank = 1; +} + +/// Origins of: +/// - Root; +/// - FellowshipAdmin (i.e. token holder referendum); +/// - Plurality vote from Fellows can promote, demote, remove and approve rank retention of members +/// of the Secretary Collective (rank `2`). +type ApproveOrigin = EitherOf< + EnsureRootWithSuccess>, + EitherOf< + MapSuccess< + EnsureXcm>, + Replace>, + >, + MapSuccess>>, + >, +>; + +pub struct SecretaryPolling, I: 'static>( + PhantomData<(T, I)>, +); + +// TODO: Include no-op impl in the Polkadot-SDK(https://github.com/paritytech/polkadot-sdk/pull/5311) +impl, I: 'static> Polling> + for SecretaryPolling +{ + type Index = MemberIndex; + type Votes = Votes; + type Class = u16; + type Moment = BlockNumberFor; + + fn classes() -> Vec { + vec![] + } + + fn as_ongoing(_index: Self::Index) -> Option<(TallyOf, Self::Class)> { + None + } + + fn access_poll( + _index: Self::Index, + f: impl FnOnce(PollStatus<&mut TallyOf, Self::Moment, Self::Class>) -> R, + ) -> R { + f(PollStatus::None) + } + + fn try_access_poll( + _index: Self::Index, + f: impl FnOnce( + PollStatus<&mut TallyOf, Self::Moment, Self::Class>, + ) -> Result, + ) -> Result { + f(PollStatus::None) + } + + #[cfg(feature = "runtime-benchmarks")] + fn create_ongoing(_class: Self::Class) -> Result { + Err(()) + } + + #[cfg(feature = "runtime-benchmarks")] + fn end_ongoing(_index: Self::Index, _approved: bool) -> Result<(), ()> { + Err(()) + } + + #[cfg(feature = "runtime-benchmarks")] + fn max_ongoing() -> (Self::Class, u32) { + (0, 0) + } +} + +pub type SecretaryCollectiveInstance = pallet_ranked_collective::Instance3; + +impl pallet_ranked_collective::Config for Runtime { + type WeightInfo = weights::pallet_ranked_collective_secretary_collective::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type AddOrigin = ApproveOrigin; + type RemoveOrigin = ApproveOrigin; + type PromoteOrigin = ApproveOrigin; + type DemoteOrigin = ApproveOrigin; + type ExchangeOrigin = ApproveOrigin; + type Polls = SecretaryPolling; + type MinRankOfClass = Identity; + type MemberSwappedHandler = crate::SecretarySalary; + type VoteWeight = pallet_ranked_collective::Geometric; + type MaxMemberCount = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkSetup = crate::SecretarySalary; +} + +pub type SecretarySalaryInstance = pallet_salary::Instance3; + +parameter_types! { + // The interior location on AssetHub for the paying account. This is the Secretary Salary + // pallet instance. This sovereign account will need funding. + pub SecretarySalaryInteriorLocation: InteriorLocation = PalletInstance(::index() as u8).into(); +} + +const USDT_UNITS: u128 = 1_000_000; + +/// [`PayOverXcm`] setup to pay the Secretary salary on the AssetHub in USDT. +pub type SecretarySalaryPaymaster = PayOverXcm< + SecretarySalaryInteriorLocation, + crate::xcm_config::XcmRouter, + crate::PolkadotXcm, + ConstU32<{ 6 * HOURS }>, + AccountId, + (), + ConvertToValue, + AliasesIntoAccountId32<(), AccountId>, +>; + +pub struct SalaryForRank; +impl GetSalary for SalaryForRank { + fn get_salary(rank: u16, _who: &AccountId) -> Balance { + if rank == 1 { + 6666 * USDT_UNITS + } else { + 0 + } + } +} + +impl pallet_salary::Config for Runtime { + type WeightInfo = weights::pallet_salary_secretary_salary::WeightInfo; + type RuntimeEvent = RuntimeEvent; + + #[cfg(not(feature = "runtime-benchmarks"))] + type Paymaster = SecretarySalaryPaymaster; + #[cfg(feature = "runtime-benchmarks")] + type Paymaster = crate::impls::benchmarks::PayWithEnsure< + SecretarySalaryPaymaster, + crate::impls::benchmarks::OpenHrmpChannel>, + >; + type Members = pallet_ranked_collective::Pallet; + + #[cfg(not(feature = "runtime-benchmarks"))] + type Salary = SalaryForRank; + #[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<{ 6666 * USDT_UNITS }>; +} diff --git a/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs b/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs index 30c6e7cdb0..20a9052d87 100644 --- a/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/weights/mod.rs @@ -32,10 +32,12 @@ pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_ranked_collective_ambassador_collective; pub mod pallet_ranked_collective_fellowship_collective; +pub mod pallet_ranked_collective_secretary_collective; pub mod pallet_referenda_ambassador_referenda; pub mod pallet_referenda_fellowship_referenda; pub mod pallet_salary_ambassador_salary; pub mod pallet_salary_fellowship_salary; +pub mod pallet_salary_secretary_salary; pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; diff --git a/system-parachains/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_secretary_collective.rs b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_secretary_collective.rs new file mode 100644 index 0000000000..58fef641b3 --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_secretary_collective.rs @@ -0,0 +1,186 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `pallet_ranked_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 +//! DATE: 2024-11-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Jesses-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/release/wbuild/collectives-polkadot-runtime/collectives_polkadot_runtime.compact.compressed.wasm +// --pallet +// pallet-ranked-collective +// --extrinsic +// +// --output=pallet_ranked_collective_secretary_collective.rs + +#![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_ranked_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_ranked_collective::WeightInfo for WeightInfo { + /// Storage: `SecretaryCollective::Members` (r:1 w:1) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::MemberCount` (r:1 w:1) + /// Proof: `SecretaryCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IndexToId` (r:0 w:1) + /// Proof: `SecretaryCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IdToIndex` (r:0 w:1) + /// Proof: `SecretaryCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn add_member() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `3507` + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) + .saturating_add(Weight::from_parts(0, 3507)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `SecretaryCollective::Members` (r:1 w:1) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::MemberCount` (r:11 w:11) + /// Proof: `SecretaryCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IdToIndex` (r:11 w:22) + /// Proof: `SecretaryCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IndexToId` (r:11 w:22) + /// Proof: `SecretaryCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 10]`. + /// The range of component `r` is `[0, 10]`. + /// The range of component `r` is `[0, 10]`. + fn remove_member(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `415 + r * (213 ±0)` + // Estimated: `3519 + r * (2529 ±0)` + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(58_425_563, 0) + .saturating_add(Weight::from_parts(0, 3519)) + // Standard Error: 420_534 + .saturating_add(Weight::from_parts(17_382_102, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2529).saturating_mul(r.into())) + } + /// Storage: `SecretaryCollective::Members` (r:1 w:1) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::MemberCount` (r:1 w:1) + /// Proof: `SecretaryCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IndexToId` (r:0 w:1) + /// Proof: `SecretaryCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IdToIndex` (r:0 w:1) + /// Proof: `SecretaryCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 10]`. + /// The range of component `r` is `[0, 10]`. + /// The range of component `r` is `[0, 10]`. + fn promote_member(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `214 + r * (17 ±0)` + // Estimated: `3507` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(21_988_269, 0) + .saturating_add(Weight::from_parts(0, 3507)) + // Standard Error: 57_513 + .saturating_add(Weight::from_parts(684_453, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `SecretaryCollective::Members` (r:1 w:1) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::MemberCount` (r:1 w:1) + /// Proof: `SecretaryCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IdToIndex` (r:1 w:2) + /// Proof: `SecretaryCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IndexToId` (r:1 w:2) + /// Proof: `SecretaryCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 10]`. + /// The range of component `r` is `[0, 10]`. + /// The range of component `r` is `[0, 10]`. + fn demote_member(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `430 + r * (72 ±0)` + // Estimated: `3519` + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(37_046_559, 0) + .saturating_add(Weight::from_parts(0, 3519)) + // Standard Error: 108_970 + .saturating_add(Weight::from_parts(1_323_622, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `SecretaryCollective::Members` (r:1 w:0) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + fn vote() -> Weight { + // Proof Size summary in bytes: + // Measured: `209` + // Estimated: `3507` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 0) + .saturating_add(Weight::from_parts(0, 3507)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `SecretaryCollective::VotingCleanup` (r:1 w:0) + /// Proof: `SecretaryCollective::VotingCleanup` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + fn cleanup_poll(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `607 + n * (1 ±0)` + // Estimated: `3579` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(21_486_534, 0) + .saturating_add(Weight::from_parts(0, 3579)) + // Standard Error: 7_810 + .saturating_add(Weight::from_parts(66_925, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `SecretaryCollective::Members` (r:2 w:2) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::MemberCount` (r:2 w:2) + /// Proof: `SecretaryCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IdToIndex` (r:2 w:4) + /// Proof: `SecretaryCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Claimant` (r:2 w:2) + /// Proof: `SecretarySalary::Claimant` (`max_values`: None, `max_size`: Some(86), added: 2561, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::IndexToId` (r:0 w:2) + /// Proof: `SecretaryCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn exchange_member() -> Weight { + // Proof Size summary in bytes: + // Measured: `446` + // Estimated: `6112` + // Minimum execution time: 57_000_000 picoseconds. + Weight::from_parts(65_000_000, 0) + .saturating_add(Weight::from_parts(0, 6112)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(12)) + } +} diff --git a/system-parachains/collectives/collectives-polkadot/src/weights/pallet_salary_secretary_salary.rs b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_salary_secretary_salary.rs new file mode 100644 index 0000000000..0670d7c7af --- /dev/null +++ b/system-parachains/collectives/collectives-polkadot/src/weights/pallet_salary_secretary_salary.rs @@ -0,0 +1,185 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `pallet_salary` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 +//! DATE: 2024-11-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `Jesses-MacBook-Pro.local`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --runtime +// target/release/wbuild/collectives-polkadot-runtime/collectives_polkadot_runtime.compact.compressed.wasm +// --pallet +// pallet-salary +// --extrinsic +// +// --output=pallet_salary_secretary_salary.rs + +#![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: `SecretarySalary::Status` (r:1 w:1) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + fn init() -> Weight { + // Proof Size summary in bytes: + // Measured: `4` + // Estimated: `1541` + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(6_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: `SecretarySalary::Status` (r:1 w:1) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + fn bump() -> Weight { + // Proof Size summary in bytes: + // Measured: `86` + // Estimated: `1541` + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(8_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: `SecretarySalary::Status` (r:1 w:0) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::Members` (r:1 w:0) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Claimant` (r:1 w:1) + /// Proof: `SecretarySalary::Claimant` (`max_values`: None, `max_size`: Some(86), added: 2561, mode: `MaxEncodedLen`) + fn induct() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3551` + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) + .saturating_add(Weight::from_parts(0, 3551)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `SecretaryCollective::Members` (r:1 w:0) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Status` (r:1 w:1) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Claimant` (r:1 w:1) + /// Proof: `SecretarySalary::Claimant` (`max_values`: None, `max_size`: Some(86), added: 2561, mode: `MaxEncodedLen`) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `362` + // Estimated: `3551` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) + .saturating_add(Weight::from_parts(0, 3551)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `SecretarySalary::Status` (r:1 w:1) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Claimant` (r:1 w:1) + /// Proof: `SecretarySalary::Claimant` (`max_values`: None, `max_size`: Some(86), added: 2561, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::Members` (r:1 w:0) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, 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::QueryCounter` (r:1 w:1) + /// Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) + /// Storage: `PolkadotXcm::Queries` (r:0 w:1) + /// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `837` + // Estimated: `4302` + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(53_000_000, 0) + .saturating_add(Weight::from_parts(0, 4302)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `SecretarySalary::Status` (r:1 w:1) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Claimant` (r:1 w:1) + /// Proof: `SecretarySalary::Claimant` (`max_values`: None, `max_size`: Some(86), added: 2561, mode: `MaxEncodedLen`) + /// Storage: `SecretaryCollective::Members` (r:1 w:0) + /// Proof: `SecretaryCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, 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::QueryCounter` (r:1 w:1) + /// Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::DeliveryFeeFactor` (r:1 w:0) + /// Proof: `XcmpQueue::DeliveryFeeFactor` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0) + /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0) + /// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: Some(1282), added: 1777, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1) + /// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: Some(105506), added: 107981, mode: `MaxEncodedLen`) + /// Storage: `PolkadotXcm::Queries` (r:0 w:1) + /// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn payout_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `837` + // Estimated: `4302` + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(53_000_000, 0) + .saturating_add(Weight::from_parts(0, 4302)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `SecretarySalary::Status` (r:1 w:1) + /// Proof: `SecretarySalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `SecretarySalary::Claimant` (r:1 w:1) + /// Proof: `SecretarySalary::Claimant` (`max_values`: None, `max_size`: Some(86), added: 2561, mode: `MaxEncodedLen`) + /// Storage: `PolkadotXcm::Queries` (r:1 w:1) + /// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn check_payment() -> Weight { + // Proof Size summary in bytes: + // Measured: `361` + // Estimated: `3826` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) + .saturating_add(Weight::from_parts(0, 3826)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } +}