diff --git a/pallets/shards/src/lib.rs b/pallets/shards/src/lib.rs index df7404903..0e7a38e33 100644 --- a/pallets/shards/src/lib.rs +++ b/pallets/shards/src/lib.rs @@ -514,44 +514,6 @@ pub mod pallet { _ => (), } } - /// Handles shard state adjustments when a member goes offline. - /// - /// # Flow - /// 1. Retrieves the `shard_id` associated with the member `id`. - /// 2. Retrieves the current `old_status`, `shard_threshold`, and `members_online` count. - /// 3. Decrements the count of online members [`ShardMembersOnline`]. - /// 4. Determines the new_status of the shard based on the conditions: - /// - If transitioning to `Offline` and not previously `Offline`, calls `Function::remove_shard_offline`. - /// - Updates [`ShardState`] with the new new_status. - /// 5. Returns the weight of the operation as specified by `::WeightInfo::member_offline()`. - fn member_offline(id: &AccountId, _: NetworkId) { - let Some(shard_id) = MemberShard::::get(id) else { return }; - let Some(old_status) = ShardState::::get(shard_id) else { return }; - let Some(shard_threshold) = ShardThreshold::::get(shard_id) else { return }; - let mut members_online = ShardMembersOnline::::get(shard_id); - members_online = members_online.saturating_less_one(); - ShardMembersOnline::::insert(shard_id, members_online); - let new_status = match old_status { - // if a member goes offline before the group key is submitted, - // then the shard will never go online - ShardStatus::Created | ShardStatus::Committed => ShardStatus::Offline, - ShardStatus::Online => { - if members_online < shard_threshold { - ShardStatus::Offline - } else { - ShardStatus::Online - } - }, - _ => old_status, - }; - if matches!(new_status, ShardStatus::Offline) - && !matches!(old_status, ShardStatus::Offline) - { - Self::remove_shard_offline(shard_id); - } else if !matches!(new_status, ShardStatus::Offline) { - ShardState::::insert(shard_id, new_status); - } - } fn members_offline(members: Vec) { let mut shard_updates: BTreeMap)> = BTreeMap::new(); diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 6aa2f364e..255685151 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -183,7 +183,6 @@ pub trait ElectionsInterface { pub trait ShardsInterface { fn member_online(id: &AccountId, network: NetworkId); - fn member_offline(id: &AccountId, network: NetworkId); fn members_offline(members: Vec); fn is_shard_online(shard_id: ShardId) -> bool; fn is_shard_member(account: &AccountId) -> bool;