From 321061125f8d2549737f2f309966d0b488a93e81 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 5 Oct 2017 12:02:02 +0400 Subject: [PATCH 1/3] add app_options to GenesisDoc (Refs #564) --- types/genesis.go | 3 ++- types/genesis_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/genesis.go b/types/genesis.go index f1b2736f8..797aff9cc 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" - "github.com/tendermint/go-crypto" + crypto "github.com/tendermint/go-crypto" "github.com/tendermint/go-wire/data" cmn "github.com/tendermint/tmlibs/common" ) @@ -29,6 +29,7 @@ type GenesisDoc struct { ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"` Validators []GenesisValidator `json:"validators"` AppHash data.Bytes `json:"app_hash"` + AppOptions *json.RawMessage `json:"app_options,omitempty"` } // SaveAs is a utility method for saving GenensisDoc as a JSON file. diff --git a/types/genesis_test.go b/types/genesis_test.go index 0ffce4b53..fb0d4ca23 100644 --- a/types/genesis_test.go +++ b/types/genesis_test.go @@ -30,7 +30,7 @@ func TestGenesis(t *testing.T) { } // test a good one by raw json - genDocBytes := []byte(`{"genesis_time":"0001-01-01T00:00:00Z","chain_id":"test-chain-QDKdJr","consensus_params":null,"validators":[{"pub_key":{"type":"ed25519","data":"961EAB8752E51A03618502F55C2B6E09C38C65635C64CCF3173ED452CF86C957"},"power":10,"name":""}],"app_hash":""}`) + genDocBytes := []byte(`{"genesis_time":"0001-01-01T00:00:00Z","chain_id":"test-chain-QDKdJr","consensus_params":null,"validators":[{"pub_key":{"type":"ed25519","data":"961EAB8752E51A03618502F55C2B6E09C38C65635C64CCF3173ED452CF86C957"},"power":10,"name":""}],"app_hash":"","app_options":{"account_owner": "Bob"}}`) _, err := GenesisDocFromJSON(genDocBytes) assert.NoError(t, err, "expected no error for good genDoc json") From b26f81239931f07afd7dfe6a0bbee76eca044153 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 5 Oct 2017 12:05:12 +0400 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c48d0850b..603c35a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,12 @@ BUG FIXES: - Graceful handling/recovery for apps that have non-determinism or fail to halt - Graceful handling/recovery for violations of safety, or liveness +## 0.12.0 (TBD) + +IMPROVEMENTS: + - genesis doc: added `app_options` field, which, along with the other fields, + will be returned upon `/genesis` rpc call. + ## 0.11.1 (October 10, 2017) IMPROVEMENTS: From 616b07ff6bd7c1a4888bbb82c56ade25024e7f4d Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 13 Oct 2017 13:34:47 +0400 Subject: [PATCH 3/3] make AppOptions an interface{} --- types/genesis.go | 2 +- types/validator_set_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/genesis.go b/types/genesis.go index 797aff9cc..e33f60258 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -29,7 +29,7 @@ type GenesisDoc struct { ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"` Validators []GenesisValidator `json:"validators"` AppHash data.Bytes `json:"app_hash"` - AppOptions *json.RawMessage `json:"app_options,omitempty"` + AppOptions interface{} `json:"app_options,omitempty"` } // SaveAs is a utility method for saving GenensisDoc as a JSON file. diff --git a/types/validator_set_test.go b/types/validator_set_test.go index 71a1993e7..69f25d620 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - cmn "github.com/tendermint/tmlibs/common" "github.com/tendermint/go-crypto" + cmn "github.com/tendermint/tmlibs/common" ) func randPubKey() crypto.PubKey {