bridge slashing issue fix
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
commit
885c519519
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3832,7 +3832,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ghost-slow-clap"
|
||||
version = "0.3.14"
|
||||
version = "0.3.15"
|
||||
dependencies = [
|
||||
"frame-benchmarking",
|
||||
"frame-support",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ghost-slow-clap"
|
||||
version = "0.3.14"
|
||||
version = "0.3.15"
|
||||
description = "Applause protocol for the EVM bridge"
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
|
@ -1162,16 +1162,22 @@ impl<T: Config> Pallet<T> {
|
||||
session_index: SessionIndex,
|
||||
average_claps: u32,
|
||||
) -> bool {
|
||||
if average_claps == 0 {
|
||||
return true;
|
||||
}
|
||||
|
||||
let claps_in_session = AuthorityInfoInSession::<T>::get(session_index);
|
||||
match claps_in_session.get(authority_index) {
|
||||
Some(clap_in_session) => {
|
||||
let number_of_claps = &clap_in_session.actions;
|
||||
let authority_deviation = if *number_of_claps < average_claps {
|
||||
Perbill::from_rational(*number_of_claps, average_claps)
|
||||
} else { Perbill::from_rational(average_claps, *number_of_claps) };
|
||||
Perbill::from_rational(average_claps - *number_of_claps, average_claps)
|
||||
} else {
|
||||
Perbill::from_rational(*number_of_claps - average_claps, average_claps)
|
||||
};
|
||||
authority_deviation < Perbill::from_percent(T::OffenceThreshold::get())
|
||||
},
|
||||
_ => false,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ fn prepare_companion(amount: u64) -> Companion<NetworkIdOf<Runtime>, BalanceOf<R
|
||||
Companion {
|
||||
network_id: 1,
|
||||
receiver: H160::from_low_u64_ne(1337),
|
||||
fee: H256::from_low_u64_ne(40_000),
|
||||
amount: amount,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user