From 67513a9adb5053a878ed0d04efcca3c2fa9bb856 Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Sat, 27 Jun 2020 01:37:45 +1200 Subject: [PATCH] Implement Contains for pallet-membership (#6518) * implement Contains for pallet-membership * bump version --- bin/node/runtime/src/lib.rs | 2 +- frame/membership/src/lib.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index e3c9c2b95f0bd..c5c11fe577a3f 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -98,7 +98,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. spec_version: 254, - impl_version: 0, + impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; diff --git a/frame/membership/src/lib.rs b/frame/membership/src/lib.rs index 71b09028380dd..c8563b52f81f9 100644 --- a/frame/membership/src/lib.rs +++ b/frame/membership/src/lib.rs @@ -26,7 +26,7 @@ use sp_std::prelude::*; use frame_support::{ decl_module, decl_storage, decl_event, decl_error, - traits::{ChangeMembers, InitializeMembers, EnsureOrigin}, + traits::{ChangeMembers, InitializeMembers, EnsureOrigin, Contains}, }; use frame_system::{self as system, ensure_signed}; @@ -264,6 +264,16 @@ impl, I: Instance> Module { } } +impl, I: Instance> Contains for Module { + fn sorted_members() -> Vec { + Self::members() + } + + fn count() -> usize { + Members::::decode_len().unwrap_or(0) + } +} + #[cfg(test)] mod tests { use super::*;