cosmos / gaia

Cosmos Hub
https://hub.cosmos.network
Apache License 2.0
476 stars 693 forks source link

Exported genesis can't be validated using gaiad validate-genesis #1384

Closed uditvira closed 2 years ago

uditvira commented 2 years ago

Summary of Bug

If you use gaiad validate-genesis to validate an exported genesis from the Cosmos Hub mainnet, you get the following error:

Error: error validating genesis file mainnet-genesis.json: name field cannot be blank

This was reproduced by @ASoTNetworks

Version

I've reproduced this with gaiad 6.00 and 6.0.4

Steps to Reproduce

  1. Stop a synced node
  2. Export a genesis file gaiad --for-zero-height --height=9961097 &> mainnet-genesis.json (Notice I need to use &> and not > to dump contents into a file, because gaiad is writing output to stderr and not stdout. This is an unrelated issue)
  3. gaiad validate-genesis mainnet-genesis.json

For Admin Use

okwme commented 2 years ago

@alexanderbez you helped confirm this issue, is there a summary of what needs to be fixed in a future release to address the issue?

glnro commented 2 years ago

Yeah just to confirm this would be in Rho...we'd need to add two lines I think in SetUpgradeHandler

banktypes.DefaultGenesisState().DenomMetadata[0].Name = "Cosmos Hub Atom"
banktypes.DefaultGenesisState().DenomMetadata[0].Symbol = "ATOM"
yaruwangway commented 2 years ago

hi, here is the fix for export to stdout, not stderr. https://github.com/cosmos/cosmos-sdk/pull/11844

Pantani commented 2 years ago

@uditvira, can you please check the beginning of the genesis.json, if the JSON looks consistent or if there are any logs?

Can you also try it to export the JSON? gaiad export --for-zero-height --height=9961097 2> mainnet-genesis.json

Pantani commented 2 years ago

I found two bugs regarding the export and validate-genesis commands.

{
  "app_state": {
    "authz": {},
    "packetfowardmiddleware": {
      "params": {
        "fee_percentage": "0.000000000000000000"
      }
    },
    "interchainaccounts": {
      "host_genesis_state": {
        "port": "icahost"
      }
    },
    "liquidity": {
      "params": {
        "pool_types": [
          {
            "id": 1,
            "name": "StandardLiquidityPool",
            "min_reserve_coin_num": 2,
            "max_reserve_coin_num": 2,
            "description": "Standard liquidity pool with pool price function X/Y, ESPM constraint, and two kinds of reserve coins"
          }
        ],
        "min_init_deposit_amount": "1000000",
        "init_pool_coin_mint_amount": "1000000",
        "max_reserve_coin_amount": "0",
        "pool_creation_fee": [
          {
            "denom": "stake",
            "amount": "40000000"
          }
        ],
        "swap_fee_rate": "0.003000000000000000",
        "withdraw_fee_rate": "0.000000000000000000",
        "max_order_amount_ratio": "0.100000000000000000",
        "unit_batch_height": 1,
        "circuit_breaker_enabled": false
      },
      "pool_records": []
    },
    "bank": {
      "denom_metadata": [
        {
          "name": "Cosmos Hub Atom",
          "symbol": "ATOM"
        }
      ]
    },
    "ibc": {
      "connection_genesis": {
        "params": {
          "max_expected_time_per_block": 30000000000
        }
      }
    }
  }
}
okwme commented 2 years ago

think we just need to hard code our bank metadata in our initgenesis or export genesis for gaia https://docs.cosmos.network/main/architecture/adr-024-coin-metadata.html