diff --git a/Cargo.lock b/Cargo.lock
index b7d92f45334..2499f0e30ad 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2421,6 +2421,7 @@ dependencies = [
"pallet-balances",
"pallet-collator-selection",
"pallet-collective",
+ "pallet-collective-content",
"pallet-core-fellowship",
"pallet-multisig",
"pallet-preimage",
@@ -8240,6 +8241,21 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "pallet-collective-content"
+version = "0.1.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+]
+
[[package]]
name = "pallet-contracts"
version = "4.0.0-dev"
diff --git a/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/ambassador.rs b/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/ambassador.rs
new file mode 100644
index 00000000000..12ebd70ea5c
--- /dev/null
+++ b/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/ambassador.rs
@@ -0,0 +1,67 @@
+// 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 .
+
+//! Integration tests concerning the Fellowship.
+
+use crate::*;
+use collectives_polkadot_runtime::ambassador::AmbassadorSalaryPaymaster;
+use frame_support::traits::{fungible::Mutate, tokens::Pay};
+use sp_core::crypto::Ss58Codec;
+use xcm_emulator::TestExt;
+
+#[test]
+fn pay_salary() {
+ // TODO remove comments - /~https://github.com/paritytech/cumulus/issues/3027
+ // let pay_from: AccountId =
+ // ::from_string("5DS1Gaf6R9eFAV8QyeZP9P89kTkJMurxv3y3J3TTMu8p8VCX")
+ // .unwrap();
+ // let pay_to = Polkadot::account_id_of(ALICE);
+ // let pay_amount = 90000000000;
+
+ // AssetHubPolkadot::execute_with(|| {
+ // type AssetHubBalances = ::Balances;
+
+ // assert_ok!(>::mint_into(&pay_from, pay_amount * 2));
+ // });
+
+ // Collectives::execute_with(|| {
+ // type RuntimeEvent = ::RuntimeEvent;
+
+ // assert_ok!(AmbassadorSalaryPaymaster::pay(&pay_to, (), pay_amount));
+ // assert_expected_events!(
+ // Collectives,
+ // vec![
+ // RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
+ // ]
+ // );
+ // });
+
+ // AssetHubPolkadot::execute_with(|| {
+ // type RuntimeEvent = ::RuntimeEvent;
+
+ // assert_expected_events!(
+ // AssetHubPolkadot,
+ // vec![
+ // RuntimeEvent::Balances(pallet_balances::Event::Transfer { from, to, amount }) => {
+ // from: from == &pay_from,
+ // to: to == &pay_to,
+ // amount: amount == &pay_amount,
+ // },
+ // RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) => {},
+ // ]
+ // );
+ // });
+}
diff --git a/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/mod.rs b/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/mod.rs
index 1ede78b5979..f6d0484feb4 100644
--- a/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/mod.rs
+++ b/parachains/integration-tests/emulated/collectives/collectives-polkadot/src/tests/mod.rs
@@ -14,4 +14,5 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see .
+mod ambassador;
mod fellowship;
diff --git a/parachains/pallets/collective-content/Cargo.toml b/parachains/pallets/collective-content/Cargo.toml
new file mode 100644
index 00000000000..02ba045b6de
--- /dev/null
+++ b/parachains/pallets/collective-content/Cargo.toml
@@ -0,0 +1,45 @@
+[package]
+name = "pallet-collective-content"
+version = "0.1.0"
+authors = ["Parity Technologies "]
+edition = "2021"
+description = "Managed content"
+
+[dependencies]
+codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
+scale-info = { version = "2.3.0", default-features = false, features = ["derive"] }
+
+frame-benchmarking = { git = "/~https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
+frame-support = { git = "/~https://github.com/paritytech/substrate", default-features = false, branch = "master" }
+frame-system = { git = "/~https://github.com/paritytech/substrate", default-features = false, branch = "master" }
+
+sp-core = { git = "/~https://github.com/paritytech/substrate", default-features = false, branch = "master" }
+sp-runtime = { git = "/~https://github.com/paritytech/substrate", default-features = false, branch = "master" }
+sp-std = { git = "/~https://github.com/paritytech/substrate", default-features = false, branch = "master" }
+
+[dev-dependencies]
+sp-io = { git = "/~https://github.com/paritytech/substrate", branch = "master" }
+
+[features]
+default = [ "std" ]
+runtime-benchmarks = [
+ "frame-benchmarking/runtime-benchmarks",
+ "frame-support/runtime-benchmarks",
+ "frame-system/runtime-benchmarks",
+ "sp-runtime/runtime-benchmarks",
+]
+
+std = [
+ "codec/std",
+ "scale-info/std",
+ "frame-support/std",
+ "frame-system/std",
+ "sp-core/std",
+ "sp-runtime/std",
+ "sp-std/std",
+]
+
+try-runtime = [
+ "frame-support/try-runtime",
+ "frame-system/try-runtime",
+]
diff --git a/parachains/pallets/collective-content/src/benchmarking.rs b/parachains/pallets/collective-content/src/benchmarking.rs
new file mode 100644
index 00000000000..72db22d7b1c
--- /dev/null
+++ b/parachains/pallets/collective-content/src/benchmarking.rs
@@ -0,0 +1,116 @@
+// Copyright (C) 2023 Parity Technologies (UK) Ltd.
+// 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.
+
+//! The pallet benchmarks.
+
+use super::{Pallet as CollectiveContent, *};
+use frame_benchmarking::{impl_benchmark_test_suite, v2::*};
+use frame_support::traits::EnsureOrigin;
+
+fn assert_last_event, I: 'static>(generic_event: >::RuntimeEvent) {
+ frame_system::Pallet::::assert_last_event(generic_event.into());
+}
+
+/// returns CID hash of 68 bytes of given `i`.
+fn create_cid(i: u8) -> OpaqueCid {
+ let cid: OpaqueCid = [i; 68].to_vec().try_into().unwrap();
+ cid
+}
+
+#[instance_benchmarks]
+mod benchmarks {
+ use super::*;
+
+ #[benchmark]
+ fn set_charter() -> Result<(), BenchmarkError> {
+ let cid: OpaqueCid = create_cid(1);
+ let origin =
+ T::CharterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
+
+ #[extrinsic_call]
+ _(origin as T::RuntimeOrigin, cid.clone());
+
+ assert_eq!(CollectiveContent::::charter(), Some(cid.clone()));
+ assert_last_event::(Event::NewCharterSet { cid }.into());
+ Ok(())
+ }
+
+ #[benchmark]
+ fn announce() -> Result<(), BenchmarkError> {
+ let expire_at = DispatchTime::<_>::At(10u32.into());
+ let now = frame_system::Pallet::::block_number();
+ let cid: OpaqueCid = create_cid(1);
+ let origin = T::AnnouncementOrigin::try_successful_origin()
+ .map_err(|_| BenchmarkError::Weightless)?;
+
+ #[extrinsic_call]
+ _(origin as T::RuntimeOrigin, cid.clone(), Some(expire_at.clone()));
+
+ assert_eq!(CollectiveContent::::announcements_count(), 1);
+ assert_last_event::(
+ Event::AnnouncementAnnounced { cid, expire_at: expire_at.evaluate(now) }.into(),
+ );
+
+ Ok(())
+ }
+
+ #[benchmark]
+ fn remove_announcement() -> Result<(), BenchmarkError> {
+ let cid: OpaqueCid = create_cid(1);
+ let origin = T::AnnouncementOrigin::try_successful_origin()
+ .map_err(|_| BenchmarkError::Weightless)?;
+ CollectiveContent::::announce(origin.clone(), cid.clone(), None)
+ .expect("could not publish an announcement");
+ assert_eq!(CollectiveContent::::announcements_count(), 1);
+
+ #[extrinsic_call]
+ _(origin as T::RuntimeOrigin, cid.clone());
+
+ assert_eq!(CollectiveContent::::announcements_count(), 0);
+ assert_last_event::(Event::AnnouncementRemoved { cid }.into());
+
+ Ok(())
+ }
+
+ #[benchmark]
+ fn cleanup_announcements(x: Linear<0, 100>) -> Result<(), BenchmarkError> {
+ let origin = T::AnnouncementOrigin::try_successful_origin().unwrap();
+
+ let max_count = x;
+ for i in 0..max_count {
+ let cid: OpaqueCid = create_cid(i as u8);
+ CollectiveContent::::announce(
+ origin.clone(),
+ cid,
+ Some(DispatchTime::<_>::At(5u32.into())),
+ )
+ .expect("could not publish an announcement");
+ }
+ assert_eq!(CollectiveContent::::announcements_count(), max_count);
+ frame_system::Pallet::::set_block_number(10u32.into());
+
+ #[block]
+ {
+ CollectiveContent::::cleanup_announcements(10u32.into());
+ }
+
+ assert_eq!(CollectiveContent::::announcements_count(), 0);
+ assert_eq!(frame_system::Pallet::::events().len() as u32, max_count);
+
+ Ok(())
+ }
+
+ impl_benchmark_test_suite!(CollectiveContent, super::mock::new_bench_ext(), super::mock::Test);
+}
diff --git a/parachains/pallets/collective-content/src/lib.rs b/parachains/pallets/collective-content/src/lib.rs
new file mode 100644
index 00000000000..bbbeb62eda2
--- /dev/null
+++ b/parachains/pallets/collective-content/src/lib.rs
@@ -0,0 +1,267 @@
+// Copyright (C) 2023 Parity Technologies (UK) Ltd.
+// 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.
+
+//! Managed Collective Content Pallet
+//!
+//! The pallet provides the functionality to store different types of content. This would typically
+//! be used by an on-chain collective, such as the Polkadot Alliance or Ambassador Program.
+//!
+//! The pallet stores content as an [OpaqueCid], which should correspond to some off-chain hosting
+//! service, such as IPFS, and contain any type of data. Each type of content has its own origin
+//! from which it can be managed. The origins are configurable in the runtime. Storing content does
+//! not require a deposit, as it is expected to be managed by a trusted collective.
+//!
+//! Content types:
+//!
+//! - Collective [charter](pallet::Charter): A single document (`OpaqueCid`) managed by
+//! [CharterOrigin](pallet::Config::CharterOrigin).
+//! - Collective [announcements](pallet::Announcements): A list of announcements managed by
+//! [AnnouncementOrigin](pallet::Config::AnnouncementOrigin).
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg(test)]
+mod mock;
+#[cfg(test)]
+mod tests;
+
+#[cfg(feature = "runtime-benchmarks")]
+mod benchmarking;
+pub mod weights;
+
+pub use pallet::*;
+pub use weights::WeightInfo;
+
+use frame_support::{traits::schedule::DispatchTime, BoundedVec};
+use sp_core::ConstU32;
+use sp_std::prelude::*;
+
+/// IPFS compatible CID.
+// Worst case 2 bytes base and codec, 2 bytes hash type and size, 64 bytes hash digest.
+pub type OpaqueCid = BoundedVec>;
+
+#[frame_support::pallet]
+pub mod pallet {
+ use super::*;
+ use frame_support::{ensure, pallet_prelude::*};
+ use frame_system::pallet_prelude::*;
+ use sp_runtime::{traits::BadOrigin, ArithmeticError::Overflow, Saturating};
+
+ /// The current storage version.
+ const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);
+
+ #[pallet::pallet]
+ #[pallet::storage_version(STORAGE_VERSION)]
+ pub struct Pallet(PhantomData<(T, I)>);
+
+ /// The module configuration trait.
+ #[pallet::config]
+ pub trait Config: frame_system::Config {
+ /// The overarching event type.
+ type RuntimeEvent: From>
+ + IsType<::RuntimeEvent>;
+
+ /// Default lifetime for an announcement before it expires.
+ type AnnouncementLifetime: Get>;
+
+ /// The origin to control the collective announcements.
+ type AnnouncementOrigin: EnsureOrigin;
+
+ /// The origin to control the collective charter.
+ type CharterOrigin: EnsureOrigin;
+
+ /// Weight information needed for the pallet.
+ type WeightInfo: WeightInfo;
+ }
+
+ #[pallet::error]
+ pub enum Error {
+ /// The announcement is not found.
+ MissingAnnouncement,
+ /// Number of announcements exceeds `MaxAnnouncementsCount`.
+ TooManyAnnouncements,
+ /// Cannot expire in the past.
+ InvalidExpiration,
+ }
+
+ #[pallet::event]
+ #[pallet::generate_deposit(pub(super) fn deposit_event)]
+ pub enum Event, I: 'static = ()> {
+ /// A new charter has been set.
+ NewCharterSet { cid: OpaqueCid },
+ /// A new announcement has been made.
+ AnnouncementAnnounced { cid: OpaqueCid, expire_at: BlockNumberFor },
+ /// An on-chain announcement has been removed.
+ AnnouncementRemoved { cid: OpaqueCid },
+ }
+
+ /// The collective charter.
+ #[pallet::storage]
+ #[pallet::getter(fn charter)]
+ pub type Charter, I: 'static = ()> = StorageValue<_, OpaqueCid, OptionQuery>;
+
+ /// The collective announcements.
+ #[pallet::storage]
+ #[pallet::getter(fn announcements)]
+ pub type Announcements, I: 'static = ()> =
+ StorageMap<_, Blake2_128Concat, OpaqueCid, BlockNumberFor, OptionQuery>;
+
+ /// The current count of the announcements.
+ #[pallet::storage]
+ #[pallet::getter(fn announcements_count)]
+ pub type AnnouncementsCount, I: 'static = ()> = StorageValue<_, u32, ValueQuery>;
+
+ /// The closest expiration block number of an announcement.
+ #[pallet::storage]
+ pub type NextAnnouncementExpireAt, I: 'static = ()> =
+ StorageValue<_, BlockNumberFor, OptionQuery>;
+
+ #[pallet::call]
+ impl, I: 'static> Pallet {
+ /// Set the collective charter.
+ ///
+ /// Parameters:
+ /// - `origin`: Must be the [Config::CharterOrigin].
+ /// - `cid`: [CID](super::OpaqueCid) of the IPFS document of the collective charter.
+ ///
+ /// Weight: `O(1)`.
+ #[pallet::call_index(0)]
+ #[pallet::weight(T::WeightInfo::set_charter())]
+ pub fn set_charter(origin: OriginFor, cid: OpaqueCid) -> DispatchResult {
+ T::CharterOrigin::ensure_origin(origin)?;
+
+ Charter::::put(&cid);
+
+ Self::deposit_event(Event::::NewCharterSet { cid });
+ Ok(())
+ }
+
+ /// Publish an announcement.
+ ///
+ /// Parameters:
+ /// - `origin`: Must be the [Config::AnnouncementOrigin].
+ /// - `cid`: [CID](super::OpaqueCid) of the IPFS document to announce.
+ /// - `maybe_expire`: Expiration block of the announcement. If `None`
+ /// [`Config::AnnouncementLifetime`]
+ /// used as a default.
+ ///
+ /// Weight: `O(1)`.
+ #[pallet::call_index(1)]
+ #[pallet::weight(T::WeightInfo::announce())]
+ pub fn announce(
+ origin: OriginFor,
+ cid: OpaqueCid,
+ maybe_expire: Option>>,
+ ) -> DispatchResult {
+ T::AnnouncementOrigin::ensure_origin(origin)?;
+
+ let now = frame_system::Pallet::::block_number();
+ let expire_at = maybe_expire
+ .map_or(now.saturating_add(T::AnnouncementLifetime::get()), |e| e.evaluate(now));
+ ensure!(expire_at > now, Error::::InvalidExpiration);
+
+ >::insert(cid.clone(), expire_at);
+ >::try_mutate(|count| -> DispatchResult {
+ *count = count.checked_add(1).ok_or(Overflow)?;
+ Ok(())
+ })?;
+
+ if NextAnnouncementExpireAt::::get().map_or(true, |n| n > expire_at) {
+ NextAnnouncementExpireAt::::put(expire_at);
+ }
+
+ Self::deposit_event(Event::::AnnouncementAnnounced { cid, expire_at });
+ Ok(())
+ }
+
+ /// Remove an announcement.
+ ///
+ /// Transaction fee refunded for expired announcements.
+ ///
+ /// Parameters:
+ /// - `origin`: Must be the [Config::AnnouncementOrigin] or signed for expired
+ /// announcements.
+ /// - `cid`: [CID](super::OpaqueCid) of the IPFS document to remove.
+ ///
+ /// Weight: `O(1)`.
+ #[pallet::call_index(2)]
+ #[pallet::weight(T::WeightInfo::remove_announcement())]
+ pub fn remove_announcement(
+ origin: OriginFor,
+ cid: OpaqueCid,
+ ) -> DispatchResultWithPostInfo {
+ let maybe_who = match T::AnnouncementOrigin::try_origin(origin) {
+ Ok(_) => None,
+ Err(origin) => Some(ensure_signed(origin)?),
+ };
+ let expire_at = >::get(cid.clone())
+ .ok_or(Error::::MissingAnnouncement)?;
+ let now = frame_system::Pallet::::block_number();
+ ensure!(maybe_who.is_none() || now >= expire_at, BadOrigin);
+
+ >::remove(cid.clone());
+ >::mutate(|count| count.saturating_dec());
+
+ Self::deposit_event(Event::::AnnouncementRemoved { cid });
+
+ if now >= expire_at {
+ return Ok(Pays::No.into())
+ }
+ Ok(Pays::Yes.into())
+ }
+ }
+
+ impl, I: 'static> Pallet {
+ /// Clean up expired announcements.
+ pub fn cleanup_announcements(now: BlockNumberFor) {
+ if NextAnnouncementExpireAt::::get().map_or(true, |next| next > now) {
+ // no expired announcements expected.
+ return
+ }
+ let mut maybe_next: Option> = None;
+ let mut count = 0;
+ >::translate(|cid, expire_at: BlockNumberFor| {
+ if now >= expire_at {
+ Self::deposit_event(Event::::AnnouncementRemoved { cid });
+ None
+ } else {
+ // determine `NextAnnouncementExpireAt`.
+ maybe_next = match maybe_next {
+ Some(next) if expire_at > next => Some(next),
+ _ => Some(expire_at),
+ };
+ count += 1;
+ // return translated `maybe_expire_at`.
+ Some(expire_at)
+ }
+ });
+ >::set(maybe_next);
+ >::set(count);
+ }
+ }
+
+ #[pallet::hooks]
+ impl, I: 'static> Hooks> for Pallet {
+ /// Clean up expired announcements if there is enough `remaining_weight` weight left.
+ fn on_idle(now: BlockNumberFor, remaining_weight: Weight) -> Weight {
+ let weight = T::WeightInfo::cleanup_announcements(>::get());
+ if remaining_weight.any_lt(weight) {
+ return T::DbWeight::get().reads(1)
+ }
+ Self::cleanup_announcements(now);
+ weight
+ }
+ }
+}
diff --git a/parachains/pallets/collective-content/src/mock.rs b/parachains/pallets/collective-content/src/mock.rs
new file mode 100644
index 00000000000..cd5df25ad67
--- /dev/null
+++ b/parachains/pallets/collective-content/src/mock.rs
@@ -0,0 +1,109 @@
+// Copyright (C) 2023 Parity Technologies (UK) Ltd.
+// 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.
+
+//! Test utilities.
+
+pub use crate as pallet_collective_content;
+use crate::WeightInfo;
+use frame_support::{
+ ord_parameter_types, parameter_types,
+ traits::{ConstU32, ConstU64},
+ weights::Weight,
+};
+use frame_system::EnsureSignedBy;
+use sp_runtime::{traits::IdentityLookup, BuildStorage};
+
+frame_support::construct_runtime!(
+ pub enum Test {
+ System: frame_system,
+ CollectiveContent: pallet_collective_content,
+ }
+);
+
+type AccountId = u64;
+type Block = frame_system::mocking::MockBlock;
+
+ord_parameter_types! {
+ pub const CharterManager: u64 = 1;
+ pub const AnnouncementManager: u64 = 2;
+ pub const SomeAccount: u64 = 3;
+}
+
+parameter_types! {
+ pub const AnnouncementLifetime: u64 = 100;
+}
+
+impl pallet_collective_content::Config for Test {
+ type RuntimeEvent = RuntimeEvent;
+ type AnnouncementLifetime = AnnouncementLifetime;
+ type AnnouncementOrigin = EnsureSignedBy;
+ type CharterOrigin = EnsureSignedBy;
+ type WeightInfo = CCWeightInfo;
+}
+
+impl frame_system::Config for Test {
+ type BaseCallFilter = ();
+ type BlockWeights = ();
+ type BlockLength = ();
+ type DbWeight = ();
+ type RuntimeOrigin = RuntimeOrigin;
+ type RuntimeCall = RuntimeCall;
+ type Nonce = u64;
+ type Block = Block;
+ type Hash = sp_core::H256;
+ type Hashing = sp_runtime::traits::BlakeTwo256;
+ type AccountId = AccountId;
+ type Lookup = IdentityLookup;
+ type RuntimeEvent = RuntimeEvent;
+ type BlockHashCount = ConstU64<250>;
+ type Version = ();
+ type PalletInfo = PalletInfo;
+ type AccountData = ();
+ type OnNewAccount = ();
+ type OnKilledAccount = ();
+ type SystemWeightInfo = ();
+ type SS58Prefix = ();
+ type OnSetCode = ();
+ type MaxConsumers = ConstU32<16>;
+}
+pub struct CCWeightInfo;
+impl WeightInfo for CCWeightInfo {
+ fn set_charter() -> Weight {
+ Weight::zero()
+ }
+ fn announce() -> Weight {
+ Weight::zero()
+ }
+ fn remove_announcement() -> Weight {
+ Weight::zero()
+ }
+ fn cleanup_announcements(_x: u32) -> Weight {
+ // used in tests.
+ Weight::from_parts(10, 0)
+ }
+}
+
+// Build test environment.
+pub fn new_test_ext() -> sp_io::TestExternalities {
+ let t = RuntimeGenesisConfig::default().build_storage().unwrap().into();
+ let mut ext = sp_io::TestExternalities::new(t);
+ ext.execute_with(|| System::set_block_number(1));
+ ext
+}
+
+#[cfg(feature = "runtime-benchmarks")]
+pub fn new_bench_ext() -> sp_io::TestExternalities {
+ frame_system::GenesisConfig::default().build_storage().unwrap().into()
+}
diff --git a/parachains/pallets/collective-content/src/tests.rs b/parachains/pallets/collective-content/src/tests.rs
new file mode 100644
index 00000000000..ed110fa8edf
--- /dev/null
+++ b/parachains/pallets/collective-content/src/tests.rs
@@ -0,0 +1,279 @@
+// Copyright (C) 2023 Parity Technologies (UK) Ltd.
+// 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.
+
+//! Tests.
+
+use super::{mock::*, *};
+use frame_support::{
+ assert_noop, assert_ok, error::BadOrigin, pallet_prelude::Pays, traits::Hooks, weights::Weight,
+};
+
+/// returns CID hash of 68 bytes of given `i`.
+fn create_cid(i: u8) -> OpaqueCid {
+ let cid: OpaqueCid = [i; 68].to_vec().try_into().unwrap();
+ cid
+}
+
+#[test]
+fn set_charter_works() {
+ new_test_ext().execute_with(|| {
+ // wrong origin.
+ let origin = RuntimeOrigin::signed(SomeAccount::get());
+ let cid = create_cid(1);
+ assert_noop!(CollectiveContent::set_charter(origin, cid), BadOrigin);
+
+ // success.
+ let origin = RuntimeOrigin::signed(CharterManager::get());
+ let cid = create_cid(2);
+
+ assert_ok!(CollectiveContent::set_charter(origin, cid.clone()));
+ assert_eq!(CollectiveContent::charter(), Some(cid.clone()));
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::NewCharterSet { cid }));
+
+ // reset. success.
+ let origin = RuntimeOrigin::signed(CharterManager::get());
+ let cid = create_cid(3);
+
+ assert_ok!(CollectiveContent::set_charter(origin, cid.clone()));
+ assert_eq!(CollectiveContent::charter(), Some(cid.clone()));
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::NewCharterSet { cid }));
+ });
+}
+
+#[test]
+fn announce_works() {
+ new_test_ext().execute_with(|| {
+ let now = frame_system::Pallet::::block_number();
+ // wrong origin.
+ let origin = RuntimeOrigin::signed(SomeAccount::get());
+ let cid = create_cid(1);
+
+ assert_noop!(CollectiveContent::announce(origin, cid, None), BadOrigin);
+ assert_eq!(AnnouncementsCount::::get(), 0);
+
+ // success.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(2);
+ let maybe_expire_at = None;
+
+ assert_ok!(CollectiveContent::announce(origin, cid.clone(), maybe_expire_at));
+ assert_eq!(
+ NextAnnouncementExpireAt::::get(),
+ Some(now.saturating_add(AnnouncementLifetime::get()))
+ );
+ assert_eq!(AnnouncementsCount::::get(), 1);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementAnnounced {
+ cid,
+ expire_at: now.saturating_add(AnnouncementLifetime::get()),
+ }));
+
+ // one more. success.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(3);
+ let maybe_expire_at = None;
+
+ assert_ok!(CollectiveContent::announce(origin, cid.clone(), maybe_expire_at));
+ assert_eq!(
+ NextAnnouncementExpireAt::::get(),
+ Some(now.saturating_add(AnnouncementLifetime::get()))
+ );
+ assert_eq!(AnnouncementsCount::::get(), 2);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementAnnounced {
+ cid,
+ expire_at: now.saturating_add(AnnouncementLifetime::get()),
+ }));
+
+ // one more with expire. success.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(4);
+ let maybe_expire_at = DispatchTime::<_>::After(10);
+
+ assert_ok!(CollectiveContent::announce(origin, cid.clone(), Some(maybe_expire_at)));
+ assert_eq!(NextAnnouncementExpireAt::::get(), Some(maybe_expire_at.evaluate(now)));
+ assert_eq!(AnnouncementsCount::::get(), 3);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementAnnounced {
+ cid,
+ expire_at: maybe_expire_at.evaluate(now),
+ }));
+
+ // one more with later expire. success.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(5);
+ let prev_maybe_expire_at = DispatchTime::<_>::After(10);
+ let maybe_expire_at = DispatchTime::<_>::At(now + 20);
+
+ assert_ok!(CollectiveContent::announce(origin, cid.clone(), Some(maybe_expire_at)));
+ assert_eq!(
+ NextAnnouncementExpireAt::::get(),
+ Some(prev_maybe_expire_at.evaluate(now))
+ );
+ assert_eq!(AnnouncementsCount::::get(), 4);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementAnnounced {
+ cid,
+ expire_at: maybe_expire_at.evaluate(now),
+ }));
+
+ // one more with earlier expire. success.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(6);
+ let maybe_expire_at = DispatchTime::<_>::At(now + 5);
+
+ assert_ok!(CollectiveContent::announce(origin, cid.clone(), Some(maybe_expire_at)));
+ assert_eq!(NextAnnouncementExpireAt::::get(), Some(maybe_expire_at.evaluate(now)));
+ assert_eq!(AnnouncementsCount::::get(), 5);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementAnnounced {
+ cid,
+ expire_at: maybe_expire_at.evaluate(now),
+ }));
+ });
+}
+
+#[test]
+fn remove_announcement_works() {
+ new_test_ext().execute_with(|| {
+ assert_eq!(AnnouncementsCount::::get(), 0);
+ // wrong origin.
+ let origin = RuntimeOrigin::signed(CharterManager::get());
+ let cid = create_cid(8);
+
+ assert_noop!(
+ CollectiveContent::remove_announcement(origin, cid),
+ Error::::MissingAnnouncement
+ );
+
+ // missing announcement.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(9);
+
+ assert_noop!(
+ CollectiveContent::remove_announcement(origin, cid),
+ Error::::MissingAnnouncement
+ );
+
+ // wrong origin. announcement not yet expired.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(10);
+ assert_ok!(CollectiveContent::announce(origin.clone(), cid.clone(), None));
+ assert!(>::contains_key(cid.clone()));
+ assert_eq!(AnnouncementsCount::::get(), 1);
+
+ let origin = RuntimeOrigin::signed(SomeAccount::get());
+ assert_noop!(CollectiveContent::remove_announcement(origin, cid.clone()), BadOrigin);
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ assert_ok!(CollectiveContent::remove_announcement(origin, cid));
+
+ // success.
+
+ // remove first announcement and assert.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(11);
+ assert_ok!(CollectiveContent::announce(origin.clone(), cid.clone(), None));
+ assert!(>::contains_key(cid.clone()));
+ assert_eq!(AnnouncementsCount::::get(), 1);
+
+ let info = CollectiveContent::remove_announcement(origin.clone(), cid.clone()).unwrap();
+ assert_eq!(info.pays_fee, Pays::Yes);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementRemoved {
+ cid: cid.clone(),
+ }));
+ assert_noop!(
+ CollectiveContent::remove_announcement(origin, cid.clone()),
+ Error::::MissingAnnouncement
+ );
+ assert!(!>::contains_key(cid));
+ assert_eq!(AnnouncementsCount::::get(), 0);
+
+ // remove expired announcement and assert.
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ let cid = create_cid(12);
+ assert_ok!(CollectiveContent::announce(
+ origin.clone(),
+ cid.clone(),
+ Some(DispatchTime::<_>::At(10))
+ ));
+ assert!(>::contains_key(cid.clone()));
+ assert_eq!(AnnouncementsCount::::get(), 1);
+
+ System::set_block_number(11);
+ let origin = RuntimeOrigin::signed(SomeAccount::get());
+ let info = CollectiveContent::remove_announcement(origin.clone(), cid.clone()).unwrap();
+ assert_eq!(info.pays_fee, Pays::No);
+ System::assert_last_event(RuntimeEvent::CollectiveContent(Event::AnnouncementRemoved {
+ cid: cid.clone(),
+ }));
+ assert_eq!(AnnouncementsCount::::get(), 0);
+ assert_noop!(
+ CollectiveContent::remove_announcement(origin, cid),
+ Error::::MissingAnnouncement
+ );
+ });
+}
+
+#[test]
+fn clean_announcements_works() {
+ new_test_ext().execute_with(|| {
+ System::set_block_number(1);
+ let cleanup_block = 5;
+
+ let announcements: [(_, _); 8] = [
+ (create_cid(1), Some(cleanup_block + 5)),
+ // expired
+ (create_cid(2), Some(cleanup_block - 1)),
+ (create_cid(3), Some(cleanup_block + 2)),
+ // expired
+ (create_cid(4), Some(cleanup_block)),
+ (create_cid(5), None),
+ // expired
+ (create_cid(6), Some(cleanup_block - 2)),
+ (create_cid(7), Some(cleanup_block + 3)),
+ (create_cid(8), Some(cleanup_block + 4)),
+ ];
+ let origin = RuntimeOrigin::signed(AnnouncementManager::get());
+ for (cid, maybe_expire_at) in announcements.into_iter() {
+ assert_ok!(CollectiveContent::announce(
+ origin.clone(),
+ cid,
+ maybe_expire_at.map_or(None, |expire_at| Some(DispatchTime::<_>::At(expire_at)))
+ ));
+ }
+ assert_eq!(>::iter_keys().count(), 8);
+ assert_eq!(AnnouncementsCount::::get(), 8);
+ System::set_block_number(cleanup_block);
+
+ // invoke `clean_announcements` through the on_idle hook.
+ assert_eq!(
+ >::on_idle(cleanup_block, Weight::from_parts(20, 0)),
+ Weight::from_parts(10, 0)
+ );
+ assert_eq!(>::iter_keys().count(), 5);
+ assert_eq!(AnnouncementsCount::::get(), 5);
+ assert_eq!(>::get(), Some(cleanup_block + 2));
+ System::assert_has_event(RuntimeEvent::CollectiveContent(Event::AnnouncementRemoved {
+ cid: create_cid(2),
+ }));
+ System::assert_has_event(RuntimeEvent::CollectiveContent(Event::AnnouncementRemoved {
+ cid: create_cid(4),
+ }));
+ System::assert_has_event(RuntimeEvent::CollectiveContent(Event::AnnouncementRemoved {
+ cid: create_cid(6),
+ }));
+
+ // on_idle. not enough weight.
+ assert_eq!(
+ >::on_idle(cleanup_block, Weight::from_parts(9, 0)),
+ Weight::from_parts(0, 0)
+ );
+ });
+}
diff --git a/parachains/pallets/collective-content/src/weights.rs b/parachains/pallets/collective-content/src/weights.rs
new file mode 100644
index 00000000000..5715fe0924d
--- /dev/null
+++ b/parachains/pallets/collective-content/src/weights.rs
@@ -0,0 +1,46 @@
+// Copyright (C) 2023 Parity Technologies (UK) Ltd.
+// 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.
+
+//! The pallet weight info trait and its unit implementation.
+
+use frame_support::weights::Weight;
+
+/// Weights information needed for the pallet.
+pub trait WeightInfo {
+ /// Returns the weight of the set_charter extrinsic.
+ fn set_charter() -> Weight;
+ /// Returns the weight of the announce extrinsic.
+ fn announce() -> Weight;
+ /// Returns the weight of the remove_announcement extrinsic.
+ fn remove_announcement() -> Weight;
+ /// Returns the weight of the action.
+ fn cleanup_announcements(x: u32) -> Weight;
+}
+
+/// Unit implementation of the [WeightInfo].
+impl WeightInfo for () {
+ fn set_charter() -> Weight {
+ Weight::zero()
+ }
+ fn announce() -> Weight {
+ Weight::zero()
+ }
+ fn remove_announcement() -> Weight {
+ Weight::zero()
+ }
+ fn cleanup_announcements(_x: u32) -> Weight {
+ Weight::zero()
+ }
+}
diff --git a/parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs
index 3e40afb83f9..3957ddf3c5d 100644
--- a/parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs
+++ b/parachains/runtimes/assets/asset-hub-polkadot/src/xcm_config.rs
@@ -186,6 +186,9 @@ match_types! {
pub type FellowshipSalaryPallet: impl Contains = {
MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(64)) }
};
+ pub type AmbassadorSalaryPallet: impl Contains = {
+ MultiLocation { parents: 1, interior: X2(Parachain(1001), PalletInstance(74)) }
+ };
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
@@ -372,6 +375,7 @@ pub type Barrier = TrailingSetTopicAsId<
ParentOrParentsPlurality,
FellowsPlurality,
FellowshipSalaryPallet,
+ AmbassadorSalaryPallet,
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom,
diff --git a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml
index a23db7d4955..a8a66241f56 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml
+++ b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml
@@ -74,6 +74,7 @@ cumulus-primitives-utility = { path = "../../../../primitives/utility", default-
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
+pallet-collective-content = { path = "../../../pallets/collective-content", default-features = false }
[build-dependencies]
substrate-wasm-builder = { git = "/~https://github.com/paritytech/substrate", branch = "master", optional = true }
@@ -110,6 +111,7 @@ runtime-benchmarks = [
"pallet-ranked-collective/runtime-benchmarks",
"pallet-core-fellowship/runtime-benchmarks",
"pallet-salary/runtime-benchmarks",
+ "pallet-collective-content/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
@@ -140,6 +142,7 @@ try-runtime = [
"pallet-ranked-collective/try-runtime",
"pallet-core-fellowship/try-runtime",
"pallet-salary/try-runtime",
+ "pallet-collective-content/try-runtime",
]
std = [
"codec/std",
@@ -197,4 +200,5 @@ std = [
"substrate-wasm-builder",
"pallet-core-fellowship/std",
"pallet-salary/std",
+ "pallet-collective-content/std",
]
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/mod.rs b/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/mod.rs
new file mode 100644
index 00000000000..4447a7d0451
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/mod.rs
@@ -0,0 +1,252 @@
+// Copyright (C) 2022 Parity Technologies (UK) Ltd.
+// 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.
+
+//! The Ambassador Program.
+//!
+//! The module defines the following on-chain functionality of the Ambassador Program:
+//!
+//! - Managed set of program members, where every member has a [rank](ranks)
+//! (via [AmbassadorCollective](pallet_ranked_collective)).
+//! - Referendum functionality for the program members to propose, vote on, and execute
+//! proposals on behalf of the members of a certain [rank](Origin)
+//! (via [AmbassadorReferenda](pallet_referenda)).
+//! - Managed content (charter, announcements) (via [pallet_collective_content]).
+//! - Promotion and demotion periods, register of members' activity, and rank based salaries
+//! (via [AmbassadorCore](pallet_core_fellowship)).
+//! - Members' salaries (via [AmbassadorSalary](pallet_salary), requiring a member to be
+//! imported or inducted into [AmbassadorCore](pallet_core_fellowship)).
+
+pub mod origins;
+mod tracks;
+
+use super::*;
+use crate::xcm_config::{DotAssetHub, FellowshipAdminBodyId};
+use frame_support::traits::{EitherOf, MapSuccess, TryMapSuccess};
+pub use origins::pallet_origins as pallet_ambassador_origins;
+use origins::pallet_origins::{
+ EnsureAmbassadorsVoice, EnsureAmbassadorsVoiceFrom, EnsureHeadAmbassadorsVoice, Origin,
+};
+use sp_core::ConstU128;
+use sp_runtime::traits::{CheckedReduceBy, ConstU16, ConvertToValue, Replace};
+use xcm::prelude::*;
+use xcm_builder::{AliasesIntoAccountId32, PayOverXcm};
+
+/// The Ambassador Program's member ranks.
+pub mod ranks {
+ use pallet_ranked_collective::Rank;
+
+ #[allow(dead_code)]
+ pub const CANDIDATE: Rank = 0;
+ pub const AMBASSADOR_TIER_1: Rank = 1;
+ pub const AMBASSADOR_TIER_2: Rank = 2;
+ pub const SENIOR_AMBASSADOR_TIER_3: Rank = 3;
+ pub const SENIOR_AMBASSADOR_TIER_4: Rank = 4;
+ pub const HEAD_AMBASSADOR_TIER_5: Rank = 5;
+ pub const HEAD_AMBASSADOR_TIER_6: Rank = 6;
+ pub const HEAD_AMBASSADOR_TIER_7: Rank = 7;
+ pub const MASTER_AMBASSADOR_TIER_8: Rank = 8;
+ pub const MASTER_AMBASSADOR_TIER_9: Rank = 9;
+}
+
+impl pallet_ambassador_origins::Config for Runtime {}
+
+pub type AmbassadorCollectiveInstance = pallet_ranked_collective::Instance2;
+
+/// Demotion is by any of:
+/// - Root can promote arbitrarily.
+/// - the FellowshipAdmin origin (i.e. token holder referendum);
+/// - a senior members vote by the rank two above the current rank.
+pub type DemoteOrigin = EitherOf<
+ frame_system::EnsureRootWithSuccess>,
+ EitherOf<
+ MapSuccess<
+ EnsureXcm>,
+ Replace>,
+ >,
+ TryMapSuccess<
+ EnsureAmbassadorsVoiceFrom>,
+ CheckedReduceBy>,
+ >,
+ >,
+>;
+
+/// Promotion and approval (rank-retention) is by any of:
+/// - Root can promote arbitrarily.
+/// - the FellowshipAdmin origin (i.e. token holder referendum);
+/// - a senior members vote by the rank two above the new/current rank.
+/// - a member of rank `5` or above can add a candidate (rank `0`).
+pub type PromoteOrigin = EitherOf<
+ DemoteOrigin,
+ TryMapSuccess<
+ pallet_ranked_collective::EnsureMember<
+ Runtime,
+ AmbassadorCollectiveInstance,
+ { ranks::HEAD_AMBASSADOR_TIER_5 },
+ >,
+ Replace>,
+ >,
+>;
+
+impl pallet_ranked_collective::Config for Runtime {
+ type WeightInfo = weights::pallet_ranked_collective_ambassador_collective::WeightInfo;
+ type RuntimeEvent = RuntimeEvent;
+ type PromoteOrigin = PromoteOrigin;
+ type DemoteOrigin = DemoteOrigin;
+ type Polls = AmbassadorReferenda;
+ type MinRankOfClass = sp_runtime::traits::Identity;
+ type VoteWeight = pallet_ranked_collective::Linear;
+}
+
+parameter_types! {
+ pub const AlarmInterval: BlockNumber = 1;
+ pub const SubmissionDeposit: Balance = 0;
+ pub const UndecidingTimeout: BlockNumber = 7 * DAYS;
+ // The Ambassador Referenda pallet account, used as a temporarily place to deposit a slashed imbalance before teleport to the treasury.
+ pub AmbassadorPalletAccount: AccountId = constants::account::AMBASSADOR_REFERENDA_PALLET_ID.into_account_truncating();
+}
+
+pub type AmbassadorReferendaInstance = pallet_referenda::Instance2;
+
+impl pallet_referenda::Config for Runtime {
+ type WeightInfo = weights::pallet_referenda_ambassador_referenda::WeightInfo;
+ type RuntimeCall = RuntimeCall;
+ type RuntimeEvent = RuntimeEvent;
+ type Scheduler = Scheduler;
+ type Currency = Balances;
+ // A proposal can be submitted by a member of the Ambassador Program of
+ // [ranks::SENIOR_AMBASSADOR_TIER_3] rank or higher.
+ type SubmitOrigin = pallet_ranked_collective::EnsureMember<
+ Runtime,
+ AmbassadorCollectiveInstance,
+ { ranks::SENIOR_AMBASSADOR_TIER_3 },
+ >;
+ type CancelOrigin = EitherOf, EnsureHeadAmbassadorsVoice>;
+ type KillOrigin = EitherOf, EnsureHeadAmbassadorsVoice>;
+ type Slash = ToParentTreasury;
+ type Votes = pallet_ranked_collective::Votes;
+ type Tally = pallet_ranked_collective::TallyOf;
+ type SubmissionDeposit = SubmissionDeposit;
+ type MaxQueued = ConstU32<20>;
+ type UndecidingTimeout = UndecidingTimeout;
+ type AlarmInterval = AlarmInterval;
+ type Tracks = tracks::TracksInfo;
+ type Preimages = Preimage;
+}
+
+parameter_types! {
+ pub const AnnouncementLifetime: BlockNumber = 180 * DAYS;
+}
+
+pub type AmbassadorContentInstance = pallet_collective_content::Instance1;
+
+impl pallet_collective_content::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type CharterOrigin = EitherOf, EnsureHeadAmbassadorsVoice>;
+ type AnnouncementLifetime = AnnouncementLifetime;
+ // An announcement can be submitted by a Senior Ambassador member or an ambassador plurality
+ // voice taken via referendum.
+ type AnnouncementOrigin = EitherOfDiverse<
+ pallet_ranked_collective::EnsureMember<
+ Runtime,
+ AmbassadorCollectiveInstance,
+ { ranks::SENIOR_AMBASSADOR_TIER_3 },
+ >,
+ EnsureAmbassadorsVoice,
+ >;
+ type WeightInfo = weights::pallet_collective_content::WeightInfo;
+}
+
+pub type AmbassadorCoreInstance = pallet_core_fellowship::Instance2;
+
+impl pallet_core_fellowship::Config for Runtime {
+ type WeightInfo = weights::pallet_core_fellowship_ambassador_core::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 Head Ambassadors.
+ type ParamsOrigin = EitherOfDiverse<
+ EnsureXcm>,
+ EnsureHeadAmbassadorsVoice,
+ >;
+ // Induction (creating a candidate) is by any of:
+ // - Root;
+ // - the FellowshipAdmin origin (i.e. token holder referendum);
+ // - a single Head Ambassador;
+ // - a vote among all senior members.
+ type InductOrigin = EitherOfDiverse<
+ EnsureXcm>,
+ EitherOfDiverse<
+ pallet_ranked_collective::EnsureMember<
+ Runtime,
+ AmbassadorCollectiveInstance,
+ { ranks::HEAD_AMBASSADOR_TIER_5 },
+ >,
+ EnsureAmbassadorsVoiceFrom>,
+ >,
+ >;
+ type ApproveOrigin = PromoteOrigin;
+ type PromoteOrigin = PromoteOrigin;
+ type EvidenceSize = ConstU32<65536>;
+}
+
+pub type AmbassadorSalaryInstance = pallet_salary::Instance2;
+
+parameter_types! {
+ // The interior location on AssetHub for the paying account. This is the Ambassador Salary
+ // pallet instance (which sits at index 74). This sovereign account will need funding.
+ pub AmbassadorSalaryLocation: InteriorMultiLocation = PalletInstance(74).into();
+}
+
+/// [`PayOverXcm`] setup to pay the Ambassador salary on the AssetHub in DOT.
+pub type AmbassadorSalaryPaymaster = PayOverXcm<
+ AmbassadorSalaryLocation,
+ crate::xcm_config::XcmRouter,
+ crate::PolkadotXcm,
+ ConstU32<{ 6 * HOURS }>,
+ AccountId,
+ (),
+ ConvertToValue,
+ AliasesIntoAccountId32<(), AccountId>,
+>;
+
+impl pallet_salary::Config for Runtime {
+ type WeightInfo = weights::pallet_salary_ambassador_salary::WeightInfo;
+ type RuntimeEvent = RuntimeEvent;
+
+ #[cfg(not(feature = "runtime-benchmarks"))]
+ type Paymaster = AmbassadorSalaryPaymaster;
+ #[cfg(feature = "runtime-benchmarks")]
+ type Paymaster = crate::impls::benchmarks::PayWithEnsure<
+ AmbassadorSalaryPaymaster,
+ crate::impls::benchmarks::OpenHrmpChannel>,
+ >;
+ 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<{ 10_000 * DOLLARS }>;
+}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/origins.rs b/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/origins.rs
new file mode 100644
index 00000000000..3ce8a6b9e5d
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/origins.rs
@@ -0,0 +1,135 @@
+// Copyright (C) 2022 Parity Technologies (UK) Ltd.
+// 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.
+
+//! The Ambassador Program's origins.
+
+#[frame_support::pallet]
+pub mod pallet_origins {
+ use crate::ambassador::ranks;
+ use frame_support::pallet_prelude::*;
+ use pallet_ranked_collective::Rank;
+
+ #[pallet::pallet]
+ pub struct Pallet(PhantomData);
+
+ /// The pallet configuration trait.
+ #[pallet::config]
+ pub trait Config: frame_system::Config {}
+
+ #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)]
+ #[pallet::origin]
+ pub enum Origin {
+ /// Plurality voice of the [ranks::AMBASSADOR_TIER_1] members or above given via
+ /// referendum.
+ Ambassadors,
+ /// Plurality voice of the [ranks::AMBASSADOR_TIER_2] members or above given via
+ /// referendum.
+ AmbassadorsTier2,
+ /// Plurality voice of the [ranks::SENIOR_AMBASSADOR_TIER_3] members or above given via
+ /// referendum.
+ SeniorAmbassadors,
+ /// Plurality voice of the [ranks::SENIOR_AMBASSADOR_TIER_4] members or above given via
+ /// referendum.
+ SeniorAmbassadorsTier4,
+ /// Plurality voice of the [ranks::HEAD_AMBASSADOR_TIER_5] members or above given via
+ /// referendum.
+ HeadAmbassadors,
+ /// Plurality voice of the [ranks::HEAD_AMBASSADOR_TIER_6] members or above given via
+ /// referendum.
+ HeadAmbassadorsTier6,
+ /// Plurality voice of the [ranks::HEAD_AMBASSADOR_TIER_7] members or above given via
+ /// referendum.
+ HeadAmbassadorsTier7,
+ /// Plurality voice of the [ranks::MASTER_AMBASSADOR_TIER_8] members or above given via
+ /// referendum.
+ MasterAmbassadors,
+ /// Plurality voice of the [ranks::MASTER_AMBASSADOR_TIER_9] members or above given via
+ /// referendum.
+ MasterAmbassadorsTier9,
+ }
+
+ impl Origin {
+ /// Returns the rank that the origin `self` speaks for, or `None` if it doesn't speak for
+ /// any.
+ pub fn as_voice(&self) -> Option {
+ Some(match &self {
+ Origin::Ambassadors => ranks::AMBASSADOR_TIER_1,
+ Origin::AmbassadorsTier2 => ranks::AMBASSADOR_TIER_2,
+ Origin::SeniorAmbassadors => ranks::SENIOR_AMBASSADOR_TIER_3,
+ Origin::SeniorAmbassadorsTier4 => ranks::SENIOR_AMBASSADOR_TIER_4,
+ Origin::HeadAmbassadors => ranks::HEAD_AMBASSADOR_TIER_5,
+ Origin::HeadAmbassadorsTier6 => ranks::HEAD_AMBASSADOR_TIER_6,
+ Origin::HeadAmbassadorsTier7 => ranks::HEAD_AMBASSADOR_TIER_7,
+ Origin::MasterAmbassadors => ranks::MASTER_AMBASSADOR_TIER_8,
+ Origin::MasterAmbassadorsTier9 => ranks::MASTER_AMBASSADOR_TIER_9,
+ })
+ }
+ }
+
+ /// Implementation of the [EnsureOrigin] trait for the [Origin::HeadAmbassadors] origin.
+ pub struct EnsureHeadAmbassadorsVoice;
+ impl> + From> EnsureOrigin for EnsureHeadAmbassadorsVoice {
+ type Success = ();
+ fn try_origin(o: O) -> Result {
+ o.into().and_then(|o| match o {
+ Origin::HeadAmbassadors => Ok(()),
+ r => Err(O::from(r)),
+ })
+ }
+
+ #[cfg(feature = "runtime-benchmarks")]
+ fn try_successful_origin() -> Result {
+ Ok(O::from(Origin::HeadAmbassadors))
+ }
+ }
+
+ /// Implementation of the [EnsureOrigin] trait for the plurality voice [Origin]s
+ /// from a given rank `R` with the success result of the corresponding [Rank].
+ pub struct EnsureAmbassadorsVoiceFrom(PhantomData);
+ impl, O: Into> + From> EnsureOrigin
+ for EnsureAmbassadorsVoiceFrom
+ {
+ type Success = Rank;
+ fn try_origin(o: O) -> Result {
+ o.into().and_then(|o| match Origin::as_voice(&o) {
+ Some(r) if r >= R::get() => Ok(r),
+ _ => Err(O::from(o)),
+ })
+ }
+
+ #[cfg(feature = "runtime-benchmarks")]
+ fn try_successful_origin() -> Result {
+ ranks::MASTER_AMBASSADOR_TIER_9
+ .ge(&R::get())
+ .then(|| O::from(Origin::MasterAmbassadorsTier9))
+ .ok_or(())
+ }
+ }
+
+ /// Implementation of the [EnsureOrigin] trait for the plurality voice [Origin]s with the
+ /// success result of the corresponding [Rank].
+ pub struct EnsureAmbassadorsVoice;
+ impl> + From> EnsureOrigin for EnsureAmbassadorsVoice {
+ type Success = Rank;
+ fn try_origin(o: O) -> Result {
+ o.into().and_then(|o| Origin::as_voice(&o).ok_or(O::from(o)))
+ }
+
+ #[cfg(feature = "runtime-benchmarks")]
+ fn try_successful_origin() -> Result {
+ Ok(O::from(Origin::MasterAmbassadorsTier9))
+ }
+ }
+}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/tracks.rs b/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/tracks.rs
new file mode 100644
index 00000000000..3906377d18c
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/ambassador/tracks.rs
@@ -0,0 +1,282 @@
+// Copyright (C) 2022 Parity Technologies (UK) Ltd.
+// 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.
+
+//! The Ambassador Program's referenda voting tracks.
+
+use super::Origin;
+use crate::{constants::currency::DOLLARS, Balance, BlockNumber, RuntimeOrigin, DAYS, HOURS};
+use sp_runtime::Perbill;
+
+/// Referendum `TrackId` type.
+pub type TrackId = u16;
+
+/// Referendum track IDs.
+pub mod constants {
+ use super::TrackId;
+
+ pub const AMBASSADOR_TIER_1: TrackId = 1;
+ pub const AMBASSADOR_TIER_2: TrackId = 2;
+ pub const SENIOR_AMBASSADOR_TIER_3: TrackId = 3;
+ pub const SENIOR_AMBASSADOR_TIER_4: TrackId = 4;
+ pub const HEAD_AMBASSADOR_TIER_5: TrackId = 5;
+ pub const HEAD_AMBASSADOR_TIER_6: TrackId = 6;
+ pub const HEAD_AMBASSADOR_TIER_7: TrackId = 7;
+ pub const MASTER_AMBASSADOR_TIER_8: TrackId = 8;
+ pub const MASTER_AMBASSADOR_TIER_9: TrackId = 9;
+}
+
+/// The type implementing the [`pallet_referenda::TracksInfo`] trait for referenda pallet.
+pub struct TracksInfo;
+
+/// Information on the voting tracks.
+impl pallet_referenda::TracksInfo for TracksInfo {
+ type Id = TrackId;
+
+ type RuntimeOrigin = ::PalletsOrigin;
+
+ /// Return the array of available tracks and their information.
+ fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] {
+ static DATA: [(TrackId, pallet_referenda::TrackInfo); 9] = [
+ (
+ constants::AMBASSADOR_TIER_1,
+ pallet_referenda::TrackInfo {
+ name: "ambassador tier 1",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::AMBASSADOR_TIER_2,
+ pallet_referenda::TrackInfo {
+ name: "ambassador tier 2",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::SENIOR_AMBASSADOR_TIER_3,
+ pallet_referenda::TrackInfo {
+ name: "senior ambassador tier 3",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::SENIOR_AMBASSADOR_TIER_4,
+ pallet_referenda::TrackInfo {
+ name: "senior ambassador tier 4",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::HEAD_AMBASSADOR_TIER_5,
+ pallet_referenda::TrackInfo {
+ name: "head ambassador tier 5",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::HEAD_AMBASSADOR_TIER_6,
+ pallet_referenda::TrackInfo {
+ name: "head ambassador tier 6",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::HEAD_AMBASSADOR_TIER_7,
+ pallet_referenda::TrackInfo {
+ name: "head ambassador tier 7",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::MASTER_AMBASSADOR_TIER_8,
+ pallet_referenda::TrackInfo {
+ name: "master ambassador tier 8",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ (
+ constants::MASTER_AMBASSADOR_TIER_9,
+ pallet_referenda::TrackInfo {
+ name: "master ambassador tier 9",
+ max_deciding: 10,
+ decision_deposit: 5 * DOLLARS,
+ prepare_period: 24 * HOURS,
+ decision_period: 7 * DAYS,
+ confirm_period: 24 * HOURS,
+ min_enactment_period: 1 * HOURS,
+ 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(10),
+ ceil: Perbill::from_percent(50),
+ },
+ },
+ ),
+ ];
+ &DATA[..]
+ }
+
+ /// Determine the voting track for the given `origin`.
+ fn track_for(id: &Self::RuntimeOrigin) -> Result {
+ #[cfg(feature = "runtime-benchmarks")]
+ {
+ // For benchmarks, we enable a root origin.
+ // It is important that this is not available in production!
+ let root: Self::RuntimeOrigin = frame_system::RawOrigin::Root.into();
+ if &root == id {
+ return Ok(constants::MASTER_AMBASSADOR_TIER_9)
+ }
+ }
+
+ match Origin::try_from(id.clone()) {
+ Ok(Origin::Ambassadors) => Ok(constants::AMBASSADOR_TIER_1),
+ Ok(Origin::AmbassadorsTier2) => Ok(constants::AMBASSADOR_TIER_2),
+ Ok(Origin::SeniorAmbassadors) => Ok(constants::SENIOR_AMBASSADOR_TIER_3),
+ Ok(Origin::SeniorAmbassadorsTier4) => Ok(constants::SENIOR_AMBASSADOR_TIER_4),
+ Ok(Origin::HeadAmbassadors) => Ok(constants::HEAD_AMBASSADOR_TIER_5),
+ Ok(Origin::HeadAmbassadorsTier6) => Ok(constants::HEAD_AMBASSADOR_TIER_6),
+ Ok(Origin::HeadAmbassadorsTier7) => Ok(constants::HEAD_AMBASSADOR_TIER_7),
+ Ok(Origin::MasterAmbassadors) => Ok(constants::MASTER_AMBASSADOR_TIER_8),
+ Ok(Origin::MasterAmbassadorsTier9) => Ok(constants::MASTER_AMBASSADOR_TIER_9),
+ _ => Err(()),
+ }
+ }
+}
+
+// implements [`frame_support::traits::Get`] for [`TracksInfo`]
+pallet_referenda::impl_tracksinfo_get!(TracksInfo, Balance, BlockNumber);
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/constants.rs b/parachains/runtimes/collectives/collectives-polkadot/src/constants.rs
index ac516447c74..4aeb53dbe9a 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/constants.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/constants.rs
@@ -26,6 +26,10 @@ pub mod account {
/// It is used as a temporarily place to deposit a slashed imbalance
/// before the teleport to the Treasury.
pub const REFERENDA_PALLET_ID: PalletId = PalletId(*b"py/refer");
+ /// Ambassador Referenda pallet ID.
+ /// It is used as a temporarily place to deposit a slashed imbalance
+ /// before the teleport to the Treasury.
+ pub const AMBASSADOR_REFERENDA_PALLET_ID: PalletId = PalletId(*b"py/amref");
}
pub mod currency {
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs
index 489b868eff3..df0d44da295 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs
@@ -20,11 +20,13 @@ pub(crate) mod migration;
mod origins;
mod tracks;
use crate::{
- constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, FellowshipReferenda,
- GovernanceLocation, PolkadotTreasuryAccount, Preimage, Runtime, RuntimeCall, RuntimeEvent,
- RuntimeOrigin, Scheduler, DAYS,
+ constants,
+ impls::ToParentTreasury,
+ weights,
+ xcm_config::{FellowshipAdminBodyId, UsdtAssetHub},
+ AccountId, Balance, Balances, FellowshipReferenda, GovernanceLocation, PolkadotTreasuryAccount,
+ Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, Scheduler, DAYS,
};
-use cumulus_primitives_core::Junction::GeneralIndex;
use frame_support::{
parameter_types,
traits::{EitherOf, EitherOfDiverse, MapSuccess, OriginTrait, TryWithMorphedArg},
@@ -36,11 +38,10 @@ pub use origins::{
};
use pallet_ranked_collective::EnsureOfRank;
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
-use polkadot_runtime_constants::{time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX};
+use polkadot_runtime_constants::time::HOURS;
use sp_core::{ConstU128, ConstU32};
use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace, TakeFirst};
-use xcm::latest::BodyId;
-use xcm_builder::{AliasesIntoAccountId32, LocatableAssetId, PayOverXcm};
+use xcm_builder::{AliasesIntoAccountId32, PayOverXcm};
#[cfg(feature = "runtime-benchmarks")]
use crate::impls::benchmarks::{OpenHrmpChannel, PayWithEnsure};
@@ -63,7 +64,6 @@ pub mod ranks {
parameter_types! {
// Referenda pallet account, used to temporarily deposit slashed imbalance before teleporting.
pub ReferendaPalletAccount: AccountId = constants::account::REFERENDA_PALLET_ID.into_account_truncating();
- pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX);
}
impl pallet_fellowship_origins::Config for Runtime {}
@@ -71,7 +71,7 @@ impl pallet_fellowship_origins::Config for Runtime {}
pub type FellowshipReferendaInstance = pallet_referenda::Instance1;
impl pallet_referenda::Config for Runtime {
- type WeightInfo = weights::pallet_referenda::WeightInfo;
+ type WeightInfo = weights::pallet_referenda_fellowship_referenda::WeightInfo;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
@@ -106,7 +106,7 @@ impl pallet_referenda::Config for Runtime {
pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1;
impl pallet_ranked_collective::Config for Runtime {
- type WeightInfo = weights::pallet_ranked_collective::WeightInfo;
+ type WeightInfo = weights::pallet_ranked_collective_fellowship_collective::WeightInfo;
type RuntimeEvent = RuntimeEvent;
#[cfg(not(feature = "runtime-benchmarks"))]
@@ -138,7 +138,7 @@ impl pallet_ranked_collective::Config for Runtime
pub type FellowshipCoreInstance = pallet_core_fellowship::Instance1;
impl pallet_core_fellowship::Config for Runtime {
- type WeightInfo = weights::pallet_core_fellowship::WeightInfo;
+ type WeightInfo = weights::pallet_core_fellowship_fellowship_core::WeightInfo;
type RuntimeEvent = RuntimeEvent;
type Members = pallet_ranked_collective::Pallet;
type Balance = Balance;
@@ -196,12 +196,6 @@ 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();
@@ -217,12 +211,12 @@ pub type FellowshipSalaryPaymaster = PayOverXcm<
ConstU32<{ 6 * HOURS }>,
AccountId,
(),
- ConvertToValue,
+ ConvertToValue,
AliasesIntoAccountId32<(), AccountId>,
>;
impl pallet_salary::Config for Runtime {
- type WeightInfo = weights::pallet_salary::WeightInfo;
+ type WeightInfo = weights::pallet_salary_fellowship_salary::WeightInfo;
type RuntimeEvent = RuntimeEvent;
#[cfg(not(feature = "runtime-benchmarks"))]
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs
index 74c19cd9db3..6274fa4d242 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs
@@ -36,12 +36,14 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
+pub mod ambassador;
pub mod constants;
pub mod impls;
mod weights;
pub mod xcm_config;
// Fellowship configurations.
pub mod fellowship;
+pub use ambassador::pallet_ambassador_origins;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use fellowship::{
@@ -289,6 +291,8 @@ pub enum ProxyType {
Alliance,
/// Fellowship proxy. Allows calls related to the Fellowship.
Fellowship,
+ /// Ambassador proxy. Allows calls related to the Ambassador Program.
+ Ambassador,
}
impl Default for ProxyType {
fn default() -> Self {
@@ -326,6 +330,14 @@ impl InstanceFilter for ProxyType {
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. }
),
+ ProxyType::Ambassador => matches!(
+ c,
+ RuntimeCall::AmbassadorCollective { .. } |
+ RuntimeCall::AmbassadorReferenda { .. } |
+ RuntimeCall::AmbassadorContent { .. } |
+ RuntimeCall::Utility { .. } |
+ RuntimeCall::Multisig { .. }
+ ),
}
}
fn is_superset(&self, o: &Self) -> bool {
@@ -606,6 +618,14 @@ construct_runtime!(
FellowshipCore: pallet_core_fellowship::::{Pallet, Call, Storage, Event} = 63,
// pub type FellowshipSalaryInstance = pallet_salary::Instance1;
FellowshipSalary: pallet_salary::::{Pallet, Call, Storage, Event} = 64,
+
+ // Ambassador Program.
+ AmbassadorCollective: pallet_ranked_collective::::{Pallet, Call, Storage, Event} = 70,
+ AmbassadorReferenda: pallet_referenda::::{Pallet, Call, Storage, Event} = 71,
+ AmbassadorOrigins: pallet_ambassador_origins::{Origin} = 72,
+ AmbassadorCore: pallet_core_fellowship::::{Pallet, Call, Storage, Event} = 73,
+ AmbassadorSalary: pallet_salary::::{Pallet, Call, Storage, Event} = 74,
+ AmbassadorContent: pallet_collective_content::::{Pallet, Call, Storage, Event} = 75,
}
);
@@ -674,6 +694,11 @@ mod benches {
[pallet_ranked_collective, FellowshipCollective]
[pallet_core_fellowship, FellowshipCore]
[pallet_salary, FellowshipSalary]
+ [pallet_referenda, AmbassadorReferenda]
+ [pallet_ranked_collective, AmbassadorCollective]
+ [pallet_collective_content, AmbassadorContent]
+ [pallet_core_fellowship, AmbassadorCore]
+ [pallet_salary, AmbassadorSalary]
);
}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs
index b0e49549914..bd366095e9d 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs
@@ -6,13 +6,18 @@ 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_collective_content;
+pub mod pallet_core_fellowship_ambassador_core;
+pub mod pallet_core_fellowship_fellowship_core;
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_ranked_collective_ambassador_collective;
+pub mod pallet_ranked_collective_fellowship_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_scheduler;
pub mod pallet_session;
pub mod pallet_timestamp;
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective_content.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective_content.rs
new file mode 100644
index 00000000000..9cbf529ca72
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collective_content.rs
@@ -0,0 +1,101 @@
+
+//! Autogenerated weights for `pallet_collective_content`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-08-18, STEPS: `10`, REPEAT: `3`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+
+// Executed Command:
+// ./target/debug/polkadot-parachain
+// benchmark
+// pallet
+// --chain=collectives-polkadot-dev
+// --steps=10
+// --repeat=3
+// --pallet=pallet_collective_content
+// --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_collective_content`.
+pub struct WeightInfo(PhantomData);
+impl pallet_collective_content::WeightInfo for WeightInfo {
+ /// Storage: `AmbassadorContent::Charter` (r:0 w:1)
+ /// Proof: `AmbassadorContent::Charter` (`max_values`: Some(1), `max_size`: Some(70), added: 565, mode: `MaxEncodedLen`)
+ fn set_charter() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 99_000_000 picoseconds.
+ Weight::from_parts(99_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 0))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::AnnouncementsCount` (r:1 w:1)
+ /// Proof: `AmbassadorContent::AnnouncementsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::NextAnnouncementExpireAt` (r:1 w:1)
+ /// Proof: `AmbassadorContent::NextAnnouncementExpireAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::Announcements` (r:0 w:1)
+ /// Proof: `AmbassadorContent::Announcements` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`)
+ fn announce() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `285`
+ // Estimated: `3507`
+ // Minimum execution time: 273_000_000 picoseconds.
+ Weight::from_parts(278_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 3507))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::Announcements` (r:1 w:1)
+ /// Proof: `AmbassadorContent::Announcements` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::AnnouncementsCount` (r:1 w:1)
+ /// Proof: `AmbassadorContent::AnnouncementsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn remove_announcement() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `450`
+ // Estimated: `3555`
+ // Minimum execution time: 326_000_000 picoseconds.
+ Weight::from_parts(338_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 3555))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorContent::NextAnnouncementExpireAt` (r:1 w:1)
+ /// Proof: `AmbassadorContent::NextAnnouncementExpireAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::Announcements` (r:101 w:100)
+ /// Proof: `AmbassadorContent::Announcements` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorContent::AnnouncementsCount` (r:0 w:1)
+ /// Proof: `AmbassadorContent::AnnouncementsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// The range of component `x` is `[0, 100]`.
+ fn cleanup_announcements(x: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `167 + x * (96 ±0)`
+ // Estimated: `3555 + x * (2565 ±0)`
+ // Minimum execution time: 37_000_000 picoseconds.
+ Weight::from_parts(144_774_246, 0)
+ .saturating_add(Weight::from_parts(0, 3555))
+ // Standard Error: 329_536
+ .saturating_add(Weight::from_parts(138_770_008, 0).saturating_mul(x.into()))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into())))
+ .saturating_add(T::DbWeight::get().writes(1))
+ .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into())))
+ .saturating_add(Weight::from_parts(0, 2565).saturating_mul(x.into()))
+ }
+}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship_ambassador_core.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship_ambassador_core.rs
new file mode 100644
index 00000000000..f40940a8b25
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship_ambassador_core.rs
@@ -0,0 +1,223 @@
+// 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-08-11, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+
+// Executed Command:
+// target/release/polkadot-parachain
+// benchmark
+// pallet
+// --chain=collectives-polkadot-dev
+// --wasm-execution=compiled
+// --pallet=pallet_core_fellowship
+// --extrinsic=*
+// --steps=2
+// --repeat=2
+// --json
+// --header=./file_header.txt
+// --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: `AmbassadorCore::Params` (r:0 w:1)
+ /// Proof: `AmbassadorCore::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: 11_000_000 picoseconds.
+ Weight::from_parts(11_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 0))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Params` (r:1 w:0)
+ /// Proof: `AmbassadorCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::MemberEvidence` (r:1 w:1)
+ /// Proof: `AmbassadorCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
+ fn bump_offboard() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `66011`
+ // Estimated: `69046`
+ // Minimum execution time: 96_000_000 picoseconds.
+ Weight::from_parts(111_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 69046))
+ .saturating_add(T::DbWeight::get().reads(6))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Params` (r:1 w:0)
+ /// Proof: `AmbassadorCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::MemberEvidence` (r:1 w:1)
+ /// Proof: `AmbassadorCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
+ fn bump_demote() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `66121`
+ // Estimated: `69046`
+ // Minimum execution time: 99_000_000 picoseconds.
+ Weight::from_parts(116_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 69046))
+ .saturating_add(T::DbWeight::get().reads(6))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ fn set_active() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `360`
+ // Estimated: `3514`
+ // Minimum execution time: 21_000_000 picoseconds.
+ Weight::from_parts(22_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: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IndexToId` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ fn induct() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `118`
+ // Estimated: `3514`
+ // Minimum execution time: 36_000_000 picoseconds.
+ Weight::from_parts(36_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: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Params` (r:1 w:0)
+ /// Proof: `AmbassadorCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::MemberEvidence` (r:1 w:1)
+ /// Proof: `AmbassadorCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IndexToId` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ fn promote() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `65989`
+ // Estimated: `69046`
+ // Minimum execution time: 95_000_000 picoseconds.
+ Weight::from_parts(110_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 69046))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(6))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::MemberEvidence` (r:0 w:1)
+ /// Proof: `AmbassadorCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
+ fn offboard() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `331`
+ // Estimated: `3514`
+ // Minimum execution time: 21_000_000 picoseconds.
+ Weight::from_parts(22_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: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ fn import() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `285`
+ // Estimated: `3514`
+ // Minimum execution time: 20_000_000 picoseconds.
+ Weight::from_parts(21_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: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::Member` (r:1 w:1)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::MemberEvidence` (r:1 w:1)
+ /// Proof: `AmbassadorCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
+ fn approve() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `65967`
+ // Estimated: `69046`
+ // Minimum execution time: 78_000_000 picoseconds.
+ Weight::from_parts(104_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 69046))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorCore::Member` (r:1 w:0)
+ /// Proof: `AmbassadorCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCore::MemberEvidence` (r:1 w:1)
+ /// Proof: `AmbassadorCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
+ fn submit_evidence() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `151`
+ // Estimated: `69046`
+ // Minimum execution time: 43_000_000 picoseconds.
+ Weight::from_parts(44_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 69046))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship_fellowship_core.rs
similarity index 87%
rename from parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship.rs
rename to parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship_fellowship_core.rs
index 50a8bcea500..51c95003c2f 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_core_fellowship_fellowship_core.rs
@@ -17,24 +17,21 @@
//! Autogenerated weights for `pallet_core_fellowship`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-08-11, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
-//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
// Executed Command:
-// ./target/production/polkadot-parachain
+// target/release/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --wasm-execution=compiled
// --pallet=pallet_core_fellowship
-// --no-storage-info
-// --no-median-slopes
-// --no-min-squares
// --extrinsic=*
-// --steps=50
-// --repeat=20
+// --steps=2
+// --repeat=2
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/
@@ -56,8 +53,8 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
- // Minimum execution time: 9_077_000 picoseconds.
- Weight::from_parts(9_356_000, 0)
+ // Minimum execution time: 11_000_000 picoseconds.
+ Weight::from_parts(12_000_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -75,10 +72,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn bump_offboard() -> Weight {
// Proof Size summary in bytes:
- // Measured: `66111`
+ // Measured: `66144`
// Estimated: `69046`
- // Minimum execution time: 128_419_000 picoseconds.
- Weight::from_parts(149_318_000, 0)
+ // Minimum execution time: 109_000_000 picoseconds.
+ Weight::from_parts(125_000_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
@@ -97,10 +94,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn bump_demote() -> Weight {
// Proof Size summary in bytes:
- // Measured: `66221`
+ // Measured: `66254`
// Estimated: `69046`
- // Minimum execution time: 127_629_000 picoseconds.
- Weight::from_parts(130_928_000, 0)
+ // Minimum execution time: 112_000_000 picoseconds.
+ Weight::from_parts(114_000_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
@@ -111,10 +108,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
fn set_active() -> Weight {
// Proof Size summary in bytes:
- // Measured: `460`
+ // Measured: `493`
// Estimated: `3514`
- // Minimum execution time: 18_655_000 picoseconds.
- Weight::from_parts(19_331_000, 0)
+ // Minimum execution time: 22_000_000 picoseconds.
+ Weight::from_parts(27_000_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@@ -131,10 +128,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn induct() -> Weight {
// Proof Size summary in bytes:
- // Measured: `218`
+ // Measured: `251`
// Estimated: `3514`
- // Minimum execution time: 28_764_000 picoseconds.
- Weight::from_parts(29_385_000, 0)
+ // Minimum execution time: 35_000_000 picoseconds.
+ Weight::from_parts(36_000_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(5))
@@ -155,10 +152,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn promote() -> Weight {
// Proof Size summary in bytes:
- // Measured: `66089`
+ // Measured: `66122`
// Estimated: `69046`
- // Minimum execution time: 123_179_000 picoseconds.
- Weight::from_parts(125_302_000, 0)
+ // Minimum execution time: 97_000_000 picoseconds.
+ Weight::from_parts(129_000_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(6))
@@ -171,10 +168,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn offboard() -> Weight {
// Proof Size summary in bytes:
- // Measured: `431`
+ // Measured: `464`
// Estimated: `3514`
- // Minimum execution time: 19_700_000 picoseconds.
- Weight::from_parts(20_319_000, 0)
+ // Minimum execution time: 22_000_000 picoseconds.
+ Weight::from_parts(22_000_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@@ -185,10 +182,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
fn import() -> Weight {
// Proof Size summary in bytes:
- // Measured: `385`
+ // Measured: `418`
// Estimated: `3514`
- // Minimum execution time: 18_048_000 picoseconds.
- Weight::from_parts(18_345_000, 0)
+ // Minimum execution time: 20_000_000 picoseconds.
+ Weight::from_parts(24_000_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@@ -201,10 +198,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn approve() -> Weight {
// Proof Size summary in bytes:
- // Measured: `66067`
+ // Measured: `66100`
// Estimated: `69046`
- // Minimum execution time: 108_578_000 picoseconds.
- Weight::from_parts(111_311_000, 0)
+ // Minimum execution time: 89_000_000 picoseconds.
+ Weight::from_parts(119_000_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
@@ -215,10 +212,10 @@ impl pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `FellowshipCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn submit_evidence() -> Weight {
// Proof Size summary in bytes:
- // Measured: `151`
+ // Measured: `184`
// Estimated: `69046`
- // Minimum execution time: 94_484_000 picoseconds.
- Weight::from_parts(97_930_000, 0)
+ // Minimum execution time: 43_000_000 picoseconds.
+ Weight::from_parts(52_000_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_ambassador_collective.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_ambassador_collective.rs
new file mode 100644
index 00000000000..a6372c4b89d
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_ambassador_collective.rs
@@ -0,0 +1,177 @@
+// 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_ranked_collective`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-08-11, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+
+// Executed Command:
+// target/release/polkadot-parachain
+// benchmark
+// pallet
+// --chain=collectives-polkadot-dev
+// --wasm-execution=compiled
+// --pallet=pallet_ranked_collective
+// --extrinsic=*
+// --steps=2
+// --repeat=2
+// --json
+// --header=./file_header.txt
+// --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_ranked_collective`.
+pub struct WeightInfo(PhantomData);
+impl pallet_ranked_collective::WeightInfo for WeightInfo {
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IndexToId` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::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: 21_000_000 picoseconds.
+ Weight::from_parts(23_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: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:11 w:11)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:11 w:11)
+ /// Proof: `AmbassadorCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IndexToId` (r:11 w:11)
+ /// Proof: `AmbassadorCollective::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]`.
+ fn remove_member(r: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `508 + r * (281 ±0)`
+ // Estimated: `3519 + r * (2529 ±0)`
+ // Minimum execution time: 34_000_000 picoseconds.
+ Weight::from_parts(36_500_000, 0)
+ .saturating_add(Weight::from_parts(0, 3519))
+ // Standard Error: 158_113
+ .saturating_add(Weight::from_parts(16_000_000, 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(4))
+ .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(r.into())))
+ .saturating_add(Weight::from_parts(0, 2529).saturating_mul(r.into()))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IndexToId` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:0 w:1)
+ /// Proof: `AmbassadorCollective::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]`.
+ fn promote_member(r: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `210 + r * (17 ±0)`
+ // Estimated: `3507`
+ // Minimum execution time: 25_000_000 picoseconds.
+ Weight::from_parts(26_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 3507))
+ // Standard Error: 180_277
+ .saturating_add(Weight::from_parts(650_000, 0).saturating_mul(r.into()))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IdToIndex` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::IndexToId` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::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]`.
+ fn demote_member(r: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `508 + r * (71 ±0)`
+ // Estimated: `3519`
+ // Minimum execution time: 34_000_000 picoseconds.
+ Weight::from_parts(36_500_000, 0)
+ .saturating_add(Weight::from_parts(0, 3519))
+ // Standard Error: 335_410
+ .saturating_add(Weight::from_parts(550_000, 0).saturating_mul(r.into()))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::Voting` (r:1 w:1)
+ /// Proof: `AmbassadorCollective::Voting` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn vote() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `566`
+ // Estimated: `317568`
+ // Minimum execution time: 57_000_000 picoseconds.
+ Weight::from_parts(60_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::VotingCleanup` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::VotingCleanup` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::Voting` (r:100 w:100)
+ /// Proof: `AmbassadorCollective::Voting` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
+ /// 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: `209 + n * (52 ±0)`
+ // Estimated: `4365 + n * (2550 ±0)`
+ // Minimum execution time: 18_000_000 picoseconds.
+ Weight::from_parts(18_500_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ // Standard Error: 11_180
+ .saturating_add(Weight::from_parts(1_335_000, 0).saturating_mul(n.into()))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
+ .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
+ .saturating_add(Weight::from_parts(0, 2550).saturating_mul(n.into()))
+ }
+}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_fellowship_collective.rs
similarity index 82%
rename from parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs
rename to parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_fellowship_collective.rs
index 0ce5de87c8f..724e820dc80 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_ranked_collective_fellowship_collective.rs
@@ -17,24 +17,21 @@
//! Autogenerated weights for `pallet_ranked_collective`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-08-11, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
-//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
// Executed Command:
-// ./target/production/polkadot-parachain
+// target/release/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --wasm-execution=compiled
// --pallet=pallet_ranked_collective
-// --no-storage-info
-// --no-median-slopes
-// --no-min-squares
// --extrinsic=*
-// --steps=50
-// --repeat=20
+// --steps=2
+// --repeat=2
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/
@@ -62,8 +59,8 @@ impl pallet_ranked_collective::WeightInfo for WeightInf
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3507`
- // Minimum execution time: 16_027_000 picoseconds.
- Weight::from_parts(16_501_000, 0)
+ // Minimum execution time: 21_000_000 picoseconds.
+ Weight::from_parts(22_000_000, 0)
.saturating_add(Weight::from_parts(0, 3507))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
@@ -77,15 +74,16 @@ impl pallet_ranked_collective::WeightInfo for WeightInf
/// Storage: `FellowshipCollective::IndexToId` (r:11 w:11)
/// Proof: `FellowshipCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// The range of component `r` is `[0, 10]`.
+ /// The range of component `r` is `[0, 10]`.
fn remove_member(r: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `617 + r * (281 ±0)`
+ // Measured: `608 + r * (281 ±0)`
// Estimated: `3519 + r * (2529 ±0)`
- // Minimum execution time: 27_829_000 picoseconds.
- Weight::from_parts(30_053_705, 0)
+ // Minimum execution time: 35_000_000 picoseconds.
+ Weight::from_parts(36_500_000, 0)
.saturating_add(Weight::from_parts(0, 3519))
- // Standard Error: 26_813
- .saturating_add(Weight::from_parts(13_088_861, 0).saturating_mul(r.into()))
+ // Standard Error: 254_950
+ .saturating_add(Weight::from_parts(15_900_000, 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(4))
@@ -101,15 +99,16 @@ impl pallet_ranked_collective::WeightInfo for WeightInf
/// Storage: `FellowshipCollective::IdToIndex` (r:0 w:1)
/// Proof: `FellowshipCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// The range of component `r` is `[0, 10]`.
+ /// The range of component `r` is `[0, 10]`.
fn promote_member(r: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `314 + r * (17 ±0)`
+ // Measured: `310 + r * (17 ±0)`
// Estimated: `3507`
- // Minimum execution time: 19_762_000 picoseconds.
- Weight::from_parts(20_493_905, 0)
+ // Minimum execution time: 25_000_000 picoseconds.
+ Weight::from_parts(25_500_000, 0)
.saturating_add(Weight::from_parts(0, 3507))
- // Standard Error: 5_519
- .saturating_add(Weight::from_parts(349_033, 0).saturating_mul(r.into()))
+ // Standard Error: 70_710
+ .saturating_add(Weight::from_parts(400_000, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -122,15 +121,16 @@ impl pallet_ranked_collective::WeightInfo for WeightInf
/// Storage: `FellowshipCollective::IndexToId` (r:1 w:1)
/// Proof: `FellowshipCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// The range of component `r` is `[0, 10]`.
+ /// The range of component `r` is `[0, 10]`.
fn demote_member(r: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `632 + r * (72 ±0)`
+ // Measured: `608 + r * (71 ±0)`
// Estimated: `3519`
- // Minimum execution time: 28_092_000 picoseconds.
- Weight::from_parts(30_800_398, 0)
+ // Minimum execution time: 35_000_000 picoseconds.
+ Weight::from_parts(37_500_000, 0)
.saturating_add(Weight::from_parts(0, 3519))
- // Standard Error: 17_223
- .saturating_add(Weight::from_parts(615_330, 0).saturating_mul(r.into()))
+ // Standard Error: 150_000
+ .saturating_add(Weight::from_parts(350_000, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -144,10 +144,10 @@ impl pallet_ranked_collective::WeightInfo for WeightInf
/// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
fn vote() -> Weight {
// Proof Size summary in bytes:
- // Measured: `666`
+ // Measured: `700`
// Estimated: `317568`
- // Minimum execution time: 46_255_000 picoseconds.
- Weight::from_parts(47_590_000, 0)
+ // Minimum execution time: 57_000_000 picoseconds.
+ Weight::from_parts(57_000_000, 0)
.saturating_add(Weight::from_parts(0, 317568))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
@@ -159,18 +159,19 @@ impl pallet_ranked_collective::WeightInfo for WeightInf
/// Storage: `FellowshipCollective::Voting` (r:100 w:100)
/// Proof: `FellowshipCollective::Voting` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 100]`.
+ /// The range of component `n` is `[0, 100]`.
fn cleanup_poll(n: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `500 + n * (50 ±0)`
- // Estimated: `4365 + n * (2540 ±0)`
- // Minimum execution time: 14_975_000 picoseconds.
- Weight::from_parts(17_408_362, 0)
+ // Measured: `343 + n * (52 ±0)`
+ // Estimated: `4365 + n * (2550 ±0)`
+ // Minimum execution time: 18_000_000 picoseconds.
+ Weight::from_parts(19_000_000, 0)
.saturating_add(Weight::from_parts(0, 4365))
- // Standard Error: 3_134
- .saturating_add(Weight::from_parts(1_222_024, 0).saturating_mul(n.into()))
+ // Standard Error: 25_000
+ .saturating_add(Weight::from_parts(1_395_000, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
- .saturating_add(Weight::from_parts(0, 2540).saturating_mul(n.into()))
+ .saturating_add(Weight::from_parts(0, 2550).saturating_mul(n.into()))
}
}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda_ambassador_referenda.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda_ambassador_referenda.rs
new file mode 100644
index 00000000000..fdc451c5d31
--- /dev/null
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda_ambassador_referenda.rs
@@ -0,0 +1,536 @@
+// 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_referenda`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-08-11, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+
+// Executed Command:
+// target/release/polkadot-parachain
+// benchmark
+// pallet
+// --chain=collectives-polkadot-dev
+// --wasm-execution=compiled
+// --pallet=pallet_referenda
+// --extrinsic=*
+// --steps=2
+// --repeat=2
+// --json
+// --header=./file_header.txt
+// --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_referenda`.
+pub struct WeightInfo(PhantomData);
+impl pallet_referenda::WeightInfo for WeightInfo {
+ /// Storage: `AmbassadorCollective::Members` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::ReferendumCount` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:0 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ fn submit() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `255`
+ // Estimated: `159279`
+ // Minimum execution time: 32_000_000 picoseconds.
+ Weight::from_parts(34_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn place_decision_deposit_preparing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `366`
+ // Estimated: `317568`
+ // Minimum execution time: 63_000_000 picoseconds.
+ Weight::from_parts(68_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn place_decision_deposit_queued() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1165`
+ // Estimated: `159279`
+ // Minimum execution time: 97_000_000 picoseconds.
+ Weight::from_parts(123_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn place_decision_deposit_not_queued() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1173`
+ // Estimated: `159279`
+ // Minimum execution time: 104_000_000 picoseconds.
+ Weight::from_parts(111_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn place_decision_deposit_passing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `702`
+ // Estimated: `317568`
+ // Minimum execution time: 140_000_000 picoseconds.
+ Weight::from_parts(150_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn place_decision_deposit_failing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `601`
+ // Estimated: `317568`
+ // Minimum execution time: 81_000_000 picoseconds.
+ Weight::from_parts(82_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ fn refund_decision_deposit() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `317`
+ // Estimated: `4365`
+ // Minimum execution time: 38_000_000 picoseconds.
+ Weight::from_parts(38_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(1))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ fn refund_submission_deposit() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `167`
+ // Estimated: `4365`
+ // Minimum execution time: 17_000_000 picoseconds.
+ Weight::from_parts(18_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(1))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn cancel() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `311`
+ // Estimated: `317568`
+ // Minimum execution time: 44_000_000 picoseconds.
+ Weight::from_parts(45_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ /// Storage: `System::Account` (r:1 w:1)
+ /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+ /// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
+ /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
+ /// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
+ /// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
+ /// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
+ /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
+ /// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `AmbassadorReferenda::MetadataOf` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
+ fn kill() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `626`
+ // Estimated: `317568`
+ // Minimum execution time: 183_000_000 picoseconds.
+ Weight::from_parts(187_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(11))
+ .saturating_add(T::DbWeight::get().writes(6))
+ }
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ fn one_fewer_deciding_queue_empty() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `140`
+ // Estimated: `3636`
+ // Minimum execution time: 12_000_000 picoseconds.
+ Weight::from_parts(12_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 3636))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn one_fewer_deciding_failing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1412`
+ // Estimated: `159279`
+ // Minimum execution time: 88_000_000 picoseconds.
+ Weight::from_parts(97_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn one_fewer_deciding_passing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1412`
+ // Estimated: `159279`
+ // Minimum execution time: 87_000_000 picoseconds.
+ Weight::from_parts(92_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ fn nudge_referendum_requeued_insertion() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `935`
+ // Estimated: `4365`
+ // Minimum execution time: 43_000_000 picoseconds.
+ Weight::from_parts(46_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ fn nudge_referendum_requeued_slide() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `935`
+ // Estimated: `4365`
+ // Minimum execution time: 39_000_000 picoseconds.
+ Weight::from_parts(43_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ fn nudge_referendum_queued() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `951`
+ // Estimated: `4365`
+ // Minimum execution time: 48_000_000 picoseconds.
+ Weight::from_parts(50_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::TrackQueue` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(171), added: 2646, mode: `MaxEncodedLen`)
+ fn nudge_referendum_not_queued() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `959`
+ // Estimated: `4365`
+ // Minimum execution time: 42_000_000 picoseconds.
+ Weight::from_parts(48_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_no_deposit() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `263`
+ // Estimated: `159279`
+ // Minimum execution time: 28_000_000 picoseconds.
+ Weight::from_parts(30_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_preparing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `311`
+ // Estimated: `159279`
+ // Minimum execution time: 26_000_000 picoseconds.
+ Weight::from_parts(28_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ fn nudge_referendum_timed_out() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `208`
+ // Estimated: `4365`
+ // Minimum execution time: 19_000_000 picoseconds.
+ Weight::from_parts(20_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(1))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_begin_deciding_failing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `546`
+ // Estimated: `159279`
+ // Minimum execution time: 42_000_000 picoseconds.
+ Weight::from_parts(46_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::DecidingCount` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_begin_deciding_passing() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `647`
+ // Estimated: `159279`
+ // Minimum execution time: 87_000_000 picoseconds.
+ Weight::from_parts(93_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_begin_confirming() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `700`
+ // Estimated: `159279`
+ // Minimum execution time: 100_000_000 picoseconds.
+ Weight::from_parts(120_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_end_confirming() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `683`
+ // Estimated: `159279`
+ // Minimum execution time: 90_000_000 picoseconds.
+ Weight::from_parts(100_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_continue_not_confirming() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `700`
+ // Estimated: `159279`
+ // Minimum execution time: 77_000_000 picoseconds.
+ Weight::from_parts(82_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_continue_confirming() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `704`
+ // Estimated: `159279`
+ // Minimum execution time: 68_000_000 picoseconds.
+ Weight::from_parts(77_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:2 w:2)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Lookup` (r:1 w:1)
+ /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
+ fn nudge_referendum_approved() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `704`
+ // Estimated: `317568`
+ // Minimum execution time: 99_000_000 picoseconds.
+ Weight::from_parts(104_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 317568))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorCollective::MemberCount` (r:1 w:0)
+ /// Proof: `AmbassadorCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
+ /// Storage: `Scheduler::Agenda` (r:1 w:1)
+ /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
+ fn nudge_referendum_rejected() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `700`
+ // Estimated: `159279`
+ // Minimum execution time: 87_000_000 picoseconds.
+ Weight::from_parts(100_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 159279))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `Preimage::StatusFor` (r:1 w:0)
+ /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::MetadataOf` (r:0 w:1)
+ /// Proof: `AmbassadorReferenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
+ fn set_some_metadata() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `419`
+ // Estimated: `4365`
+ // Minimum execution time: 23_000_000 picoseconds.
+ Weight::from_parts(25_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AmbassadorReferenda::ReferendumInfoFor` (r:1 w:0)
+ /// Proof: `AmbassadorReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
+ /// Storage: `AmbassadorReferenda::MetadataOf` (r:1 w:1)
+ /// Proof: `AmbassadorReferenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
+ fn clear_metadata() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `285`
+ // Estimated: `4365`
+ // Minimum execution time: 20_000_000 picoseconds.
+ Weight::from_parts(21_000_000, 0)
+ .saturating_add(Weight::from_parts(0, 4365))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+}
diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda_fellowship_referenda.rs
similarity index 87%
rename from parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs
rename to parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda_fellowship_referenda.rs
index 1e8b3ecae2e..16459a6bc7f 100644
--- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda.rs
+++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_referenda_fellowship_referenda.rs
@@ -17,24 +17,21 @@
//! Autogenerated weights for `pallet_referenda`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-08-11, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
-//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
+//! HOSTNAME: `cob`, CPU: ``
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-polkadot-dev")`, DB CACHE: 1024
// Executed Command:
-// ./target/production/polkadot-parachain
+// target/release/polkadot-parachain
// benchmark
// pallet
// --chain=collectives-polkadot-dev
// --wasm-execution=compiled
// --pallet=pallet_referenda
-// --no-storage-info
-// --no-median-slopes
-// --no-min-squares
// --extrinsic=*
-// --steps=50
-// --repeat=20
+// --steps=2
+// --repeat=2
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/
@@ -60,10 +57,10 @@ impl pallet_referenda::WeightInfo for WeightInfo {
/// Proof: `FellowshipReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(900), added: 3375, mode: `MaxEncodedLen`)
fn submit() -> Weight {
// Proof Size summary in bytes:
- // Measured: `355`
+ // Measured: `389`
// Estimated: `159279`
- // Minimum execution time: 29_271_000 picoseconds.
- Weight::from_parts(30_285_000, 0)
+ // Minimum execution time: 34_000_000 picoseconds.
+ Weight::from_parts(36_000_000, 0)
.saturating_add(Weight::from_parts(0, 159279))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
@@ -74,10 +71,10 @@ impl pallet_referenda::WeightInfo for WeightInfo {
/// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
fn place_decision_deposit_preparing() -> Weight {
// Proof Size summary in bytes:
- // Measured: `366`
+ // Measured: `400`
// Estimated: `317568`
- // Minimum execution time: 52_128_000 picoseconds.
- Weight::from_parts(53_504_000, 0)
+ // Minimum execution time: 64_000_000 picoseconds.
+ Weight::from_parts(67_000_000, 0)
.saturating_add(Weight::from_parts(0, 317568))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
@@ -92,10 +89,10 @@ impl pallet_referenda::WeightInfo for WeightInfo {
/// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
fn place_decision_deposit_queued() -> Weight {
// Proof Size summary in bytes:
- // Measured: `2004`
+ // Measured: `2038`
// Estimated: `159279`
- // Minimum execution time: 110_018_000 picoseconds.
- Weight::from_parts(114_369_000, 0)
+ // Minimum execution time: 99_000_000 picoseconds.
+ Weight::from_parts(109_000_000, 0)
.saturating_add(Weight::from_parts(0, 159279))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
@@ -110,10 +107,10 @@ impl pallet_referenda::WeightInfo for WeightInfo {
/// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(155814), added: 158289, mode: `MaxEncodedLen`)
fn place_decision_deposit_not_queued() -> Weight {
// Proof Size summary in bytes:
- // Measured: `2045`
+ // Measured: `2079`
// Estimated: `159279`
- // Minimum execution time: 110_231_000 picoseconds.
- Weight::from_parts(114_517_000, 0)
+ // Minimum execution time: 101_000_000 picoseconds.
+ Weight::from_parts(111_000_000, 0)
.saturating_add(Weight::from_parts(0, 159279))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
@@ -128,10 +125,10 @@ impl pallet_referenda::WeightInfo for WeightInfo