Skip to content

Commit

Permalink
Use sensible maths for from_rational.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neopallium committed Jan 10, 2025
1 parent 8234940 commit 04f6d0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pallets/runtime/tests/src/staking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6103,7 +6103,7 @@ fn proportional_ledger_slash_works() {
ledger.active = unit;
ledger.total = unit * 4 + value;
// When
assert_eq!(ledger.slash(slash, 0, 0), slash - 5);
assert_eq!(ledger.slash(slash, 0, 0), slash);
// Then
// The amount slashed out of `unit`
let affected_balance = value + unit * 4;
Expand All @@ -6119,12 +6119,12 @@ fn proportional_ledger_slash_works() {
value - value_slash
};
assert_eq!(ledger.active, unit_slashed);
assert_eq!(ledger.unlocking, vec![c(5, value_slashed)]);
assert_eq!(ledger.total, value_slashed);
assert_eq!(ledger.unlocking, vec![c(5, value_slashed), c(7, 32)]);
assert_eq!(ledger.total, value_slashed + 32);
assert_eq!(LedgerSlashPerEra::get().0, 0);
assert_eq!(
LedgerSlashPerEra::get().1,
BTreeMap::from([(4, 0), (5, value_slashed), (6, 0), (7, 0)])
BTreeMap::from([(4, 0), (5, value_slashed), (6, 0), (7, 32)])
);
}

Expand Down

0 comments on commit 04f6d0f

Please sign in to comment.