Validators don't get slashed for offlineness until 10% at once (#4232)

* Validators don't get slashed for offlineness until 10% at once

* Update frame/im-online/src/tests.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>

* Update frame/im-online/src/tests.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>

* Apply suggestions from code review

Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
Gavin Wood
2019-11-27 18:57:03 +00:00
committed by GitHub
parent 77d0c065d3
commit de5686509c
2 changed files with 17 additions and 6 deletions
+8 -3
View File
@@ -38,14 +38,19 @@ fn test_unresponsiveness_slash_fraction() {
);
assert_eq!(
UnresponsivenessOffence::<()>::slash_fraction(3, 50),
Perbill::from_parts(6000000), // 0.6%
UnresponsivenessOffence::<()>::slash_fraction(5, 50),
Perbill::zero(), // 0%
);
assert_eq!(
UnresponsivenessOffence::<()>::slash_fraction(7, 50),
Perbill::from_parts(4200000), // 0.42%
);
// One third offline should be punished around 5%.
assert_eq!(
UnresponsivenessOffence::<()>::slash_fraction(17, 50),
Perbill::from_parts(48000000), // 4.8%
Perbill::from_parts(46200000), // 4.62%
);
}