diff --git a/runtime/parachains/src/util.rs b/runtime/parachains/src/util.rs index f3e5623d7ac5..2e0625f42202 100644 --- a/runtime/parachains/src/util.rs +++ b/runtime/parachains/src/util.rs @@ -43,11 +43,11 @@ pub fn make_persisted_validation_data( /// Take an active subset of a set containing all validators. /// -/// First item in pair will be all items in set have indeces found in the `active` indices set (in +/// First item in pair will be all items in set have indices found in the `active` indices set (in /// the order of the `active` vec, the second item will contain the rest, in the original order. /// /// ```ignore -/// split_active_subset(active.into_iter().collect(), all).0 == take_active_subset(active, all) +/// split_active_subset(active, all).0 == take_active_subset(active, all) /// ``` pub fn split_active_subset(active: &[ValidatorIndex], all: &[T]) -> (Vec, Vec) { let active_set: BTreeSet<_> = active.iter().cloned().collect(); @@ -73,6 +73,10 @@ pub fn split_active_subset(active: &[ValidatorIndex], all: &[T]) -> (V } /// Uses `split_active_subset` and concatenates the inactive to the active vec. +/// +/// ```ignore +/// split_active_subset(active, all)[0..active.len()]) == take_active_subset(active, all) +/// ``` pub fn take_active_subset_and_inactive(active: &[ValidatorIndex], all: &[T]) -> Vec { let (mut a, mut i) = split_active_subset(active, all); a.append(&mut i);