Merge branch 'develop' into cwgoes/fix-gov-sim-more-import-export

This commit is contained in:
Christopher Goes 2018-11-12 15:28:52 +01:00
commit 81ae35c0f7
8 changed files with 83 additions and 11 deletions

View File

@ -20,6 +20,7 @@ FEATURES
* [cli] [\#2569](https://github.com/cosmos/cosmos-sdk/pull/2569) Add commands to query validator unbondings and redelegations
* [cli] [\#2524](https://github.com/cosmos/cosmos-sdk/issues/2524) Add support offline mode to `gaiacli tx sign`. Lookups are not performed if the flag `--offline` is on.
* [cli] [\#2558](https://github.com/cosmos/cosmos-sdk/issues/2558) Rename --print-sigs to --validate-signatures. It now performs a complete set of sanity checks and reports to the user. Also added --print-signature-only to print the signature only, not the whole transaction.
* [cli] [\#2704](https://github.com/cosmos/cosmos-sdk/pull/2704) New add-genesis-account convenience command to populate genesis.json with genesis accounts.
* SDK
* [\#1336](https://github.com/cosmos/cosmos-sdk/issues/1336) Mechanism for SDK Users to configure their own Bech32 prefixes instead of using the default cosmos prefixes.

8
Gopkg.lock generated
View File

@ -298,7 +298,7 @@
"model",
]
pruneopts = "UT"
revision = "7e9e6cabbd393fc208072eedef99188d0ce788b6"
revision = "0b1957f9d949dfa3084171a6ec5642b38055276a"
[[projects]]
branch = "master"
@ -434,7 +434,7 @@
version = "v0.11.1"
[[projects]]
digest = "1:395820b381043b9d2204e181ddf0f9147397c4a7b8f5dc3162de4cfcddf4589a"
digest = "1:5b1373b03f39e6f6061cd91f3829100527ebb5f94240c092bf9e5d314b153501"
name = "github.com/tendermint/tendermint"
packages = [
"abci/client",
@ -500,8 +500,8 @@
"version",
]
pruneopts = "UT"
revision = "03e42d2e3866f01a00625f608e3bbfaeb30690de"
version = "v0.26.1-rc0"
revision = "48ab899923c564bbf2fa2f1244c11cb930e28132"
version = "v0.26.1-rc3"
[[projects]]
digest = "1:7886f86064faff6f8d08a3eb0e8c773648ff5a2e27730831e2bfbf07467f6666"

View File

@ -36,7 +36,7 @@
[[override]]
name = "github.com/tendermint/tendermint"
version = "v0.26.1-rc0" # TODO replace w/ 0.26.1
version = "v0.26.1-rc3" # TODO replace w/ 0.26.1
## deps without releases:

View File

@ -48,9 +48,12 @@ BUG FIXES
* Gaia CLI (`gaiacli`)
* Gaia
* [\#2723] Use `cosmosvalcons` Bech32 prefix in `tendermint show-address`
* [\#2742](https://github.com/cosmos/cosmos-sdk/issues/2742) Fix time format of TimeoutCommit override
* SDK
- \#2733 [x/gov, x/mock/simulation] Fix governance simulation, update x/gov import/export
* Tendermint
* [\#2797](https://github.com/tendermint/tendermint/pull/2797) AddressBook requires addresses to have IDs; Do not crap out immediately after sending pex addrs in seed mode

View File

@ -42,6 +42,7 @@ func main() {
rootCmd.AddCommand(gaiaInit.CollectGenTxsCmd(ctx, cdc))
rootCmd.AddCommand(gaiaInit.TestnetFilesCmd(ctx, cdc, server.AppInit{}))
rootCmd.AddCommand(gaiaInit.GenTxCmd(ctx, cdc))
rootCmd.AddCommand(gaiaInit.AddGenesisAccountCmd(ctx, cdc))
server.AddCommands(ctx, cdc, rootCmd, appInit,
newApp, exportAppStateAndTMValidators)

View File

@ -0,0 +1,66 @@
package init
import (
"fmt"
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/common"
)
// AddGenesisAccountCmd returns add-genesis-account cobra Command
func AddGenesisAccountCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "add-genesis-account [address] [coin][,[coin]]",
Short: "Add genesis account to genesis.json",
Args: cobra.ExactArgs(2),
RunE: func(_ *cobra.Command, args []string) error {
config := ctx.Config
config.SetRoot(viper.GetString(cli.HomeFlag))
addr, err := sdk.AccAddressFromBech32(args[0])
if err != nil {
return err
}
coins, err := sdk.ParseCoins(args[1])
if err != nil {
return err
}
coins.Sort()
genFile := config.GenesisFile()
if !common.FileExists(genFile) {
return fmt.Errorf("%s does not exist, run `gaiad init` first", genFile)
}
genDoc, err := loadGenesisDoc(cdc, genFile)
if err != nil {
return err
}
var appState app.GenesisState
if err = cdc.UnmarshalJSON(genDoc.AppState, &appState); err != nil {
return err
}
acc := auth.NewBaseAccountWithAddress(addr)
acc.Coins = coins
appState.Accounts = append(appState.Accounts, app.NewGenesisAccount(&acc))
appStateJSON, err := cdc.MarshalJSON(appState)
if err != nil {
return err
}
return ExportGenesisFile(genFile, genDoc.ChainID, nil, appStateJSON)
},
}
cmd.Flags().String(cli.HomeFlag, app.DefaultNodeHome, "node's home directory")
return cmd
}

View File

@ -63,17 +63,17 @@ func ShowValidatorCmd(ctx *Context) *cobra.Command {
func ShowAddressCmd(ctx *Context) *cobra.Command {
cmd := &cobra.Command{
Use: "show-address",
Short: "Shows this node's tendermint validator address",
Short: "Shows this node's tendermint validator consensus address",
RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config
privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorFile())
valAddr := (sdk.ValAddress)(privValidator.Address)
valConsAddr := (sdk.ConsAddress)(privValidator.Address)
if viper.GetBool(client.FlagJson) {
return printlnJSON(valAddr)
return printlnJSON(valConsAddr)
}
fmt.Println(valAddr.String())
fmt.Println(valConsAddr.String())
return nil
},
}

View File

@ -7,6 +7,7 @@ import (
"os/signal"
"path/filepath"
"syscall"
"time"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@ -92,7 +93,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) {
conf.P2P.RecvRate = 5120000
conf.P2P.SendRate = 5120000
conf.TxIndex.IndexAllTags = true
conf.Consensus.TimeoutCommit = 5000
conf.Consensus.TimeoutCommit = 5 * time.Second
cfg.WriteConfigFile(configFilePath, conf)
// Fall through, just so that its parsed into memory.
}