Browse Source

remove deprecated `app_options` field from genesis

pull/1936/head
Anton Kaliaev 7 years ago
parent
commit
b271c40783
No known key found for this signature in database GPG Key ID: 7B6881D965918214
4 changed files with 11 additions and 17 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +1
    -1
      consensus/replay.go
  3. +4
    -5
      scripts/wire2amino.go
  4. +1
    -11
      types/genesis.go

+ 5
- 0
CHANGELOG.md View File

@ -1,5 +1,10 @@
# Changelog
## TBD
IMPROVEMENTS:
- [genesis] removed deprecated `app_options` field.
## 0.22.2
*July 10th, 2018*


+ 1
- 1
consensus/replay.go View File

@ -273,7 +273,7 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight
ChainId: h.genDoc.ChainID,
ConsensusParams: csParams,
Validators: validators,
AppStateBytes: h.genDoc.AppStateJSON,
AppStateBytes: h.genDoc.AppState,
}
res, err := proxyApp.Consensus().InitChainSync(req)
if err != nil {


+ 4
- 5
scripts/wire2amino.go View File

@ -29,9 +29,8 @@ type Genesis struct {
ConsensusParams *types.ConsensusParams `json:"consensus_params,omitempty"`
Validators []GenesisValidator `json:"validators"`
AppHash cmn.HexBytes `json:"app_hash"`
AppStateJSON json.RawMessage `json:"app_state,omitempty"`
AppState json.RawMessage `json:"app_state,omitempty"`
AppOptions json.RawMessage `json:"app_options,omitempty"` // DEPRECATED
}
type NodeKey struct {
@ -112,12 +111,12 @@ func convertGenesis(cdc *amino.Codec, jsonBytes []byte) ([]byte, error) {
ChainID: genesis.ChainID,
ConsensusParams: genesis.ConsensusParams,
// Validators
AppHash: genesis.AppHash,
AppStateJSON: genesis.AppStateJSON,
AppHash: genesis.AppHash,
AppState: genesis.AppState,
}
if genesis.AppOptions != nil {
genesisNew.AppStateJSON = genesis.AppOptions
genesisNew.AppState = genesis.AppOptions
}
for _, v := range genesis.Validators {


+ 1
- 11
types/genesis.go View File

@ -26,17 +26,7 @@ type GenesisDoc struct {
ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"`
Validators []GenesisValidator `json:"validators"`
AppHash cmn.HexBytes `json:"app_hash"`
AppStateJSON json.RawMessage `json:"app_state,omitempty"`
AppOptions json.RawMessage `json:"app_options,omitempty"` // DEPRECATED
}
// AppState returns raw application state.
// TODO: replace with AppState field during next breaking release (0.18)
func (genDoc *GenesisDoc) AppState() json.RawMessage {
if len(genDoc.AppOptions) > 0 {
return genDoc.AppOptions
}
return genDoc.AppStateJSON
AppState json.RawMessage `json:"app_state,omitempty"`
}
// SaveAs is a utility method for saving GenensisDoc as a JSON file.


Loading…
Cancel
Save