Ensure invulnerables have associated validator keys before they are set (#812)

* Added check to ensure invulnerables have associated validator keys before they are set

* Added check to ensure invulnerables have associated validator keys before they are set

* Update pallets/collator-selection/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Added test for associated validators when setting invulnerables

* FMT

Co-authored-by: Omadoye Abraham <abraham.o@turing.com>
Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
authored and GitHub committed 2022-02-07 16:42:37 +00:00
1 parent b5a268e69b
commit de8462ec2b
2 files changed
+21

No files matched your search

@@ -48,6 +48,16 @@ fn it_should_set_invulnerables() {
CollatorSelection::set_invulnerables(Origin::signed(1), new_set.clone()),
BadOrigin
);
// cannot set invulnerables without associated validator keys
let invulnerables = vec![7];
assert_noop!(
CollatorSelection::set_invulnerables(
Origin::signed(RootAccount::get()),
invulnerables.clone()
),
Error::<Test>::ValidatorNotRegistered
);
});
}