Skip to content

Commit

Permalink
Add no current signer guard
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Nov 20, 2024
1 parent 78a8190 commit d28c607
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pallets/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,11 @@ pub mod pallet {
return Ok(weight);
}

// Network not jumpstarted
if current_signers_length == 0 {
return Ok(weight);
}

let mut new_signers: Vec<Vec<u8>> = vec![];
let mut count = 0u32;
let mut remove_indicies_len = 0;
Expand Down
7 changes: 7 additions & 0 deletions pallets/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,13 @@ fn it_deletes_when_no_bond_left() {
});
}

#[test]
fn it_doesnt_panic_when_no_signers() {
new_test_ext().execute_with(|| {
assert_ok!(Staking::new_session_handler(&[1, 2, 3]));
});
}

#[test]
fn it_tests_new_session_handler() {
new_test_ext().execute_with(|| {
Expand Down

0 comments on commit d28c607

Please sign in to comment.