mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 01:11:04 +00:00
Change the Config of the MaxRococoNum Slot from a Constant to a Storage function (#7217)
* set MaxPermanentSlots and MaxTemporarySlots with a extrinsic instead of a constant * delete the MaxPermanentSlots and MaxTemporarySlots constants from config on Rococo and Westend * migration code for assigned slots * remove getters * little refactor * set values in the GenesisConfig * refactor in the migration, adding it in the rococo runtime * refactor: fmt * Minor fix * pre_upgrade check * add migration to mod v1 * Logs following Substrate#12873 * fix: current storage version set to 1 * use enact when try-runtime * Vec seems to be missing * feature gate import * fix as per #13993 * address comments Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * address comments Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * benchmarking for assign_perm_parachain_slot extrinsic * benchmark all the extrinsics of the pallet * cargo fmt for assigned slots * migration added for westend * licence in benchmarking file * BuildGenesisConfig * assigned_slots default in genesis * cargo fmt * assigned_slots fix tests config * cargo fmt * fix benchmarking compile error * fix benchmarking imports * benchmark worst case scenario for validation code and head data * add assigned_slots in frame_benchmarking on Rococo and Westend * modify values for para_id in benchmarking * delete the assigned_slots in westend frame_benchmarking * fix benchmarkings and add it to westend * cargo fmt * ".git/.scripts/commands/bench/bench.sh" --subcommand=runtime --runtime=rococo --target_dir=polkadot --pallet=runtime_common::assigned_slots * ".git/.scripts/commands/bench/bench.sh" --subcommand=runtime --runtime=westend --target_dir=polkadot --pallet=runtime_common::assigned_slots * use generated weights in assigned_slots pallet * small changes in set_max_permanent_slots and set_max_temporary_slots * revert last commit * address some comments * wrap migration with VersionCheckedMigrateToV1 * add experimental feature in pallet, and assers in post_upgrade migration * clean warnings * clean unnecesary experimental flag * small typo in comments * cargo fmt * small comments fixes --------- Co-authored-by: al3mart <11448715+al3mart@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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<Runtime>;
|
||||
}
|
||||
|
||||
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<T>} = 63,
|
||||
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 64,
|
||||
AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>} = 65,
|
||||
AssignedSlots: assigned_slots::{Pallet, Call, Storage, Event<T>, Config<T>} = 65,
|
||||
|
||||
// Pallet for sending XCM.
|
||||
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
|
||||
@@ -1285,6 +1282,7 @@ pub mod migrations {
|
||||
pub type Unreleased = (
|
||||
pallet_im_online::migration::v1::Migration<Runtime>,
|
||||
parachains_configuration::migration::v7::MigrateToV7<Runtime>,
|
||||
assigned_slots::migration::v1::VersionCheckedMigrateToV1<Runtime>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> runtime_common::assigned_slots::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user