Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- PAH: filter `staking.reap_stash` from both `BaseCallFilter` and the XCM `SafeCallFilter` while the validator self-stake transition to higher bond. See Ref: [#1890](https://polkadot.subsquare.io/referenda/1890) ([#1159](https://github.com/polkadot-fellows/runtimes/pull/1159))
- Collectives Polkadot: Increase the Secretary Collective salary budget ([#1172](https://github.com/polkadot-fellows/runtimes/pull/1172))
- Align all runtimes to use the same values for e.g. `TransactionByteFee` and some other clean ups. ([#1175](https://github.com/polkadot-fellows/runtimes/pull/1175))
- Flexible minimum validator set size on rc ([#PR1193](https://github.com/polkadot-fellows/runtimes/pull/1193))


## [2.2.2] 23.04.2026

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,15 @@ pub mod dynamic_params {
#[codec(index = 1)]
pub static BurnDestination: BurnDestinationAccount = Default::default();
}

/// Parameters used by `pallet-staking-async-ah-client`.
#[dynamic_pallet_params]
#[codec(index = 2)]
pub mod ah_client {
/// Minimum size of the validator set that the relay chain will accept from Asset Hub.
#[codec(index = 0)]
pub static MinimumValidatorSetSize: u32 = 100;
Comment thread
muharem marked this conversation as resolved.
}
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -822,6 +831,12 @@ impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParamet
Inflation(_) => frame_system::ensure_root(origin.clone()),
Treasury(_) =>
EitherOf::<EnsureRoot<AccountId>, GeneralAdmin>::ensure_origin(origin.clone()),
AhClient(_) => EitherOfDiverse::<
// either local root or StakingAdmin, or same from OpenGov on AH
EitherOf<EnsureRoot<AccountId>, StakingAdmin>,
EnsureXcm<IsVoiceOfBody<AssetHubLocation, StakingAdminBodyId>>,
>::ensure_origin(origin.clone())
.map(|_success| ()),
}
.map_err(|_| origin)
}
Expand Down Expand Up @@ -1760,8 +1775,6 @@ impl pallet_nomination_pools::Config for Runtime {
parameter_types! {
pub const DelegatedStakingPalletId: PalletId = PalletId(*b"py/dlstk");
pub const SlashRewardFraction: Perbill = Perbill::from_percent(1);
// Kusama always wants 1000 validators, we reject anything smaller than that.
pub storage MinimumValidatorSetSize: u32 = 1000;
}

impl pallet_delegated_staking::Config for Runtime {
Expand All @@ -1782,7 +1795,7 @@ impl pallet_staking_async_ah_client::Config for Runtime {
type AdminOrigin = EnsureRoot<AccountId>;
type SessionInterface = Session;
type SendToAssetHub = StakingXcmToAssetHub;
type MinimumValidatorSetSize = MinimumValidatorSetSize;
type MinimumValidatorSetSize = dynamic_params::ah_client::MinimumValidatorSetSize;
type UnixTime = Timestamp;
type PointsPerBlock = ConstU32<20>;
type MaxOffenceBatchSize = ConstU32<32>;
Expand Down
4 changes: 4 additions & 0 deletions relay/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pallet-multisig = { workspace = true }
pallet-nomination-pools = { workspace = true }
pallet-nomination-pools-runtime-api = { workspace = true }
pallet-offences = { workspace = true }
pallet-parameters = { workspace = true }
pallet-preimage = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
Expand Down Expand Up @@ -180,6 +181,7 @@ std = [
"pallet-nomination-pools/std",
"pallet-offences-benchmarking?/std",
"pallet-offences/std",
"pallet-parameters/std",
"pallet-preimage/std",
"pallet-proxy/std",
"pallet-referenda/std",
Expand Down Expand Up @@ -264,6 +266,7 @@ runtime-benchmarks = [
"pallet-nomination-pools/runtime-benchmarks",
"pallet-offences-benchmarking/runtime-benchmarks",
"pallet-offences/runtime-benchmarks",
"pallet-parameters/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
Expand Down Expand Up @@ -326,6 +329,7 @@ try-runtime = [
"pallet-multisig/try-runtime",
"pallet-nomination-pools/try-runtime",
"pallet-offences/try-runtime",
"pallet-parameters/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
"pallet-referenda/try-runtime",
Expand Down
76 changes: 70 additions & 6 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ use frame_election_provider_support::{
};
use frame_support::{
construct_runtime,
dynamic_params::{dynamic_pallet_params, dynamic_params},
genesis_builder_helper::{build_state, get_preset},
parameter_types,
traits::{
fungible::HoldConsideration,
tokens::{imbalance::ResolveTo, UnityOrOuterConversion},
ConstU32, ConstU8, ConstUint, Contains, EitherOf, EitherOfDiverse, FromContains, Get,
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
ProcessMessageError, WithdrawReasons,
ConstU32, ConstU8, ConstUint, Contains, EitherOf, EitherOfDiverse, EnsureOrigin,
EnsureOriginWithArg, FromContains, Get, InstanceFilter, KeyOwnerProofSystem,
LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons,
},
weights::{
constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIME_PER_MICROS},
Expand Down Expand Up @@ -1601,16 +1602,75 @@ impl pallet_delegated_staking::Config for Runtime {
type CoreStaking = Staking;
}

/// Dynamic params that can be adjusted at runtime.
#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::<Runtime>)]
pub mod dynamic_params {
use super::*;

/// Parameters used by `pallet-staking-async-ah-client`.
#[dynamic_pallet_params]
#[codec(index = 0)]
pub mod ah_client {
/// Minimum size of the validator set that the relay chain will accept from Asset Hub.
#[codec(index = 0)]
pub static MinimumValidatorSetSize: u32 = 250;
}
}

#[cfg(feature = "runtime-benchmarks")]
impl Default for RuntimeParameters {
fn default() -> Self {
RuntimeParameters::AhClient(dynamic_params::ah_client::Parameters::MinimumValidatorSetSize(
dynamic_params::ah_client::MinimumValidatorSetSize,
Some(250),
))
}
}

/// Defines what origin can modify which dynamic parameters.
pub struct DynamicParameterOrigin;
impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParameterOrigin {
type Success = ();

fn try_origin(
origin: RuntimeOrigin,
key: &RuntimeParametersKey,
) -> Result<Self::Success, RuntimeOrigin> {
use crate::RuntimeParametersKey::*;

match key {
AhClient(_) => EitherOfDiverse::<
// either local root or StakingAdmin, or same from OpenGov on AH
EitherOf<EnsureRoot<AccountId>, StakingAdmin>,
EnsureXcm<IsVoiceOfBody<AssetHubLocation, StakingAdminBodyId>>,
>::ensure_origin(origin.clone())
.map(|_success| ()),
}
.map_err(|_| origin)
}

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin(_key: &RuntimeParametersKey) -> Result<RuntimeOrigin, ()> {
// Provide the origin for the parameter returned by `Default`:
Ok(RuntimeOrigin::root())
}
}

impl pallet_parameters::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeParameters = RuntimeParameters;
type AdminOrigin = DynamicParameterOrigin;
type WeightInfo = weights::pallet_parameters::WeightInfo<Runtime>;
}

impl ah_client::Config for Runtime {
type CurrencyBalance = Balance;
type AssetHubOrigin =
frame_support::traits::EitherOfDiverse<EnsureRoot<AccountId>, EnsureAssetHub>;
type AdminOrigin = EnsureRoot<AccountId>;
type SessionInterface = Session;
type SendToAssetHub = StakingXcmToAssetHub;
// Polkadot RC currently has 600 validators. Note: this has to be updated with AH validator
// count increasing.
type MinimumValidatorSetSize = ConstU32<600>;
type MinimumValidatorSetSize = dynamic_params::ah_client::MinimumValidatorSetSize;
type UnixTime = Timestamp;
type PointsPerBlock = ConstU32<20>;
type MaxOffenceBatchSize = ConstU32<32>;
Expand Down Expand Up @@ -1844,6 +1904,9 @@ construct_runtime! {
DelegatedStaking: pallet_delegated_staking = 41,
StakingAhClient: pallet_staking_async_ah_client = 42,

// Dynamic, configurable parameters.
Parameters: pallet_parameters = 46,

// Parachains pallets. Start indices at 50 to leave room.
ParachainsOrigin: parachains_origin = 50,
Configuration: parachains_configuration = 51,
Expand Down Expand Up @@ -1999,6 +2062,7 @@ mod benches {
[pallet_multisig, Multisig]
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
[pallet_offences, OffencesBench::<Runtime>]
[pallet_parameters, Parameters]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
Expand Down
1 change: 1 addition & 0 deletions relay/polkadot/src/weights/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions relay/polkadot/src/weights/pallet_parameters.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading