Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix staking slashing tests
  • Loading branch information
rphmeier committed Aug 14, 2018
commit ea0be64a4417b4f2962bf7e73b12dd6eb1dfa214
8 changes: 4 additions & 4 deletions substrate/runtime/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ fn slashing_should_work() {
assert_eq!(Staking::voting_balance(&10), 21);

System::set_block_number(7);
Timestamp::set_timestamp(100); // way too late - early exit.
::system::ExtrinsicIndex::<Test>::put(1);
Session::note_offline(&0, vec![0]).unwrap(); // val 10 reported bad.
Session::check_rotate_session();
assert_eq!(Staking::current_era(), 1);
assert_eq!(Session::current_index(), 3);
Expand Down Expand Up @@ -310,9 +311,9 @@ fn nominating_slashes_should_work() {
assert_eq!(Staking::voting_balance(&4), 40);

System::set_block_number(5);
Timestamp::set_timestamp(100); // late
::system::ExtrinsicIndex::<Test>::put(1);
Session::note_offline(&0, vec![0, 1]).unwrap(); // both get reported offline.
assert_eq!(Session::blocks_remaining(), 1);
assert!(Session::broken_validation());
Session::check_rotate_session();

assert_eq!(Staking::current_era(), 2);
Expand Down Expand Up @@ -388,7 +389,6 @@ fn staking_eras_work() {

// Block 6: No change.
System::set_block_number(6);
assert!(!Session::broken_validation());
Session::check_rotate_session();
assert_eq!(Session::current_index(), 6);
assert_eq!(Staking::sessions_per_era(), 3);
Expand Down