diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs
index 7aabfa6e9185..87a8650c2ed6 100644
--- a/node/service/src/chain_spec.rs
+++ b/node/service/src/chain_spec.rs
@@ -515,6 +515,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Runtim
},
xcm_pallet: Default::default(),
nomination_pools: Default::default(),
+ assigned_slots: Default::default(),
}
}
@@ -1023,6 +1024,7 @@ fn rococo_staging_testnet_config_genesis(
},
xcm_pallet: Default::default(),
nis_counterpart_balances: Default::default(),
+ assigned_slots: Default::default(),
}
}
@@ -1484,6 +1486,7 @@ pub fn westend_testnet_genesis(
},
xcm_pallet: Default::default(),
nomination_pools: Default::default(),
+ assigned_slots: Default::default(),
}
}
@@ -1573,6 +1576,7 @@ pub fn rococo_testnet_genesis(
},
xcm_pallet: Default::default(),
nis_counterpart_balances: Default::default(),
+ assigned_slots: Default::default(),
}
}
diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml
index c9812d806733..dda7c2e92368 100644
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -64,6 +64,9 @@ test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../pri
[features]
default = ["std"]
+experimental = [
+ "frame-support/experimental"
+]
no_std = []
std = [
"bitvec/std",
diff --git a/runtime/common/src/assigned_slots/benchmarking.rs b/runtime/common/src/assigned_slots/benchmarking.rs
new file mode 100644
index 000000000000..61638fe6cabf
--- /dev/null
+++ b/runtime/common/src/assigned_slots/benchmarking.rs
@@ -0,0 +1,160 @@
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Benchmarking for assigned_slots pallet
+
+#![cfg(feature = "runtime-benchmarks")]
+use super::*;
+
+use frame_benchmarking::v2::*;
+use frame_support::assert_ok;
+use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
+use primitives::Id as ParaId;
+use sp_runtime::traits::Bounded;
+
+type CurrencyOf = <::Leaser as Leaser>>::Currency;
+type BalanceOf = <<::Leaser as Leaser>>::Currency as Currency<
+ ::AccountId,
+>>::Balance;
+#[benchmarks(where T: Config)]
+mod benchmarks {
+ use super::*;
+
+ use crate::assigned_slots::Pallet as AssignedSlots;
+
+ fn register_parachain(para_id: ParaId) {
+ let who: T::AccountId = whitelisted_caller();
+ let worst_validation_code = T::Registrar::worst_validation_code();
+ let worst_head_data = T::Registrar::worst_head_data();
+
+ CurrencyOf::::make_free_balance_be(&who, BalanceOf::::max_value());
+
+ assert_ok!(T::Registrar::register(
+ who,
+ para_id,
+ worst_head_data,
+ worst_validation_code.clone()
+ ));
+ assert_ok!(paras::Pallet::::add_trusted_validation_code(
+ frame_system::Origin::::Root.into(),
+ worst_validation_code,
+ ));
+ T::Registrar::execute_pending_transitions();
+ }
+
+ #[benchmark]
+ fn assign_perm_parachain_slot() {
+ let para_id = ParaId::from(1_u32);
+ let caller = RawOrigin::Root;
+
+ let _ =
+ AssignedSlots::::set_max_permanent_slots(frame_system::Origin::::Root.into(), 10);
+ register_parachain::(para_id);
+
+ let counter = PermanentSlotCount::::get();
+ let current_lease_period: BlockNumberFor =
+ T::Leaser::lease_period_index(frame_system::Pallet::::block_number())
+ .and_then(|x| Some(x.0))
+ .unwrap();
+ #[extrinsic_call]
+ assign_perm_parachain_slot(caller, para_id);
+
+ assert_eq!(
+ PermanentSlots::::get(para_id),
+ Some((
+ current_lease_period,
+ LeasePeriodOf::::from(T::PermanentSlotLeasePeriodLength::get()),
+ ))
+ );
+ assert_eq!(PermanentSlotCount::::get(), counter + 1);
+ }
+
+ #[benchmark]
+ fn assign_temp_parachain_slot() {
+ let para_id = ParaId::from(2_u32);
+ let caller = RawOrigin::Root;
+
+ let _ =
+ AssignedSlots::::set_max_temporary_slots(frame_system::Origin::::Root.into(), 10);
+ register_parachain::(para_id);
+
+ let current_lease_period: BlockNumberFor =
+ T::Leaser::lease_period_index(frame_system::Pallet::::block_number())
+ .and_then(|x| Some(x.0))
+ .unwrap();
+
+ let counter = TemporarySlotCount::::get();
+ #[extrinsic_call]
+ assign_temp_parachain_slot(caller, para_id, SlotLeasePeriodStart::Current);
+
+ let tmp = ParachainTemporarySlot {
+ manager: whitelisted_caller(),
+ period_begin: current_lease_period,
+ period_count: LeasePeriodOf::::from(T::TemporarySlotLeasePeriodLength::get()),
+ last_lease: Some(BlockNumberFor::::zero()),
+ lease_count: 1,
+ };
+ assert_eq!(TemporarySlots::::get(para_id), Some(tmp));
+ assert_eq!(TemporarySlotCount::::get(), counter + 1);
+ }
+
+ #[benchmark]
+ fn unassign_parachain_slot() {
+ let para_id = ParaId::from(3_u32);
+ let caller = RawOrigin::Root;
+
+ let _ =
+ AssignedSlots::::set_max_temporary_slots(frame_system::Origin::::Root.into(), 10);
+ register_parachain::(para_id);
+
+ let _ = AssignedSlots::::assign_temp_parachain_slot(
+ caller.clone().into(),
+ para_id,
+ SlotLeasePeriodStart::Current,
+ );
+
+ let counter = TemporarySlotCount::::get();
+ #[extrinsic_call]
+ unassign_parachain_slot(caller, para_id);
+
+ assert_eq!(TemporarySlots::::get(para_id), None);
+ assert_eq!(TemporarySlotCount::::get(), counter - 1);
+ }
+
+ #[benchmark]
+ fn set_max_permanent_slots() {
+ let caller = RawOrigin::Root;
+ #[extrinsic_call]
+ set_max_permanent_slots(caller, u32::MAX);
+
+ assert_eq!(MaxPermanentSlots::::get(), u32::MAX);
+ }
+
+ #[benchmark]
+ fn set_max_temporary_slots() {
+ let caller = RawOrigin::Root;
+ #[extrinsic_call]
+ set_max_temporary_slots(caller, u32::MAX);
+
+ assert_eq!(MaxTemporarySlots::::get(), u32::MAX);
+ }
+
+ impl_benchmark_test_suite!(
+ AssignedSlots,
+ crate::assigned_slots::tests::new_test_ext(),
+ crate::assigned_slots::tests::Test,
+ );
+}
diff --git a/runtime/common/src/assigned_slots/migration.rs b/runtime/common/src/assigned_slots/migration.rs
new file mode 100644
index 000000000000..884d67222d28
--- /dev/null
+++ b/runtime/common/src/assigned_slots/migration.rs
@@ -0,0 +1,77 @@
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+use super::{Config, MaxPermanentSlots, MaxTemporarySlots, Pallet, LOG_TARGET};
+use frame_support::{
+ dispatch::GetStorageVersion,
+ traits::{Get, OnRuntimeUpgrade},
+};
+
+#[cfg(feature = "try-runtime")]
+use frame_support::ensure;
+#[cfg(feature = "try-runtime")]
+use sp_std::vec::Vec;
+
+pub mod v1 {
+
+ use super::*;
+ pub struct MigrateToV1(sp_std::marker::PhantomData);
+ impl OnRuntimeUpgrade for MigrateToV1 {
+ #[cfg(feature = "try-runtime")]
+ fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> {
+ let onchain_version = Pallet::::on_chain_storage_version();
+ ensure!(onchain_version < 1, "assigned_slots::MigrateToV1 migration can be deleted");
+ Ok(Default::default())
+ }
+
+ fn on_runtime_upgrade() -> frame_support::weights::Weight {
+ let onchain_version = Pallet::::on_chain_storage_version();
+ if onchain_version < 1 {
+ const MAX_PERMANENT_SLOTS: u32 = 100;
+ const MAX_TEMPORARY_SLOTS: u32 = 100;
+
+ >::put(MAX_PERMANENT_SLOTS);
+ >::put(MAX_TEMPORARY_SLOTS);
+ // Return the weight consumed by the migration.
+ T::DbWeight::get().reads_writes(1, 3)
+ } else {
+ log::info!(target: LOG_TARGET, "MigrateToV1 should be removed");
+ T::DbWeight::get().reads(1)
+ }
+ }
+
+ #[cfg(feature = "try-runtime")]
+ fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::TryRuntimeError> {
+ let onchain_version = Pallet::::on_chain_storage_version();
+ ensure!(onchain_version == 1, "assigned_slots::MigrateToV1 needs to be run");
+ assert_eq!(>::get(), 100);
+ assert_eq!(>::get(), 100);
+ Ok(())
+ }
+ }
+
+ /// [`VersionUncheckedMigrateToV1`] wrapped in a
+ /// [`frame_support::migrations::VersionedRuntimeUpgrade`], ensuring the migration is only
+ /// performed when on-chain version is 0.
+ #[cfg(feature = "experimental")]
+ pub type VersionCheckedMigrateToV1 = frame_support::migrations::VersionedRuntimeUpgrade<
+ 0,
+ 1,
+ MigrateToV1,
+ Pallet,
+ ::DbWeight,
+ >;
+}
diff --git a/runtime/common/src/assigned_slots.rs b/runtime/common/src/assigned_slots/mod.rs
similarity index 88%
rename from runtime/common/src/assigned_slots.rs
rename to runtime/common/src/assigned_slots/mod.rs
index b3c1381c9ec9..4763c3e3f0b4 100644
--- a/runtime/common/src/assigned_slots.rs
+++ b/runtime/common/src/assigned_slots/mod.rs
@@ -23,10 +23,12 @@
//! This pallet should not be used on a production relay chain,
//! only on a test relay chain (e.g. Rococo).
+pub mod benchmarking;
+pub mod migration;
+
use crate::{
- slots::{self, Pallet as Slots, WeightInfo},
+ slots::{self, Pallet as Slots, WeightInfo as SlotsWeightInfo},
traits::{LeaseError, Leaser, Registrar},
- MAXIMUM_BLOCK_WEIGHT,
};
use frame_support::{pallet_prelude::*, traits::Currency};
use frame_system::pallet_prelude::*;
@@ -41,6 +43,8 @@ use scale_info::TypeInfo;
use sp_runtime::traits::{One, Saturating, Zero};
use sp_std::prelude::*;
+const LOG_TARGET: &str = "runtime::assigned_slots";
+
/// Lease period an assigned slot should start from (current, or next one).
#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo)]
pub enum SlotLeasePeriodStart {
@@ -67,6 +71,33 @@ pub struct ParachainTemporarySlot {
pub lease_count: u32,
}
+pub trait WeightInfo {
+ fn assign_perm_parachain_slot() -> Weight;
+ fn assign_temp_parachain_slot() -> Weight;
+ fn unassign_parachain_slot() -> Weight;
+ fn set_max_permanent_slots() -> Weight;
+ fn set_max_temporary_slots() -> Weight;
+}
+
+pub struct TestWeightInfo;
+impl WeightInfo for TestWeightInfo {
+ fn assign_perm_parachain_slot() -> Weight {
+ Weight::zero()
+ }
+ fn assign_temp_parachain_slot() -> Weight {
+ Weight::zero()
+ }
+ fn unassign_parachain_slot() -> Weight {
+ Weight::zero()
+ }
+ fn set_max_permanent_slots() -> Weight {
+ Weight::zero()
+ }
+ fn set_max_temporary_slots() -> Weight {
+ Weight::zero()
+ }
+}
+
type BalanceOf = <<::Leaser as Leaser>>::Currency as Currency<
::AccountId,
>>::Balance;
@@ -76,7 +107,11 @@ type LeasePeriodOf = <::Leaser as Leaser>>::Le
pub mod pallet {
use super::*;
+ /// The current storage version.
+ const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
+
#[pallet::pallet]
+ #[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet(_);
#[pallet::config]
@@ -103,17 +138,12 @@ pub mod pallet {
#[pallet::constant]
type TemporarySlotLeasePeriodLength: Get;
- /// The max number of permanent slots that can be assigned.
- #[pallet::constant]
- type MaxPermanentSlots: Get;
-
- /// The max number of temporary slots that can be assigned.
- #[pallet::constant]
- type MaxTemporarySlots: Get;
-
/// The max number of temporary slots to be scheduled per lease periods.
#[pallet::constant]
type MaxTemporarySlotPerLeasePeriod: Get;
+
+ /// Weight Information for the Extrinsics in the Pallet
+ type WeightInfo: WeightInfo;
}
/// Assigned permanent slots, with their start lease period, and duration.
@@ -148,13 +178,41 @@ pub mod pallet {
#[pallet::getter(fn active_temporary_slot_count)]
pub type ActiveTemporarySlotCount = StorageValue<_, u32, ValueQuery>;
+ /// The max number of temporary slots that can be assigned.
+ #[pallet::storage]
+ pub type MaxTemporarySlots = StorageValue<_, u32, ValueQuery>;
+
+ /// The max number of permanent slots that can be assigned.
+ #[pallet::storage]
+ pub type MaxPermanentSlots = StorageValue<_, u32, ValueQuery>;
+
+ #[pallet::genesis_config]
+ #[derive(frame_support::DefaultNoBound)]
+ pub struct GenesisConfig {
+ pub max_temporary_slots: u32,
+ pub max_permanent_slots: u32,
+ pub _config: PhantomData,
+ }
+
+ #[pallet::genesis_build]
+ impl BuildGenesisConfig for GenesisConfig {
+ fn build(&self) {
+ >::put(&self.max_permanent_slots);
+ >::put(&self.max_temporary_slots);
+ }
+ }
+
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event {
- /// A para was assigned a permanent parachain slot
+ /// A parachain was assigned a permanent parachain slot
PermanentSlotAssigned(ParaId),
- /// A para was assigned a temporary parachain slot
+ /// A parachain was assigned a temporary parachain slot
TemporarySlotAssigned(ParaId),
+ /// The maximum number of permanent slots has been changed
+ MaxPermanentSlotsChanged { slots: u32 },
+ /// The maximum number of temporary slots has been changed
+ MaxTemporarySlotsChanged { slots: u32 },
}
#[pallet::error]
@@ -173,9 +231,9 @@ pub mod pallet {
SlotNotAssigned,
/// An ongoing lease already exists.
OngoingLeaseExists,
- // Maximum number of permanent slots exceeded
+ // The maximum number of permanent slots exceeded
MaxPermanentSlotsExceeded,
- // Maximum number of temporary slots exceeded
+ // The maximum number of temporary slots exceeded
MaxTemporarySlotsExceeded,
}
@@ -196,16 +254,15 @@ pub mod pallet {
#[pallet::call]
impl Pallet {
- // TODO: Benchmark this
/// Assign a permanent parachain slot and immediately create a lease for it.
#[pallet::call_index(0)]
- #[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))]
+ #[pallet::weight((::WeightInfo::assign_perm_parachain_slot(), DispatchClass::Operational))]
pub fn assign_perm_parachain_slot(origin: OriginFor, id: ParaId) -> DispatchResult {
T::AssignSlotOrigin::ensure_origin(origin)?;
let manager = T::Registrar::manager_of(id).ok_or(Error::::ParaDoesntExist)?;
- ensure!(T::Registrar::is_parathread(id), Error::::NotParathread,);
+ ensure!(T::Registrar::is_parathread(id), Error::::NotParathread);
ensure!(
!Self::has_permanent_slot(id) && !Self::has_temporary_slot(id),
@@ -227,7 +284,7 @@ pub mod pallet {
);
ensure!(
- PermanentSlotCount::::get() < T::MaxPermanentSlots::get(),
+ PermanentSlotCount::::get() < MaxPermanentSlots::::get(),
Error::::MaxPermanentSlotsExceeded
);
@@ -253,12 +310,11 @@ pub mod pallet {
Ok(())
}
- // TODO: Benchmark this
/// Assign a temporary parachain slot. The function tries to create a lease for it
/// immediately if `SlotLeasePeriodStart::Current` is specified, and if the number
/// of currently active temporary slots is below `MaxTemporarySlotPerLeasePeriod`.
#[pallet::call_index(1)]
- #[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))]
+ #[pallet::weight((::WeightInfo::assign_temp_parachain_slot(), DispatchClass::Operational))]
pub fn assign_temp_parachain_slot(
origin: OriginFor,
id: ParaId,
@@ -290,7 +346,7 @@ pub mod pallet {
);
ensure!(
- TemporarySlotCount::::get() < T::MaxTemporarySlots::get(),
+ TemporarySlotCount::::get() < MaxTemporarySlots::::get(),
Error::::MaxTemporarySlotsExceeded
);
@@ -324,9 +380,12 @@ pub mod pallet {
// Treat failed lease creation as warning .. slot will be allocated a lease
// in a subsequent lease period by the `allocate_temporary_slot_leases`
// function.
- log::warn!(target: "assigned_slots",
+ log::warn!(
+ target: LOG_TARGET,
"Failed to allocate a temp slot for para {:?} at period {:?}: {:?}",
- id, current_lease_period, err
+ id,
+ current_lease_period,
+ err
);
},
}
@@ -340,10 +399,9 @@ pub mod pallet {
Ok(())
}
- // TODO: Benchmark this
/// Unassign a permanent or temporary parachain slot
#[pallet::call_index(2)]
- #[pallet::weight(((MAXIMUM_BLOCK_WEIGHT / 10) as Weight, DispatchClass::Operational))]
+ #[pallet::weight((::WeightInfo::unassign_parachain_slot(), DispatchClass::Operational))]
pub fn unassign_parachain_slot(origin: OriginFor, id: ParaId) -> DispatchResult {
T::AssignSlotOrigin::ensure_origin(origin.clone())?;
@@ -377,15 +435,42 @@ pub mod pallet {
// Treat failed downgrade as warning .. slot lease has been cleared,
// so the parachain will be downgraded anyway by the slots pallet
// at the end of the lease period .
- log::warn!(target: "assigned_slots",
+ log::warn!(
+ target: LOG_TARGET,
"Failed to downgrade parachain {:?} at period {:?}: {:?}",
- id, Self::current_lease_period_index(), err
+ id,
+ Self::current_lease_period_index(),
+ err
);
}
}
Ok(())
}
+
+ /// Sets the storage value [`MaxPermanentSlots`].
+ #[pallet::call_index(3)]
+ #[pallet::weight((::WeightInfo::set_max_permanent_slots(), DispatchClass::Operational))]
+ pub fn set_max_permanent_slots(origin: OriginFor, slots: u32) -> DispatchResult {
+ ensure_root(origin)?;
+
+ >::put(slots);
+
+ Self::deposit_event(Event::::MaxPermanentSlotsChanged { slots });
+ Ok(())
+ }
+
+ /// Sets the storage value [`MaxTemporarySlots`].
+ #[pallet::call_index(4)]
+ #[pallet::weight((::WeightInfo::set_max_temporary_slots(), DispatchClass::Operational))]
+ pub fn set_max_temporary_slots(origin: OriginFor, slots: u32) -> DispatchResult {
+ ensure_root(origin)?;
+
+ >::put(slots);
+
+ Self::deposit_event(Event::::MaxTemporarySlotsChanged { slots });
+ Ok(())
+ }
}
}
@@ -530,9 +615,11 @@ impl Pallet {
// Note: leases that have ended in previous lease period, should have been cleaned in slots
// pallet.
if let Err(err) = Self::allocate_temporary_slot_leases(lease_period_index) {
- log::error!(target: "assigned_slots",
+ log::error!(
+ target: LOG_TARGET,
"Allocating slots failed for lease period {:?}, with: {:?}",
- lease_period_index, err
+ lease_period_index,
+ err
);
}
::WeightInfo::force_lease() *
@@ -673,8 +760,6 @@ mod tests {
parameter_types! {
pub const PermanentSlotLeasePeriodLength: u32 = 3;
pub const TemporarySlotLeasePeriodLength: u32 = 2;
- pub const MaxPermanentSlots: u32 = 2;
- pub const MaxTemporarySlots: u32 = 6;
pub const MaxTemporarySlotPerLeasePeriod: u32 = 2;
}
@@ -684,9 +769,8 @@ mod tests {
type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength;
- type MaxPermanentSlots = MaxPermanentSlots;
- type MaxTemporarySlots = MaxTemporarySlots;
type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod;
+ type WeightInfo = crate::assigned_slots::TestWeightInfo;
}
// This function basically just builds a genesis storage key/value store according to
@@ -698,6 +782,15 @@ mod tests {
}
.assimilate_storage(&mut t)
.unwrap();
+
+ crate::assigned_slots::GenesisConfig:: {
+ max_temporary_slots: 6,
+ max_permanent_slots: 2,
+ _config: Default::default(),
+ }
+ .assimilate_storage(&mut t)
+ .unwrap();
+
t.into()
}
@@ -1324,4 +1417,47 @@ mod tests {
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 1), false);
});
}
+ #[test]
+ fn set_max_permanent_slots_fails_for_no_root_origin() {
+ new_test_ext().execute_with(|| {
+ run_to_block(1);
+
+ assert_noop!(
+ AssignedSlots::set_max_permanent_slots(RuntimeOrigin::signed(1), 5),
+ BadOrigin
+ );
+ });
+ }
+ #[test]
+ fn set_max_permanent_slots_succeeds() {
+ new_test_ext().execute_with(|| {
+ run_to_block(1);
+
+ assert_eq!(MaxPermanentSlots::::get(), 2);
+ assert_ok!(AssignedSlots::set_max_permanent_slots(RuntimeOrigin::root(), 10),);
+ assert_eq!(MaxPermanentSlots::::get(), 10);
+ });
+ }
+
+ #[test]
+ fn set_max_temporary_slots_fails_for_no_root_origin() {
+ new_test_ext().execute_with(|| {
+ run_to_block(1);
+
+ assert_noop!(
+ AssignedSlots::set_max_temporary_slots(RuntimeOrigin::signed(1), 5),
+ BadOrigin
+ );
+ });
+ }
+ #[test]
+ fn set_max_temporary_slots_succeeds() {
+ new_test_ext().execute_with(|| {
+ run_to_block(1);
+
+ assert_eq!(MaxTemporarySlots::::get(), 6);
+ assert_ok!(AssignedSlots::set_max_temporary_slots(RuntimeOrigin::root(), 12),);
+ assert_eq!(MaxTemporarySlots::::get(), 12);
+ });
+ }
}
diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml
index 41d25d3aa6f6..f1f0d1cbe729 100644
--- a/runtime/rococo/Cargo.toml
+++ b/runtime/rococo/Cargo.toml
@@ -83,7 +83,7 @@ frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch =
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
hex-literal = { version = "0.4.1" }
-runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
+runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false, features=["experimental"] }
runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
polkadot-parachain = { path = "../../parachain", default-features = false }
diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs
index 31b657c3a5fb..d923437a67e5 100644
--- a/runtime/rococo/src/lib.rs
+++ b/runtime/rococo/src/lib.rs
@@ -1334,8 +1334,6 @@ impl paras_sudo_wrapper::Config for Runtime {}
parameter_types! {
pub const PermanentSlotLeasePeriodLength: u32 = 365;
pub const TemporarySlotLeasePeriodLength: u32 = 5;
- pub const MaxPermanentSlots: u32 = 100;
- pub const MaxTemporarySlots: u32 = 100;
pub const MaxTemporarySlotPerLeasePeriod: u32 = 5;
}
@@ -1345,9 +1343,8 @@ impl assigned_slots::Config for Runtime {
type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength;
- type MaxPermanentSlots = MaxPermanentSlots;
- type MaxTemporarySlots = MaxTemporarySlots;
type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod;
+ type WeightInfo = weights::runtime_common_assigned_slots::WeightInfo;
}
impl validator_manager::Config for Runtime {
@@ -1471,7 +1468,7 @@ construct_runtime! {
MmrLeaf: pallet_beefy_mmr::{Pallet, Storage} = 242,
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 250,
- AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event} = 251,
+ AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event, Config} = 251,
// Validator Manager pallet.
ValidatorManager: validator_manager::{Pallet, Call, Storage, Event} = 252,
@@ -1526,6 +1523,7 @@ pub mod migrations {
pallet_society::migrations::VersionCheckedMigrateToV2,
pallet_im_online::migration::v1::Migration,
parachains_configuration::migration::v7::MigrateToV7,
+ assigned_slots::migration::v1::VersionCheckedMigrateToV1,
);
}
@@ -1572,6 +1570,7 @@ mod benches {
// Polkadot
// NOTE: Make sure to prefix these with `runtime_common::` so
// the that path resolves correctly in the generated file.
+ [runtime_common::assigned_slots, AssignedSlots]
[runtime_common::auctions, Auctions]
[runtime_common::crowdloan, Crowdloan]
[runtime_common::claims, Claims]
diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs
index 5bc39330e28e..75acfe9a5d64 100644
--- a/runtime/rococo/src/weights/mod.rs
+++ b/runtime/rococo/src/weights/mod.rs
@@ -42,6 +42,7 @@ pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_xcm;
+pub mod runtime_common_assigned_slots;
pub mod runtime_common_auctions;
pub mod runtime_common_claims;
pub mod runtime_common_crowdloan;
diff --git a/runtime/rococo/src/weights/runtime_common_assigned_slots.rs b/runtime/rococo/src/weights/runtime_common_assigned_slots.rs
new file mode 100644
index 000000000000..a6beeded4286
--- /dev/null
+++ b/runtime/rococo/src/weights/runtime_common_assigned_slots.rs
@@ -0,0 +1,151 @@
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Autogenerated weights for `runtime_common::assigned_slots`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `runner-ynta1nyy-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
+//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024
+
+// Executed Command:
+// target/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --json-file=/builds/parity/mirrors/polkadot/.git/.artifacts/bench.json
+// --pallet=runtime_common::assigned_slots
+// --chain=rococo-dev
+// --header=./file_header.txt
+// --output=./runtime/rococo/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 `runtime_common::assigned_slots`.
+pub struct WeightInfo(PhantomData);
+impl runtime_common::assigned_slots::WeightInfo for WeightInfo {
+ /// Storage: `Registrar::Paras` (r:1 w:1)
+ /// Proof: `Registrar::Paras` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ParaLifecycles` (r:1 w:1)
+ /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::PermanentSlots` (r:1 w:1)
+ /// Proof: `AssignedSlots::PermanentSlots` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::TemporarySlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::TemporarySlots` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
+ /// Storage: `Slots::Leases` (r:1 w:1)
+ /// Proof: `Slots::Leases` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::PermanentSlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::PermanentSlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::MaxPermanentSlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::MaxPermanentSlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0)
+ /// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ActionsQueue` (r:1 w:1)
+ /// Proof: `Paras::ActionsQueue` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ fn assign_perm_parachain_slot() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `673`
+ // Estimated: `4138`
+ // Minimum execution time: 84_646_000 picoseconds.
+ Weight::from_parts(91_791_000, 0)
+ .saturating_add(Weight::from_parts(0, 4138))
+ .saturating_add(T::DbWeight::get().reads(9))
+ .saturating_add(T::DbWeight::get().writes(6))
+ }
+ /// Storage: `Registrar::Paras` (r:1 w:1)
+ /// Proof: `Registrar::Paras` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ParaLifecycles` (r:1 w:1)
+ /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::PermanentSlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::PermanentSlots` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::TemporarySlots` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlots` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
+ /// Storage: `Slots::Leases` (r:1 w:1)
+ /// Proof: `Slots::Leases` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::TemporarySlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::MaxTemporarySlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::MaxTemporarySlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::ActiveTemporarySlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::ActiveTemporarySlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0)
+ /// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ActionsQueue` (r:1 w:1)
+ /// Proof: `Paras::ActionsQueue` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ fn assign_temp_parachain_slot() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `673`
+ // Estimated: `4138`
+ // Minimum execution time: 68_091_000 picoseconds.
+ Weight::from_parts(77_310_000, 0)
+ .saturating_add(Weight::from_parts(0, 4138))
+ .saturating_add(T::DbWeight::get().reads(10))
+ .saturating_add(T::DbWeight::get().writes(7))
+ }
+ /// Storage: `AssignedSlots::PermanentSlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::PermanentSlots` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::TemporarySlots` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlots` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
+ /// Storage: `Paras::ParaLifecycles` (r:1 w:0)
+ /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `Slots::Leases` (r:1 w:1)
+ /// Proof: `Slots::Leases` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::TemporarySlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn unassign_parachain_slot() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `823`
+ // Estimated: `4288`
+ // Minimum execution time: 38_081_000 picoseconds.
+ Weight::from_parts(40_987_000, 0)
+ .saturating_add(Weight::from_parts(0, 4288))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AssignedSlots::MaxPermanentSlots` (r:0 w:1)
+ /// Proof: `AssignedSlots::MaxPermanentSlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn set_max_permanent_slots() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 7_182_000 picoseconds.
+ Weight::from_parts(7_437_000, 0)
+ .saturating_add(Weight::from_parts(0, 0))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AssignedSlots::MaxTemporarySlots` (r:0 w:1)
+ /// Proof: `AssignedSlots::MaxTemporarySlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn set_max_temporary_slots() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 7_153_000 picoseconds.
+ Weight::from_parts(7_456_000, 0)
+ .saturating_add(Weight::from_parts(0, 0))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+}
diff --git a/runtime/westend/Cargo.toml b/runtime/westend/Cargo.toml
index 4773176e1762..e665a08b1ed1 100644
--- a/runtime/westend/Cargo.toml
+++ b/runtime/westend/Cargo.toml
@@ -89,7 +89,7 @@ pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate"
pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
hex-literal = { version = "0.4.1", optional = true }
-runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
+runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false, features=["experimental"] }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
polkadot-parachain = { path = "../../parachain", default-features = false }
runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false }
diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs
index 9bb5a6db613d..9c322d6b8436 100644
--- a/runtime/westend/src/lib.rs
+++ b/runtime/westend/src/lib.rs
@@ -1007,8 +1007,6 @@ impl paras_sudo_wrapper::Config for Runtime {}
parameter_types! {
pub const PermanentSlotLeasePeriodLength: u32 = 26;
pub const TemporarySlotLeasePeriodLength: u32 = 1;
- pub const MaxPermanentSlots: u32 = 5;
- pub const MaxTemporarySlots: u32 = 20;
pub const MaxTemporarySlotPerLeasePeriod: u32 = 5;
}
@@ -1018,9 +1016,8 @@ impl assigned_slots::Config for Runtime {
type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength;
- type MaxPermanentSlots = MaxPermanentSlots;
- type MaxTemporarySlots = MaxTemporarySlots;
type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod;
+ type WeightInfo = weights::runtime_common_assigned_slots::WeightInfo;
}
impl parachains_disputes::Config for Runtime {
@@ -1231,7 +1228,7 @@ construct_runtime! {
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62,
Auctions: auctions::{Pallet, Call, Storage, Event} = 63,
Crowdloan: crowdloan::{Pallet, Call, Storage, Event} = 64,
- AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event} = 65,
+ AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event, Config} = 65,
// Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 99,
@@ -1285,6 +1282,7 @@ pub mod migrations {
pub type Unreleased = (
pallet_im_online::migration::v1::Migration,
parachains_configuration::migration::v7::MigrateToV7,
+ assigned_slots::migration::v1::VersionCheckedMigrateToV1,
);
}
@@ -1309,6 +1307,7 @@ mod benches {
// Polkadot
// NOTE: Make sure to prefix these with `runtime_common::` so
// the that path resolves correctly in the generated file.
+ [runtime_common::assigned_slots, AssignedSlots]
[runtime_common::auctions, Auctions]
[runtime_common::crowdloan, Crowdloan]
[runtime_common::paras_registrar, Registrar]
diff --git a/runtime/westend/src/weights/mod.rs b/runtime/westend/src/weights/mod.rs
index 6341b3da8b69..531de5527de5 100644
--- a/runtime/westend/src/weights/mod.rs
+++ b/runtime/westend/src/weights/mod.rs
@@ -37,6 +37,7 @@ pub mod pallet_timestamp;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_xcm;
+pub mod runtime_common_assigned_slots;
pub mod runtime_common_auctions;
pub mod runtime_common_crowdloan;
pub mod runtime_common_paras_registrar;
diff --git a/runtime/westend/src/weights/runtime_common_assigned_slots.rs b/runtime/westend/src/weights/runtime_common_assigned_slots.rs
new file mode 100644
index 000000000000..c3f1060a9ac0
--- /dev/null
+++ b/runtime/westend/src/weights/runtime_common_assigned_slots.rs
@@ -0,0 +1,151 @@
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot. If not, see .
+
+//! Autogenerated weights for `runtime_common::assigned_slots`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `runner-ynta1nyy-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
+//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024
+
+// Executed Command:
+// target/production/polkadot
+// benchmark
+// pallet
+// --steps=50
+// --repeat=20
+// --extrinsic=*
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --json-file=/builds/parity/mirrors/polkadot/.git/.artifacts/bench.json
+// --pallet=runtime_common::assigned_slots
+// --chain=westend-dev
+// --header=./file_header.txt
+// --output=./runtime/westend/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 `runtime_common::assigned_slots`.
+pub struct WeightInfo(PhantomData);
+impl runtime_common::assigned_slots::WeightInfo for WeightInfo {
+ /// Storage: `Registrar::Paras` (r:1 w:1)
+ /// Proof: `Registrar::Paras` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ParaLifecycles` (r:1 w:1)
+ /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::PermanentSlots` (r:1 w:1)
+ /// Proof: `AssignedSlots::PermanentSlots` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::TemporarySlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::TemporarySlots` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
+ /// Storage: `Slots::Leases` (r:1 w:1)
+ /// Proof: `Slots::Leases` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::PermanentSlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::PermanentSlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::MaxPermanentSlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::MaxPermanentSlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0)
+ /// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ActionsQueue` (r:1 w:1)
+ /// Proof: `Paras::ActionsQueue` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ fn assign_perm_parachain_slot() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `640`
+ // Estimated: `4105`
+ // Minimum execution time: 74_788_000 picoseconds.
+ Weight::from_parts(79_847_000, 0)
+ .saturating_add(Weight::from_parts(0, 4105))
+ .saturating_add(T::DbWeight::get().reads(9))
+ .saturating_add(T::DbWeight::get().writes(6))
+ }
+ /// Storage: `Registrar::Paras` (r:1 w:1)
+ /// Proof: `Registrar::Paras` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ParaLifecycles` (r:1 w:1)
+ /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::PermanentSlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::PermanentSlots` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::TemporarySlots` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlots` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
+ /// Storage: `Slots::Leases` (r:1 w:1)
+ /// Proof: `Slots::Leases` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::TemporarySlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::MaxTemporarySlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::MaxTemporarySlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::ActiveTemporarySlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::ActiveTemporarySlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ /// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0)
+ /// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
+ /// Storage: `Paras::ActionsQueue` (r:1 w:1)
+ /// Proof: `Paras::ActionsQueue` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ fn assign_temp_parachain_slot() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `640`
+ // Estimated: `4105`
+ // Minimum execution time: 73_324_000 picoseconds.
+ Weight::from_parts(77_993_000, 0)
+ .saturating_add(Weight::from_parts(0, 4105))
+ .saturating_add(T::DbWeight::get().reads(10))
+ .saturating_add(T::DbWeight::get().writes(7))
+ }
+ /// Storage: `AssignedSlots::PermanentSlots` (r:1 w:0)
+ /// Proof: `AssignedSlots::PermanentSlots` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`)
+ /// Storage: `AssignedSlots::TemporarySlots` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlots` (`max_values`: None, `max_size`: Some(61), added: 2536, mode: `MaxEncodedLen`)
+ /// Storage: `Paras::ParaLifecycles` (r:1 w:0)
+ /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `Slots::Leases` (r:1 w:1)
+ /// Proof: `Slots::Leases` (`max_values`: None, `max_size`: None, mode: `Measured`)
+ /// Storage: `AssignedSlots::TemporarySlotCount` (r:1 w:1)
+ /// Proof: `AssignedSlots::TemporarySlotCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn unassign_parachain_slot() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `592`
+ // Estimated: `4057`
+ // Minimum execution time: 32_796_000 picoseconds.
+ Weight::from_parts(35_365_000, 0)
+ .saturating_add(Weight::from_parts(0, 4057))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: `AssignedSlots::MaxPermanentSlots` (r:0 w:1)
+ /// Proof: `AssignedSlots::MaxPermanentSlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn set_max_permanent_slots() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 7_104_000 picoseconds.
+ Weight::from_parts(7_358_000, 0)
+ .saturating_add(Weight::from_parts(0, 0))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: `AssignedSlots::MaxTemporarySlots` (r:0 w:1)
+ /// Proof: `AssignedSlots::MaxTemporarySlots` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
+ fn set_max_temporary_slots() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 7_097_000 picoseconds.
+ Weight::from_parts(7_429_000, 0)
+ .saturating_add(Weight::from_parts(0, 0))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+}