Skip to content

[Staking] [AHM] Fixes insufficient slashing of nominators (and some other small issues).#8937

Merged
Ank4n merged 13 commits intomasterfrom
ankn/slashing-fixes
Jul 1, 2025
Merged

[Staking] [AHM] Fixes insufficient slashing of nominators (and some other small issues).#8937
Ank4n merged 13 commits intomasterfrom
ankn/slashing-fixes

Conversation

@Ank4n
Copy link
Contributor

@Ank4n Ank4n commented Jun 23, 2025

Changes to pallet-staking-async

Removed

  • Config constant MaxDisabledValidators: This constant was removed since validator disabling logic has been moved to pallet-session, making it redundant in staking-async.
  • Storage DoubleMap NominatorSlashInEra: This was used to track per-era maximum slashes for nominators. It’s no longer required — we now only track the highest slash per validator per era.
  • Call withdraw_overstake: This was a temporary extrinsic meant to fix overstake issues, but with fungible migration of staking funds, this is no longer possible and the extrinsic is obsolete.

Changed

  • Nominator slashing logic: The logic now aggregates slashes from distinct offending validators nominated by a nominator within the same era. For repeated offences by the same validator, only the highest slash fraction is applied. Previously, the pallet applied only the highest slash across all validators, regardless of how many were slashed.

@Ank4n Ank4n requested a review from a team as a code owner June 23, 2025 10:19
@Ank4n Ank4n added R0-no-crate-publish-required The change does not require any crates to be re-published. T2-pallets This PR/Issue is related to a particular pallet. labels Jun 23, 2025
@Ank4n Ank4n changed the title [WIP] Slashing fixes [Staking] [AHM] Fixes insufficient slashing of nominators and some other small issues. Jun 27, 2025
@Ank4n Ank4n removed the R0-no-crate-publish-required The change does not require any crates to be re-published. label Jun 30, 2025
@Ank4n
Copy link
Contributor Author

Ank4n commented Jun 30, 2025

/cmd prdoc --audience runtime_dev

@Ank4n Ank4n changed the title [Staking] [AHM] Fixes insufficient slashing of nominators and some other small issues. [Staking] [AHM] Fixes insufficient slashing of nominators (and some other small issues). Jun 30, 2025
@Ank4n Ank4n requested review from kianenigma and sigurpol June 30, 2025 08:55
Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes and the test looks good, I will approve once I learn more about the motivation behind slashing change.

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/15994150373
Failed job name: fmt

Copy link
Contributor

@sigurpol sigurpol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with all the slashing magic, but the changes and tests make sense to me, so I give a weak approval 😄

@Ank4n Ank4n added this pull request to the merge queue Jul 1, 2025
Merged via the queue into master with commit 8546b7a Jul 1, 2025
313 of 318 checks passed
@Ank4n Ank4n deleted the ankn/slashing-fixes branch July 1, 2025 15:42
ordian added a commit that referenced this pull request Jul 24, 2025
* master: (91 commits)
  Add extra information to the harmless error logs during validate_transaction (#9047)
  `sp-tracing`: Remove `test-utils` feature (#9063)
  add try-state check for staking roles -- staker cannot be nominator a… (#9034)
  net/discovery: File persistence for `AddrCache` (#8839)
  dispute-coordinator: handle race with offchain disabling (#9050)
  Align parameters for `EventEmitter::emit_sent_event` (#9057)
  Fetch parent block `api_version` (#9059)
  [XCM Precompile] Rename functions and improve docs in the Solidity interface (#9023)
  Cleanup and improvements for `ControlledValidatorIndices` (#8896)
  reenable 0001-parachains-pvf (#9046)
  Add optional auto-rebag within on-idle (#8684)
  Fix flaxy 0003-block-building-warp-sync test - one more approach (#8974)
  [Staking] [AHM] Fixes insufficient slashing of nominators (and some other small issues). (#8937)
  chore: Bump bounded-collections dep (#9004)
  XCMP and DMP improvements (#8860)
  EPMB/unsigned: fixed multi-page winner computation (#8987)
  Always send full parent header, not only hash, part of collation response (#8939)
  revive: Precompiles should return dummy code when queried (#9001)
  Fix confusing log messages in network protocol behaviour (#8819)
  Fix pallet_migrations benchmark when FailedMigrationHandler emits events (#8694)
  ...
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
…ther small issues). (#8937)

Changes to pallet-staking-async

## Removed
- Config constant `MaxDisabledValidators`: This constant was removed
since validator disabling logic has been moved to pallet-session, making
it redundant in staking-async.
- Storage DoubleMap `NominatorSlashInEra`: This was used to track
per-era maximum slashes for nominators. It’s no longer required — we now
only track the highest slash per validator per era.
- Call `withdraw_overstake`: This was a temporary extrinsic meant to fix
overstake issues, but with fungible migration of staking funds, this is
no longer possible and the extrinsic is obsolete.

## Changed
- Nominator slashing logic: The logic now aggregates slashes from
distinct offending validators nominated by a nominator within the same
era. For repeated offences by the same validator, only the highest slash
fraction is applied. Previously, the pallet applied only the highest
slash across all validators, regardless of how many were slashed.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T2-pallets This PR/Issue is related to a particular pallet.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants