Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 2 additions & 1 deletion Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ parameter_types! {
pub const RelaySessionDuration: BlockNumber = 1 * HOURS;
// 2 eras for unbonding (12 hours).
pub const BondingDuration: sp_staking::EraIndex = 2;
// Nominators can unbond faster when not slashable (2 eras = 12 hours).
pub const NominatorFastUnbondDuration: sp_staking::EraIndex = 2;
// 1 era in which slashes can be cancelled (6 hours).
pub const SlashDeferDuration: sp_staking::EraIndex = 1;
pub const MaxControllersInDeprecationBatch: u32 = 751;
Expand All @@ -285,6 +287,7 @@ impl pallet_staking_async::Config for Runtime {
type Reward = ();
type SessionsPerEra = SessionsPerEra;
type BondingDuration = BondingDuration;
type NominatorFastUnbondDuration = NominatorFastUnbondDuration;
type SlashDeferDuration = SlashDeferDuration;
type AdminOrigin = EitherOf<EnsureRoot<AccountId>, StakingAdmin>;
type EraPayout = EraPayout;
Expand Down

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions prdoc/pr_10502.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Allow nominators to be unslashable with configurable fast unbonding

doc:
- audience: Runtime User
description: |
Nominators can now be set as unslashable via runtime configuration. When unslashable,
nominators use a configurable fast unbonding duration instead of the full bonding period.
Validators always use the full bonding duration regardless of this setting.

New config parameter `NominatorFastUnbondDuration` controls the unbonding time for
non-slashable nominators (recommended: 2 eras).

crates:
- name: sp-staking
bump: minor
- name: pallet-staking-async
bump: minor
- name: pallet-nomination-pools
bump: patch
- name: asset-hub-westend-runtime
bump: minor
7 changes: 5 additions & 2 deletions substrate/frame/nomination-pools/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ pub trait StakeStrategy {
/// The type of staking strategy of the current adapter.
fn strategy_type() -> StakeStrategyType;

/// See [`StakingInterface::bonding_duration`].
/// See [`StakingInterface::nominator_bonding_duration`].
///
/// Pool accounts are nominators, so they use the nominator bonding duration which can be
/// shorter than the validator bonding duration when nominators are not slashable.
fn bonding_duration() -> EraIndex {
Self::CoreStaking::bonding_duration()
Self::CoreStaking::nominator_bonding_duration()
}

/// See [`StakingInterface::current_era`].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ pallet-bags-list = { default-features = true, workspace = true }
pallet-balances = { default-features = true, workspace = true }
pallet-delegated-staking = { default-features = true, workspace = true }
pallet-nomination-pools = { default-features = true, workspace = true }
pallet-staking = { default-features = true, workspace = true }
pallet-staking-reward-curve = { default-features = true, workspace = true }
pallet-timestamp = { default-features = true, workspace = true }
pallet-staking-async = { workspace = true, default-features = true }
pallet-staking-async-rc-client = { workspace = true, default-features = true }
pallet-staking-reward-curve = { workspace = true, default-features = true }
pallet-timestamp = { workspace = true, default-features = true }

log = { workspace = true, default-features = true }
sp-tracing = { default-features = true, workspace = true }
Loading
Loading