Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Implement Contains for pallet-membership (#6518)
Browse files Browse the repository at this point in the history
* implement Contains for pallet-membership

* bump version
  • Loading branch information
xlc authored Jun 26, 2020
1 parent 4cc4b76 commit 67513a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
12 changes: 11 additions & 1 deletion frame/membership/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -264,6 +264,16 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
}
}

impl<T: Trait<I>, I: Instance> Contains<T::AccountId> for Module<T, I> {
fn sorted_members() -> Vec<T::AccountId> {
Self::members()
}

fn count() -> usize {
Members::<T, I>::decode_len().unwrap_or(0)
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 67513a9

Please sign in to comment.