Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(export-genesis): fix export genesis command for missing values #1800

Merged
merged 8 commits into from
Oct 24, 2022
11 changes: 11 additions & 0 deletions app/upgrades/v8/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package v8

import (
"errors"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
Expand All @@ -16,6 +18,15 @@ func CreateUpgradeHandler(
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("start to run module migrations...")

// Add atom name and symbol into the bank keeper
atomMetaData, found := keepers.BankKeeper.GetDenomMetaData(ctx, "uatom")
if !found {
return nil, errors.New("atom denom not found")
}
atomMetaData.Name = "Cosmos Hub Atom"
okwme marked this conversation as resolved.
Show resolved Hide resolved
atomMetaData.Symbol = "ATOM"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, when i query the node in public net, denom-metadata is already there.

{"metadatas":[{"description":"The native staking token of the Cosmos Hub.","denom_units":[{"denom":"uatom","exponent":0,"aliases":["microatom"]},{"denom":"matom","exponent":3,"aliases":["milliatom"]},{"denom":"atom","exponent":6,"aliases":[]}],"base":"uatom","display":"atom","name":"","symbol":""}],"pagination":{"next_key":null,"total":"1"}}

also, the denom is uatom.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is different than the actual denom

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@Pantani Pantani Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can confirm the parameter through mainnet API (http://<rpc...>:1317/cosmos/bank/v1beta1/denoms_metadata) . The parameter the SDK use as a key index is base, and we are using uatom:

$ curl http://<RPC_ADDRESS>:1317/cosmos/bank/v1beta1/denoms_metadata
{
  "metadatas": [
    {
      "description": "The native staking token of the Cosmos Hub.",
      "denom_units": [
        {
          "denom": "uatom",
          "exponent": 0,
          "aliases": [
            "microatom"
          ]
        },
        {
          "denom": "matom",
          "exponent": 3,
          "aliases": [
            "milliatom"
          ]
        },
        {
          "denom": "atom",
          "exponent": 6,
          "aliases": [
          ]
        }
      ],
      "base": "uatom",
      "display": "atom",
      "name": "",
      "symbol": ""
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keepers.BankKeeper.SetDenomMetaData(ctx, atomMetaData)

return mm.RunMigrations(ctx, configurator, vm)
}
}