Skip to content

Bank balance query shows base-unit amount with display denom label #556

Description

@linear

What's broken

On the v2.1.0-rc12 testnet, akash query bank balances returns the base-unit amount paired with the display denom label. The query resolves uakt to its display denom akt via genesis denom metadata, but does not scale the amount. The output reads as 100000000000akt when it actually represents 100000000000uakt — a 1,000,000× discrepancy between the number and the unit shown.

Repro

  1. Query bank balances against a chain whose genesis exposes denom metadata for uakt → akt (v2.1.0-rc12 testnet).
  2. Run akash query bank balances <addr>.
  3. Observe output:
balances:
- amount: "100000000000"
  denom: akt
pagination: {}

Expected vs Actual

Expected: amount and denom in the response are internally consistent — either 100000000000uakt (base denom) or 100000akt (resolved + scaled).
Actual: 100000000000akt — base-unit amount paired with the display denom label.

Why this surfaced now

The v2.1.0-rc12 testnet genesis includes denom metadata for uakt → akt. Mainnet does not expose denom metadata the same way, so the CLI defaults silently produce the expected base-denom string there. Anyone querying balances on a chain that publishes denom metadata sees the mislabeled amount.

Solution

Keep denom resolution and scale the amount to match. 100000000000uakt → 100000akt. Cleaner display, but a client-facing behavior change. Need to decide how to handle balances that do not divide evenly by the display exponent — sdk.Coin amounts are integers, so a partial amount like 6994315uakt cannot be represented as 6.994315akt in the current response shape without either changing the response contract or keeping that specific coin in its base denom.

Acceptance Criteria

  • On a chain that publishes uakt → akt denom metadata, the bank balance query output's amount and denom are internally consistent.
  • Behavior on mainnet (no exposed denom metadata) is unchanged.
  • The chosen direction is documented so client integrators know what response shape to expect on chains that publish denom metadata.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions