New genesis workflow (#2602)

New genesis workflow:
* `gaiad init` is now used to generate an empty `genesis.json`.
* Genesis accounts need to be populated manually before running
  `gaiad collect-gentxs`.
* This should support starfish too, see #2615 for more info.
* Closes: #2596 #2615
* Validate validator address and address against respective account ex ante
* Fix local testnet failures
* New genesis tests
* Run make format
* Add --pubkey flag
* gaiad collect-gentxs takes no args
This commit is contained in:
Alessio Treglia
2018-11-04 20:26:46 -08:00
committed by Jae Kwon
parent f4338d6f75
commit c20fcbfd8f
19 changed files with 463 additions and 311 deletions
+5 -2
View File
@@ -3,6 +3,7 @@ package mock
import (
"encoding/json"
"fmt"
"github.com/tendermint/tendermint/types"
"path/filepath"
abci "github.com/tendermint/tendermint/abci/types"
@@ -102,7 +103,8 @@ func InitChainer(key sdk.StoreKey) func(sdk.Context, abci.RequestInitChain) abci
// AppGenState can be passed into InitCmd, returns a static string of a few
// key-values that can be parsed by InitChainer
func AppGenState(_ *codec.Codec, _ []json.RawMessage) (appState json.RawMessage, err error) {
func AppGenState(_ *codec.Codec, _ types.GenesisDoc, _ []json.RawMessage) (appState json.
RawMessage, err error) {
appState = json.RawMessage(`{
"values": [
{
@@ -119,7 +121,8 @@ func AppGenState(_ *codec.Codec, _ []json.RawMessage) (appState json.RawMessage,
}
// AppGenStateEmpty returns an empty transaction state for mocking.
func AppGenStateEmpty(_ *codec.Codec, _ []json.RawMessage) (appState json.RawMessage, err error) {
func AppGenStateEmpty(_ *codec.Codec, _ types.GenesisDoc, _ []json.RawMessage) (
appState json.RawMessage, err error) {
appState = json.RawMessage(``)
return
}
+2 -1
View File
@@ -1,6 +1,7 @@
package mock
import (
"github.com/tendermint/tendermint/types"
"testing"
"github.com/stretchr/testify/require"
@@ -20,7 +21,7 @@ func TestInitApp(t *testing.T) {
require.NoError(t, err)
// initialize it future-way
appState, err := AppGenState(nil, nil)
appState, err := AppGenState(nil, types.GenesisDoc{}, nil)
require.NoError(t, err)
//TODO test validators in the init chain?