Assessment reports>Orderly Network>Threat Model>subBalance

Function: subBalance(byte[32] _tokenHash, uint256 _chainId, uint128 _deltaBalance)

The function can be used only by the Ledger contract to decrease the Vault balance in _chainId. But actual function is not called from the current Ledger contract version. If the balance is reduced not in the process of withdrawing funds initiated by users, then after reducing the Vault balance, they will potentially not be able to withdraw funds from there due to insufficient balance.

Inputs

  • _tokenHash

    • Control: Controlled by Ledger.

    • Constraints: If tokenBalanceOnchain[_tokenHash][_chainId] is less than _deltaBalance, the call will revert.

    • Impact: The token hash.

  • _chainId

    • Control: Controlled by Ledger.

    • Constraints: If tokenBalanceOnchain[_tokenHash][_chainId] is less than _deltaBalance, the call will revert.

    • Impact: The chain ID.

  • _deltaBalance

    • Control: Controlled by Ledger.

    • Constraints: If tokenBalanceOnchain[_tokenHash][_chainId] is less than _deltaBalance, the call will revert.

    • Impact: The amount of balance to decrease.

Branches and code coverage

Intended branches

  • The balance was decreased properly.

Negative behavior

  • tokenBalanceOnchain[_tokenHash][_chainId] is less than _deltaBalance.

  • A caller is not a trusted Ledger contract.

Zellic © 2024Back to top ↑