HydraDX-node
HydraDX-node copied to clipboard
[Audit_RV] Inconsistent sign for 0 in SimpleImbalance
The SimpleBalance
implementation does not use a consistent sign for 0
. By default 0
is negative, and add
also makes 0
negative, but sub
makes it positive.
In the current implementation, SimpleBalance
is used only with negative values, so sub
should not produce a 0
value. Still, it may make sense to make the sign of 0
consistent, e.g. by making it always be negative
.
https://github.com/galacticcouncil/HydraDX-node/blob/8de6222f967cc1bfe120207a775e8f0dc8eb92a5/pallets/omnipool/src/types.rs#L206