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

Commit 643c745

Browse files
committed
Improve docs
1 parent 2e1c338 commit 643c745

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

frame/babe/src/equivocation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl<Offender: Clone> Offence<Offender> for EquivocationOffence<Offender> {
8888
}
8989

9090
// The formula is min((3k / n)^2, 1)
91-
// with: k = offenders_number, n = validators_number
91+
// where k = offenders_number and n = validators_number
9292
fn slash_fraction(&self, offenders_count: u32) -> Perbill {
9393
// Perbill type domain is [0, 1] by definition
9494
Perbill::from_rational(3 * offenders_count, self.validator_set_count).square()

frame/grandpa/src/equivocation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ impl<Offender: Clone> Offence<Offender> for EquivocationOffence<Offender> {
9797
self.time_slot
9898
}
9999

100+
// The formula is min((3k / n)^2, 1)
101+
// where k = offenders_number and n = validators_number
100102
fn slash_fraction(&self, offenders_count: u32) -> Perbill {
101-
// the formula is min((3k / n)^2, 1)
102-
let x = Perbill::from_rational(3 * offenders_count, self.validator_set_count);
103-
// _ ^ 2
104-
x.square()
103+
// Perbill type domain is [0, 1] by definition
104+
Perbill::from_rational(3 * offenders_count, self.validator_set_count).square()
105105
}
106106
}
107107

0 commit comments

Comments
 (0)