mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 14:57:56 +00:00
staking: only disable slashed validators and keep them disabled for whole era (#9448)
* session: remove disabled validators threshold logic * staking: add logic to track offending validators * staking: disable validators for the whole era * frame: fix tests * staking: add tests for disabling validators handling * staking: fix adding offending validator when already slashed in era * address review comments * session, staking: add comments about sorted vecs Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -338,7 +338,7 @@ fn session_keys_generate_output_works_as_set_keys_input() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn return_true_if_more_than_third_is_disabled() {
|
||||
fn disable_index_returns_false_if_already_disabled() {
|
||||
new_test_ext().execute_with(|| {
|
||||
set_next_validators(vec![1, 2, 3, 4, 5, 6, 7]);
|
||||
force_new_session();
|
||||
@@ -347,10 +347,9 @@ fn return_true_if_more_than_third_is_disabled() {
|
||||
force_new_session();
|
||||
initialize_block(2);
|
||||
|
||||
assert_eq!(Session::disable_index(0), true);
|
||||
assert_eq!(Session::disable_index(0), false);
|
||||
assert_eq!(Session::disable_index(1), false);
|
||||
assert_eq!(Session::disable_index(2), true);
|
||||
assert_eq!(Session::disable_index(3), true);
|
||||
assert_eq!(Session::disable_index(1), true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user