HydraDX-node icon indicating copy to clipboard operation
HydraDX-node copied to clipboard

[Audit_RV]Bug: Checking of usable account balance is insufficient

Open yanliu18 opened this issue 2 years ago • 0 comments

Usable balance of an account should be the free balance minus the frozen/locked balance.

Description

https://github.com/galacticcouncil/HydraDX-node/blob/20c8ac6079b8b3d6f16a9f15e9e43353ea6b9abc/pallets/omnipool/src/lib.rs#L1048

The quoted code above does not implement the correct logic of checking usable balance of Omnipool account. To be consistent, it should be using ensure_can_withdraw() to check the usable balance.

Expected Behavior

It should have no effect to the function behaviour. Sufficient balance before transfer is guaranteed by MultiCurrency implementation of transfer()function.

Context

Audit by Runtime Verification

yanliu18 avatar Sep 01 '22 02:09 yanliu18