mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-17 18:15:41 +00:00
im-online: don't disable offending validators (#13493)
This commit is contained in:
@@ -101,7 +101,7 @@ use sp_runtime::{
|
|||||||
PerThing, Perbill, Permill, RuntimeDebug, SaturatedConversion,
|
PerThing, Perbill, Permill, RuntimeDebug, SaturatedConversion,
|
||||||
};
|
};
|
||||||
use sp_staking::{
|
use sp_staking::{
|
||||||
offence::{Kind, Offence, ReportOffence},
|
offence::{DisableStrategy, Kind, Offence, ReportOffence},
|
||||||
SessionIndex,
|
SessionIndex,
|
||||||
};
|
};
|
||||||
use sp_std::prelude::*;
|
use sp_std::prelude::*;
|
||||||
@@ -951,6 +951,10 @@ impl<Offender: Clone> Offence<Offender> for UnresponsivenessOffence<Offender> {
|
|||||||
self.session_index
|
self.session_index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn disable_strategy(&self) -> DisableStrategy {
|
||||||
|
DisableStrategy::Never
|
||||||
|
}
|
||||||
|
|
||||||
fn slash_fraction(&self, offenders: u32) -> Perbill {
|
fn slash_fraction(&self, offenders: u32) -> Perbill {
|
||||||
// the formula is min((3 * (k - (n / 10 + 1))) / n, 1) * 0.07
|
// the formula is min((3 * (k - (n / 10 + 1))) / n, 1) * 0.07
|
||||||
// basically, 10% can be offline with no slash, but after that, it linearly climbs up to 7%
|
// basically, 10% can be offline with no slash, but after that, it linearly climbs up to 7%
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ fn test_unresponsiveness_slash_fraction() {
|
|||||||
dummy_offence.slash_fraction(17),
|
dummy_offence.slash_fraction(17),
|
||||||
Perbill::from_parts(46200000), // 4.62%
|
Perbill::from_parts(46200000), // 4.62%
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Offline offences should never lead to being disabled.
|
||||||
|
assert_eq!(dummy_offence.disable_strategy(), DisableStrategy::Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user