diff --git a/CHANGELOG.md b/CHANGELOG.md index c98b55beb..d21352c06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,11 @@ 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.17.0 (TBD) + +BREAKING: +- [genesis] rename `app_options` to `app_state` + ## 0.16.1 (TBD) IMPROVEMENTS: diff --git a/Gopkg.lock b/Gopkg.lock index b032f23c0..70be9a3fa 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -294,6 +294,7 @@ revision = "1875d0a70c90e57f11972aefd42276df65e895b9" [[projects]] + branch = "master" name = "golang.org/x/net" packages = [ "context", @@ -302,9 +303,10 @@ "idna", "internal/timeseries", "lex/httplex", + "netutil", "trace" ] - revision = "2fb46b16b8dda405028c50f7c7f0f9dd1fa6bfb1" + revision = "cbe0f9307d0156177f9dd5dc85da1a31abc5f2fb" [[projects]] name = "golang.org/x/sys" @@ -369,6 +371,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "402db24a8ce0cac835f1d0d3c40d4066d57660acac43b647066d94913bfc3efc" + inputs-digest = "a65ef86e3db67769c1fa4ae1f67af8d5b95474f4b95ec799d8572e19b44b206a" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 875b84a4d..73ab28cbd 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -89,6 +89,10 @@ name = "google.golang.org/grpc" version = "1.7.3" +[[constraint]] + branch = "master" + name = "golang.org/x/net" + [prune] go-tests = true unused-packages = true diff --git a/docs/specification/genesis.rst b/docs/specification/genesis.rst index 7e36c1315..5edd1b7b9 100644 --- a/docs/specification/genesis.rst +++ b/docs/specification/genesis.rst @@ -5,12 +5,6 @@ The genesis.json file in ``$TMHOME/config`` defines the initial TendermintCore state upon genesis of the blockchain (`see definition `__). -NOTE: This does not (yet) specify the application state (e.g. initial -distribution of tokens). Currently we leave it up to the application to -load the initial application genesis state. In the future, we may -include genesis SetOption messages that get passed from TendermintCore -to the app upon genesis. - Fields ~~~~~~ @@ -26,6 +20,7 @@ Fields - ``app_hash``: The expected application hash (as returned by the ``Commit`` ABCI message) upon genesis. If the app's hash does not match, a warning message is printed. +- ``app_state``: The application state (e.g. initial distribution of tokens). Sample genesis.json ~~~~~~~~~~~~~~~~~~~ @@ -69,5 +64,8 @@ Sample genesis.json "name": "mach4" } ], - "app_hash": "15005165891224E721CB664D15CB972240F5703F" + "app_hash": "15005165891224E721CB664D15CB972240F5703F", + "app_state": { + {"account": "Bob", "coins": 5000} + } } diff --git a/types/genesis.go b/types/genesis.go index b7e4f6452..ef2d16791 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -28,7 +28,7 @@ type GenesisDoc struct { ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"` Validators []GenesisValidator `json:"validators"` AppHash cmn.HexBytes `json:"app_hash"` - AppOptions interface{} `json:"app_options,omitempty"` + AppState json.RawMessage `json:"app_state,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 bdef3b925..aa713289f 100644 --- a/types/genesis_test.go +++ b/types/genesis_test.go @@ -10,7 +10,6 @@ import ( ) func TestGenesis(t *testing.T) { - // test some bad ones from raw json testCases := [][]byte{ []byte{}, // empty @@ -30,7 +29,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":"","app_options":{"account_owner": "Bob"}}`) + 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_state":{"account_owner": "Bob"}}`) _, err := GenesisDocFromJSON(genDocBytes) assert.NoError(t, err, "expected no error for good genDoc json")