Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release back to develop #2590

Merged
merged 16 commits into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
343 changes: 293 additions & 50 deletions CHANGELOG.md

Large diffs are not rendered by default.

200 changes: 2 additions & 198 deletions PENDING.md

Large diffs are not rendered by default.

40 changes: 23 additions & 17 deletions client/keys/new.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package keys

import (
"bufio"
"fmt"
"os"

"github.com/bartekn/go-bip39"
"github.com/pkg/errors"
Expand Down Expand Up @@ -46,15 +44,15 @@ input
output
- armor encrypted private key (saved to file)
*/
// nolint: gocyclo
func runNewCmd(cmd *cobra.Command, args []string) error {
name := args[0]
kb, err := GetKeyBase()
kb, err := GetKeyBaseWithWritePerm()
if err != nil {
return err
}

buf := client.BufferStdin()

_, err = kb.Get(name)
if err == nil {
// account exists, ask for user confirmation
Expand All @@ -73,24 +71,25 @@ func runNewCmd(cmd *cobra.Command, args []string) error {
return err
}

// if we're using ledger, only thing we need is the path.
// generate key and we're done.
// If we're using ledger, only thing we need is the path. So generate key and
// we're done.
if viper.GetBool(client.FlagUseLedger) {

algo := keys.Secp256k1 // SigningAlgo(viper.GetString(flagType))
algo := keys.Secp256k1
path := bip44Params.DerivationPath() // ccrypto.DerivationPath{44, 118, account, 0, index}

info, err := kb.CreateLedger(name, path, algo)
if err != nil {
return err
}

printCreate(info, "")
return nil
}

// get the mnemonic
var mnemonic string

if !useDefaults {
mnemonic, err = client.GetString("> Enter your bip39 mnemonic, or hit enter to generate one.", buf)
mnemonic, err = client.GetString("Enter your bip39 mnemonic, or hit enter to generate one.", buf)
if err != nil {
return err
}
Expand All @@ -102,6 +101,7 @@ func runNewCmd(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}

mnemonic, err = bip39.NewMnemonic(entropySeed[:])
if err != nil {
return err
Expand All @@ -113,7 +113,8 @@ func runNewCmd(cmd *cobra.Command, args []string) error {
if !useDefaults {
printStep()
printPrefixed("Enter your bip39 passphrase. This is combined with the mnemonic to derive the seed")
bip39Passphrase, err = client.GetString("> Most users should just hit enter to use the default, \"\"", buf)

bip39Passphrase, err = client.GetString("Most users should just hit enter to use the default, \"\"", buf)
if err != nil {
return err
}
Expand All @@ -124,14 +125,16 @@ func runNewCmd(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}

if bip39Passphrase != p2 {
return errors.New("passphrases don't match")
}
}
}

// get the encryption password
printStep()

// get the encryption password
encryptPassword, err := client.GetCheckPassword(
"> Enter a passphrase to encrypt your key to disk:",
"> Repeat the passphrase:", buf)
Expand All @@ -143,24 +146,26 @@ func runNewCmd(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
_ = info

_ = info
return nil
}

func getBIP44ParamsAndPath(path string, flagSet bool) (*hd.BIP44Params, error) {
buf := bufio.NewReader(os.Stdin)
buf := client.BufferStdin()
bip44Path := path

// if it wasnt set in the flag, give it a chance to overide interactively
// if it wasn't set in the flag, give it a chance to overide interactively
if !flagSet {
var err error

printStep()

var err error
bip44Path, err = client.GetString(fmt.Sprintf("> Enter your bip44 path. Default is %s\n", path), buf)
bip44Path, err = client.GetString(fmt.Sprintf("Enter your bip44 path. Default is %s\n", path), buf)
if err != nil {
return nil, err
}

if len(bip44Path) == 0 {
bip44Path = path
}
Expand All @@ -170,6 +175,7 @@ func getBIP44ParamsAndPath(path string, flagSet bool) (*hd.BIP44Params, error) {
if err != nil {
return nil, err
}

return bip44params, nil
}

Expand Down
2 changes: 1 addition & 1 deletion client/keys/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"github.com/tendermint/tendermint/crypto"
"net/http"

"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/crypto/multisig"
"github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/keys/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
"github.com/gorilla/mux"

"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
"github.com/spf13/cobra"
)

func updateKeyCommand() *cobra.Command {
Expand Down
2 changes: 1 addition & 1 deletion client/keys/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func ReadPassphraseFromStdin(name string) (string, error) {

// TODO make keybase take a database not load from the directory

// GetKeyBase initializes a read-only KeyBase based on the configuration.
// GetKeyBase initializes a read-only KeyBase based on the configuration.
func GetKeyBase() (keys.Keybase, error) {
rootDir := viper.GetString(cli.HomeFlag)
return GetKeyBaseFromDir(rootDir)
Expand Down
2 changes: 1 addition & 1 deletion client/keys/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestGetKeyBaseLocks(t *testing.T) {
// Acquire db
kb, err := GetKeyBaseFromDirWithWritePerm(dir)
require.Nil(t, err)
_, _, err = kb.CreateMnemonic("foo", keys.English, "12345678", keys.Secp256k1)
_, _, err = kb.CreateMnemonic("foo", keys.English, "12345678", keys.Secp256k1)
require.Nil(t, err)
// Reset global variable
keybase = nil
Expand Down
2 changes: 1 addition & 1 deletion crypto/keys/keybase.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keys/mintkey"
"github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
tmcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/crypto/secp256k1"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
)

var _ Keybase = dbKeybase{}
Expand Down
2 changes: 1 addition & 1 deletion crypto/keys/mintkey/mintkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric"

cmn "github.com/tendermint/tendermint/libs/common"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
cmn "github.com/tendermint/tendermint/libs/common"
)

const (
Expand Down
86 changes: 86 additions & 0 deletions docs/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
module.exports = {
title: "Cosmos Network",
description: "Documentation for the Cosmos Network.",
dest: "./dist/docs",
base: "/docs/",
markdown: {
lineNumbers: true
},
themeConfig: {
lastUpdated: "Last Updated",
nav: [{ text: "Back to Cosmos", link: "https://cosmos.network" }],
sidebar: [
{
title: "Introduction",
collapsable: false,
children: [
"/introduction/cosmos-hub",
"/introduction/tendermint",
]
},
{
title: "Getting Started",
collapsable: false,
children: [
"/getting-started/voyager",
"/getting-started/installation",
"/getting-started/full-node",
"/getting-started/create-testnet"
]
},
{
title: "Cosmos SDK",
collapsable: false,
children: [
["/sdk/overview", "Overview"],
["/sdk/core/intro", "Core"],
"/sdk/core/app1",
"/sdk/core/app2",
"/sdk/core/app3",
"/sdk/core/app4",
"/sdk/core/app5",
// "/sdk/modules",
"/sdk/clients"
]
},
// {
// title: "Specifications",
// collapsable: false,
// children: [
// ["/specs/overview", "Overview"],
// "/specs/governance",
// "/specs/ibc",
// "/specs/staking",
// "/specs/icts",
// ]
// },
{
title: "Lotion JS",
collapsable: false,
children: [["/lotion/overview", "Overview"], "/lotion/building-an-app"]
},
{
title: "Validators",
collapsable: false,
children: [
["/validators/overview", "Overview"],
["/validators/security", "Security"],
["/validators/validator-setup", "Validator Setup"],
"/validators/validator-faq"
]
},
{
title: "Resources",
collapsable: false,
children: [
// ["/resources/faq" "General"],
"/resources/delegator-faq",
["/resources/whitepaper", "Whitepaper - English"],
["/resources/whitepaper-ko", "Whitepaper - 한국어"],
["/resources/whitepaper-zh-CN", "Whitepaper - 中文"],
["/resources/whitepaper-pt", "Whitepaper - Português"]
]
}
]
}
}
2 changes: 1 addition & 1 deletion x/auth/client/rest/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/utils"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
"github.com/cosmos/cosmos-sdk/x/auth"
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
)

// SignBody defines the properties of a sign request's body.
Expand Down
3 changes: 0 additions & 3 deletions x/distribution/keeper/allocation.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package keeper

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)

// Allocate fees handles distribution of the collected fees
func (k Keeper) AllocateTokens(ctx sdk.Context, percentVotes sdk.Dec, proposer sdk.ConsAddress) {
ctx.Logger().With("module", "x/distribution").Error(fmt.Sprintf("allocation height: %v", ctx.BlockHeight()))

// get the proposer of this block
proposerValidator := k.stakeKeeper.ValidatorByConsAddr(ctx, proposer)
Expand Down
3 changes: 0 additions & 3 deletions x/distribution/keeper/hooks.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
Expand Down Expand Up @@ -48,7 +46,6 @@ func (k Keeper) onDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress,
WithdrawalHeight: ctx.BlockHeight(),
}
k.SetDelegationDistInfo(ctx, ddi)
ctx.Logger().With("module", "x/distribution").Error(fmt.Sprintf("ddi created: %v", ddi))
}

// Withdrawal all validator rewards
Expand Down
2 changes: 1 addition & 1 deletion x/gov/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"io/ioutil"
"strings"

"github.com/cosmos/cosmos-sdk/x/gov/client"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/cosmos/cosmos-sdk/x/gov/client"
)

const (
Expand Down
16 changes: 8 additions & 8 deletions x/gov/client/rest/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov"

"github.com/cosmos/cosmos-sdk/x/gov/client"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/cosmos/cosmos-sdk/x/gov/client"
)

// REST Variable names
Expand Down Expand Up @@ -41,12 +41,12 @@ func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec)
}

type postProposalReq struct {
BaseReq utils.BaseReq `json:"base_req"`
Title string `json:"title"` // Title of the proposal
Description string `json:"description"` // Description of the proposal
ProposalType string `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
Proposer sdk.AccAddress `json:"proposer"` // Address of the proposer
InitialDeposit sdk.Coins `json:"initial_deposit"` // Coins to add to the proposal's deposit
BaseReq utils.BaseReq `json:"base_req"`
Title string `json:"title"` // Title of the proposal
Description string `json:"description"` // Description of the proposal
ProposalType string `json:"proposal_type"` // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
Proposer sdk.AccAddress `json:"proposer"` // Address of the proposer
InitialDeposit sdk.Coins `json:"initial_deposit"` // Coins to add to the proposal's deposit
}

type depositReq struct {
Expand All @@ -58,7 +58,7 @@ type depositReq struct {
type voteReq struct {
BaseReq utils.BaseReq `json:"base_req"`
Voter sdk.AccAddress `json:"voter"` // address of the voter
Option string `json:"option"` // option from OptionSet chosen by the voter
Option string `json:"option"` // option from OptionSet chosen by the voter
}

func postProposalHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc {
Expand Down
1 change: 0 additions & 1 deletion x/gov/client/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ func NormalizeProposalStatus(status string) string {
}
return ""
}

Loading