Skip to content
Snippets Groups Projects
Commit fcd17363 authored by Mildred Ki'Lya's avatar Mildred Ki'Lya
Browse files

Remove dead code (MembershipRevokedRecently)

parent d32bcbf4
No related branches found
No related tags found
1 merge request!94Remove RevocationPeriod rule
...@@ -154,13 +154,6 @@ fn test_revoke_smiths_them_rejoin() { ...@@ -154,13 +154,6 @@ fn test_revoke_smiths_them_rejoin() {
Some(4) Some(4)
)); ));
// Dave should not be able to re-request membership before the RevocationPeriod end
run_to_block(3);
assert_noop!(
SmithsMembership::request_membership(Origin::signed(4), ()),
pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently
);
// At block #6, Dave shoud be able to request smith membership // At block #6, Dave shoud be able to request smith membership
run_to_block(6); run_to_block(6);
assert_ok!(SmithsMembership::request_membership(Origin::signed(4), ())); assert_ok!(SmithsMembership::request_membership(Origin::signed(4), ()));
......
...@@ -180,8 +180,6 @@ pub mod pallet { ...@@ -180,8 +180,6 @@ pub mod pallet {
OriginNotAllowedToUseIdty, OriginNotAllowedToUseIdty,
/// Membership request not found /// Membership request not found
MembershipRequestNotFound, MembershipRequestNotFound,
/// Membership revoked recently
MembershipRevokedRecently,
} }
// HOOKS // // HOOKS //
...@@ -292,7 +290,10 @@ pub mod pallet { ...@@ -292,7 +290,10 @@ pub mod pallet {
let idty_id = Self::ensure_origin_and_get_idty_id(origin, maybe_idty_id)?; let idty_id = Self::ensure_origin_and_get_idty_id(origin, maybe_idty_id)?;
// Apply phase // Apply phase
let _ = Self::do_revoke_membership(idty_id); if Self::remove_membership(&idty_id) {
Self::deposit_event(Event::MembershipRevoked(idty_id));
T::OnEvent::on_event(&sp_membership::Event::MembershipRevoked(idty_id));
}
Ok(().into()) Ok(().into())
} }
...@@ -336,14 +337,6 @@ pub mod pallet { ...@@ -336,14 +337,6 @@ pub mod pallet {
Ok(().into()) Ok(().into())
} }
pub(super) fn do_revoke_membership(idty_id: T::IdtyId) -> Weight {
if Self::remove_membership(&idty_id) {
Self::deposit_event(Event::MembershipRevoked(idty_id));
T::OnEvent::on_event(&sp_membership::Event::MembershipRevoked(idty_id));
}
0
}
fn ensure_origin_and_get_idty_id( fn ensure_origin_and_get_idty_id(
origin: OriginFor<T>, origin: OriginFor<T>,
maybe_idty_id: Option<T::IdtyId>, maybe_idty_id: Option<T::IdtyId>,
......
...@@ -113,14 +113,7 @@ fn test_membership_revocation() { ...@@ -113,14 +113,7 @@ fn test_membership_revocation() {
RuntimeEvent::DefaultMembership(Event::MembershipRevoked(0)) RuntimeEvent::DefaultMembership(Event::MembershipRevoked(0))
); );
// Membership 0 can't request membership before the end of RevokePeriod (1 + 4 = 5) // Membership 0 can re-request membership
run_to_block(2);
assert_eq!(
DefaultMembership::request_membership(Origin::signed(0), ()),
Err(Error::<Test, _>::MembershipRevokedRecently.into())
);
// Membership 0 can request membership after the end of RevokePeriod (1 + 4 = 5)
run_to_block(5); run_to_block(5);
assert_ok!(DefaultMembership::request_membership(Origin::signed(0), ()),); assert_ok!(DefaultMembership::request_membership(Origin::signed(0), ()),);
assert_eq!( assert_eq!(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment