Skip to content

Commit

Permalink
remove slashed operator from current set and reduce the operator tota…
Browse files Browse the repository at this point in the history
…l stake from domain total stake
  • Loading branch information
vedhavyas committed Dec 9, 2024
1 parent ac3d5e5 commit 5ad3ad6
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 5ad3ad6

Please sign in to comment.