Skip to content

staking: add manual_slash extrinsic#7805

Merged
ordian merged 13 commits intomasterfrom
ao-governance-manual-slash
Mar 13, 2025
Merged

staking: add manual_slash extrinsic#7805
ordian merged 13 commits intomasterfrom
ao-governance-manual-slash

Conversation

@ordian
Copy link
Copy Markdown
Contributor

@ordian ordian commented Mar 5, 2025

This PR adds a convenience extrinsic manual_slash for the governance to slash a validator manually.

Changes

  • The on_offence implementation for the Staking pallet accepts a slice of OffenceDetails including the full validator exposure, however, it simply ignores that part. I've extracted the functionality into an inherent on_offence method that takes OffenceDetails without the full exposure and this is called directly in manual_slash
  • manual_slash creates an offence for a validator with a given slash percentange

Questions

  • should manual_slash accept session instead of an era when the validator was in the active set? staking thinks in terms of eras and we can check out of bounds this way, which is why it was chosen for this implementation, but if there are arguments against, happy to change to session index
  • should the accepted origin be something more than just root? Changed to T::AdminOrigin to align with cancel_deferred_slash
  • should I adapt this PR also against [DNM] Add AH-next runtime - the post-migration Asset Hub runtime #6996? looking at the changes, it should apply mostly without conflicts

@ordian ordian requested review from Ank4n and tdimitrov March 5, 2025 08:03
@ordian ordian added T1-FRAME This PR/Issue is related to core FRAME, the framework. T8-polkadot This PR/Issue is related to/affects the Polkadot network. labels Mar 5, 2025
Copy link
Copy Markdown
Contributor

@tdimitrov tdimitrov left a comment

Choose a reason for hiding this comment

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

Looks good. Approving modulo the question I've left and your todo.

My view on the questions in the PR description:

should manual_slash accept session instead of an era when the validator was in the active set?

I can't think about a case when we want to slash at a particular session so I'd say this is good.

should the accepted origin be something more than just root?

Maybe we might want to apply a manual slash from AH via XCM, but I wouldn't worry about this right now. I think it's good as it is.

should I adapt this PR also against #6996?

@Ank4n and @kianenigma are doing a lot of changes to the staking pallet here which will be merged in master. I think having your PR merged in master is enough.

ordian and others added 5 commits March 6, 2025 10:36
* master:
  pallet-scheduler: Put back postponed tasks into the agenda (#7790)
  ci: update credentials for command-backport (#7798)
  [XCM] add generic location to account converter that also works with external ecosystems (#7313)
  [AHM] Make more stuff public (#7802)
  Support adding extra request-response protocols to the node (#7708)
  notifications/tests: Fix tests to avoid overflow on adding duration to instant (#7793)
  pallet revive: rpc build script should not panic (#7786)
  pallet-bridge-relayers - migrate benchmarks to v2 (#7531)
@paritytech-workflow-stopper
Copy link
Copy Markdown

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

@ordian ordian enabled auto-merge March 12, 2025 03:19
ordian added 2 commits March 13, 2025 03:43
* master:
  Remove execute_with_origin implementation in the XCM executor (#7889)
  [staking] Currency Migration and Overstake fix (#7763)
  fix westend try-state CI (#7895)
@ordian ordian added this pull request to the merge queue Mar 13, 2025
Merged via the queue into master with commit f8c90b2 Mar 13, 2025
223 of 243 checks passed
@ordian ordian deleted the ao-governance-manual-slash branch March 13, 2025 04:12
ordian added a commit that referenced this pull request Mar 17, 2025
* origin: (325 commits)
  Add an extra_constant to pallet-treasury (#7918)
  Bump the ci_dependencies group across 1 directory with 4 updates (#7855)
  remove compromised action (#7934)
  Fixing token-economics dead link (#5302)
  [pallet-revive] Fix pallet-revive-fixtures build.rs (#7928)
  cumulus: fix pov exporter format (#7923)
  sp-api: Support `mut` in `impl_runtime_apis!` (#7924)
  Remove clones from block seal function (#7917)
  [pallet-revive] precompiles 2->9 (#7810)
  Use non-native token to benchmark xcm on asset hub (#7893)
  [CI] bump timeout wait for build in zombienet workflows. (#7871)
  taplo: split long array line to multiline array (#7905)
  [pallet-revive] fixture as dev dep (#7844)
  notifications/libp2p: Punish notification protocol misbehavior on outbound substreams (#7781)
  [Release|CI/CD] Update version of the cache action in the Publish docker ci (#7892)
  Remove `pallet::getter` usage from bridges/modules (#7120)
  [pallet-revive] Support blocktag in eth_getLogs RPC (#7879)
  Improve error message in benchmark macro (#7873)
  staking: add `manual_slash` extrinsic (#7805)
  Remove execute_with_origin implementation in the XCM executor (#7889)
  ...
alindima pushed a commit that referenced this pull request Apr 8, 2025
This PR adds a convenience extrinsic `manual_slash` for the governance
to slash a validator manually.

## Changes

* The `on_offence` implementation for the Staking pallet accepts a slice
of `OffenceDetails` including the full validator exposure, however, it
simply
[ignores](https://github.com/paritytech/polkadot-sdk/blob/c8d33396345237c1864dfc0a9b2172b7dfe7ac8f/substrate/frame/staking/src/pallet/impls.rs#L1864)
that part. I've extracted the functionality into an inherent
`on_offence` method that takes `OffenceDetails` without the full
exposure and this is called directly in `manual_slash`
* `manual_slash` creates an offence for a validator with a given slash
percentange

## Questions

- [x] should `manual_slash` accept session instead of an era when the
validator was in the active set? staking thinks in terms of eras and we
can check out of bounds this way, which is why it was chosen for this
implementation, but if there are arguments against, happy to change to
session index
- [X] should the accepted origin be something more than just root?
Changed to `T::AdminOrigin` to align with `cancel_deferred_slash`
- [X] should I adapt this PR also against
#6996? looking at the
changes, it should apply mostly without conflicts

---------

Co-authored-by: Tsvetomir Dimitrov <[email protected]>
Co-authored-by: Ankan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T1-FRAME This PR/Issue is related to core FRAME, the framework. T8-polkadot This PR/Issue is related to/affects the Polkadot network.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants