pallet-offences: Switch to partition_point (#9049)

This changes the code to use `partition_point` instead of
`binary_search_by_key`, because this was very likely the problematic
pallet 2 weeks ago on polkadot.
This commit is contained in:
Bastian Köcher
2021-06-12 01:38:17 +01:00
committed by GitHub
parent 0869fdf9aa
commit e360cff92e
3 changed files with 68 additions and 9 deletions
+5
View File
@@ -170,3 +170,8 @@ impl<T: Clone> offence::Offence<T> for Offence<T> {
Perbill::from_percent(5 + offenders_count * 100 / validator_set_count)
}
}
/// Create the report id for the given `offender` and `time_slot` combination.
pub fn report_id(time_slot: u128, offender: u64) -> H256 {
Offences::report_id::<Offence<u64>>(&time_slot, &offender)
}