Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
im-online: don't disable offending validators (#13493)
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva authored Mar 2, 2023
1 parent 7d00033 commit df93a0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ use sp_runtime::{
PerThing, Perbill, Permill, RuntimeDebug, SaturatedConversion,
};
use sp_staking::{
offence::{Kind, Offence, ReportOffence},
offence::{DisableStrategy, Kind, Offence, ReportOffence},
SessionIndex,
};
use sp_std::prelude::*;
Expand Down Expand Up @@ -951,6 +951,10 @@ impl<Offender: Clone> Offence<Offender> for UnresponsivenessOffence<Offender> {
self.session_index
}

fn disable_strategy(&self) -> DisableStrategy {
DisableStrategy::Never
}

fn slash_fraction(&self, offenders: u32) -> Perbill {
// 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%
Expand Down
3 changes: 3 additions & 0 deletions frame/im-online/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ fn test_unresponsiveness_slash_fraction() {
dummy_offence.slash_fraction(17),
Perbill::from_parts(46200000), // 4.62%
);

// Offline offences should never lead to being disabled.
assert_eq!(dummy_offence.disable_strategy(), DisableStrategy::Never);
}

#[test]
Expand Down

0 comments on commit df93a0d

Please sign in to comment.