From 2152348f35a8edd2ee800d83b4a77b6ff946a1cb Mon Sep 17 00:00:00 2001 From: librelois <c@elo.tf> Date: Sat, 4 Jun 2022 17:11:02 +0200 Subject: [PATCH] =?UTF-8?q?fix(wot):=C2=A0membership=20expiration=20should?= =?UTF-8?q?=20trigger=20idty=20removal=20for=20main=20wot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/duniter-wot/src/lib.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pallets/duniter-wot/src/lib.rs b/pallets/duniter-wot/src/lib.rs index eda6693c7..c41cd1dc1 100644 --- a/pallets/duniter-wot/src/lib.rs +++ b/pallets/duniter-wot/src/lib.rs @@ -220,8 +220,25 @@ where WotDiffs::<T, I>::append(WotDiff::AddNode(*idty_index)); } } - sp_membership::Event::<IdtyIndex, MetaData>::MembershipExpired(idty_index) - | sp_membership::Event::<IdtyIndex, MetaData>::MembershipRevoked(idty_index) => { + // Membership expiration cases: + // Triggered by the membership pallet: we should remove the identity only for the main + // wot + sp_membership::Event::<IdtyIndex, MetaData>::MembershipExpired(idty_index) => { + if !T::IsSubWot::get() { + Self::dispath_idty_call(pallet_identity::Call::remove_identity { + idty_index: *idty_index, + idty_name: None, + }); + WotDiffs::<T, I>::append(WotDiff::DisableNode(*idty_index)); + } + } + // Membership revocation cases: + // - Triggered by identity removal: the identity underlying will by removed by the + // caller. + // - Triggered by the membership pallet: it's ondly possible for the sub-wot, so we + // should not remove the underlying identity + // So, in any case, we must do nothing + sp_membership::Event::<IdtyIndex, MetaData>::MembershipRevoked(idty_index) => { if !T::IsSubWot::get() { WotDiffs::<T, I>::append(WotDiff::DisableNode(*idty_index)); } -- GitLab