diff --git a/app/genesis_test.go b/app/genesis_test.go index 95e1d788e..57c895c8d 100644 --- a/app/genesis_test.go +++ b/app/genesis_test.go @@ -7,10 +7,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/basecoin/modules/coin" + eyescli "github.com/tendermint/merkleeyes/client" cmn "github.com/tendermint/tmlibs/common" "github.com/tendermint/tmlibs/log" + + "github.com/tendermint/basecoin/modules/coin" ) const genesisFilepath = "./testdata/genesis.json" diff --git a/client/commands/init.go b/client/commands/init.go index d53b03cab..fe0109372 100644 --- a/client/commands/init.go +++ b/client/commands/init.go @@ -15,19 +15,19 @@ import ( "github.com/spf13/pflag" "github.com/spf13/viper" + "github.com/tendermint/light-client/certifiers" + "github.com/tendermint/light-client/certifiers/files" "github.com/tendermint/tmlibs/cli" cmn "github.com/tendermint/tmlibs/common" "github.com/tendermint/tendermint/types" - - "github.com/tendermint/light-client/certifiers" - "github.com/tendermint/light-client/certifiers/files" ) var ( dirPerm = os.FileMode(0700) ) +//nolint const ( SeedFlag = "seed" HashFlag = "valhash" diff --git a/client/commands/proofs/get.go b/client/commands/proofs/get.go index c670e7b3e..34638698c 100644 --- a/client/commands/proofs/get.go +++ b/client/commands/proofs/get.go @@ -8,12 +8,11 @@ import ( wire "github.com/tendermint/go-wire" "github.com/tendermint/go-wire/data" - + lc "github.com/tendermint/light-client" + "github.com/tendermint/light-client/proofs" "github.com/tendermint/tendermint/rpc/client" - lc "github.com/tendermint/light-client" "github.com/tendermint/basecoin/client/commands" - "github.com/tendermint/light-client/proofs" ) // GetAndParseAppProof does most of the work of the query commands, but is quite diff --git a/client/commands/proofs/state.go b/client/commands/proofs/state.go index 6f7109d01..e55b5b581 100644 --- a/client/commands/proofs/state.go +++ b/client/commands/proofs/state.go @@ -4,24 +4,25 @@ import ( "github.com/spf13/cobra" "github.com/tendermint/go-wire/data" + "github.com/tendermint/light-client/proofs" "github.com/tendermint/basecoin/client/commands" - "github.com/tendermint/light-client/proofs" ) -var KeyCmd = &cobra.Command{ +// KeyQueryCmd - CLI command to query a state by key with proof +var KeyQueryCmd = &cobra.Command{ Use: "key [key]", Short: "Handle proofs for state of abci app", Long: `This will look up a given key in the abci app, verify the proof, and output it as hex. If you want json output, use an app-specific command that knows key and value structure.`, - RunE: commands.RequireInit(doKeyQuery), + RunE: commands.RequireInit(keyQueryCmd), } // Note: we cannot yse GetAndParseAppProof here, as we don't use go-wire to // parse the object, but rather return the raw bytes -func doKeyQuery(cmd *cobra.Command, args []string) error { +func keyQueryCmd(cmd *cobra.Command, args []string) error { // parse cli height := GetHeight() key, err := ParseHexKey(args, "key") diff --git a/client/commands/proofs/tx.go b/client/commands/proofs/tx.go index 7dc21af05..cffc4dfc1 100644 --- a/client/commands/proofs/tx.go +++ b/client/commands/proofs/tx.go @@ -3,13 +3,16 @@ package proofs import ( "github.com/spf13/cobra" - "github.com/tendermint/basecoin/client/commands" "github.com/tendermint/light-client/proofs" + + "github.com/tendermint/basecoin/client/commands" ) +//nolint TODO add description var TxPresenters = proofs.NewPresenters() -var TxCmd = &cobra.Command{ +// TxQueryCmd - CLI command to query a transaction with proof +var TxQueryCmd = &cobra.Command{ Use: "tx [txhash]", Short: "Handle proofs of commited txs", Long: `Proofs allows you to validate abci state with merkle proofs. @@ -18,10 +21,10 @@ These proofs tie the data to a checkpoint, which is managed by "seeds". Here we can validate these proofs and import/export them to prove specific data to other peers as needed. `, - RunE: commands.RequireInit(doTxQuery), + RunE: commands.RequireInit(txQueryCmd), } -func doTxQuery(cmd *cobra.Command, args []string) error { +func txQueryCmd(cmd *cobra.Command, args []string) error { // parse cli height := GetHeight() bkey, err := ParseHexKey(args, "txhash") diff --git a/client/commands/proxy/root.go b/client/commands/proxy/root.go index 0284f4dbe..4845773da 100644 --- a/client/commands/proxy/root.go +++ b/client/commands/proxy/root.go @@ -7,14 +7,13 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - cmn "github.com/tendermint/tmlibs/common" - "github.com/tendermint/tmlibs/log" - + certclient "github.com/tendermint/light-client/certifiers/client" "github.com/tendermint/tendermint/rpc/client" "github.com/tendermint/tendermint/rpc/core" rpc "github.com/tendermint/tendermint/rpc/lib/server" + cmn "github.com/tendermint/tmlibs/common" + "github.com/tendermint/tmlibs/log" - certclient "github.com/tendermint/light-client/certifiers/client" "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/rpc/insecure.go b/client/commands/rpc/insecure.go index 80432f95e..5587a5914 100644 --- a/client/commands/rpc/insecure.go +++ b/client/commands/rpc/insecure.go @@ -2,6 +2,7 @@ package rpc import ( "github.com/spf13/cobra" + "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/rpc/root.go b/client/commands/rpc/root.go index 471744b2f..2a1d0e532 100644 --- a/client/commands/rpc/root.go +++ b/client/commands/rpc/root.go @@ -6,9 +6,9 @@ import ( "github.com/spf13/cobra" "github.com/tendermint/go-wire/data" + certclient "github.com/tendermint/light-client/certifiers/client" "github.com/tendermint/tendermint/rpc/client" - certclient "github.com/tendermint/light-client/certifiers/client" "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/rpc/secure.go b/client/commands/rpc/secure.go index d49504143..717c20c98 100644 --- a/client/commands/rpc/secure.go +++ b/client/commands/rpc/secure.go @@ -3,6 +3,7 @@ package rpc import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/seeds/export.go b/client/commands/seeds/export.go index a4c453526..1ac3ac42a 100644 --- a/client/commands/seeds/export.go +++ b/client/commands/seeds/export.go @@ -4,6 +4,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/seeds/import.go b/client/commands/seeds/import.go index 2731324d9..4a63ef7d7 100644 --- a/client/commands/seeds/import.go +++ b/client/commands/seeds/import.go @@ -6,7 +6,9 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + "github.com/tendermint/light-client/certifiers" + "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/seeds/show.go b/client/commands/seeds/show.go index 5ea8287e8..100201b63 100644 --- a/client/commands/seeds/show.go +++ b/client/commands/seeds/show.go @@ -7,7 +7,9 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "github.com/tendermint/light-client/certifiers" + "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/seeds/update.go b/client/commands/seeds/update.go index 575ede4ac..153f090f8 100644 --- a/client/commands/seeds/update.go +++ b/client/commands/seeds/update.go @@ -4,7 +4,9 @@ import ( "fmt" "github.com/spf13/cobra" + "github.com/tendermint/light-client/certifiers" + "github.com/tendermint/basecoin/client/commands" ) diff --git a/client/commands/txs/presenter.go b/client/commands/txs/presenter.go index b13f694e5..79f718a4f 100644 --- a/client/commands/txs/presenter.go +++ b/client/commands/txs/presenter.go @@ -2,6 +2,7 @@ package txs import ( "github.com/pkg/errors" + wire "github.com/tendermint/go-wire" "github.com/tendermint/light-client/proofs" ctypes "github.com/tendermint/tendermint/rpc/core/types" diff --git a/client/commands/txs/root.go b/client/commands/txs/root.go index 6a1080477..b9e9ea3ac 100644 --- a/client/commands/txs/root.go +++ b/client/commands/txs/root.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + "github.com/tendermint/basecoin" ) diff --git a/cmd/basecoin/commands/key.go b/cmd/basecoin/commands/key.go index b5b03e3fb..72620072f 100644 --- a/cmd/basecoin/commands/key.go +++ b/cmd/basecoin/commands/key.go @@ -8,8 +8,6 @@ import ( "path" "strings" - //"github.com/pkg/errors" - "github.com/spf13/viper" "github.com/tendermint/go-crypto" diff --git a/cmd/basecoin/main.go b/cmd/basecoin/main.go index 8b4f5764c..33ba8c1d4 100644 --- a/cmd/basecoin/main.go +++ b/cmd/basecoin/main.go @@ -3,9 +3,10 @@ package main import ( "os" + "github.com/tendermint/tmlibs/cli" + "github.com/tendermint/basecoin/app" "github.com/tendermint/basecoin/cmd/basecoin/commands" - "github.com/tendermint/tmlibs/cli" ) func main() { diff --git a/modules/auth/errors.go b/modules/auth/errors.go index 8de87b20f..28352ce2d 100644 --- a/modules/auth/errors.go +++ b/modules/auth/errors.go @@ -5,6 +5,7 @@ import ( "fmt" abci "github.com/tendermint/abci/types" + "github.com/tendermint/basecoin/errors" ) diff --git a/modules/auth/tx_test.go b/modules/auth/tx_test.go index 745e4466e..03ef42c12 100644 --- a/modules/auth/tx_test.go +++ b/modules/auth/tx_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/basecoin/stack" crypto "github.com/tendermint/go-crypto" keys "github.com/tendermint/go-crypto/keys" "github.com/tendermint/go-crypto/keys/cryptostore" @@ -14,6 +13,7 @@ import ( wire "github.com/tendermint/go-wire" "github.com/tendermint/basecoin" + "github.com/tendermint/basecoin/stack" ) func checkSignBytes(t *testing.T, bytes []byte, expected string) { diff --git a/modules/base/commands/wrap.go b/modules/base/commands/wrap.go index e199c4ed0..92e994fd0 100644 --- a/modules/base/commands/wrap.go +++ b/modules/base/commands/wrap.go @@ -6,9 +6,8 @@ import ( "github.com/spf13/pflag" "github.com/spf13/viper" - "github.com/tendermint/basecoin/client/commands" - "github.com/tendermint/basecoin" + "github.com/tendermint/basecoin/client/commands" txcmd "github.com/tendermint/basecoin/client/commands/txs" "github.com/tendermint/basecoin/modules/base" ) diff --git a/modules/base/errors.go b/modules/base/errors.go index bd55b1ffe..8279bc434 100644 --- a/modules/base/errors.go +++ b/modules/base/errors.go @@ -4,9 +4,8 @@ package base import ( "fmt" - pkgerrors "github.com/pkg/errors" - abci "github.com/tendermint/abci/types" + "github.com/tendermint/basecoin/errors" ) @@ -25,13 +24,11 @@ func IsNoChainErr(err error) bool { return errors.IsSameError(errNoChain, err) } func ErrWrongChain(chain string) errors.TMError { - msg := pkgerrors.Wrap(errWrongChain, chain) - return errors.WithCode(msg, unauthorized) + return errors.WithMessage(chain, errWrongChain, unauthorized) } func IsWrongChainErr(err error) bool { return errors.IsSameError(errWrongChain, err) } - func ErrExpired() errors.TMError { return errors.WithCode(errExpired, unauthorized) } diff --git a/modules/base/tx_test.go b/modules/base/tx_test.go index 00bd4ea79..1830c469d 100644 --- a/modules/base/tx_test.go +++ b/modules/base/tx_test.go @@ -7,10 +7,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tendermint/basecoin/stack" "github.com/tendermint/go-wire/data" "github.com/tendermint/basecoin" + "github.com/tendermint/basecoin/stack" ) func TestEncoding(t *testing.T) { diff --git a/modules/coin/commands/query.go b/modules/coin/commands/query.go index 55e7a060f..5bea51478 100644 --- a/modules/coin/commands/query.go +++ b/modules/coin/commands/query.go @@ -4,10 +4,10 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - lcmd "github.com/tendermint/basecoin/client/commands" - proofcmd "github.com/tendermint/basecoin/client/commands/proofs" lc "github.com/tendermint/light-client" + lcmd "github.com/tendermint/basecoin/client/commands" + proofcmd "github.com/tendermint/basecoin/client/commands/proofs" "github.com/tendermint/basecoin/modules/auth" "github.com/tendermint/basecoin/modules/coin" "github.com/tendermint/basecoin/stack" diff --git a/modules/coin/errors.go b/modules/coin/errors.go index 1f045adbb..49513f433 100644 --- a/modules/coin/errors.go +++ b/modules/coin/errors.go @@ -4,9 +4,8 @@ package coin import ( "fmt" - pkgerrors "github.com/pkg/errors" - abci "github.com/tendermint/abci/types" + "github.com/tendermint/basecoin/errors" ) @@ -83,8 +82,7 @@ func IsNoOutputsErr(err error) bool { } func ErrUnknownKey(mod string) errors.TMError { - w := pkgerrors.Wrap(errUnknownKey, mod) - return errors.WithCode(w, unknownRequest) + return errors.WithMessage(mod, errUnknownKey, unknownRequest) } func IsUnknownKeyErr(err error) bool { return errors.IsSameError(errUnknownKey, err) diff --git a/modules/coin/helper.go b/modules/coin/helper.go index 21c9ea782..4672e85d3 100644 --- a/modules/coin/helper.go +++ b/modules/coin/helper.go @@ -1,11 +1,11 @@ package coin import ( - "github.com/tendermint/basecoin/modules/auth" crypto "github.com/tendermint/go-crypto" "github.com/tendermint/go-wire/data" "github.com/tendermint/basecoin" + "github.com/tendermint/basecoin/modules/auth" ) // AccountWithKey is a helper for tests, that includes and account diff --git a/modules/nonce/commands/query.go b/modules/nonce/commands/query.go index ccc94b937..2570c88d9 100644 --- a/modules/nonce/commands/query.go +++ b/modules/nonce/commands/query.go @@ -6,11 +6,11 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" + lc "github.com/tendermint/light-client" + "github.com/tendermint/basecoin" lcmd "github.com/tendermint/basecoin/client/commands" proofcmd "github.com/tendermint/basecoin/client/commands/proofs" - lc "github.com/tendermint/light-client" - "github.com/tendermint/basecoin/modules/nonce" "github.com/tendermint/basecoin/stack" ) diff --git a/modules/roles/error.go b/modules/roles/error.go index 02b9e0637..62ff77226 100644 --- a/modules/roles/error.go +++ b/modules/roles/error.go @@ -5,6 +5,7 @@ import ( "fmt" abci "github.com/tendermint/abci/types" + "github.com/tendermint/basecoin/errors" ) diff --git a/modules/roles/handler_test.go b/modules/roles/handler_test.go index e5c744bbc..6d1c5dfa6 100644 --- a/modules/roles/handler_test.go +++ b/modules/roles/handler_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/tendermint/basecoin" "github.com/tendermint/basecoin/modules/roles" "github.com/tendermint/basecoin/stack" diff --git a/modules/roles/store.go b/modules/roles/store.go index c29d93f0f..eb114ff6f 100644 --- a/modules/roles/store.go +++ b/modules/roles/store.go @@ -3,10 +3,11 @@ package roles import ( "fmt" + wire "github.com/tendermint/go-wire" + "github.com/tendermint/basecoin" "github.com/tendermint/basecoin/errors" "github.com/tendermint/basecoin/state" - wire "github.com/tendermint/go-wire" ) // NewPerm creates a role permission with the given label diff --git a/stack/state_space_test.go b/stack/state_space_test.go index 2722ad6a3..071b32660 100644 --- a/stack/state_space_test.go +++ b/stack/state_space_test.go @@ -6,11 +6,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/tendermint/go-wire/data" "github.com/tendermint/tmlibs/log" "github.com/tendermint/basecoin" "github.com/tendermint/basecoin/state" - "github.com/tendermint/go-wire/data" ) // writerMid is a middleware that writes the given bytes on CheckTx and DeliverTx