reproduction: two fresh DO instance, run this script on each:
https://gist.github.com/zramsay/35e158dab11be5380c03b3489ef0e43e
then run gaiad init on each. result is an unpredictable genesis.json:
{
"consensus_params": {
"block_size_params": {
"max_bytes": 22020096,
"max_txs": 100000,
"max_gas": -1
},
"tx_size_params": {
"max_bytes": 10240,
"max_gas": -1
},
"block_gossip_params": {
"block_part_size_bytes": 65536
},
"evidence_params": {
"max_age": 100000
}
},
"validators": [
{
"pub_key": {
"type": "AC26791624DE60",
"value": "c7UMMAbjFuc5GhGPy0E5q5tefy12p9Tq0imXqdrKXwo="
},
"power": 100,
"name": ""
}
],
"app_hash": "",
"genesis_time": "2018-05-11T15:52:25.424795506Z",
"chain_id": "test-chain-Q6VeoW",
"app_state": {
"accounts": [
{
"address": "718C9C23F98C9642569742ADDD9F9AB9743FBD5D",
"coins": [
{
"denom": "Token",
"amount": 1000
},
{
"denom": "steak",
"amount": 50
}
]
}
],
"stake": {
"pool": {
"total_supply": 50,
"bonded_shares": "0",
"unbonded_shares": "0",
"bonded_pool": 0,
"unbonded_pool": 0,
"inflation_last_time": 0,
"inflation": "7/100"
},
"params": {
"inflation_rate_change": "13/100",
"inflation_max": "1/5",
"inflation_min": "7/100",
"goal_bonded": "67/100",
"max_validators": 100,
"bond_denom": "steak"
},
"candidates": null,
"bonds": null
}
}
}
or
{
"app_hash": "",
"app_state": {
"accounts": [
{
"address": "6DCF9B36086732D9EC8FB44FCB6C61E670AA1FCD",
"coins": [
{
"denom": "Token",
"amount": 1000
},
{
"denom": "steak",
"amount": 50
}
]
}
],
"stake": {
"pool": {
"total_supply": 50,
"bonded_shares": "0",
"unbonded_shares": "0",
"bonded_pool": 0,
"unbonded_pool": 0,
"inflation_last_time": 0,
"inflation": "7/100"
},
"params": {
"inflation_rate_change": "13/100",
"inflation_max": "1/5",
"inflation_min": "7/100",
"goal_bonded": "67/100",
"max_validators": 100,
"bond_denom": "steak"
},
"candidates": null,
"bonds": null
}
},
"genesis_time": "2018-05-11T15:59:30.143586646Z",
"chain_id": "test-chain-lha4nT",
"consensus_params": {
"block_size_params": {
"max_bytes": 22020096,
"max_txs": 100000,
"max_gas": -1
},
"tx_size_params": {
"max_bytes": 10240,
"max_gas": -1
},
"block_gossip_params": {
"block_part_size_bytes": 65536
},
"evidence_params": {
"max_age": 100000
}
},
"validators": [
{
"pub_key": {
"type": "AC26791624DE60",
"value": "nd0VwHlkErW+26GSvcHyEEZv4Rf09RpeLXJSj5mTbWg="
},
"power": 100,
"name": ""
}
]
}
Any user familiar with tendermint/gaia will be expecting something like:
"genesis_time": "2018-05-11T15:59:30.143586646Z",
"chain_id": "test-chain-lha4nT",
"consensus_params": {
at the top, rather than a randomized shuffling of fields
Can we sort all JSON keys in codec.MarshalJSON actually? We need this for transaction signing/verification too, see https://github.com/cosmos/ledger-cosmos/pull/43.
Sounds like a go-amino change
Any user familiar with tendermint/gaia will be expecting something like:
The reason this behaves differently, is here: https://github.com/cosmos/cosmos-sdk/issues/1531
We are discussing to add the possibility to sort keys in JSON in amino (for signing purposes). This doesn't solve the above issue though.
It seems this issue is because we're using a map for the genesis. Can we just use a struct for it? Then it will be deterministic.
Possibly changing go-amino is a separate issue.
Yeah I think it is - as per Liamsi comment it looks like this issue will be addressed with #1531 not using keys
@alexanderbez want to tackle this ?
For sure! 鈿★笍
Most helpful comment
For sure! 鈿★笍