From e9a58b51b5eb69ec4d5d1174e9fda6b8dc934603 Mon Sep 17 00:00:00 2001 From: linning Date: Sat, 9 Dec 2023 03:16:29 +0800 Subject: [PATCH] Skip operator in do_slash_operators if it is not found Signed-off-by: linning --- crates/pallet-domains/src/staking.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/pallet-domains/src/staking.rs b/crates/pallet-domains/src/staking.rs index 6e806b6065..cc482bd08b 100644 --- a/crates/pallet-domains/src/staking.rs +++ b/crates/pallet-domains/src/staking.rs @@ -552,7 +552,13 @@ where { for (operator_id, reason) in operator_ids { Operators::::try_mutate(operator_id, |maybe_operator| { - let operator = maybe_operator.as_mut().ok_or(Error::UnknownOperator)?; + let operator = match maybe_operator.as_mut() { + // If the operator is already slashed and removed due to fraud proof, when the operator + // is slash again due to invalid bundle, which happen after the ER is confirmed, we can + // not find the operator here thus just return. + None => return Ok(()), + Some(operator) => operator, + }; let mut pending_slashes = PendingSlashes::::get(operator.current_domain_id).unwrap_or_default();