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

Staking reward could potentially overflow #1572

@gnunicorn

Description

@gnunicorn

Look here:

let total = noms.iter().map(<balances::Module<T>>::total_balance).fold(T::Balance::zero(), |acc, x| acc + x);
if !total.is_zero() {
let safe_mul_rational = |b| b * rem / total;// FIXME: avoid overflow
for n in noms.iter() {

.max(One::one());
let safe_mul_rational = |b| b * reward / total;// FIXME: avoid overflow
for n in noms.iter() {

Metadata

Metadata

Labels

I3-bugThe node fails to follow expected behavior.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions