diff --git a/Cargo.lock b/Cargo.lock index 699ea7b25..64013a5e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8805,6 +8805,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", + "sp-staking", "sp-std", "sp-transaction-pool", "sp-version", @@ -10957,6 +10958,7 @@ dependencies = [ "pallet-dip-provider", "pallet-membership", "pallet-multisig", + "pallet-session", "pallet-tips", "pallet-transaction-payment", "pallet-treasury", @@ -10972,6 +10974,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "sp-trie", "sp-weights", @@ -13892,6 +13895,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", + "sp-staking", "sp-std", "sp-transaction-pool", "sp-version", diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index 3e02afa07..49437a882 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -51,6 +51,7 @@ pallet-authorship = { workspace = true } pallet-balances = { workspace = true } pallet-membership = { workspace = true } pallet-multisig = { workspace = true } +pallet-session = { workspace = true } pallet-tips = { workspace = true } pallet-transaction-payment = { workspace = true } pallet-treasury = { workspace = true } @@ -58,6 +59,7 @@ sp-consensus-aura = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } +sp-staking = { workspace = true } sp-std = { workspace = true } sp-trie = { workspace = true } sp-weights = { workspace = true } @@ -128,6 +130,7 @@ std = [ "pallet-membership/std", "pallet-multisig/std", "pallet-multisig/std", + "pallet-session/std", "pallet-tips/std", "pallet-transaction-payment/std", "pallet-treasury/std", @@ -164,6 +167,7 @@ try-runtime = [ "pallet-bonded-coins/try-runtime", "pallet-membership/try-runtime", "pallet-multisig/try-runtime", + "pallet-session/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", "pallet-treasury/try-runtime", diff --git a/runtimes/common/src/constants.rs b/runtimes/common/src/constants.rs index 073fe6d83..ef7403663 100644 --- a/runtimes/common/src/constants.rs +++ b/runtimes/common/src/constants.rs @@ -278,6 +278,8 @@ pub mod staking { pub const NETWORK_REWARD_RATE: Perquintill = Perquintill::from_percent(10); + pub const MAX_COLLATORS: u32 = 32; + parameter_types! { /// Minimum round length is 1 hour pub const MinBlocksPerRound: BlockNumber = MIN_BLOCKS_PER_ROUND; @@ -309,6 +311,8 @@ pub mod staking { pub const NetworkRewardStart: BlockNumber = super::treasury::INITIAL_PERIOD_LENGTH; /// The rate in percent for the network rewards pub const NetworkRewardRate: Perquintill = NETWORK_REWARD_RATE; + /// The maximum number of collators + pub const MaxCollators: u32 = MAX_COLLATORS; } } diff --git a/runtimes/common/src/lib.rs b/runtimes/common/src/lib.rs index 8e17e86e8..358d6e9e8 100644 --- a/runtimes/common/src/lib.rs +++ b/runtimes/common/src/lib.rs @@ -55,6 +55,7 @@ pub mod errors; pub mod fees; pub mod migrations; pub mod pallet_id; +pub mod session; pub mod web3_names; pub mod xcm_config; pub use web3_names::Web3Name; diff --git a/runtimes/common/src/session.rs b/runtimes/common/src/session.rs new file mode 100644 index 000000000..13d8dde99 --- /dev/null +++ b/runtimes/common/src/session.rs @@ -0,0 +1,81 @@ +// KILT Blockchain – +// Copyright (C) 2025, KILT Foundation + +// The KILT Blockchain 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. + +// The KILT Blockchain 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 this program. If not, see . + +// If you feel like getting in touch with us, you can do so at + +pub use frame_support::weights::constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; +use frame_system::Pallet as SystemPallet; +use pallet_membership::{Config as MembershipConfig, Instance3, Pallet as MembershipPallet}; +use pallet_session::SessionManager as SessionManagerTrait; +pub use sp_consensus_aura::sr25519::AuthorityId; +use sp_core::Get; +use sp_runtime::SaturatedConversion; +use sp_staking::SessionIndex; +use sp_std::{marker::PhantomData, vec::Vec}; + +use crate::constants::staking::DefaultBlocksPerRound; + +type AccountIdOf = ::AccountId; + +/// The session manager for the collator set. +pub struct SessionManager(PhantomData); + +impl SessionManagerTrait> for SessionManager +where + Runtime: MembershipConfig + pallet_session::Config, + ::ValidatorId: From>, +{ + fn new_session(new_index: SessionIndex) -> Option>> { + let collators = MembershipPallet::::members().to_vec(); + + log::debug!( + "assembling new collators for new session {} at #{:?} with {:?}", + new_index, + SystemPallet::::block_number(), + collators + ); + + let has_collator_keys = collators.iter().any(|collator| { + pallet_session::NextKeys::::contains_key(::ValidatorId::from( + collator.clone(), + )) + }); + + SystemPallet::::register_extra_weight_unchecked( + ::DbWeight::get() + .reads(2u64.saturating_add(collators.len().saturated_into::())), + frame_support::pallet_prelude::DispatchClass::Mandatory, + ); + + if collators.is_empty() || !has_collator_keys { + // we never want to pass an empty set of collators. This would brick the chain. + log::error!("💥 keeping old session because of empty collator set!"); + return None; + } + + Some(collators) + } + + fn start_session(_start_index: SessionIndex) { + // We don't care + } + + fn end_session(_end_index: SessionIndex) { + // We don't care + } +} + +pub type FixedLengthSession = pallet_session::PeriodicSessions; diff --git a/runtimes/peregrine/Cargo.toml b/runtimes/peregrine/Cargo.toml index 63836a6bf..e71fae39f 100644 --- a/runtimes/peregrine/Cargo.toml +++ b/runtimes/peregrine/Cargo.toml @@ -64,6 +64,7 @@ sp-metadata-ir = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } +sp-staking = { workspace = true } sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } diff --git a/runtimes/peregrine/src/benchmarks/mod.rs b/runtimes/peregrine/src/benchmarks/mod.rs index 88fa2d3ee..7bc508d30 100644 --- a/runtimes/peregrine/src/benchmarks/mod.rs +++ b/runtimes/peregrine/src/benchmarks/mod.rs @@ -38,10 +38,10 @@ use xcm::v4::{Asset, Assets, Fungibility, Location}; use crate::{ xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, BondedCurrencies, BondedFungibles, - Council, Ctype, Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, Inflation, - MessageQueue, Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, - RuntimeEvent, Scheduler, Sudo, System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, - Treasury, Utility, Vesting, Web3Names, + Collators, Council, Ctype, Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, + Inflation, MessageQueue, Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, + PublicCredentials, Runtime, RuntimeEvent, Scheduler, Sudo, System, TechnicalCommittee, TechnicalMembership, + Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting, Web3Names, }; pub(crate) mod asset_switch; @@ -56,11 +56,9 @@ use pallet_assets as pallet_bonded_assets; #[allow(unused_imports)] use pallet_collective as pallet_technical_committee_collective; #[allow(unused_imports)] -use pallet_did_lookup as pallet_unique_linking; -#[allow(unused_imports)] use pallet_membership as pallet_technical_membership; #[allow(unused_imports)] -use pallet_web3_names as pallet_dot_names; +use pallet_membership as pallet_collators; define_benchmarks!( [frame_system, frame_system_benchmarking::Pallet::] @@ -100,6 +98,7 @@ define_benchmarks!( // pallet_membership instances [pallet_membership, TipsMembership] [pallet_technical_membership, TechnicalMembership] + [pallet_collators, Collators] // pallet_did_lookup instances [pallet_did_lookup, DidLookup] // pallet_web3_names instances diff --git a/runtimes/peregrine/src/governance.rs b/runtimes/peregrine/src/governance.rs index 0f1fc2811..5476e107d 100644 --- a/runtimes/peregrine/src/governance.rs +++ b/runtimes/peregrine/src/governance.rs @@ -175,7 +175,7 @@ impl pallet_collective::Config for Runtime { type SetMembersOrigin = EnsureRoot; } -type RootOrMoreThanHalfCouncil = RootOrCollectiveProportion; +pub(crate) type RootOrMoreThanHalfCouncil = RootOrCollectiveProportion; type TechnicalMembershipProvider = pallet_membership::Instance1; impl pallet_membership::Config for Runtime { diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 916eb8c87..3bb07492a 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -116,6 +116,7 @@ construct_runtime! { ParachainStaking: parachain_staking = 21, Authorship: pallet_authorship = 20, AuraExt: cumulus_pallet_aura_ext = 24, + Collators: pallet_membership:: = 25, Democracy: pallet_democracy = 30, Council: pallet_collective:: = 31, diff --git a/runtimes/peregrine/src/system/mod.rs b/runtimes/peregrine/src/system/mod.rs index 27cf37e53..48be7b9e8 100644 --- a/runtimes/peregrine/src/system/mod.rs +++ b/runtimes/peregrine/src/system/mod.rs @@ -18,7 +18,7 @@ use frame_support::{ parameter_types, - traits::{AsEnsureOriginWithArg, Everything, PrivilegeCmp}, + traits::{AsEnsureOriginWithArg, Everything, NeverEnsureOrigin, PrivilegeCmp}, weights::Weight, }; use frame_system::EnsureRoot; @@ -26,6 +26,7 @@ use runtime_common::{ asset_switch::EnsureRootAsTreasury, constants, fees::{ToAuthorCredit, WeightToFee}, + session::{FixedLengthSession, SessionManager}, AccountId, AuthorityId, Balance, BlockHashCount, BlockLength, BlockWeights, FeeSplit, Hash, Nonce, SendDustAndFeesToTreasury, SlowAdjustingFeeUpdate, }; @@ -41,9 +42,9 @@ use sp_weights::ConstantMultiplier; use xcm::v4::Location; use crate::{ - governance::{CouncilCollective, RootOrCollectiveProportion}, - weights, Aura, Balances, Block, OriginCaller, PalletInfo, ParachainStaking, Preimage, Runtime, RuntimeCall, - RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, System, VERSION, + governance::{CouncilCollective, RootOrCollectiveProportion, RootOrMoreThanHalfCouncil}, + weights, Aura, Balances, Block, OriginCaller, PalletInfo, Preimage, Runtime, RuntimeCall, RuntimeEvent, + RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, System, VERSION, }; pub(crate) mod proxy; @@ -145,9 +146,9 @@ impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ValidatorId = AccountId; type ValidatorIdOf = ConvertInto; - type ShouldEndSession = ParachainStaking; - type NextSessionRotation = ParachainStaking; - type SessionManager = ParachainStaking; + type ShouldEndSession = FixedLengthSession; + type NextSessionRotation = FixedLengthSession; + type SessionManager = SessionManager; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = weights::pallet_session::WeightInfo; @@ -163,7 +164,7 @@ impl pallet_aura::Config for Runtime { impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = ParachainStaking; + type EventHandler = (); } impl pallet_utility::Config for Runtime { @@ -280,3 +281,21 @@ impl pallet_scheduler::Config for Runtime { type OriginPrivilegeCmp = OriginPrivilegeCmp; type Preimages = Preimage; } + +type CollatorMembershipProvider = pallet_membership::Instance3; +impl pallet_membership::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddOrigin = RootOrMoreThanHalfCouncil; + type RemoveOrigin = RootOrMoreThanHalfCouncil; + type SwapOrigin = RootOrMoreThanHalfCouncil; + type ResetOrigin = RootOrMoreThanHalfCouncil; + type PrimeOrigin = NeverEnsureOrigin; + type MembershipInitialized = (); + + #[cfg(feature = "runtime-benchmarks")] + type MembershipChanged = crate::benchmarks::governance::MockMembershipChangedForBenchmarks; + #[cfg(not(feature = "runtime-benchmarks"))] + type MembershipChanged = (); + type MaxMembers = constants::staking::MaxCollators; + type WeightInfo = weights::pallet_collators::WeightInfo; +} diff --git a/runtimes/peregrine/src/weights/mod.rs b/runtimes/peregrine/src/weights/mod.rs index ec7616fdc..d9e019950 100644 --- a/runtimes/peregrine/src/weights/mod.rs +++ b/runtimes/peregrine/src/weights/mod.rs @@ -28,6 +28,7 @@ pub mod pallet_assets; pub mod pallet_balances; pub mod pallet_bonded_assets; pub mod pallet_bonded_coins; +pub mod pallet_collators; pub mod pallet_collective; pub mod pallet_democracy; pub mod pallet_deposit_storage; diff --git a/runtimes/peregrine/src/weights/pallet_collators.rs b/runtimes/peregrine/src/weights/pallet_collators.rs new file mode 100644 index 000000000..fa6333702 --- /dev/null +++ b/runtimes/peregrine/src/weights/pallet_collators.rs @@ -0,0 +1,259 @@ +// KILT Blockchain – +// Copyright (C) 2025, KILT Foundation + +// The KILT Blockchain 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. + +// The KILT Blockchain 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 this program. If not, see . + +// If you feel like getting in touch with us, you can do so at + +//! Autogenerated weights for `pallet_collators` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 33.0.0 +//! DATE: 2025-04-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/kilt-parachain +// benchmark +// pallet +// --heap-pages=4096 +// --chain=dev +// --pallet=pallet-collators +// --extrinsic=* +// --header=HEADER-GPL +// --template=.maintain/runtime-weight-template.hbs +// --output=./runtimes/peregrine/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_imports)] +#![allow(clippy::as_conversions)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +// TODO: Remove once the benchmarking stuff fully supports pallet instances. +use pallet_membership as pallet_collators; + +/// Weight functions for `pallet_collators`. +pub struct WeightInfo(PhantomData); +impl pallet_collators::WeightInfo for WeightInfo { + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// The range of component `m` is `[1, 31]`. + fn add_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `170 + m * (32 ±0)` + // Estimated: `2510` + // Minimum execution time: 4_812_000 picoseconds. + Weight::from_parts(5_223_134, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 771 + .saturating_add(Weight::from_parts(16_478, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:0) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[2, 32]`. + fn remove_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_159_000 picoseconds. + Weight::from_parts(6_682_650, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 725 + .saturating_add(Weight::from_parts(15_110, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:0) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[2, 32]`. + fn swap_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_279_000 picoseconds. + Weight::from_parts(6_612_007, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 980 + .saturating_add(Weight::from_parts(26_782, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:0) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn reset_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_318_000 picoseconds. + Weight::from_parts(6_828_217, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 932 + .saturating_add(Weight::from_parts(72_412, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:1) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn change_key(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_538_000 picoseconds. + Weight::from_parts(7_074_832, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 891 + .saturating_add(Weight::from_parts(18_976, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:0) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:0 w:1) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn set_prime(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `170 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 3_643_000 picoseconds. + Weight::from_parts(4_129_209, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 497 + .saturating_add(Weight::from_parts(4_023, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Prime` (r:0 w:1) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn clear_prime(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_096_000 picoseconds. + Weight::from_parts(1_229_794, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 94 + .saturating_add(Weight::from_parts(35, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().writes(2)) + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_add_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_remove_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_swap_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_reset_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_change_key() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_set_prime() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } +} diff --git a/runtimes/spiritnet/Cargo.toml b/runtimes/spiritnet/Cargo.toml index c5558eec5..f05eaf145 100644 --- a/runtimes/spiritnet/Cargo.toml +++ b/runtimes/spiritnet/Cargo.toml @@ -62,6 +62,7 @@ sp-metadata-ir = { workspace = true } sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } +sp-staking = { workspace = true } sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } diff --git a/runtimes/spiritnet/src/benchmarks/mod.rs b/runtimes/spiritnet/src/benchmarks/mod.rs index fcb53b313..ee4356ec5 100644 --- a/runtimes/spiritnet/src/benchmarks/mod.rs +++ b/runtimes/spiritnet/src/benchmarks/mod.rs @@ -37,11 +37,11 @@ use sp_std::{boxed::Box, vec, vec::Vec}; use xcm::v4::{Asset, Assets, Fungibility, Location}; use crate::{ - xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, Council, Ctype, Delegation, - Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, Inflation, MessageQueue, Migration, - Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent, Scheduler, - System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility, Vesting, - Web3Names, + xcm::XcmConfig, AllPalletsWithSystem, AssetSwitchPool1, Attestation, Balances, Collators, Council, Ctype, + Delegation, Democracy, DepositStorage, Did, DidLookup, DipProvider, Fungibles, Indices, Inflation, MessageQueue, + Migration, Multisig, ParachainStaking, ParachainSystem, Preimage, Proxy, PublicCredentials, Runtime, RuntimeEvent, + Scheduler, System, TechnicalCommittee, TechnicalMembership, Timestamp, Tips, TipsMembership, Treasury, Utility, + Vesting, Web3Names, }; pub(crate) mod asset_switch; @@ -56,6 +56,9 @@ use pallet_collective as pallet_technical_committee_collective; #[allow(unused_imports)] use pallet_membership as pallet_technical_membership; +#[allow(unused_imports)] +use pallet_membership as pallet_collators; + define_benchmarks!( [frame_system, frame_system_benchmarking::Pallet::] [pallet_timestamp, Timestamp] @@ -93,6 +96,7 @@ define_benchmarks!( // pallet_membership instances [pallet_membership, TipsMembership] [pallet_technical_membership, TechnicalMembership] + [pallet_collators, Collators] // pallet_did_lookup instances [pallet_did_lookup, DidLookup] // pallet_web3_names instances diff --git a/runtimes/spiritnet/src/governance.rs b/runtimes/spiritnet/src/governance.rs index 0f1fc2811..5476e107d 100644 --- a/runtimes/spiritnet/src/governance.rs +++ b/runtimes/spiritnet/src/governance.rs @@ -175,7 +175,7 @@ impl pallet_collective::Config for Runtime { type SetMembersOrigin = EnsureRoot; } -type RootOrMoreThanHalfCouncil = RootOrCollectiveProportion; +pub(crate) type RootOrMoreThanHalfCouncil = RootOrCollectiveProportion; type TechnicalMembershipProvider = pallet_membership::Instance1; impl pallet_membership::Config for Runtime { diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 7822d21dc..fec68bca9 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -113,6 +113,7 @@ construct_runtime! { ParachainStaking: parachain_staking = 21, Authorship: pallet_authorship = 20, AuraExt: cumulus_pallet_aura_ext = 24, + Collators: pallet_membership:: = 25, Democracy: pallet_democracy = 30, Council: pallet_collective:: = 31, diff --git a/runtimes/spiritnet/src/system/mod.rs b/runtimes/spiritnet/src/system/mod.rs index 42f495fcb..65a232cc8 100644 --- a/runtimes/spiritnet/src/system/mod.rs +++ b/runtimes/spiritnet/src/system/mod.rs @@ -18,7 +18,7 @@ use frame_support::{ parameter_types, - traits::{AsEnsureOriginWithArg, Everything, PrivilegeCmp}, + traits::{AsEnsureOriginWithArg, Everything, NeverEnsureOrigin, PrivilegeCmp}, weights::Weight, }; use frame_system::EnsureRoot; @@ -26,6 +26,7 @@ use runtime_common::{ asset_switch::EnsureRootAsTreasury, constants, fees::{ToAuthorCredit, WeightToFee}, + session::{FixedLengthSession, SessionManager}, AccountId, AuthorityId, Balance, BlockHashCount, BlockLength, BlockWeights, FeeSplit, Hash, Nonce, SendDustAndFeesToTreasury, SlowAdjustingFeeUpdate, }; @@ -41,9 +42,9 @@ use sp_weights::ConstantMultiplier; use xcm::v4::Location; use crate::{ - governance::{CouncilCollective, RootOrCollectiveProportion}, - weights, Aura, Balances, Block, OriginCaller, PalletInfo, ParachainStaking, Preimage, Runtime, RuntimeCall, - RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, System, VERSION, + governance::{CouncilCollective, RootOrCollectiveProportion, RootOrMoreThanHalfCouncil}, + weights, Aura, Balances, Block, OriginCaller, PalletInfo, Preimage, Runtime, RuntimeCall, RuntimeEvent, + RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, System, VERSION, }; pub(crate) mod proxy; @@ -145,9 +146,9 @@ impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ValidatorId = AccountId; type ValidatorIdOf = ConvertInto; - type ShouldEndSession = ParachainStaking; - type NextSessionRotation = ParachainStaking; - type SessionManager = ParachainStaking; + type ShouldEndSession = FixedLengthSession; + type NextSessionRotation = FixedLengthSession; + type SessionManager = SessionManager; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = weights::pallet_session::WeightInfo; @@ -163,7 +164,7 @@ impl pallet_aura::Config for Runtime { impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = ParachainStaking; + type EventHandler = (); } impl pallet_utility::Config for Runtime { @@ -274,3 +275,20 @@ impl pallet_scheduler::Config for Runtime { type OriginPrivilegeCmp = OriginPrivilegeCmp; type Preimages = Preimage; } + +type CollatorMembershipProvider = pallet_membership::Instance3; +impl pallet_membership::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AddOrigin = RootOrMoreThanHalfCouncil; + type RemoveOrigin = RootOrMoreThanHalfCouncil; + type SwapOrigin = RootOrMoreThanHalfCouncil; + type ResetOrigin = RootOrMoreThanHalfCouncil; + type PrimeOrigin = NeverEnsureOrigin; + type MembershipInitialized = (); + #[cfg(feature = "runtime-benchmarks")] + type MembershipChanged = crate::benchmarks::governance::MockMembershipChangedForBenchmarks; + #[cfg(not(feature = "runtime-benchmarks"))] + type MembershipChanged = (); + type MaxMembers = constants::staking::MaxCollators; + type WeightInfo = weights::pallet_collators::WeightInfo; +} diff --git a/runtimes/spiritnet/src/weights/mod.rs b/runtimes/spiritnet/src/weights/mod.rs index 6e59fa1f9..bbbd83504 100644 --- a/runtimes/spiritnet/src/weights/mod.rs +++ b/runtimes/spiritnet/src/weights/mod.rs @@ -26,6 +26,7 @@ pub mod frame_system; pub mod pallet_asset_switch; pub mod pallet_assets; pub mod pallet_balances; +pub mod pallet_collators; pub mod pallet_collective; pub mod pallet_democracy; pub mod pallet_deposit_storage; diff --git a/runtimes/spiritnet/src/weights/pallet_collators.rs b/runtimes/spiritnet/src/weights/pallet_collators.rs new file mode 100644 index 000000000..fa6333702 --- /dev/null +++ b/runtimes/spiritnet/src/weights/pallet_collators.rs @@ -0,0 +1,259 @@ +// KILT Blockchain – +// Copyright (C) 2025, KILT Foundation + +// The KILT Blockchain 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. + +// The KILT Blockchain 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 this program. If not, see . + +// If you feel like getting in touch with us, you can do so at + +//! Autogenerated weights for `pallet_collators` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 33.0.0 +//! DATE: 2025-04-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `rust-2`, CPU: `12th Gen Intel(R) Core(TM) i9-12900K` +//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/kilt-parachain +// benchmark +// pallet +// --heap-pages=4096 +// --chain=dev +// --pallet=pallet-collators +// --extrinsic=* +// --header=HEADER-GPL +// --template=.maintain/runtime-weight-template.hbs +// --output=./runtimes/peregrine/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_imports)] +#![allow(clippy::as_conversions)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +// TODO: Remove once the benchmarking stuff fully supports pallet instances. +use pallet_membership as pallet_collators; + +/// Weight functions for `pallet_collators`. +pub struct WeightInfo(PhantomData); +impl pallet_collators::WeightInfo for WeightInfo { + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// The range of component `m` is `[1, 31]`. + fn add_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `170 + m * (32 ±0)` + // Estimated: `2510` + // Minimum execution time: 4_812_000 picoseconds. + Weight::from_parts(5_223_134, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 771 + .saturating_add(Weight::from_parts(16_478, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:0) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[2, 32]`. + fn remove_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_159_000 picoseconds. + Weight::from_parts(6_682_650, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 725 + .saturating_add(Weight::from_parts(15_110, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:0) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[2, 32]`. + fn swap_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_279_000 picoseconds. + Weight::from_parts(6_612_007, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 980 + .saturating_add(Weight::from_parts(26_782, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:0) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn reset_member(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_318_000 picoseconds. + Weight::from_parts(6_828_217, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 932 + .saturating_add(Weight::from_parts(72_412, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:1) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:1 w:1) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn change_key(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `222 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 6_538_000 picoseconds. + Weight::from_parts(7_074_832, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 891 + .saturating_add(Weight::from_parts(18_976, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Members` (r:1 w:0) + /// Proof: `Collators::Members` (`max_values`: Some(1), `max_size`: Some(1025), added: 1520, mode: `MaxEncodedLen`) + /// Storage: `Collators::Prime` (r:0 w:1) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn set_prime(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `170 + m * (32 ±0)` + // Estimated: `2510 + m * (32 ±0)` + // Minimum execution time: 3_643_000 picoseconds. + Weight::from_parts(4_129_209, 0) + .saturating_add(Weight::from_parts(0, 2510)) + // Standard Error: 497 + .saturating_add(Weight::from_parts(4_023, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `Collators::Prime` (r:0 w:1) + /// Proof: `Collators::Prime` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// Proof: UNKNOWN KEY `0xdfe4dad7b89644d5962c7bb034ca6f7bb10896c85af113f86bae1ab193a37922` (r:0 w:1) + /// The range of component `m` is `[1, 32]`. + fn clear_prime(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_096_000 picoseconds. + Weight::from_parts(1_229_794, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 94 + .saturating_add(Weight::from_parts(35, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().writes(2)) + } +} + +#[cfg(test)] +mod tests { + #[test] + fn test_add_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_remove_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_swap_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_reset_member() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_change_key() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } + #[test] + fn test_set_prime() { + assert!( + ::BlockWeights::get() + .per_class + .get(frame_support::dispatch::DispatchClass::Normal) + .max_extrinsic + .unwrap_or_else(::max_value) + .proof_size() + > 2510 + ); + } +} diff --git a/scripts/run_benches_for_runtime.sh b/scripts/run_benches_for_runtime.sh index 7720f9913..0e43280b4 100755 --- a/scripts/run_benches_for_runtime.sh +++ b/scripts/run_benches_for_runtime.sh @@ -45,6 +45,7 @@ pallets=( # `pallet-membership` instances pallet-membership pallet-technical-membership + pallet-collators # `pallet-collective` instances pallet-collective pallet-technical-committee-collective