Make perthings operate in type operator (#2501)

* perthings operate in type operator

* implementation with rem

* fmt

* doc

* better fmt

* bump version

* Tests for pet-things

* demonstrate output as type of operation

* Remove redundant assertions.

* rename test

* update lock

* bump impl version
This commit is contained in:
thiolliere
2019-05-15 18:48:58 +02:00
committed by Gavin Wood
parent e0a6a1f55a
commit aa2c496a65
6 changed files with 135 additions and 35 deletions
+2 -2
View File
@@ -180,7 +180,7 @@ pub fn elect<T: Trait + 'static, FV, FN, FS>(
let temp =
n.budget.saturating_mul(SCALE_FACTOR) / c.approval_stake
* (*n.load / SCALE_FACTOR);
c.score = Fraction::from_max_value((*c.score).saturating_add(temp));
c.score = Fraction::from_parts((*c.score).saturating_add(temp));
}
}
}
@@ -196,7 +196,7 @@ pub fn elect<T: Trait + 'static, FV, FN, FS>(
for n in &mut nominators {
for e in &mut n.edges {
if e.who == winner.who {
e.load = Fraction::from_max_value(*winner.score - *n.load);
e.load = Fraction::from_parts(*winner.score - *n.load);
n.load = winner.score;
}
}