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

Bad genesis validation error #5086

Closed
4 tasks
cbarraford opened this issue Sep 21, 2019 · 13 comments · Fixed by #5497 or #5499
Closed
4 tasks

Bad genesis validation error #5086

cbarraford opened this issue Sep 21, 2019 · 13 comments · Fixed by #5497 or #5499
Assignees
Milestone

Comments

@cbarraford
Copy link
Contributor

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
@cbarraford
Copy link
Contributor Author

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.

@cbarraford
Copy link
Contributor Author

also, my genutil was wrong.

was this

"genutil": null,

should be ...

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

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 21, 2019

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

@cbarraford
Copy link
Contributor Author

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)

@alexanderbez
Copy link
Contributor

alexanderbez commented Sep 22, 2019

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

@alexanderbez
Copy link
Contributor

This is still happening. Need to fix ASAP.

@k
Copy link

k commented Jan 8, 2020

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

@alexanderbez
Copy link
Contributor

alexanderbez commented Jan 8, 2020

@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.

@cbarraford cbarraford mentioned this issue Jan 9, 2020
11 tasks
@cbarraford
Copy link
Contributor Author

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

@alexanderbez
Copy link
Contributor

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

@cbarraford
Copy link
Contributor Author

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

@alexanderbez
Copy link
Contributor

:)

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 ?

@cbarraford
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants