-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
staking: add manual_slash
extrinsic
#7805
base: master
Are you sure you want to change the base?
Conversation
All GitHub workflows were cancelled due to failure one of the required jobs. |
/// will be applied. | ||
/// - The slash will be deferred by `SlashDeferDuration` eras before being enacted. | ||
#[pallet::call_index(33)] | ||
#[pallet::weight(T::WeightInfo::force_unstake(1))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
There was a problem hiding this 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.
@@ -2639,5 +2639,63 @@ pub mod pallet { | |||
|
|||
Ok(()) | |||
} | |||
|
|||
/// This function allows governance to manually slash of a validator and is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This function allows governance to manually slash of a validator and is a | |
/// This function allows governance to manually slash a validator and is a |
|
||
// Check era is valid | ||
let current_era = CurrentEra::<T>::get().ok_or(Error::<T>::InvalidEraToReward)?; | ||
let history_depth = T::HistoryDepth::get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a point to check if validator_stash
was in the active set during era
or this is performed later when handling the offence?
This PR adds a convenience extrinsic
manual_slash
for the governance to slash a validator manually.Changes
on_offence
implementation for the Staking pallet accepts a slice ofOffenceDetails
including the full validator exposure, however, it simply ignores that part. I've extracted the functionality into an inherenton_offence
method that takesOffenceDetails
without the full exposure and this is called directly inmanual_slash
manual_slash
creates an offence for a validator with a given slash percentangeQuestions
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