Skip to content

Reliability: toChainDenom called with default chain in sendOsmosisIbcTokenToMantle #202

@deepanshutr

Description

@deepanshutr

Problem

data/txApi.js:695 (in sendOsmosisIbcTokenToMantle):

```js
const amountInDenom = toChainDenom(amount);
```

Every other tx builder in this file passes the chain explicitly — for example data/txApi.js:53:

```js
const amountInDenom = toChainDenom(amount, chainName, chainDenom);
```

The osmosis-IBC variant falls through to the defaults (defaultChainName = "assetmantle", defaultChainDenom = "umntl"). It works today by coincidence — IBC-MNTL on Osmosis (`ibc/CBA34207...FDDE623813FFC`) and native umntl both have exponent 6, so BigNumber(amount).shiftedBy(6) returns the right number either way.

But if:

  • the IBC denom on Osmosis is ever re-issued under a different exponent, or
  • defaultChainDenom exponent changes (chain registry update), or
  • this builder is reused for a different token,

the builder would silently send the wrong amount. Bridge tx amount errors are not recoverable — funds may end up at a non-existent denom or be trapped on the destination chain.

Proposed fix

Pass the actual osmosis chain context, the same way the sendIbcTokenToMantle and sendGravityIbcTokenToMantle builders do:

```js
const amountInDenom = toChainDenom(amount, osmosisChainName, osmosisIBCToken);
```

Add a unit test that calls the builder with amount = "1.5" and asserts amountInDenom === "1500000" so any future denom/exponent drift fails loud.

Where to look

  • data/txApi.js:678-720sendOsmosisIbcTokenToMantle
  • Compare to data/txApi.js:608-660sendGravityIbcTokenToMantle (gets the args right)

Why now

Behaviorally fine today; latent footgun. Two-line fix + a test. Ships safely on its own; doesn't need a major dep upgrade or UI work.

Acceptance

  • toChainDenom(amount, osmosisChainName, osmosisIBCToken) in sendOsmosisIbcTokenToMantle
  • Smoke test in data/__tests__/txApi.test.js verifying the conversion

Background: surfaced during the self-audit pass behind #198.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions