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:
omadoyeabraham
2022-02-07 17:42:37 +01:00
committed by GitHub
parent 93ca4e137e
commit b2f663475f
2 changed files with 21 additions and 0 deletions
+10
View File
@@ -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
);
});
}