Cosmos-sdk: Bad genesis validation error

Created on 21 Sep 2019  Â·  13Comments  Â·  Source: cosmos/cosmos-sdk

Summary of Bug

When validating my genesis.json file, i get an error that doesn't really help me to understand the problem.

$ skyyd validate-genesis
validating genesis file at /Users/cbarraford/.skyyd/config/genesis.json
ERROR: error validating genesis file /Users/cbarraford/.skyyd/config/genesis.json: UnmarshalJSON cannot decode empty bytes

Here is the genesis file.
https://gist.github.com/cbarraford/45edb0e0e6d7f206c6dee1751d617188

Version

0.37

Steps to Reproduce

validate the attached genesis file


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
CLI bug

All 13 comments

Btw, my genesis.json was missing...

"supply": {
            "supply": []
        },

This file was generated from skyyd export, so maybe theres a bug in the export genesis code.

also, my genutil was wrong.

was this

"genutil": null,

should be ...

 "genutil": {
        "gentxs": null
    },

the default value for gentxs should be []. I'm not too sure why supply is missing, but should also default to the empty value.

just a stab in the dark, but i'd guess that the code isn't init'ing the variable right.

This will create null

var gentxs []gentx

vs this will create []

gentxs := make([]gentx, 0)

correct, we need to make sure gentxs default to gentxs := make([]gentx, 0)

This is still happening. Need to fix ASAP.

Yes this needs to be fixed, I got stuck on this for a good hour because of genutil was not being formatted correctly

@k would you be willing to instead fix the issue here and open a PR in the SDK? We'd be happy to review and merge.

@alexanderbez not confident i'm approaching this right, but here is a stab at the problem.

I don't follow @cbarraford? This is the only approach AFAIK, what is the alternative?

@alexanderbez i like the approach you have in your PR better than mine. Good work!

:)

That being done, I still wonder if we should include your PR. That is, if genesis state constructors should set slices to empty when they're nil. WDYT @fedekunze ?

I'll follow your lead on this. Happy to make any further changes to the PR, if needed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cwgoes picture cwgoes  Â·  3Comments

mossid picture mossid  Â·  3Comments

fedekunze picture fedekunze  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

faboweb picture faboweb  Â·  3Comments