From ac0a7c0a1d95206c3677e6d632035ddcd3dfdad6 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 10 Dec 2018 14:26:34 +0000 Subject: [PATCH 1/5] Move generate_only and simulate to POST body in REST txs Closes: #3056 --- client/lcd/lcd_test.go | 28 ++++++++++++++++------------ client/utils/rest.go | 30 +++++++----------------------- x/stake/client/rest/tx.go | 6 +++--- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index 04453111a..34f8edbc9 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -279,29 +279,29 @@ func TestCoinSend(t *testing.T) { require.Equal(t, int64(1), mycoins.Amount.Int64()) // test failure with too little gas - res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "100", 0, "") + res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "100", 0, false, false) require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) // test failure with negative gas - res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "-200", 0, "") + res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "-200", 0, false, false) require.Equal(t, http.StatusBadRequest, res.StatusCode, body) // test failure with 0 gas - res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "0", 0, "") + res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "0", 0, false, false) require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) // test failure with wrong adjustment - res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "simulate", 0.1, "") + res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "simulate", 0.1, false, false) require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) // run simulation and test success with estimated gas - res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "", 0, "?simulate=true") + res, body, _ = doSendWithGas(t, port, seed, name, password, addr, "", 0, true, false) require.Equal(t, http.StatusOK, res.StatusCode, body) var responseBody struct { GasEstimate int64 `json:"gas_estimate"` } require.Nil(t, json.Unmarshal([]byte(body), &responseBody)) - res, body, _ = doSendWithGas(t, port, seed, name, password, addr, fmt.Sprintf("%v", responseBody.GasEstimate), 0, "") + res, body, _ = doSendWithGas(t, port, seed, name, password, addr, fmt.Sprintf("%v", responseBody.GasEstimate), 0, false, false) require.Equal(t, http.StatusOK, res.StatusCode, body) } @@ -342,7 +342,7 @@ func TestCoinSendGenerateSignAndBroadcast(t *testing.T) { acc := getAccount(t, port, addr) // generate TX - res, body, _ := doSendWithGas(t, port, seed, name, password, addr, "simulate", 0, "?generate_only=true") + res, body, _ := doSendWithGas(t, port, seed, name, password, addr, "simulate", 0, false, true) require.Equal(t, http.StatusOK, res.StatusCode, body) var msg auth.StdTx require.Nil(t, cdc.UnmarshalJSON([]byte(body), &msg)) @@ -897,7 +897,9 @@ func getAccount(t *testing.T, port string, addr sdk.AccAddress) auth.Account { return acc } -func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.AccAddress, gas string, gasAdjustment float64, queryStr string) (res *http.Response, body string, receiveAddr sdk.AccAddress) { +func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.AccAddress, gas string, + gasAdjustment float64, simulate, generateOnly bool) ( + res *http.Response, body string, receiveAddr sdk.AccAddress) { // create receive address kb := client.MockKeyBase() @@ -935,11 +937,13 @@ func doSendWithGas(t *testing.T, port, seed, name, password string, addr sdk.Acc "password": "%s", "chain_id": "%s", "account_number":"%d", - "sequence":"%d" + "sequence": "%d", + "simulate": %v, + "generate_only": %v } - }`, coinbz, gasStr, gasAdjustmentStr, name, password, chainID, accnum, sequence)) + }`, coinbz, gasStr, gasAdjustmentStr, name, password, chainID, accnum, sequence, simulate, generateOnly)) - res, body = Request(t, port, "POST", fmt.Sprintf("/bank/accounts/%s/transfers%v", receiveAddr, queryStr), jsonStr) + res, body = Request(t, port, "POST", fmt.Sprintf("/bank/accounts/%s/transfers", receiveAddr), jsonStr) return } @@ -958,7 +962,7 @@ func doRecoverKey(t *testing.T, port, recoverName, recoverPassword, seed string) } func doSend(t *testing.T, port, seed, name, password string, addr sdk.AccAddress) (receiveAddr sdk.AccAddress, resultTx ctypes.ResultBroadcastTxCommit) { - res, body, receiveAddr := doSendWithGas(t, port, seed, name, password, addr, "", 0, "") + res, body, receiveAddr := doSendWithGas(t, port, seed, name, password, addr, "", 0, false, false) require.Equal(t, http.StatusOK, res.StatusCode, body) err := cdc.UnmarshalJSON([]byte(body), &resultTx) diff --git a/client/utils/rest.go b/client/utils/rest.go index c0a8c3c77..36ff05af8 100644 --- a/client/utils/rest.go +++ b/client/utils/rest.go @@ -4,7 +4,6 @@ import ( "fmt" "io/ioutil" "net/http" - "net/url" "strconv" "strings" @@ -17,11 +16,6 @@ import ( authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" ) -const ( - queryArgDryRun = "simulate" - queryArgGenerateOnly = "generate_only" -) - //---------------------------------------- // Basic HTTP utilities @@ -39,18 +33,6 @@ func WriteSimulationResponse(w http.ResponseWriter, gas uint64) { w.Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas))) } -// HasDryRunArg returns true if the request's URL query contains the dry run -// argument and its value is set to "true". -func HasDryRunArg(r *http.Request) bool { - return urlQueryHasArg(r.URL, queryArgDryRun) -} - -// HasGenerateOnlyArg returns whether a URL's query "generate-only" parameter -// is set to "true". -func HasGenerateOnlyArg(r *http.Request) bool { - return urlQueryHasArg(r.URL, queryArgGenerateOnly) -} - // ParseInt64OrReturnBadRequest converts s to a int64 value. func ParseInt64OrReturnBadRequest(w http.ResponseWriter, s string) (n int64, ok bool) { var err error @@ -113,8 +95,6 @@ func WriteGenerateStdTxResponse(w http.ResponseWriter, txBldr authtxb.TxBuilder, return } -func urlQueryHasArg(url *url.URL, arg string) bool { return url.Query().Get(arg) == "true" } - //---------------------------------------- // Building / Sending utilities @@ -128,6 +108,8 @@ type BaseReq struct { Sequence uint64 `json:"sequence"` Gas string `json:"gas"` GasAdjustment string `json:"gas_adjustment"` + GenerateOnly bool `json:"generate_only"` + Simulate bool `json:"simulate"` } // Sanitize performs basic sanitization on a BaseReq object. @@ -140,6 +122,8 @@ func (br BaseReq) Sanitize() BaseReq { GasAdjustment: strings.TrimSpace(br.GasAdjustment), AccountNumber: br.AccountNumber, Sequence: br.Sequence, + GenerateOnly: br.GenerateOnly, + Simulate: br.Simulate, } } @@ -223,14 +207,14 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c Sequence: baseReq.Sequence, } - if HasDryRunArg(r) || txBldr.SimulateGas { + if baseReq.Simulate || txBldr.SimulateGas { newBldr, err := EnrichCtxWithGas(txBldr, cliCtx, baseReq.Name, msgs) if err != nil { WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - if HasDryRunArg(r) { + if baseReq.Simulate { WriteSimulationResponse(w, newBldr.Gas) return } @@ -238,7 +222,7 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c txBldr = newBldr } - if HasGenerateOnlyArg(r) { + if baseReq.GenerateOnly { WriteGenerateStdTxResponse(w, txBldr, msgs) return } diff --git a/x/stake/client/rest/tx.go b/x/stake/client/rest/tx.go index 437d40e77..5deb5b53c 100644 --- a/x/stake/client/rest/tx.go +++ b/x/stake/client/rest/tx.go @@ -219,14 +219,14 @@ func delegationsRequestHandlerFn(cdc *codec.Codec, kb keys.Keybase, cliCtx conte baseReq.Sequence++ - if utils.HasDryRunArg(r) || txBldr.SimulateGas { + if baseReq.Simulate || txBldr.SimulateGas { newBldr, err := utils.EnrichCtxWithGas(txBldr, cliCtx, baseReq.Name, []sdk.Msg{msg}) if err != nil { utils.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) return } - if utils.HasDryRunArg(r) { + if baseReq.Simulate { utils.WriteSimulationResponse(w, newBldr.Gas) return } @@ -234,7 +234,7 @@ func delegationsRequestHandlerFn(cdc *codec.Codec, kb keys.Keybase, cliCtx conte txBldr = newBldr } - if utils.HasGenerateOnlyArg(r) { + if baseReq.GenerateOnly { utils.WriteGenerateStdTxResponse(w, txBldr, []sdk.Msg{msg}) return } From 24a1670cf04898d077c4f00d745ef6cc25d5f1d1 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 10 Dec 2018 14:27:25 +0000 Subject: [PATCH 2/5] Run make format --- baseapp/helpers.go | 3 ++- baseapp/options.go | 3 ++- baseapp/query_test.go | 3 ++- client/config.go | 3 ++- client/context/context.go | 7 ++++--- client/context/errors.go | 3 ++- client/context/query.go | 3 ++- client/keys.go | 3 ++- client/keys/delete.go | 3 ++- client/keys/mnemonic.go | 3 ++- client/keys/root.go | 3 ++- client/keys/show.go | 8 +++++--- client/keys/update.go | 8 +++++--- client/keys/utils.go | 9 +++++---- client/keys/utils_test.go | 6 ++++-- client/lcd/root.go | 13 +++++++------ client/lcd/test_helpers.go | 6 ++++-- client/rpc/block.go | 3 ++- client/rpc/root.go | 3 ++- client/rpc/status.go | 5 +++-- client/rpc/validators.go | 5 +++-- client/tx/broadcast.go | 3 ++- client/tx/query.go | 3 ++- client/utils/utils.go | 5 +++-- client/utils/utils_test.go | 5 +++-- cmd/cosmos-sdk-cli/cmd/init.go | 3 ++- cmd/gaia/app/app.go | 9 +++++---- cmd/gaia/app/app_test.go | 7 ++++--- cmd/gaia/app/benchmarks/txsize_test.go | 3 ++- cmd/gaia/app/export.go | 5 +++-- cmd/gaia/app/genesis.go | 3 ++- cmd/gaia/app/genesis_test.go | 7 ++++--- cmd/gaia/app/invariants.go | 3 ++- cmd/gaia/cmd/gaiadebug/main.go | 7 ++++--- cmd/gaia/init/collect.go | 11 ++++++----- cmd/gaia/init/genesis_accts.go | 9 +++++---- cmd/gaia/init/genesis_accts_test.go | 3 ++- cmd/gaia/init/gentx.go | 9 +++++---- cmd/gaia/init/init.go | 9 +++++---- cmd/gaia/init/init_test.go | 10 ++++++---- cmd/gaia/init/testnet.go | 3 ++- cmd/gaia/init/utils.go | 5 +++-- crypto/keys/codec.go | 3 ++- crypto/keys/keybase.go | 3 ++- crypto/keys/keybase_test.go | 3 ++- crypto/keys/mintkey/mintkey.go | 3 ++- crypto/keys/types.go | 3 ++- docs/_attic/sdk/core/examples/app2_test.go | 3 ++- docs/examples/basecoin/app/app.go | 11 ++++++----- docs/examples/basecoin/app/app_test.go | 9 +++++---- docs/examples/basecoin/cli_test/cli_test.go | 3 ++- docs/examples/basecoin/cmd/basecli/main.go | 5 +++-- docs/examples/basecoin/cmd/basecoind/main.go | 9 +++++---- docs/examples/democoin/app/app_test.go | 11 ++++++----- docs/examples/democoin/cli_test/cli_test.go | 3 ++- docs/examples/democoin/cmd/democoind/main.go | 3 ++- docs/examples/democoin/mock/validator.go | 3 ++- docs/examples/democoin/x/cool/app_test.go | 7 ++++--- docs/examples/democoin/x/pow/mine.go | 3 ++- server/config/config_test.go | 3 ++- server/export.go | 6 ++++-- server/init.go | 7 +++++-- server/mock/app.go | 3 ++- server/mock/app_test.go | 3 ++- server/test_helpers.go | 3 ++- server/tm_cmds.go | 8 +++++--- server/util.go | 9 +++++---- server/util_test.go | 3 ++- store/dbstoreadapter.go | 3 ++- store/list_test.go | 3 ++- store/multistoreproof_test.go | 3 ++- store/transientstore.go | 3 ++- types/context_test.go | 3 ++- types/decimal_test.go | 3 ++- types/errors.go | 3 ++- x/auth/account.go | 3 ++- x/auth/ante.go | 3 ++- x/auth/ante_test.go | 5 +++-- x/auth/client/cli/sign.go | 7 ++++--- x/auth/client/txbuilder/txbuilder_test.go | 3 ++- x/auth/keeper.go | 3 ++- x/auth/keeper_bench_test.go | 5 +++-- x/auth/keeper_test.go | 7 ++++--- x/auth/stdtx.go | 5 +++-- x/auth/stdtx_test.go | 3 ++- x/bank/client/cli/broadcast.go | 5 +++-- x/bank/client/cli/sendtx.go | 3 ++- x/bank/simulation/msgs.go | 3 ++- x/distribution/client/module_client.go | 5 +++-- x/distribution/keeper/allocation_test.go | 5 +++-- x/distribution/keeper/delegation_test.go | 3 ++- x/distribution/keeper/keeper_test.go | 3 ++- x/distribution/keeper/validator_test.go | 3 ++- x/distribution/types/dec_coin_test.go | 3 ++- x/distribution/types/delegator_info_test.go | 3 ++- x/distribution/types/fee_pool_test.go | 3 ++- x/distribution/types/test_common.go | 3 ++- x/distribution/types/total_accum_test.go | 3 ++- x/distribution/types/validator_info_test.go | 3 ++- x/gov/client/cli/query.go | 5 +++-- x/gov/client/cli/tx.go | 6 ++++-- x/gov/client/cli/tx_test.go | 5 +++-- x/gov/client/module_client.go | 5 +++-- x/gov/client/rest/rest.go | 3 ++- x/gov/depositsvotes.go | 3 ++- x/gov/endblocker_test.go | 3 ++- x/gov/querier.go | 3 ++- x/gov/querier_test.go | 5 +++-- x/gov/tally_test.go | 3 ++- x/mock/app.go | 9 +++++---- x/mock/app_test.go | 5 +++-- x/mock/simulation/invariants.go | 3 ++- x/mock/test_utils.go | 5 +++-- x/slashing/client/cli/tx.go | 3 ++- x/slashing/client/module_client.go | 5 +++-- x/slashing/client/rest/query.go | 3 ++- x/slashing/keeper.go | 3 ++- x/slashing/keeper_test.go | 5 +++-- x/slashing/tick.go | 3 ++- x/stake/client/cli/utils.go | 3 ++- x/stake/client/module_client.go | 5 +++-- x/stake/client/rest/query.go | 3 ++- x/stake/client/rest/utils.go | 3 ++- x/stake/genesis_test.go | 5 +++-- x/stake/keeper/key_test.go | 5 +++-- x/stake/keeper/slash_test.go | 3 ++- x/stake/keeper/validator_test.go | 3 ++- x/stake/querier/querier.go | 3 ++- x/stake/querier/querier_test.go | 5 +++-- x/stake/types/delegation_test.go | 3 ++- x/stake/types/msg.go | 3 ++- x/stake/types/msg_test.go | 3 ++- x/stake/types/pool_test.go | 3 ++- x/stake/types/test_utils.go | 3 ++- 134 files changed, 375 insertions(+), 231 deletions(-) diff --git a/baseapp/helpers.go b/baseapp/helpers.go index f3f1448bc..b6a0a3612 100644 --- a/baseapp/helpers.go +++ b/baseapp/helpers.go @@ -1,10 +1,11 @@ package baseapp import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/abci/server" abci "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tendermint/libs/common" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // nolint - Mostly for testing diff --git a/baseapp/options.go b/baseapp/options.go index 8d86933a0..6e4104e50 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -4,9 +4,10 @@ package baseapp import ( "fmt" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - dbm "github.com/tendermint/tendermint/libs/db" ) // File for storing in-package BaseApp optional functions, diff --git a/baseapp/query_test.go b/baseapp/query_test.go index d9d4001eb..fed7ae477 100644 --- a/baseapp/query_test.go +++ b/baseapp/query_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // Test that we can only query from the latest committed state. diff --git a/client/config.go b/client/config.go index 51d6da700..ab72ee78d 100644 --- a/client/config.go +++ b/client/config.go @@ -7,9 +7,10 @@ import ( "path" "strconv" - "github.com/cosmos/cosmos-sdk/cmd/gaia/app" "github.com/tendermint/tendermint/libs/cli" + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/pelletier/go-toml" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/client/context/context.go b/client/context/context.go index 4b4407368..df30374de 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -13,14 +13,15 @@ import ( "github.com/spf13/viper" - "github.com/cosmos/cosmos-sdk/client/keys" - cskeys "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/log" tmlite "github.com/tendermint/tendermint/lite" tmliteProxy "github.com/tendermint/tendermint/lite/proxy" rpcclient "github.com/tendermint/tendermint/rpc/client" + + "github.com/cosmos/cosmos-sdk/client/keys" + cskeys "github.com/cosmos/cosmos-sdk/crypto/keys" + "github.com/cosmos/cosmos-sdk/types" ) const ctxAccStoreName = "acc" diff --git a/client/context/errors.go b/client/context/errors.go index de96aaa18..f28454ca0 100644 --- a/client/context/errors.go +++ b/client/context/errors.go @@ -1,8 +1,9 @@ package context import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // ErrInvalidAccount returns a standardized error reflecting that a given diff --git a/client/context/query.go b/client/context/query.go index 486bd5186..0eff95d30 100644 --- a/client/context/query.go +++ b/client/context/query.go @@ -10,7 +10,6 @@ import ( "strings" - "github.com/cosmos/cosmos-sdk/store" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/merkle" cmn "github.com/tendermint/tendermint/libs/common" @@ -18,6 +17,8 @@ import ( tmliteProxy "github.com/tendermint/tendermint/lite/proxy" rpcclient "github.com/tendermint/tendermint/rpc/client" tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/store" ) // GetNode returns an RPC client. If the context's client is not defined, an diff --git a/client/keys.go b/client/keys.go index a39b074b9..1fc594a2a 100644 --- a/client/keys.go +++ b/client/keys.go @@ -1,8 +1,9 @@ package client import ( - "github.com/cosmos/cosmos-sdk/crypto/keys" dbm "github.com/tendermint/tendermint/libs/db" + + "github.com/cosmos/cosmos-sdk/crypto/keys" ) // GetKeyBase initializes a keybase based on the given db. diff --git a/client/keys/delete.go b/client/keys/delete.go index e3fac4b7f..5f3ff4f09 100644 --- a/client/keys/delete.go +++ b/client/keys/delete.go @@ -10,10 +10,11 @@ import ( "github.com/spf13/viper" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client" keys "github.com/cosmos/cosmos-sdk/crypto/keys" keyerror "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" - "github.com/gorilla/mux" "github.com/spf13/cobra" ) diff --git a/client/keys/mnemonic.go b/client/keys/mnemonic.go index 33270a087..32a6856bb 100644 --- a/client/keys/mnemonic.go +++ b/client/keys/mnemonic.go @@ -4,9 +4,10 @@ import ( "crypto/sha256" "fmt" - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" + bip39 "github.com/bartekn/go-bip39" ) diff --git a/client/keys/root.go b/client/keys/root.go index bca6f50e8..f747d84a0 100644 --- a/client/keys/root.go +++ b/client/keys/root.go @@ -1,9 +1,10 @@ package keys import ( - "github.com/cosmos/cosmos-sdk/client" "github.com/gorilla/mux" "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" ) // Commands registers a sub-tree of commands to interact with diff --git a/client/keys/show.go b/client/keys/show.go index d539eb3b7..9583dd07a 100644 --- a/client/keys/show.go +++ b/client/keys/show.go @@ -4,17 +4,19 @@ import ( "fmt" "net/http" - "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/tendermint/tendermint/crypto" - "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/crypto/keys" + "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" + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( diff --git a/client/keys/update.go b/client/keys/update.go index 2489bce12..e72da240c 100644 --- a/client/keys/update.go +++ b/client/keys/update.go @@ -5,12 +5,14 @@ import ( "fmt" "net/http" - "github.com/cosmos/cosmos-sdk/client" - keys "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/gorilla/mux" - "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" + "github.com/cosmos/cosmos-sdk/client" + keys "github.com/cosmos/cosmos-sdk/crypto/keys" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" ) func updateKeyCommand() *cobra.Command { diff --git a/client/keys/utils.go b/client/keys/utils.go index 0ac4a9c90..78899f5f8 100644 --- a/client/keys/utils.go +++ b/client/keys/utils.go @@ -5,14 +5,15 @@ import ( "net/http" "path/filepath" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/crypto/keys" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/viper" "github.com/syndtr/goleveldb/leveldb/opt" "github.com/tendermint/tendermint/libs/cli" dbm "github.com/tendermint/tendermint/libs/db" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys" + sdk "github.com/cosmos/cosmos-sdk/types" ) // KeyDBName is the directory under root where we store the keys diff --git a/client/keys/utils_test.go b/client/keys/utils_test.go index 6b65bb55a..5f3dd4560 100644 --- a/client/keys/utils_test.go +++ b/client/keys/utils_test.go @@ -1,11 +1,13 @@ package keys import ( - "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/stretchr/testify/require" "io/ioutil" "os" "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/crypto/keys" ) func TestGetKeyBaseLocks(t *testing.T) { diff --git a/client/lcd/root.go b/client/lcd/root.go index 00dab053e..ad7ba2ff0 100644 --- a/client/lcd/root.go +++ b/client/lcd/root.go @@ -7,12 +7,6 @@ import ( "net/http" "os" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/codec" - keybase "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/cosmos/cosmos-sdk/server" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cobra" @@ -20,6 +14,13 @@ import ( "github.com/tendermint/tendermint/libs/log" rpcserver "github.com/tendermint/tendermint/rpc/lib/server" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/context" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/codec" + keybase "github.com/cosmos/cosmos-sdk/crypto/keys" + "github.com/cosmos/cosmos-sdk/server" + // Import statik for light client stuff _ "github.com/cosmos/cosmos-sdk/client/lcd/statik" ) diff --git a/client/lcd/test_helpers.go b/client/lcd/test_helpers.go index 921dc96dd..87f57f385 100644 --- a/client/lcd/test_helpers.go +++ b/client/lcd/test_helpers.go @@ -14,9 +14,10 @@ import ( "strings" "testing" - stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" "github.com/tendermint/tendermint/crypto/secp256k1" + stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" @@ -33,7 +34,6 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/require" - txbuilder "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" abci "github.com/tendermint/tendermint/abci/types" tmcfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" @@ -48,6 +48,8 @@ import ( tmrpc "github.com/tendermint/tendermint/rpc/lib/server" tmtypes "github.com/tendermint/tendermint/types" + txbuilder "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" + authRest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" bankRest "github.com/cosmos/cosmos-sdk/x/bank/client/rest" govRest "github.com/cosmos/cosmos-sdk/x/gov/client/rest" diff --git a/client/rpc/block.go b/client/rpc/block.go index b2db545db..ee77fb5c1 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -8,11 +8,12 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/client/utils" "github.com/gorilla/mux" "github.com/spf13/cobra" "github.com/spf13/viper" tmliteProxy "github.com/tendermint/tendermint/lite/proxy" + + "github.com/cosmos/cosmos-sdk/client/utils" ) //BlockCommand returns the verified block data for a given heights diff --git a/client/rpc/root.go b/client/rpc/root.go index 7bdcd8cd8..c8a98bc44 100644 --- a/client/rpc/root.go +++ b/client/rpc/root.go @@ -5,9 +5,10 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" - "github.com/spf13/viper" ) const ( diff --git a/client/rpc/status.go b/client/rpc/status.go index 0f81fc9c6..86bb1ef31 100644 --- a/client/rpc/status.go +++ b/client/rpc/status.go @@ -7,11 +7,12 @@ import ( "github.com/spf13/cobra" + "github.com/spf13/viper" + ctypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" - "github.com/spf13/viper" - ctypes "github.com/tendermint/tendermint/rpc/core/types" ) // StatusCommand returns the status of the network diff --git a/client/rpc/validators.go b/client/rpc/validators.go index 6ec7ba615..9d401f69c 100644 --- a/client/rpc/validators.go +++ b/client/rpc/validators.go @@ -9,12 +9,13 @@ import ( "github.com/gorilla/mux" "github.com/spf13/cobra" + "github.com/spf13/viper" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/viper" - tmtypes "github.com/tendermint/tendermint/types" ) // TODO these next two functions feel kinda hacky based on their placement diff --git a/client/tx/broadcast.go b/client/tx/broadcast.go index 8346e1538..4080b68ec 100644 --- a/client/tx/broadcast.go +++ b/client/tx/broadcast.go @@ -3,10 +3,11 @@ package tx import ( "net/http" + "io/ioutil" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" - "io/ioutil" ) const ( diff --git a/client/tx/query.go b/client/tx/query.go index 3bbbf9a13..945701224 100644 --- a/client/tx/query.go +++ b/client/tx/query.go @@ -12,13 +12,14 @@ import ( abci "github.com/tendermint/tendermint/abci/types" ctypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/spf13/viper" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/spf13/viper" ) // QueryTxCmd implements the default command for a tx query. diff --git a/client/utils/utils.go b/client/utils/utils.go index 2d506e462..08a538eec 100644 --- a/client/utils/utils.go +++ b/client/utils/utils.go @@ -6,13 +6,14 @@ import ( "io" "os" + "github.com/tendermint/go-amino" + "github.com/tendermint/tendermint/libs/common" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/keys" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" - "github.com/tendermint/go-amino" - "github.com/tendermint/tendermint/libs/common" ) // CompleteAndBroadcastTxCli implements a utility function that facilitates diff --git a/client/utils/utils_test.go b/client/utils/utils_test.go index b22a50806..23c665239 100644 --- a/client/utils/utils_test.go +++ b/client/utils/utils_test.go @@ -4,10 +4,11 @@ import ( "errors" "testing" - "github.com/cosmos/cosmos-sdk/cmd/gaia/app" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/tendermint/tendermint/libs/common" + + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestParseQueryResponse(t *testing.T) { diff --git a/cmd/cosmos-sdk-cli/cmd/init.go b/cmd/cosmos-sdk-cli/cmd/init.go index fcf30b972..f8cf88b88 100644 --- a/cmd/cosmos-sdk-cli/cmd/init.go +++ b/cmd/cosmos-sdk-cli/cmd/init.go @@ -9,9 +9,10 @@ import ( "path/filepath" - "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" tmversion "github.com/tendermint/tendermint/version" + + "github.com/cosmos/cosmos-sdk/version" ) var remoteBasecoinPath = "github.com/cosmos/cosmos-sdk/docs/examples/basecoin" diff --git a/cmd/gaia/app/app.go b/cmd/gaia/app/app.go index 270fe52ec..d97d25f0a 100644 --- a/cmd/gaia/app/app.go +++ b/cmd/gaia/app/app.go @@ -6,6 +6,11 @@ import ( "os" "sort" + abci "github.com/tendermint/tendermint/abci/types" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" + bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,10 +22,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/stake" - abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tendermint/libs/common" - dbm "github.com/tendermint/tendermint/libs/db" - "github.com/tendermint/tendermint/libs/log" ) const ( diff --git a/cmd/gaia/app/app_test.go b/cmd/gaia/app/app_test.go index e356d6d6d..238f22966 100644 --- a/cmd/gaia/app/app_test.go +++ b/cmd/gaia/app/app_test.go @@ -4,6 +4,10 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" distr "github.com/cosmos/cosmos-sdk/x/distribution" @@ -11,9 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/stake" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/db" - "github.com/tendermint/tendermint/libs/log" abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/cmd/gaia/app/benchmarks/txsize_test.go b/cmd/gaia/app/benchmarks/txsize_test.go index a401c16ca..d9862f22c 100644 --- a/cmd/gaia/app/benchmarks/txsize_test.go +++ b/cmd/gaia/app/benchmarks/txsize_test.go @@ -3,11 +3,12 @@ package app import ( "fmt" + "github.com/tendermint/tendermint/crypto/secp256k1" + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/tendermint/tendermint/crypto/secp256k1" ) // This will fail half the time with the second output being 173 diff --git a/cmd/gaia/app/export.go b/cmd/gaia/app/export.go index a2aa42087..2b51c444b 100644 --- a/cmd/gaia/app/export.go +++ b/cmd/gaia/app/export.go @@ -4,6 +4,9 @@ import ( "encoding/json" "fmt" + abci "github.com/tendermint/tendermint/abci/types" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" @@ -12,8 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/slashing" stake "github.com/cosmos/cosmos-sdk/x/stake" - abci "github.com/tendermint/tendermint/abci/types" - tmtypes "github.com/tendermint/tendermint/types" ) // export the state of gaia for a genesis file diff --git a/cmd/gaia/app/genesis.go b/cmd/gaia/app/genesis.go index ee3ecfcd6..9c92f60ba 100644 --- a/cmd/gaia/app/genesis.go +++ b/cmd/gaia/app/genesis.go @@ -10,6 +10,8 @@ import ( "sort" "strings" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" @@ -19,7 +21,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/stake" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" - tmtypes "github.com/tendermint/tendermint/types" ) var ( diff --git a/cmd/gaia/app/genesis_test.go b/cmd/gaia/app/genesis_test.go index 1b1c19646..425962fa3 100644 --- a/cmd/gaia/app/genesis_test.go +++ b/cmd/gaia/app/genesis_test.go @@ -7,13 +7,14 @@ import ( "github.com/tendermint/tendermint/crypto/secp256k1" tmtypes "github.com/tendermint/tendermint/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/stake" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" ) var ( diff --git a/cmd/gaia/app/invariants.go b/cmd/gaia/app/invariants.go index 4a60a41ae..4582457fc 100644 --- a/cmd/gaia/app/invariants.go +++ b/cmd/gaia/app/invariants.go @@ -4,12 +4,13 @@ import ( "fmt" "time" + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" banksim "github.com/cosmos/cosmos-sdk/x/bank/simulation" distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" "github.com/cosmos/cosmos-sdk/x/mock/simulation" stakesim "github.com/cosmos/cosmos-sdk/x/stake/simulation" - abci "github.com/tendermint/tendermint/abci/types" ) func (app *GaiaApp) runtimeInvariants() []simulation.Invariant { diff --git a/cmd/gaia/cmd/gaiadebug/main.go b/cmd/gaia/cmd/gaiadebug/main.go index 5117d0aa1..59e324966 100644 --- a/cmd/gaia/cmd/gaiadebug/main.go +++ b/cmd/gaia/cmd/gaiadebug/main.go @@ -10,12 +10,13 @@ import ( "strconv" "strings" - gaia "github.com/cosmos/cosmos-sdk/cmd/gaia/app" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" "github.com/spf13/cobra" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + + gaia "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" ) func init() { diff --git a/cmd/gaia/init/collect.go b/cmd/gaia/init/collect.go index cdfc1688c..da97e4626 100644 --- a/cmd/gaia/init/collect.go +++ b/cmd/gaia/init/collect.go @@ -4,17 +4,18 @@ import ( "encoding/json" "path/filepath" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/cmd/gaia/app" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/x/auth" "github.com/spf13/cobra" "github.com/spf13/viper" cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/x/auth" ) type initConfig struct { diff --git a/cmd/gaia/init/genesis_accts.go b/cmd/gaia/init/genesis_accts.go index 04c1f6283..4f5043877 100644 --- a/cmd/gaia/init/genesis_accts.go +++ b/cmd/gaia/init/genesis_accts.go @@ -4,15 +4,16 @@ import ( "encoding/json" "fmt" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/tendermint/tendermint/libs/cli" + "github.com/tendermint/tendermint/libs/common" + "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 diff --git a/cmd/gaia/init/genesis_accts_test.go b/cmd/gaia/init/genesis_accts_test.go index 49634a90c..42a36b263 100644 --- a/cmd/gaia/init/genesis_accts_test.go +++ b/cmd/gaia/init/genesis_accts_test.go @@ -1,9 +1,10 @@ package init import ( + "testing" + "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/secp256k1" - "testing" "github.com/cosmos/cosmos-sdk/cmd/gaia/app" "github.com/cosmos/cosmos-sdk/codec" diff --git a/cmd/gaia/init/gentx.go b/cmd/gaia/init/gentx.go index 0a4eb8034..c8a7c05d2 100644 --- a/cmd/gaia/init/gentx.go +++ b/cmd/gaia/init/gentx.go @@ -11,6 +11,11 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + cfg "github.com/tendermint/tendermint/config" + "github.com/tendermint/tendermint/crypto" + tmcli "github.com/tendermint/tendermint/libs/cli" + "github.com/tendermint/tendermint/libs/common" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/keys" @@ -23,10 +28,6 @@ import ( authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/stake/client/cli" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" - cfg "github.com/tendermint/tendermint/config" - "github.com/tendermint/tendermint/crypto" - tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/tendermint/tendermint/libs/common" ) const ( diff --git a/cmd/gaia/init/init.go b/cmd/gaia/init/init.go index 19179233a..7690d5336 100644 --- a/cmd/gaia/init/init.go +++ b/cmd/gaia/init/init.go @@ -6,15 +6,16 @@ import ( "os" "path/filepath" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/cmd/gaia/app" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/server" "github.com/spf13/cobra" "github.com/spf13/viper" cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/common" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server" ) const ( diff --git a/cmd/gaia/init/init_test.go b/cmd/gaia/init/init_test.go index 1eeba66ae..faf324e6c 100644 --- a/cmd/gaia/init/init_test.go +++ b/cmd/gaia/init/init_test.go @@ -8,17 +8,19 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/cmd/gaia/app" "github.com/tendermint/tendermint/libs/cli" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/server/mock" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/stretchr/testify/require" abciServer "github.com/tendermint/tendermint/abci/server" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/server/mock" + "github.com/spf13/viper" ) diff --git a/cmd/gaia/init/testnet.go b/cmd/gaia/init/testnet.go index 73a7cea14..cfa3e6396 100644 --- a/cmd/gaia/init/testnet.go +++ b/cmd/gaia/init/testnet.go @@ -16,7 +16,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/stake" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/cosmos/cosmos-sdk/server" "github.com/spf13/cobra" "github.com/spf13/viper" cfg "github.com/tendermint/tendermint/config" @@ -24,6 +23,8 @@ import ( cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" + + "github.com/cosmos/cosmos-sdk/server" ) var ( diff --git a/cmd/gaia/init/utils.go b/cmd/gaia/init/utils.go index 58edc9b2a..14c625d7f 100644 --- a/cmd/gaia/init/utils.go +++ b/cmd/gaia/init/utils.go @@ -6,8 +6,6 @@ import ( "io/ioutil" "time" - "github.com/cosmos/cosmos-sdk/cmd/gaia/app" - "github.com/cosmos/cosmos-sdk/codec" amino "github.com/tendermint/go-amino" cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" @@ -15,6 +13,9 @@ import ( "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/cosmos/cosmos-sdk/codec" ) // ExportGenesisFile creates and writes the genesis configuration to disk. An diff --git a/crypto/keys/codec.go b/crypto/keys/codec.go index 80a13539a..f6c1a013d 100644 --- a/crypto/keys/codec.go +++ b/crypto/keys/codec.go @@ -1,9 +1,10 @@ package keys import ( - ccrypto "github.com/cosmos/cosmos-sdk/crypto" amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto/encoding/amino" + + ccrypto "github.com/cosmos/cosmos-sdk/crypto" ) var cdc = amino.NewCodec() diff --git a/crypto/keys/keybase.go b/crypto/keys/keybase.go index 982a4e726..e202cd6d8 100644 --- a/crypto/keys/keybase.go +++ b/crypto/keys/keybase.go @@ -15,11 +15,12 @@ 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{} diff --git a/crypto/keys/keybase_test.go b/crypto/keys/keybase_test.go index 3c7f98060..bc7783b67 100644 --- a/crypto/keys/keybase_test.go +++ b/crypto/keys/keybase_test.go @@ -13,8 +13,9 @@ import ( "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/cosmos/cosmos-sdk/types" dbm "github.com/tendermint/tendermint/libs/db" + + "github.com/cosmos/cosmos-sdk/types" ) func init() { diff --git a/crypto/keys/mintkey/mintkey.go b/crypto/keys/mintkey/mintkey.go index 35cb9ccab..3b06415e2 100644 --- a/crypto/keys/mintkey/mintkey.go +++ b/crypto/keys/mintkey/mintkey.go @@ -11,8 +11,9 @@ import ( "github.com/tendermint/tendermint/crypto/encoding/amino" "github.com/tendermint/tendermint/crypto/xsalsa20symmetric" - "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" cmn "github.com/tendermint/tendermint/libs/common" + + "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" ) const ( diff --git a/crypto/keys/types.go b/crypto/keys/types.go index b4b328516..14d050961 100644 --- a/crypto/keys/types.go +++ b/crypto/keys/types.go @@ -1,9 +1,10 @@ package keys import ( - ccrypto "github.com/cosmos/cosmos-sdk/crypto" "github.com/tendermint/tendermint/crypto" + ccrypto "github.com/cosmos/cosmos-sdk/crypto" + "github.com/cosmos/cosmos-sdk/crypto/keys/hd" "github.com/cosmos/cosmos-sdk/types" ) diff --git a/docs/_attic/sdk/core/examples/app2_test.go b/docs/_attic/sdk/core/examples/app2_test.go index b7c94bbcf..0712e7add 100644 --- a/docs/_attic/sdk/core/examples/app2_test.go +++ b/docs/_attic/sdk/core/examples/app2_test.go @@ -3,9 +3,10 @@ package app import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" ) diff --git a/docs/examples/basecoin/app/app.go b/docs/examples/basecoin/app/app.go index f534c9128..a469e0b2a 100644 --- a/docs/examples/basecoin/app/app.go +++ b/docs/examples/basecoin/app/app.go @@ -4,6 +4,12 @@ import ( "encoding/json" "os" + abci "github.com/tendermint/tendermint/abci/types" + cmn "github.com/tendermint/tendermint/libs/common" + dbm "github.com/tendermint/tendermint/libs/db" + "github.com/tendermint/tendermint/libs/log" + tmtypes "github.com/tendermint/tendermint/types" + bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types" @@ -11,11 +17,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" - abci "github.com/tendermint/tendermint/abci/types" - cmn "github.com/tendermint/tendermint/libs/common" - dbm "github.com/tendermint/tendermint/libs/db" - "github.com/tendermint/tendermint/libs/log" - tmtypes "github.com/tendermint/tendermint/types" ) const ( diff --git a/docs/examples/basecoin/app/app_test.go b/docs/examples/basecoin/app/app_test.go index 64bc6a86e..4dae71194 100644 --- a/docs/examples/basecoin/app/app_test.go +++ b/docs/examples/basecoin/app/app_test.go @@ -4,15 +4,16 @@ import ( "os" "testing" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/ed25519" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" ) func setGenesis(baseApp *BasecoinApp, accounts ...*types.AppAccount) (types.GenesisState, error) { diff --git a/docs/examples/basecoin/cli_test/cli_test.go b/docs/examples/basecoin/cli_test/cli_test.go index 635b54c3c..7e6a648df 100644 --- a/docs/examples/basecoin/cli_test/cli_test.go +++ b/docs/examples/basecoin/cli_test/cli_test.go @@ -6,10 +6,11 @@ import ( "os" "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/cmd/gaia/app" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/tests" - "github.com/stretchr/testify/require" ) var ( diff --git a/docs/examples/basecoin/cmd/basecli/main.go b/docs/examples/basecoin/cmd/basecli/main.go index 6e274123e..fe681a3ad 100644 --- a/docs/examples/basecoin/cmd/basecli/main.go +++ b/docs/examples/basecoin/cmd/basecli/main.go @@ -9,6 +9,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app" + "github.com/spf13/cobra" + "github.com/tendermint/tendermint/libs/cli" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" @@ -20,8 +23,6 @@ import ( slashing "github.com/cosmos/cosmos-sdk/x/slashing/client/rest" stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli" stake "github.com/cosmos/cosmos-sdk/x/stake/client/rest" - "github.com/spf13/cobra" - "github.com/tendermint/tendermint/libs/cli" ) const ( diff --git a/docs/examples/basecoin/cmd/basecoind/main.go b/docs/examples/basecoin/cmd/basecoind/main.go index 383a843b2..9cb246671 100644 --- a/docs/examples/basecoin/cmd/basecoind/main.go +++ b/docs/examples/basecoin/cmd/basecoind/main.go @@ -11,10 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" gaiaInit "github.com/cosmos/cosmos-sdk/cmd/gaia/init" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app" - "github.com/cosmos/cosmos-sdk/server" "github.com/spf13/cobra" "github.com/spf13/viper" abci "github.com/tendermint/tendermint/abci/types" @@ -23,6 +19,11 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app" + "github.com/cosmos/cosmos-sdk/server" ) const ( diff --git a/docs/examples/democoin/app/app_test.go b/docs/examples/democoin/app/app_test.go index 93cef936c..200103466 100644 --- a/docs/examples/democoin/app/app_test.go +++ b/docs/examples/democoin/app/app_test.go @@ -4,16 +4,17 @@ import ( "os" "testing" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/docs/examples/democoin/types" - "github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/ed25519" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/docs/examples/democoin/types" + "github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" ) func setGenesis(bapp *DemocoinApp, trend string, accs ...auth.BaseAccount) error { diff --git a/docs/examples/democoin/cli_test/cli_test.go b/docs/examples/democoin/cli_test/cli_test.go index 9a3cba0df..1aa9d94ac 100644 --- a/docs/examples/democoin/cli_test/cli_test.go +++ b/docs/examples/democoin/cli_test/cli_test.go @@ -8,9 +8,10 @@ import ( "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/tests" - "github.com/stretchr/testify/require" ) var ( diff --git a/docs/examples/democoin/cmd/democoind/main.go b/docs/examples/democoin/cmd/democoind/main.go index 8f52340f4..f0553ee5d 100644 --- a/docs/examples/democoin/cmd/democoind/main.go +++ b/docs/examples/democoin/cmd/democoind/main.go @@ -6,11 +6,12 @@ import ( "io" "os" - "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/viper" "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/p2p" + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" abci "github.com/tendermint/tendermint/abci/types" diff --git a/docs/examples/democoin/mock/validator.go b/docs/examples/democoin/mock/validator.go index 1d10c48b2..ee8e497cb 100644 --- a/docs/examples/democoin/mock/validator.go +++ b/docs/examples/democoin/mock/validator.go @@ -3,8 +3,9 @@ package mock import ( "bytes" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // Validator implements sdk.Validator diff --git a/docs/examples/democoin/x/cool/app_test.go b/docs/examples/democoin/x/cool/app_test.go index 3725f7b9b..7e9e29f24 100644 --- a/docs/examples/democoin/x/cool/app_test.go +++ b/docs/examples/democoin/x/cool/app_test.go @@ -3,13 +3,14 @@ package cool import ( "testing" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/mock" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/ed25519" ) var ( diff --git a/docs/examples/democoin/x/pow/mine.go b/docs/examples/democoin/x/pow/mine.go index bf1c64cd4..3c24c1264 100644 --- a/docs/examples/democoin/x/pow/mine.go +++ b/docs/examples/democoin/x/pow/mine.go @@ -5,8 +5,9 @@ import ( "math" "strconv" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // generate the mine message diff --git a/server/config/config_test.go b/server/config/config_test.go index e4d552ad2..d68d84415 100644 --- a/server/config/config_test.go +++ b/server/config/config_test.go @@ -3,8 +3,9 @@ package config import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestDefaultConfig(t *testing.T) { diff --git a/server/export.go b/server/export.go index 7b5ba4a69..aa30597da 100644 --- a/server/export.go +++ b/server/export.go @@ -7,10 +7,12 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/cosmos/cosmos-sdk/codec" - tmtypes "github.com/tendermint/tendermint/types" "io/ioutil" "path" + + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/cosmos/cosmos-sdk/codec" ) const ( diff --git a/server/init.go b/server/init.go index e1655c27e..dd9e7b890 100644 --- a/server/init.go +++ b/server/init.go @@ -4,15 +4,18 @@ import ( "encoding/json" "errors" "fmt" - "github.com/cosmos/cosmos-sdk/crypto/keys" + "github.com/tendermint/tendermint/crypto" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/crypto/keys" + + tmtypes "github.com/tendermint/tendermint/types" + clkeys "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - tmtypes "github.com/tendermint/tendermint/types" ) // SimpleGenTx is a simple genesis tx diff --git a/server/mock/app.go b/server/mock/app.go index 9e5af4498..2b0b8ed5e 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -3,9 +3,10 @@ package mock import ( "encoding/json" "fmt" - "github.com/tendermint/tendermint/types" "path/filepath" + "github.com/tendermint/tendermint/types" + abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" diff --git a/server/mock/app_test.go b/server/mock/app_test.go index a5f2a078b..707c22c85 100644 --- a/server/mock/app_test.go +++ b/server/mock/app_test.go @@ -1,9 +1,10 @@ package mock import ( - "github.com/tendermint/tendermint/types" "testing" + "github.com/tendermint/tendermint/types" + "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" diff --git a/server/test_helpers.go b/server/test_helpers.go index 4347bad6c..148f63a48 100644 --- a/server/test_helpers.go +++ b/server/test_helpers.go @@ -2,12 +2,13 @@ package server import ( "fmt" - "github.com/cosmos/cosmos-sdk/client" "io/ioutil" "net" "os" "testing" + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/viper" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/cli" diff --git a/server/tm_cmds.go b/server/tm_cmds.go index 5aeacf92f..33994b0cb 100644 --- a/server/tm_cmds.go +++ b/server/tm_cmds.go @@ -3,15 +3,17 @@ package server import ( "fmt" - "github.com/cosmos/cosmos-sdk/codec" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/codec" + tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" "github.com/tendermint/tendermint/p2p" pvm "github.com/tendermint/tendermint/privval" + + "github.com/cosmos/cosmos-sdk/client" + sdk "github.com/cosmos/cosmos-sdk/types" ) // ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout diff --git a/server/util.go b/server/util.go index 3d4a9d0b6..5c07d1b46 100644 --- a/server/util.go +++ b/server/util.go @@ -13,15 +13,16 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/server/config" - "github.com/cosmos/cosmos-sdk/version" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/libs/cli" tmflags "github.com/tendermint/tendermint/libs/cli/flags" "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/version" ) // server context diff --git a/server/util_test.go b/server/util_test.go index 2c16759c9..fb4e73259 100644 --- a/server/util_test.go +++ b/server/util_test.go @@ -4,8 +4,9 @@ import ( "encoding/json" "testing" - "github.com/cosmos/cosmos-sdk/codec" "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/codec" ) func TestInsertKeyJSON(t *testing.T) { diff --git a/store/dbstoreadapter.go b/store/dbstoreadapter.go index 8f4a1583c..76e673de5 100644 --- a/store/dbstoreadapter.go +++ b/store/dbstoreadapter.go @@ -3,8 +3,9 @@ package store import ( "io" - sdk "github.com/cosmos/cosmos-sdk/types" dbm "github.com/tendermint/tendermint/libs/db" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // Wrapper type for dbm.Db with implementation of KVStore diff --git a/store/list_test.go b/store/list_test.go index 396e2d1a1..6767457cd 100644 --- a/store/list_test.go +++ b/store/list_test.go @@ -4,8 +4,9 @@ import ( "math/rand" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestList(t *testing.T) { diff --git a/store/multistoreproof_test.go b/store/multistoreproof_test.go index db3b65cad..0f80657b8 100644 --- a/store/multistoreproof_test.go +++ b/store/multistoreproof_test.go @@ -3,10 +3,11 @@ package store import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tendermint/libs/db" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestVerifyIAVLStoreQueryProof(t *testing.T) { diff --git a/store/transientstore.go b/store/transientstore.go index a3ce89631..63b154c01 100644 --- a/store/transientstore.go +++ b/store/transientstore.go @@ -1,8 +1,9 @@ package store import ( - sdk "github.com/cosmos/cosmos-sdk/types" dbm "github.com/tendermint/tendermint/libs/db" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ KVStore = (*transientStore)(nil) diff --git a/types/context_test.go b/types/context_test.go index 0ab6c8dfc..3ccea2a8a 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -8,9 +8,10 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/store" "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" ) type MockLogger struct { diff --git a/types/decimal_test.go b/types/decimal_test.go index b35894771..fa6442f3a 100644 --- a/types/decimal_test.go +++ b/types/decimal_test.go @@ -6,8 +6,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/cosmos/cosmos-sdk/codec" "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/codec" ) // create a decimal from a decimal string (ex. "1234.5678") diff --git a/types/errors.go b/types/errors.go index 46436531e..f659f2954 100644 --- a/types/errors.go +++ b/types/errors.go @@ -4,9 +4,10 @@ import ( "fmt" "strings" - "github.com/cosmos/cosmos-sdk/codec" cmn "github.com/tendermint/tendermint/libs/common" + "github.com/cosmos/cosmos-sdk/codec" + abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/x/auth/account.go b/x/auth/account.go index 0fa601acc..f647601ca 100644 --- a/x/auth/account.go +++ b/x/auth/account.go @@ -3,9 +3,10 @@ package auth import ( "errors" + "github.com/tendermint/tendermint/crypto" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto" ) // Account is an interface used to store coins at a given address within state. diff --git a/x/auth/ante.go b/x/auth/ante.go index 3c8a0f9aa..91789dd22 100644 --- a/x/auth/ante.go +++ b/x/auth/ante.go @@ -5,10 +5,11 @@ import ( "encoding/hex" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/secp256k1" + + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( diff --git a/x/auth/ante_test.go b/x/auth/ante_test.go index 20fec8896..9d76107fe 100644 --- a/x/auth/ante_test.go +++ b/x/auth/ante_test.go @@ -5,8 +5,6 @@ import ( "strings" "testing" - codec "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" @@ -14,6 +12,9 @@ import ( "github.com/tendermint/tendermint/crypto/multisig" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/tendermint/tendermint/libs/log" + + codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) func newTestMsg(addrs ...sdk.AccAddress) *sdk.TestMsg { diff --git a/x/auth/client/cli/sign.go b/x/auth/client/cli/sign.go index 39d9b6694..842299df8 100644 --- a/x/auth/client/cli/sign.go +++ b/x/auth/client/cli/sign.go @@ -6,15 +6,16 @@ import ( "io/ioutil" "os" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/tendermint/go-amino" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" - "github.com/spf13/cobra" - "github.com/spf13/viper" - "github.com/tendermint/go-amino" ) const ( diff --git a/x/auth/client/txbuilder/txbuilder_test.go b/x/auth/client/txbuilder/txbuilder_test.go index 4ff472fef..7b0a281d6 100644 --- a/x/auth/client/txbuilder/txbuilder_test.go +++ b/x/auth/client/txbuilder/txbuilder_test.go @@ -6,11 +6,12 @@ import ( "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto/ed25519" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/tendermint/tendermint/crypto/ed25519" ) var ( diff --git a/x/auth/keeper.go b/x/auth/keeper.go index 18e82c206..bf8b92da6 100644 --- a/x/auth/keeper.go +++ b/x/auth/keeper.go @@ -1,9 +1,10 @@ package auth import ( + "github.com/tendermint/tendermint/crypto" + codec "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto" ) var ( diff --git a/x/auth/keeper_bench_test.go b/x/auth/keeper_bench_test.go index 5ca414048..413cd6afd 100644 --- a/x/auth/keeper_bench_test.go +++ b/x/auth/keeper_bench_test.go @@ -3,10 +3,11 @@ package auth import ( "testing" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) func BenchmarkAccountMapperGetAccountFound(b *testing.B) { diff --git a/x/auth/keeper_test.go b/x/auth/keeper_test.go index b0ba2e74b..ad05c0f8e 100644 --- a/x/auth/keeper_test.go +++ b/x/auth/keeper_test.go @@ -3,13 +3,14 @@ package auth import ( "testing" - codec "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + + codec "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store" + sdk "github.com/cosmos/cosmos-sdk/types" ) func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey, *sdk.KVStoreKey) { diff --git a/x/auth/stdtx.go b/x/auth/stdtx.go index 59edf7c13..053b405c9 100644 --- a/x/auth/stdtx.go +++ b/x/auth/stdtx.go @@ -4,10 +4,11 @@ import ( "encoding/json" "fmt" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/multisig" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ sdk.Tx = (*StdTx)(nil) diff --git a/x/auth/stdtx_test.go b/x/auth/stdtx_test.go index 1f2fefaca..da1fac179 100644 --- a/x/auth/stdtx_test.go +++ b/x/auth/stdtx_test.go @@ -5,12 +5,13 @@ import ( "strings" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/libs/log" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/bank/client/cli/broadcast.go b/x/bank/client/cli/broadcast.go index 126668364..1bcd811cd 100644 --- a/x/bank/client/cli/broadcast.go +++ b/x/bank/client/cli/broadcast.go @@ -4,11 +4,12 @@ import ( "io/ioutil" "os" + "github.com/spf13/cobra" + amino "github.com/tendermint/go-amino" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/spf13/cobra" - amino "github.com/tendermint/go-amino" ) // GetSignCommand returns the sign command diff --git a/x/bank/client/cli/sendtx.go b/x/bank/client/cli/sendtx.go index 1a7c444af..e61d6eb56 100644 --- a/x/bank/client/cli/sendtx.go +++ b/x/bank/client/cli/sendtx.go @@ -1,6 +1,8 @@ package cli import ( + "os" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" @@ -8,7 +10,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" bankClient "github.com/cosmos/cosmos-sdk/x/bank/client" - "os" "github.com/pkg/errors" "github.com/spf13/cobra" diff --git a/x/bank/simulation/msgs.go b/x/bank/simulation/msgs.go index 78b1f1945..96df52f56 100644 --- a/x/bank/simulation/msgs.go +++ b/x/bank/simulation/msgs.go @@ -6,13 +6,14 @@ import ( "math/big" "math/rand" + "github.com/tendermint/tendermint/crypto" + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/mock" "github.com/cosmos/cosmos-sdk/x/mock/simulation" - "github.com/tendermint/tendermint/crypto" ) // SingleInputSendTx tests and runs a single msg send w/ auth, with one input and one output, where both diff --git a/x/distribution/client/module_client.go b/x/distribution/client/module_client.go index ba725e1f8..69734b08d 100644 --- a/x/distribution/client/module_client.go +++ b/x/distribution/client/module_client.go @@ -1,10 +1,11 @@ package client import ( - "github.com/cosmos/cosmos-sdk/client" - distCmds "github.com/cosmos/cosmos-sdk/x/distribution/client/cli" "github.com/spf13/cobra" amino "github.com/tendermint/go-amino" + + "github.com/cosmos/cosmos-sdk/client" + distCmds "github.com/cosmos/cosmos-sdk/x/distribution/client/cli" ) // ModuleClient exports all client functionality from this module diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index 7d05e82b1..35ad25e66 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -3,10 +3,11 @@ package keeper import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/stake" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/stake" ) func TestAllocateTokensBasic(t *testing.T) { diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 455ad14e8..67606cc84 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -3,9 +3,10 @@ package keeper import ( "testing" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake" - "github.com/stretchr/testify/require" ) func TestWithdrawDelegationRewardBasic(t *testing.T) { diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index f8eb0925d..a8c378424 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -3,9 +3,10 @@ package keeper import ( "testing" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/stretchr/testify/require" ) func TestSetGetPreviousProposerConsAddr(t *testing.T) { diff --git a/x/distribution/keeper/validator_test.go b/x/distribution/keeper/validator_test.go index fc9331959..58079241c 100644 --- a/x/distribution/keeper/validator_test.go +++ b/x/distribution/keeper/validator_test.go @@ -3,9 +3,10 @@ package keeper import ( "testing" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake" - "github.com/stretchr/testify/require" ) func TestWithdrawValidatorRewardsAllNoDelegator(t *testing.T) { diff --git a/x/distribution/types/dec_coin_test.go b/x/distribution/types/dec_coin_test.go index 5a326fa17..9b942f07c 100644 --- a/x/distribution/types/dec_coin_test.go +++ b/x/distribution/types/dec_coin_test.go @@ -3,9 +3,10 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestPlusDecCoin(t *testing.T) { diff --git a/x/distribution/types/delegator_info_test.go b/x/distribution/types/delegator_info_test.go index e15ad2930..5619fb4d1 100644 --- a/x/distribution/types/delegator_info_test.go +++ b/x/distribution/types/delegator_info_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestWithdrawRewards(t *testing.T) { diff --git a/x/distribution/types/fee_pool_test.go b/x/distribution/types/fee_pool_test.go index 73bda52fa..ceb908d7f 100644 --- a/x/distribution/types/fee_pool_test.go +++ b/x/distribution/types/fee_pool_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestUpdateTotalValAccum(t *testing.T) { diff --git a/x/distribution/types/test_common.go b/x/distribution/types/test_common.go index b77efd46c..480244ac3 100644 --- a/x/distribution/types/test_common.go +++ b/x/distribution/types/test_common.go @@ -1,9 +1,10 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/distribution/types/total_accum_test.go b/x/distribution/types/total_accum_test.go index 81f80a154..3984612ad 100644 --- a/x/distribution/types/total_accum_test.go +++ b/x/distribution/types/total_accum_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestTotalAccumUpdateForNewHeight(t *testing.T) { diff --git a/x/distribution/types/validator_info_test.go b/x/distribution/types/validator_info_test.go index 24c3eaee4..119eb6343 100644 --- a/x/distribution/types/validator_info_test.go +++ b/x/distribution/types/validator_info_test.go @@ -3,9 +3,10 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestTakeFeePoolRewards(t *testing.T) { diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 4f0c86fea..06dabfcdd 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -5,13 +5,14 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" govClientUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) // GetCmdQueryProposal implements the query proposal command. diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 58ce91352..74c311ef4 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -5,21 +5,23 @@ import ( "os" "strconv" + "github.com/pkg/errors" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/pkg/errors" "encoding/json" "io/ioutil" "strings" - govClientUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" "github.com/spf13/cobra" "github.com/spf13/viper" + + govClientUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" ) const ( diff --git a/x/gov/client/cli/tx_test.go b/x/gov/client/cli/tx_test.go index e3aed05ff..73df8c290 100644 --- a/x/gov/client/cli/tx_test.go +++ b/x/gov/client/cli/tx_test.go @@ -1,10 +1,11 @@ package cli import ( - "github.com/spf13/viper" - "github.com/stretchr/testify/require" "io/ioutil" "testing" + + "github.com/spf13/viper" + "github.com/stretchr/testify/require" ) func TestParseSubmitProposalFlags(t *testing.T) { diff --git a/x/gov/client/module_client.go b/x/gov/client/module_client.go index 456ddfbe7..1f67c9c07 100644 --- a/x/gov/client/module_client.go +++ b/x/gov/client/module_client.go @@ -1,10 +1,11 @@ package client import ( - "github.com/cosmos/cosmos-sdk/client" - govCli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/spf13/cobra" amino "github.com/tendermint/go-amino" + + "github.com/cosmos/cosmos-sdk/client" + govCli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" ) // ModuleClient exports all client functionality from this module diff --git a/x/gov/client/rest/rest.go b/x/gov/client/rest/rest.go index 72abdb214..53deffbbe 100644 --- a/x/gov/client/rest/rest.go +++ b/x/gov/client/rest/rest.go @@ -10,9 +10,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" - govClientUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" "github.com/gorilla/mux" "github.com/pkg/errors" + + govClientUtils "github.com/cosmos/cosmos-sdk/x/gov/client/utils" ) // REST Variable names diff --git a/x/gov/depositsvotes.go b/x/gov/depositsvotes.go index 8e22f245d..3e2ac5673 100644 --- a/x/gov/depositsvotes.go +++ b/x/gov/depositsvotes.go @@ -4,8 +4,9 @@ import ( "encoding/json" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // Vote diff --git a/x/gov/endblocker_test.go b/x/gov/endblocker_test.go index 47e903758..622d0968f 100644 --- a/x/gov/endblocker_test.go +++ b/x/gov/endblocker_test.go @@ -6,9 +6,10 @@ import ( "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" - abci "github.com/tendermint/tendermint/abci/types" ) func TestTickExpiredDepositPeriod(t *testing.T) { diff --git a/x/gov/querier.go b/x/gov/querier.go index cde85bf94..8b985929e 100644 --- a/x/gov/querier.go +++ b/x/gov/querier.go @@ -3,9 +3,10 @@ package gov import ( "fmt" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" ) // query endpoints supported by the governance Querier diff --git a/x/gov/querier_test.go b/x/gov/querier_test.go index 9ee71323e..01b611e19 100644 --- a/x/gov/querier_test.go +++ b/x/gov/querier_test.go @@ -4,10 +4,11 @@ import ( "strings" "testing" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier) (DepositParams, VotingParams, TallyParams) { diff --git a/x/gov/tally_test.go b/x/gov/tally_test.go index 86564ed42..fc5cac910 100644 --- a/x/gov/tally_test.go +++ b/x/gov/tally_test.go @@ -5,11 +5,12 @@ import ( "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/stake" stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types" ) diff --git a/x/mock/app.go b/x/mock/app.go index 9251a95c0..066ac93dc 100644 --- a/x/mock/app.go +++ b/x/mock/app.go @@ -7,16 +7,17 @@ import ( "os" "sort" - bam "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/secp256k1" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + + bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" ) const chainID = "" diff --git a/x/mock/app_test.go b/x/mock/app_test.go index 1af0e4a03..098126d89 100644 --- a/x/mock/app_test.go +++ b/x/mock/app_test.go @@ -3,10 +3,11 @@ package mock import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth" ) const msgRoute = "testMsg" diff --git a/x/mock/simulation/invariants.go b/x/mock/simulation/invariants.go index a3ae5f3c3..d30b67be9 100644 --- a/x/mock/simulation/invariants.go +++ b/x/mock/simulation/invariants.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" ) // An Invariant is a function which tests a particular invariant. diff --git a/x/mock/test_utils.go b/x/mock/test_utils.go index 4d5fe05f3..9c24967ab 100644 --- a/x/mock/test_utils.go +++ b/x/mock/test_utils.go @@ -5,11 +5,12 @@ import ( "math/rand" "testing" - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" ) // BigInterval is a representation of the interval [lo, hi), where diff --git a/x/slashing/client/cli/tx.go b/x/slashing/client/cli/tx.go index 513710ce4..2e97414bd 100644 --- a/x/slashing/client/cli/tx.go +++ b/x/slashing/client/cli/tx.go @@ -1,13 +1,14 @@ package cli import ( + "os" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/slashing" - "os" "github.com/spf13/cobra" ) diff --git a/x/slashing/client/module_client.go b/x/slashing/client/module_client.go index 82efb5afe..2d7c6b6eb 100644 --- a/x/slashing/client/module_client.go +++ b/x/slashing/client/module_client.go @@ -1,10 +1,11 @@ package client import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" "github.com/spf13/cobra" amino "github.com/tendermint/go-amino" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/x/slashing/client/cli" ) // ModuleClient exports all client functionality from this module diff --git a/x/slashing/client/rest/query.go b/x/slashing/client/rest/query.go index e55b6b9be..a95c01acf 100644 --- a/x/slashing/client/rest/query.go +++ b/x/slashing/client/rest/query.go @@ -3,12 +3,13 @@ package rest import ( "net/http" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/slashing" - "github.com/gorilla/mux" ) func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) { diff --git a/x/slashing/keeper.go b/x/slashing/keeper.go index 61d366172..5137b1198 100644 --- a/x/slashing/keeper.go +++ b/x/slashing/keeper.go @@ -4,11 +4,12 @@ import ( "fmt" "time" + "github.com/tendermint/tendermint/crypto" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" stake "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/tendermint/tendermint/crypto" ) // Keeper of the slashing store diff --git a/x/slashing/keeper_test.go b/x/slashing/keeper_test.go index dd32ea3f8..fdf409c23 100644 --- a/x/slashing/keeper_test.go +++ b/x/slashing/keeper_test.go @@ -4,10 +4,11 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/stake" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/stake" ) // Have to change these parameters for tests diff --git a/x/slashing/tick.go b/x/slashing/tick.go index 03bd094af..41af4b9ae 100644 --- a/x/slashing/tick.go +++ b/x/slashing/tick.go @@ -4,9 +4,10 @@ import ( "encoding/binary" "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" tmtypes "github.com/tendermint/tendermint/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // slashing begin block functionality diff --git a/x/stake/client/cli/utils.go b/x/stake/client/cli/utils.go index 502cb11ec..848e1725d 100644 --- a/x/stake/client/cli/utils.go +++ b/x/stake/client/cli/utils.go @@ -1,12 +1,13 @@ package cli import ( + "github.com/pkg/errors" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake" "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/pkg/errors" ) func getShares( diff --git a/x/stake/client/module_client.go b/x/stake/client/module_client.go index 5a08668dc..03a7c25e2 100644 --- a/x/stake/client/module_client.go +++ b/x/stake/client/module_client.go @@ -1,10 +1,11 @@ package client import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/x/stake/client/cli" "github.com/spf13/cobra" amino "github.com/tendermint/go-amino" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/x/stake/client/cli" ) // ModuleClient exports all client functionality from this module diff --git a/x/stake/client/rest/query.go b/x/stake/client/rest/query.go index 5788346f2..085d7e4e2 100644 --- a/x/stake/client/rest/query.go +++ b/x/stake/client/rest/query.go @@ -1,10 +1,11 @@ package rest import ( - "github.com/cosmos/cosmos-sdk/x/stake" "net/http" "strings" + "github.com/cosmos/cosmos-sdk/x/stake" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/client/utils" diff --git a/x/stake/client/rest/utils.go b/x/stake/client/rest/utils.go index 7f6edc193..d9ae457cf 100644 --- a/x/stake/client/rest/utils.go +++ b/x/stake/client/rest/utils.go @@ -4,6 +4,8 @@ import ( "fmt" "net/http" + "github.com/gorilla/mux" + "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/client/utils" @@ -11,7 +13,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake" "github.com/cosmos/cosmos-sdk/x/stake/tags" - "github.com/gorilla/mux" rpcclient "github.com/tendermint/tendermint/rpc/client" ) diff --git a/x/stake/genesis_test.go b/x/stake/genesis_test.go index dfe5b7d1b..f747ca7a7 100644 --- a/x/stake/genesis_test.go +++ b/x/stake/genesis_test.go @@ -8,11 +8,12 @@ import ( "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" keep "github.com/cosmos/cosmos-sdk/x/stake/keeper" "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" ) func TestInitGenesis(t *testing.T) { diff --git a/x/stake/keeper/key_test.go b/x/stake/keeper/key_test.go index 0658e4b24..f994c3920 100644 --- a/x/stake/keeper/key_test.go +++ b/x/stake/keeper/key_test.go @@ -5,10 +5,11 @@ import ( "math/big" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/stake/types" "github.com/stretchr/testify/assert" "github.com/tendermint/tendermint/crypto/ed25519" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/stake/types" ) var ( diff --git a/x/stake/keeper/slash_test.go b/x/stake/keeper/slash_test.go index 9f89dd210..94418a962 100644 --- a/x/stake/keeper/slash_test.go +++ b/x/stake/keeper/slash_test.go @@ -6,9 +6,10 @@ import ( "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake/types" - abci "github.com/tendermint/tendermint/abci/types" ) // TODO integrate with test_common.go helper (CreateTestInput) diff --git a/x/stake/keeper/validator_test.go b/x/stake/keeper/validator_test.go index 71b0edcd1..e328537a5 100644 --- a/x/stake/keeper/validator_test.go +++ b/x/stake/keeper/validator_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake/types" - abci "github.com/tendermint/tendermint/abci/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/stake/querier/querier.go b/x/stake/querier/querier.go index 13ff97ef3..70627f0b1 100644 --- a/x/stake/querier/querier.go +++ b/x/stake/querier/querier.go @@ -1,11 +1,12 @@ package querier import ( + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" keep "github.com/cosmos/cosmos-sdk/x/stake/keeper" "github.com/cosmos/cosmos-sdk/x/stake/types" - abci "github.com/tendermint/tendermint/abci/types" ) // query endpoints supported by the staking Querier diff --git a/x/stake/querier/querier_test.go b/x/stake/querier/querier_test.go index c13a37897..525f3691a 100644 --- a/x/stake/querier/querier_test.go +++ b/x/stake/querier/querier_test.go @@ -3,12 +3,13 @@ package querier import ( "testing" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" keep "github.com/cosmos/cosmos-sdk/x/stake/keeper" "github.com/cosmos/cosmos-sdk/x/stake/types" - "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" ) var ( diff --git a/x/stake/types/delegation_test.go b/x/stake/types/delegation_test.go index e75212257..ee7d81bf5 100644 --- a/x/stake/types/delegation_test.go +++ b/x/stake/types/delegation_test.go @@ -4,8 +4,9 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestDelegationEqual(t *testing.T) { diff --git a/x/stake/types/msg.go b/x/stake/types/msg.go index 63d0afb5f..a6692a7f3 100644 --- a/x/stake/types/msg.go +++ b/x/stake/types/msg.go @@ -3,8 +3,9 @@ package types import ( "bytes" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // name to identify transaction routes diff --git a/x/stake/types/msg_test.go b/x/stake/types/msg_test.go index 4b4055fca..e5cb8a9f0 100644 --- a/x/stake/types/msg_test.go +++ b/x/stake/types/msg_test.go @@ -5,8 +5,9 @@ import ( "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/stake/types/pool_test.go b/x/stake/types/pool_test.go index 4541edd3d..f877df0b1 100644 --- a/x/stake/types/pool_test.go +++ b/x/stake/types/pool_test.go @@ -3,8 +3,9 @@ package types import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" ) func TestPoolEqual(t *testing.T) { diff --git a/x/stake/types/test_utils.go b/x/stake/types/test_utils.go index b9d77ce9f..548cd316a 100644 --- a/x/stake/types/test_utils.go +++ b/x/stake/types/test_utils.go @@ -1,9 +1,10 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( From 2e05d4e3d731188018a14c5cdfb60c55ce82ea79 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 10 Dec 2018 14:36:20 +0000 Subject: [PATCH 3/5] drop extra else block, outdent its block, and make linter happy --- x/stake/keeper/test_common.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/x/stake/keeper/test_common.go b/x/stake/keeper/test_common.go index f52b41c44..c3ca811cd 100644 --- a/x/stake/keeper/test_common.go +++ b/x/stake/keeper/test_common.go @@ -227,15 +227,14 @@ func TestingUpdateValidator(keeper Keeper, ctx sdk.Context, validator types.Vali panic("validator expected but not found") } return validator - } else { - cachectx, _ := ctx.CacheContext() - keeper.ApplyAndReturnValidatorSetUpdates(cachectx) - validator, found := keeper.GetValidator(cachectx, validator.OperatorAddr) - if !found { - panic("validator expected but not found") - } - return validator } + cachectx, _ := ctx.CacheContext() + keeper.ApplyAndReturnValidatorSetUpdates(cachectx) + validator, found := keeper.GetValidator(cachectx, validator.OperatorAddr) + if !found { + panic("validator expected but not found") + } + return validator } func validatorByPowerIndexExists(k Keeper, ctx sdk.Context, power []byte) bool { From b4528d2a5d864394f09638647be6facf0a7e285d Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 10 Dec 2018 14:39:25 +0000 Subject: [PATCH 4/5] Update PENDING.md --- PENDING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/PENDING.md b/PENDING.md index 95ecba5b5..0bf61e800 100644 --- a/PENDING.md +++ b/PENDING.md @@ -3,6 +3,7 @@ BREAKING CHANGES * Gaia REST API (`gaiacli advanced rest-server`) + * [\#3056](https://github.com/cosmos/cosmos-sdk/pull/3056) `generate_only` and `simulate` have moved from query arguments to POST requests body. * Gaia CLI (`gaiacli`) * [cli] [\#2595](https://github.com/cosmos/cosmos-sdk/issues/2595) Remove `keys new` in favor of `keys add` incorporating existing functionality with addition of key recovery functionality. From 4f34cb7c1e917224f28c12ff052e98dd9d311084 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 10 Dec 2018 16:00:38 +0000 Subject: [PATCH 5/5] Update LCD swagger docs --- client/lcd/swagger-ui/swagger.yaml | 66 +++--------------------------- 1 file changed, 6 insertions(+), 60 deletions(-) diff --git a/client/lcd/swagger-ui/swagger.yaml b/client/lcd/swagger-ui/swagger.yaml index 82e7c3429..0ecbe505f 100644 --- a/client/lcd/swagger-ui/swagger.yaml +++ b/client/lcd/swagger-ui/swagger.yaml @@ -376,16 +376,6 @@ paths: produces: - application/json parameters: - - in: query - name: simulate - description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it - required: false - type: boolean - - in: query - name: generate_only - description: if true, build an unsigned transaction and write it back - required: false - type: boolean - in: path name: address description: Account address in bech32 format @@ -638,16 +628,6 @@ paths: post: summary: Submit delegation parameters: - - in: query - name: simulate - description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it - required: false - type: boolean - - in: query - name: generate_only - description: if true, build an unsigned transaction and write it back - required: false - type: boolean - in: body name: delegation description: The password of the account to remove from the KMS @@ -1123,16 +1103,6 @@ paths: tags: - ICS23 parameters: - - in: query - name: simulate - description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it - required: false - type: boolean - - in: query - name: generate_only - description: if true, build an unsigned transaction and write it back - required: false - type: boolean - type: string description: Bech32 validator address name: validatorAddr @@ -1169,16 +1139,6 @@ paths: tags: - ICS22 parameters: - - in: query - name: simulate - description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it - required: false - type: boolean - - in: query - name: generate_only - description: if true, build an unsigned transaction and write it back - required: false - type: boolean - description: valid value of `"proposal_type"` can be `"text"`, `"parameter_change"`, `"software_upgrade"` name: post_proposal_body in: body @@ -1257,16 +1217,6 @@ paths: tags: - ICS22 parameters: - - in: query - name: simulate - description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it - required: false - type: boolean - - in: query - name: generate_only - description: if true, build an unsigned transaction and write it back - required: false - type: boolean - type: string description: proposal id name: proposalId @@ -1355,16 +1305,6 @@ paths: tags: - ICS22 parameters: - - in: query - name: simulate - description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it - required: false - type: boolean - - in: query - name: generate_only - description: if true, build an unsigned transaction and write it back - required: false - type: boolean - type: string description: proposal id name: proposalId @@ -1888,6 +1828,12 @@ definitions: gas_adjustment: type: string example: "1.2" + generate_only: + type: boolean + example: false + simulate: + type: boolean + example: true TendermintValidator: type: object properties: