From bbd4f053067d59df19f6d1e6b45acb99f2d7267a Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Wed, 27 Dec 2023 20:36:51 +0100
Subject: [PATCH] refac(smith-members): authority-members OnBlacklistedMember
 is no more used

---
 pallets/authority-members/src/impls.rs  |  2 --
 pallets/authority-members/src/lib.rs    |  1 -
 pallets/authority-members/src/mock.rs   |  1 -
 pallets/authority-members/src/traits.rs |  9 ---------
 pallets/distance/src/mock.rs            |  1 -
 pallets/smith-members/src/impls.rs      | 12 ------------
 pallets/smith-members/src/lib.rs        |  9 ---------
 runtime/common/src/pallets_config.rs    |  1 -
 8 files changed, 36 deletions(-)

diff --git a/pallets/authority-members/src/impls.rs b/pallets/authority-members/src/impls.rs
index 33b51a286..d656f01e6 100644
--- a/pallets/authority-members/src/impls.rs
+++ b/pallets/authority-members/src/impls.rs
@@ -23,7 +23,6 @@
 #![allow(clippy::type_complexity)]
 
 use super::pallet::*;
-use crate::OnBlacklistedMember;
 use frame_support::pallet_prelude::Weight;
 use frame_support::traits::Get;
 use pallet_offences::traits::OnOffenceHandler;
@@ -55,7 +54,6 @@ where
             SlashStrategy::Blacklist => {
                 for offender in offenders {
                     if let Some(member_id) = T::MemberIdOf::convert(offender.offender.0.clone()) {
-                        T::OnBlacklistedMember::on_blacklisted_member(member_id);
                         Blacklist::<T>::mutate(|blacklist| {
                             if !blacklist.contains(&member_id) {
                                 blacklist.push(member_id);
diff --git a/pallets/authority-members/src/lib.rs b/pallets/authority-members/src/lib.rs
index 006dd1bb0..0a19ac2ea 100644
--- a/pallets/authority-members/src/lib.rs
+++ b/pallets/authority-members/src/lib.rs
@@ -71,7 +71,6 @@ pub mod pallet {
         type OnNewSession: OnNewSession;
         type OnOutgoingMember: OnOutgoingMember<Self::MemberId>;
         type OnIncomingMember: OnIncomingMember<Self::MemberId>;
-        type OnBlacklistedMember: OnBlacklistedMember<Self::MemberId>;
         /// Max number of authorities allowed
         #[pallet::constant]
         type MaxAuthorities: Get<u32>;
diff --git a/pallets/authority-members/src/mock.rs b/pallets/authority-members/src/mock.rs
index d5be56ef9..4c818534a 100644
--- a/pallets/authority-members/src/mock.rs
+++ b/pallets/authority-members/src/mock.rs
@@ -159,7 +159,6 @@ impl pallet_authority_members::Config for Test {
     type RemoveMemberOrigin = system::EnsureRoot<u64>;
     type RuntimeEvent = RuntimeEvent;
     type WeightInfo = ();
-    type OnBlacklistedMember = ();
     type OnIncomingMember = ();
     type OnOutgoingMember = ();
 }
diff --git a/pallets/authority-members/src/traits.rs b/pallets/authority-members/src/traits.rs
index 2b1331e4e..2bb98f77d 100644
--- a/pallets/authority-members/src/traits.rs
+++ b/pallets/authority-members/src/traits.rs
@@ -24,15 +24,6 @@ impl OnNewSession for () {
     fn on_new_session(_: SessionIndex) {}
 }
 
-/// Handle the consequences of a blacklisting for other pallets
-pub trait OnBlacklistedMember<MemberId> {
-    fn on_blacklisted_member(member_id: MemberId);
-}
-/// By default: no consequences
-impl<MemberId> OnBlacklistedMember<MemberId> for () {
-    fn on_blacklisted_member(_: MemberId) {}
-}
-
 /// Handle the consequences of going in the authority set for other pallets.
 /// Typically, a smith won't expire as long as he is in the authority set.
 pub trait OnIncomingMember<MemberId> {
diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs
index 9c181921e..dbcf9a811 100644
--- a/pallets/distance/src/mock.rs
+++ b/pallets/distance/src/mock.rs
@@ -190,7 +190,6 @@ impl pallet_authority_members::Config for Test {
     type WeightInfo = ();
     type OnOutgoingMember = ();
     type OnIncomingMember = ();
-    type OnBlacklistedMember = ();
 }
 
 parameter_types! {
diff --git a/pallets/smith-members/src/impls.rs b/pallets/smith-members/src/impls.rs
index 7384ec421..a8c0ee3fb 100644
--- a/pallets/smith-members/src/impls.rs
+++ b/pallets/smith-members/src/impls.rs
@@ -5,18 +5,6 @@ use pallet_identity::IdtyEvent;
 use sp_runtime::traits::Convert;
 
 // TODO: /// or //! ?
-/// We want to remove a Smith when he is removed (blacklisted) from the higher level set of "authorities".
-/// A blacklisting means the user does not respect the operational conditions for an authority, so
-/// he does not deserve the Smith role.
-impl<T: Config> pallet_authority_members::OnBlacklistedMember<T::MemberId> for Pallet<T> {
-    fn on_blacklisted_member(member_id: T::MemberId) {
-        Pallet::<T>::smith_goes_blacklisted(
-            T::IdtyIdOfAuthorityId::convert(member_id).expect("convertion should be ok"),
-        );
-    }
-}
-
-///
 impl<T: Config> pallet_authority_members::OnOutgoingMember<T::MemberId> for Pallet<T> {
     fn on_outgoing_member(member_id: T::MemberId) {
         Pallet::<T>::smith_goes_offline(
diff --git a/pallets/smith-members/src/lib.rs b/pallets/smith-members/src/lib.rs
index 66ab569c5..f65e3cf4d 100644
--- a/pallets/smith-members/src/lib.rs
+++ b/pallets/smith-members/src/lib.rs
@@ -531,15 +531,6 @@ impl<T: Config> Pallet<T> {
         }
     }
 
-    // TODO: return what?
-    fn smith_goes_blacklisted(_idty_index: T::IdtyIndex) {
-        // TODO: for now, just let smith_goes_offline do the job
-        // if let Some(_) = Smiths::<T>::get(idty_index) {
-        //     Smiths::<T>::remove(idty_index);
-        //     T::OnSmithDelete::on_smith_delete(idty_index, SmithRemovalReason::Blacklisted);
-        // }
-    }
-
     fn provide_is_member(idty_id: &T::IdtyIndex) -> bool {
         let Some(smith) = Smiths::<T>::get(idty_id) else {
             return false;
diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs
index d06f97da0..bd0986770 100644
--- a/runtime/common/src/pallets_config.rs
+++ b/runtime/common/src/pallets_config.rs
@@ -240,7 +240,6 @@ macro_rules! pallets_config {
             type MaxAuthorities = MaxAuthorities;
             type RemoveMemberOrigin = EnsureRoot<Self::AccountId>;
 			type WeightInfo = common_runtime::weights::pallet_authority_members::WeightInfo<Runtime>;
-            type OnBlacklistedMember = SmithMembers;
             type OnIncomingMember = SmithMembers;
             type OnOutgoingMember = SmithMembers;
         }
-- 
GitLab