Skip to content

Commit

Permalink
Merge pull request autonomys#3294 from autonomys/remove_slashed_opera…
Browse files Browse the repository at this point in the history
…tor_from_current_set

Domains: Remove slashed operator from current set and adjust domain total stake when marked slashed
  • Loading branch information
vedhavyas authored Dec 9, 2024
2 parents e4a1210 + 5ad3ad6 commit 466e3bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/pallet-domains/src/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1367,9 +1367,14 @@ pub(crate) fn do_mark_operators_as_slashed<T: Config>(
.as_mut()
.ok_or(Error::DomainNotInitialized)?;

// slash and remove operator from next epoch set
// slash and remove operator from next and current epoch set
operator.update_status(OperatorStatus::Slashed);
stake_summary.current_operators.remove(operator_id);
stake_summary.next_operators.remove(operator_id);
stake_summary.current_total_stake = stake_summary
.current_total_stake
.checked_sub(&operator.current_total_stake)
.ok_or(Error::BalanceUnderflow)?;

pending_slashes.insert(*operator_id);
PendingSlashes::<T>::insert(operator.current_domain_id, pending_slashes);
Expand Down

0 comments on commit 466e3bd

Please sign in to comment.