You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
I was trying to calculate multiplying a balance value by a ratio via Perbill, like Perbill::from_percent(90) * my_balance. But the mul operation of Perbill won't work for large values like when balance is u128 and 1 coin is 10^18.
As in the Mul impl of Perbill, rhs is converted to u64, and the output would be saturated to u64::MAX/1_000_000_000, which around 1.84 * 10^10. This make it impossible to multiply by a typical balance value.
Due to Currency::Balance :As<u64>, this implicit saturating is error prune for balances calculation, such as offline slash calculation in staking module if I don't misunderstand: