From ae1b6f78e518b94ec7cc3588a2e6f784995a4a8a Mon Sep 17 00:00:00 2001 From: krhubert Date: Tue, 4 Feb 2020 17:46:01 +0100 Subject: [PATCH] Update cosmos-sdk to 0.38.0 + fix all api change errors --- cmd/mesg-cosmos-daemon/main.go | 8 ++--- cmd/mesg-cosmos/main.go | 7 ++-- config/config.go | 2 +- core/main.go | 4 +-- cosmos/client.go | 19 ++++------- cosmos/errors.go | 27 +++++++++++----- cosmos/genesis.go | 13 ++++---- cosmos/genesis_test.go | 10 ++++-- cosmos/keybase.go | 35 ++++++++++++-------- cosmos/keybase_test.go | 6 ++-- cosmos/module.go | 25 ++++++--------- go.mod | 13 +++----- go.sum | 58 ++++++++++++++++++++++++++++++++++ sdk/execution/module.go | 4 +-- sdk/execution/msgs.go | 16 ++++++---- sdk/instance/module.go | 3 +- sdk/modules.go | 17 +++------- sdk/ownership/module.go | 4 +-- sdk/process/module.go | 4 +-- sdk/process/msgs.go | 15 +++++---- sdk/runner/module.go | 4 +-- sdk/runner/msgs.go | 19 +++++------ sdk/service/module.go | 4 +-- sdk/service/msgs.go | 7 ++-- 24 files changed, 195 insertions(+), 129 deletions(-) diff --git a/cmd/mesg-cosmos-daemon/main.go b/cmd/mesg-cosmos-daemon/main.go index 88f7f8f9f..c671604ac 100644 --- a/cmd/mesg-cosmos-daemon/main.go +++ b/cmd/mesg-cosmos-daemon/main.go @@ -7,8 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/genaccounts" - genaccscli "github.com/cosmos/cosmos-sdk/x/genaccounts/client/cli" + "github.com/cosmos/cosmos-sdk/x/auth" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/staking" "github.com/mesg-foundation/engine/codec" @@ -51,13 +50,12 @@ func main() { // CLI commands to initialize the chain rootCmd.AddCommand( genutilcli.InitCmd(ctx, cdc, basicManager, cfg.Tendermint.Config.RootDir), - genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, cfg.Tendermint.Config.RootDir), + genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, cfg.Tendermint.Config.RootDir), genutilcli.GenTxCmd( ctx, cdc, basicManager, staking.AppModuleBasic{}, - genaccounts.AppModuleBasic{}, cfg.Tendermint.Config.RootDir, defaultCLIHome, + auth.GenesisAccountIterator{}, cfg.Tendermint.Config.RootDir, defaultCLIHome, ), genutilcli.ValidateGenesisCmd(ctx, cdc, basicManager), - genaccscli.AddGenesisAccountCmd(ctx, cdc, cfg.Tendermint.Config.RootDir, defaultCLIHome), ) server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators) diff --git a/cmd/mesg-cosmos/main.go b/cmd/mesg-cosmos/main.go index 058284ed4..c6babdfe8 100644 --- a/cmd/mesg-cosmos/main.go +++ b/cmd/mesg-cosmos/main.go @@ -5,6 +5,7 @@ import ( "path" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" @@ -44,7 +45,7 @@ func main() { } // Add --chain-id to persistent flags and mark it required - rootCmd.PersistentFlags().String(client.FlagChainID, "", "Chain ID of tendermint node") + rootCmd.PersistentFlags().String(flags.FlagChainID, "", "Chain ID of tendermint node") rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { return initConfig(rootCmd) } @@ -58,7 +59,7 @@ func main() { lcd.ServeCommand(cdc, registerRoutes), keys.Commands(), version.Cmd, - client.NewCompletionCmd(rootCmd, true), + flags.NewCompletionCmd(rootCmd, true), ) executor := cli.PrepareMainCmd(rootCmd, "MESG", defaultCLIHome) @@ -125,7 +126,7 @@ func initConfig(cmd *cobra.Command) error { return err } } - if err := viper.BindPFlag(client.FlagChainID, cmd.PersistentFlags().Lookup(client.FlagChainID)); err != nil { + if err := viper.BindPFlag(flags.FlagChainID, cmd.PersistentFlags().Lookup(flags.FlagChainID)); err != nil { return err } if err := viper.BindPFlag(cli.EncodingFlag, cmd.PersistentFlags().Lookup(cli.EncodingFlag)); err != nil { diff --git a/config/config.go b/config/config.go index 949cc8621..6b1bf2036 100644 --- a/config/config.go +++ b/config/config.go @@ -114,7 +114,7 @@ func defaultConfig() (*Config, error) { c.Cosmos.StakeTokenDenom = "atto" c.Cosmos.Bech32MainPrefix = "mesgtest" c.Cosmos.CoinType = 470 - c.Cosmos.FullFundraiserPath = "44'/470'/0'/0/0" + c.Cosmos.FullFundraiserPath = "44'/470'/0'/0/0" // TODO: is it really useful? c.Cosmos.PowerReduction = 18 c.DevGenesis.ChainID = "mesg-dev-chain" diff --git a/core/main.go b/core/main.go index c9216b880..ad9dfe1e2 100644 --- a/core/main.go +++ b/core/main.go @@ -69,7 +69,7 @@ func stopRunningServices(sdk *enginesdk.SDK, address string) error { func loadOrGenConfigAccount(kb *cosmos.Keybase, cfg *config.Config) (keys.Info, error) { if cfg.Account.Mnemonic != "" { logrus.WithField("module", "main").Warn("Config account mnemonic presents. Generating account with it...") - return kb.CreateAccount(cfg.Account.Name, cfg.Account.Mnemonic, "", cfg.Account.Password, cfg.Account.Number, cfg.Account.Index) + return kb.CreateAccount(cfg.Account.Name, cfg.Account.Mnemonic, "", cfg.Account.Password, keys.CreateHDPath(cfg.Account.Number, cfg.Account.Index).String(), cosmos.DefaultAlgo) } exist, err := kb.Exist(cfg.Account.Name) @@ -89,7 +89,7 @@ func loadOrGenConfigAccount(kb *cosmos.Keybase, cfg *config.Config) (keys.Info, "password": cfg.Account.Password, "mnemonic": mnemonic, }).Warn("Account") - return kb.CreateAccount(cfg.Account.Name, mnemonic, "", cfg.Account.Password, cfg.Account.Number, cfg.Account.Index) + return kb.CreateAccount(cfg.Account.Name, mnemonic, "", cfg.Account.Password, keys.CreateHDPath(cfg.Account.Number, cfg.Account.Index).String(), cosmos.DefaultAlgo) } func loadOrGenDevGenesis(basicManager *module.BasicManager, kb *cosmos.Keybase, cfg *config.Config) (*tmtypes.GenesisDoc, error) { diff --git a/cosmos/client.go b/cosmos/client.go index dc0df00b2..9e7015929 100644 --- a/cosmos/client.go +++ b/cosmos/client.go @@ -12,13 +12,13 @@ import ( sdktypes "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authutils "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + authExported "github.com/cosmos/cosmos-sdk/x/auth/exported" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/mesg-foundation/engine/codec" "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/x/xreflect" "github.com/mesg-foundation/engine/x/xstrings" abci "github.com/tendermint/tendermint/abci/types" - tmquery "github.com/tendermint/tendermint/libs/pubsub/query" "github.com/tendermint/tendermint/node" rpcclient "github.com/tendermint/tendermint/rpc/client" tenderminttypes "github.com/tendermint/tendermint/types" @@ -34,7 +34,7 @@ type Client struct { minGasPrices sdktypes.DecCoins // Local state - acc auth.Account + acc authExported.Account getAccountMutex sync.Mutex broadcastMutex sync.Mutex } @@ -136,11 +136,7 @@ func (c *Client) BuildAndBroadcastMsg(msg sdktypes.Msg) (*abci.ResponseDeliverTx // Stream subscribes to the provided query and returns the hash of the matching ressources. func (c *Client) Stream(ctx context.Context, query string) (chan hash.Hash, chan error, error) { subscriber := xstrings.RandASCIILetters(8) - q, err := tmquery.New(query) - if err != nil { - return nil, nil, err - } - msgStream, err := c.EventBus.SubscribeUnbuffered(ctx, subscriber, q) + eventStream, err := c.Subscribe(ctx, subscriber, query, 0) if err != nil { return nil, nil, err } @@ -150,8 +146,8 @@ func (c *Client) Stream(ctx context.Context, query string) (chan hash.Hash, chan loop: for { select { - case msg := <-msgStream.Out(): - attrs := msg.Events()[EventHashType] + case event := <-eventStream: + attrs := event.Events[EventHashType] // The following error might be too much as MAYBE if one transaction contains many messages, the events will be merged across the whole transaction if len(attrs) != 1 { errC <- fmt.Errorf("event %s has %d tag(s), but only 1 is expected", EventHashType, len(attrs)) @@ -164,9 +160,6 @@ func (c *Client) Stream(ctx context.Context, query string) (chan hash.Hash, chan hashC <- hash } } - case <-msgStream.Cancelled(): - errC <- msgStream.Err() - break loop case <-ctx.Done(): break loop } @@ -179,7 +172,7 @@ func (c *Client) Stream(ctx context.Context, query string) (chan hash.Hash, chan } // GetAccount returns the local account. -func (c *Client) GetAccount() (auth.Account, error) { +func (c *Client) GetAccount() (authExported.Account, error) { c.getAccountMutex.Lock() defer c.getAccountMutex.Unlock() if c.acc == nil { diff --git a/cosmos/errors.go b/cosmos/errors.go index 5df27462e..437d0089d 100644 --- a/cosmos/errors.go +++ b/cosmos/errors.go @@ -1,26 +1,37 @@ package cosmos import ( - "github.com/cosmos/cosmos-sdk/types" + "fmt" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) const ( // CodespaceMesg is a cosmos codespace for all mesg errors. - CodespaceMesg types.CodespaceType = "mesg" + CodespaceMesg = "mesg" ) // Base mesg codes. const ( - CodeInternal types.CodeType = 1000 - CodeValidation types.CodeType = 2000 + CodeInternal uint32 = 1000 + CodeValidation uint32 = 2000 + CodeMarshal uint32 = 2001 + CodeUnmarshal uint32 = 2002 +) + +// mesg errors +var ( + ErrValidation = sdkerrors.Register(CodespaceMesg, CodeValidation, "validation failed") + ErrMarshal = sdkerrors.Register(CodespaceMesg, CodeMarshal, "failed to marshal") // TODO: to replace by cosmoserrors.ErrJSONMarshal if it makes sense + ErrUnmarshal = sdkerrors.Register(CodespaceMesg, CodeUnmarshal, "failed to unmarshal") // TODO: to replace by cosmoserrors.ErrJSONUnmarshal if it makes sense ) // NewMesgErrorf creates error with given code type and mesg codespace. -func NewMesgErrorf(ct types.CodeType, format string, a ...interface{}) types.Error { - return types.NewError(CodespaceMesg, ct, format, a...) +func NewMesgErrorf(code uint32, format string, a ...interface{}) *sdkerrors.Error { + return sdkerrors.New(CodespaceMesg, code, fmt.Sprintf(format, a...)) } // NewMesgWrapError creates error with given code type and mesg codespace. -func NewMesgWrapError(ct types.CodeType, err error) types.Error { - return types.NewError(CodespaceMesg, ct, err.Error()) +func NewMesgWrapError(code uint32, err error) *sdkerrors.Error { + return sdkerrors.New(CodespaceMesg, code, err.Error()) } diff --git a/cosmos/genesis.go b/cosmos/genesis.go index 566a24dda..d2fe43be4 100644 --- a/cosmos/genesis.go +++ b/cosmos/genesis.go @@ -7,8 +7,8 @@ import ( sdktypes "github.com/cosmos/cosmos-sdk/types" authutils "github.com/cosmos/cosmos-sdk/x/auth/client/utils" + authexported "github.com/cosmos/cosmos-sdk/x/auth/exported" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/mesg-foundation/engine/codec" @@ -126,23 +126,24 @@ func genGenesisDoc(appState map[string]json.RawMessage, chainID string, genesisT } func genGenesisAppState(defaultGenesisŚtate map[string]json.RawMessage, signedStdTx authtypes.StdTx, initialBalances string) (map[string]json.RawMessage, error) { - genAccs := []genaccounts.GenesisAccount{} - for _, signer := range signedStdTx.GetSigners() { + genAccs := authexported.GenesisAccounts{} + pubkeys := signedStdTx.GetPubKeys() + for i, signer := range signedStdTx.GetSigners() { initialB, err := sdktypes.ParseCoins(initialBalances) if err != nil { return nil, err } - genAcc := genaccounts.NewGenesisAccountRaw(signer, initialB, sdktypes.NewCoins(), 0, 0, "", "") + genAcc := authtypes.NewBaseAccount(signer, initialB, pubkeys[i], 0, 0) if err := genAcc.Validate(); err != nil { return nil, err } genAccs = append(genAccs, genAcc) } - genstate, err := codec.MarshalJSON(genaccounts.GenesisState(genAccs)) + genstate, err := codec.MarshalJSON(authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)) if err != nil { return nil, err } - defaultGenesisŚtate[genaccounts.ModuleName] = genstate + defaultGenesisŚtate[authtypes.ModuleName] = genstate return genutil.SetGenTxsInAppGenesisState(codec.Codec, defaultGenesisŚtate, []authtypes.StdTx{signedStdTx}) } diff --git a/cosmos/genesis_test.go b/cosmos/genesis_test.go index 173ab76eb..dceb6b04e 100644 --- a/cosmos/genesis_test.go +++ b/cosmos/genesis_test.go @@ -7,20 +7,24 @@ import ( "path/filepath" "testing" + "github.com/cosmos/cosmos-sdk/crypto/keys" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/mesg-foundation/engine/codec" "github.com/stretchr/testify/require" ) func TestGenesis(t *testing.T) { + // codec + authtypes.RegisterCodec(codec.Codec) + stakingtypes.RegisterCodec(codec.Codec) + // path path, _ := ioutil.TempDir("", "TestGenesis") defer os.RemoveAll(path) // keybase kb, err := NewKeybase(filepath.Join(path, "kb")) require.NoError(t, err) - // codec - stakingtypes.RegisterCodec(codec.Codec) // variables var ( chainID = "test-chainID" @@ -37,7 +41,7 @@ func TestGenesis(t *testing.T) { ) // init account mnemonic, _ := kb.NewMnemonic() - kb.CreateAccount(name, mnemonic, "", password, 0, 0) + kb.CreateAccount(name, mnemonic, "", password, keys.CreateHDPath(0, 0).String(), DefaultAlgo) // start tests t.Run("generate validator", func(t *testing.T) { v, err := NewGenesisValidator(kb, name, password, privValidatorKeyFile, privValidatorStateFile, nodeKeyFile) diff --git a/cosmos/keybase.go b/cosmos/keybase.go index f85c73013..120b6d275 100644 --- a/cosmos/keybase.go +++ b/cosmos/keybase.go @@ -6,14 +6,16 @@ import ( clientkey "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/crypto/keys" - "github.com/cosmos/cosmos-sdk/crypto/keys/hd" "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror" "github.com/cosmos/cosmos-sdk/types" bip39 "github.com/cosmos/go-bip39" "github.com/tendermint/tendermint/crypto" ) -const mnemonicEntropySize = 256 +const ( + mnemonicEntropySize = 256 + DefaultAlgo = keys.Secp256k1 +) // Keybase is a standard cosmos keybase. type Keybase struct { @@ -111,17 +113,10 @@ func (kb *Keybase) CreateMnemonic(name string, language keys.Language, passwd st } // CreateAccount is a lock protected version of keys.CreateAccount -func (kb *Keybase) CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd string, account, index uint32) (keys.Info, error) { +func (kb *Keybase) CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd, hdPath string, algo keys.SigningAlgo) (keys.Info, error) { kb.mx.Lock() defer kb.mx.Unlock() - return kb.kb.CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd, account, index) -} - -// Derive is a lock protected version of keys.Derive -func (kb *Keybase) Derive(name, mnemonic, bip39Passwd, encryptPasswd string, params hd.BIP44Params) (keys.Info, error) { - kb.mx.Lock() - defer kb.mx.Unlock() - return kb.kb.Derive(name, mnemonic, bip39Passwd, encryptPasswd, params) + return kb.kb.CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd, hdPath, algo) } // CreateLedger is a lock protected version of keys.CreateLedger @@ -132,10 +127,10 @@ func (kb *Keybase) CreateLedger(name string, algo keys.SigningAlgo, hrp string, } // CreateOffline is a lock protected version of keys.CreateOffline -func (kb *Keybase) CreateOffline(name string, pubkey crypto.PubKey) (keys.Info, error) { +func (kb *Keybase) CreateOffline(name string, pubkey crypto.PubKey, algo keys.SigningAlgo) (keys.Info, error) { kb.mx.Lock() defer kb.mx.Unlock() - return kb.kb.CreateOffline(name, pubkey) + return kb.kb.CreateOffline(name, pubkey, algo) } // CreateMulti is a lock protected version of keys.CreateMulti @@ -201,6 +196,20 @@ func (kb *Keybase) ExportPrivateKeyObject(name string, passphrase string) (crypt return kb.kb.ExportPrivateKeyObject(name, passphrase) } +// SupportedAlgos returns a list of signing algorithms supported by the keybase +func (kb *Keybase) SupportedAlgos() []keys.SigningAlgo { + kb.mx.Lock() + defer kb.mx.Unlock() + return kb.kb.SupportedAlgos() +} + +// SupportedAlgosLedger returns a list of signing algorithms supported by the keybase's ledger integration +func (kb *Keybase) SupportedAlgosLedger() []keys.SigningAlgo { + kb.mx.Lock() + defer kb.mx.Unlock() + return kb.kb.SupportedAlgosLedger() +} + // CloseDB is a lock protected version of keys.CloseDB func (kb *Keybase) CloseDB() { kb.mx.Lock() diff --git a/cosmos/keybase_test.go b/cosmos/keybase_test.go index 8691a3841..052634517 100644 --- a/cosmos/keybase_test.go +++ b/cosmos/keybase_test.go @@ -6,6 +6,7 @@ import ( "os" "testing" + "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/stretchr/testify/require" ) @@ -27,7 +28,7 @@ func TestKeybase(t *testing.T) { }) t.Run("Create", func(t *testing.T) { - acc, err := kb.CreateAccount(name, mnemonic, "", password, 0, 0) + acc, err := kb.CreateAccount(name, mnemonic, "", password, keys.CreateHDPath(0, 0).String(), DefaultAlgo) require.NoError(t, err) require.Equal(t, name, acc.GetName()) }) @@ -45,7 +46,8 @@ func TestKeybase(t *testing.T) { t.Run("Sign", func(t *testing.T) { name2 := "name2" mnemonic2, _ := kb.NewMnemonic() - kb.CreateAccount(name2, mnemonic2, "", password, 0, 0) + _, err := kb.CreateAccount(name2, mnemonic2, "", password, keys.CreateHDPath(0, 0).String(), DefaultAlgo) + require.NoError(t, err) hash := sha256.Sum256([]byte(name + ":" + password)) hash2 := sha256.Sum256([]byte(name2 + ":" + password)) for i := 0; i < 1000; i++ { diff --git a/cosmos/module.go b/cosmos/module.go index d80596ff8..4339c9742 100644 --- a/cosmos/module.go +++ b/cosmos/module.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" cosmoscodec "github.com/cosmos/cosmos-sdk/codec" cosmostypes "github.com/cosmos/cosmos-sdk/types" + cosmoserrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/gorilla/mux" "github.com/mesg-foundation/engine/codec" @@ -103,15 +104,12 @@ func (m *AppModule) Route() string { } // NewHandler returns the handler used to apply transactions. -func (m *AppModule) NewHandler() cosmostypes.Handler { - return func(request cosmostypes.Request, msg cosmostypes.Msg) cosmostypes.Result { +func (m AppModule) NewHandler() cosmostypes.Handler { + return func(request cosmostypes.Request, msg cosmostypes.Msg) (*cosmostypes.Result, error) { request = request.WithEventManager(cosmostypes.NewEventManager()) hash, err := m.handler(request, msg) if err != nil { - if errsdk, ok := err.(cosmostypes.Error); ok { - return errsdk.Result() - } - return cosmostypes.ErrInternal(err.Error()).Result() + return nil, err // TODO: maybe it should be wrap? } event := cosmostypes.NewEvent( @@ -125,10 +123,10 @@ func (m *AppModule) NewHandler() cosmostypes.Handler { } request.EventManager().EmitEvent(event) - return cosmostypes.Result{ + return &cosmostypes.Result{ Data: hash, Events: request.EventManager().Events(), - } + }, nil } } @@ -138,18 +136,15 @@ func (m *AppModule) QuerierRoute() string { } // NewQuerierHandler returns the handler used to reply ABCI query. -func (m *AppModule) NewQuerierHandler() cosmostypes.Querier { - return func(request cosmostypes.Request, path []string, req abci.RequestQuery) ([]byte, cosmostypes.Error) { +func (m AppModule) NewQuerierHandler() cosmostypes.Querier { + return func(request cosmostypes.Request, path []string, req abci.RequestQuery) ([]byte, error) { data, err := m.querier(request, path, req) if err != nil { - if errsdk, ok := err.(cosmostypes.Error); ok { - return nil, errsdk - } - return nil, NewMesgWrapError(CodeInternal, err) + return nil, err // TODO: maybe it should be wrap? } res, err := codec.MarshalBinaryBare(data) if err != nil { - return nil, NewMesgWrapError(CodeInternal, err) + return nil, cosmoserrors.Wrapf(ErrMarshal, "%w", err) // TODO: is it useful to wrap the error? } return res, nil } diff --git a/go.mod b/go.mod index dc918e22e..10f60ab64 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect github.com/containerd/containerd v1.3.0 // indirect github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect - github.com/cosmos/cosmos-sdk v0.37.6 + github.com/cosmos/cosmos-sdk v0.38.0 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d github.com/cskr/pubsub v1.0.2 github.com/docker/cli v0.0.0-20191011045415-5d85cdacd257 @@ -35,7 +35,6 @@ require ( github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/leodido/go-urn v1.1.0 // indirect github.com/lyft/protoc-gen-validate v0.1.0 // indirect - github.com/mattn/go-isatty v0.0.8 // indirect github.com/mitchellh/go-homedir v1.1.0 github.com/morikuni/aec v1.0.0 // indirect github.com/mr-tron/base58 v1.1.3 @@ -45,23 +44,21 @@ require ( github.com/opencontainers/go-digest v1.0.0-rc1 // indirect github.com/opencontainers/image-spec v1.0.1 // indirect github.com/opencontainers/runc v0.1.1 // indirect - github.com/pelletier/go-toml v1.4.0 // indirect github.com/prometheus/client_golang v1.1.0 github.com/pseudomuto/protoc-gen-doc v1.3.0 github.com/pseudomuto/protokit v0.2.0 // indirect - github.com/rakyll/statik v0.1.6 // indirect github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect github.com/sirupsen/logrus v1.4.2 github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.6.2 - github.com/stretchr/objx v0.2.0 // indirect github.com/stretchr/testify v1.4.0 + github.com/stumble/gorocksdb v0.0.3 // indirect github.com/tendermint/go-amino v0.15.1 - github.com/tendermint/tendermint v0.32.9 - github.com/tendermint/tm-db v0.2.0 + github.com/tendermint/tendermint v0.33.0 + github.com/tendermint/tm-db v0.4.0 github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5 - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 + golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect golang.org/x/tools v0.0.0-20190813142322-97f12d73768f // indirect google.golang.org/grpc v1.27.0 diff --git a/go.sum b/go.sum index 39aacbaee..19f9b8d45 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,12 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/99designs/keyring v1.1.3 h1:mEV3iyZWjkxQ7R8ia8GcG97vCX5zQQ7n4o8R2BylwQY= +github.com/99designs/keyring v1.1.3/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200102211924-4bcbc698314f h1:4O1om+UVU+Hfcihr1timk8YNXHxzZWgCo7ofnrZRApw= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200102211924-4bcbc698314f/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= @@ -58,19 +62,27 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/cosmos-sdk v0.37.4 h1:1ioXxkpiS+wOgaUbROeDIyuF7hciU5nti0TSyBmV2Ok= +github.com/cosmos/cosmos-sdk v0.37.4/go.mod h1:Axr+Q+G2Ffduxt4zMA6KwxxvyVSKPB9+nXZVPKgpC2c= github.com/cosmos/cosmos-sdk v0.37.6 h1:l7urou9aTPqW/x3Hq+SAWn6OHDzjma+1OVi0TT+O36M= github.com/cosmos/cosmos-sdk v0.37.6/go.mod h1:63Y8V75rRDzUrtRUwy+5cBOy5mr6xytI11PBk53tBrE= +github.com/cosmos/cosmos-sdk v0.38.0 h1:BrflLMrECI2ZfftRAq2iAlxlyk+W/4iKVCNCC3a+RPc= +github.com/cosmos/cosmos-sdk v0.38.0/go.mod h1:9ZZex0GKpyNCvilvVAPBoB+0n3A/aO1+/UhPVEaiCy4= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc= github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= +github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= +github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= github.com/cskr/pubsub v1.0.2/go.mod h1:/8MzYXk/NJAz782G8RPkFzXTZVu63VotefPnR9TIRis= +github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= +github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -88,6 +100,8 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU= +github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= @@ -117,12 +131,16 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= +github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -176,6 +194,14 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9G github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= +github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f h1:8N8XWLZelZNibkhM1FuF+3Ad3YIbgirjdMiVA0eUkaM= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -196,6 +222,8 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= +github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -224,8 +252,12 @@ github.com/mattn/go-isatty v0.0.6 h1:SrwhHcpV4nWrMGdNcC2kXpMfcBVYGDuTArqyhocJgvA github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= @@ -260,9 +292,13 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4= +github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -358,10 +394,16 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d h1:gZZadD8H+fF+n9CmNhYL1Y0dJB+kLOmKd7FbPJLeGHs= +github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= +github.com/tecbot/gorocksdb v0.0.0-20191017175515-d217d93fd4c5 h1:gVwAW5OwaZlDB5/CfqcGFM9p9C+KxvQKyNOltQ8orj0= +github.com/tecbot/gorocksdb v0.0.0-20191017175515-d217d93fd4c5/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= @@ -369,14 +411,24 @@ github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8= github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o= +github.com/tendermint/iavl v0.13.0 h1:r2sINvNFlJsLlLhGoqlqPlREWYkuK26BvMfkBt+XQnA= +github.com/tendermint/iavl v0.13.0/go.mod h1:7nSUPdrsHEZ2nNZa+9gaIrcJciWd1jCQZXtcyARU82k= github.com/tendermint/tendermint v0.32.1 h1:J8ddXMbCmG6GZjdCl/N1wgdXDU9uO91J2Y5CA9xYfGo= github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU= +github.com/tendermint/tendermint v0.32.7 h1:Szu5Fm1L3pvn3t4uQxPAcP+7ndZEQKgLie/yokM56rU= +github.com/tendermint/tendermint v0.32.7/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE= +github.com/tendermint/tendermint v0.32.8 h1:eOaLJGRi5x/Rb23fiVsxq9c5fZ/6O5QplExlGjNPDVI= +github.com/tendermint/tendermint v0.32.8/go.mod h1:5/B1XZjNYtVBso8o1l/Eg4A0Mhu42lDcmftoQl95j/E= github.com/tendermint/tendermint v0.32.9 h1:++dR46xpBq/yfQx2c5KyrZmb15p2jw9Q5iEtTB82d8s= github.com/tendermint/tendermint v0.32.9/go.mod h1:5/B1XZjNYtVBso8o1l/Eg4A0Mhu42lDcmftoQl95j/E= +github.com/tendermint/tendermint v0.33.0 h1:TW1g9sQs3YSqKM8o1+opL3/VmBy4Ke/VKV9MxYpqNbI= +github.com/tendermint/tendermint v0.33.0/go.mod h1:s5UoymnPIY+GcA3mMte4P9gpMP8vS7UH7HBXikT1pHI= github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ= github.com/tendermint/tm-db v0.2.0/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= +github.com/tendermint/tm-db v0.4.0 h1:iPbCcLbf4nwDFhS39Zo1lpdS1X/cT9CkTlUx17FHQgA= +github.com/tendermint/tm-db v0.4.0/go.mod h1:+Cwhgowrf7NBGXmsqFMbwEtbo80XmyrlY5Jsk95JubQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -400,6 +452,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -439,9 +493,12 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= @@ -479,6 +536,7 @@ google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1 h1:wdKvqQk7IttEw92GoRyKG2IDrUIpgpj6H6m81yfeMW0= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/sdk/execution/module.go b/sdk/execution/module.go index 5ee7daba1..af8821c07 100644 --- a/sdk/execution/module.go +++ b/sdk/execution/module.go @@ -4,6 +4,7 @@ import ( "fmt" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/mesg-foundation/engine/cosmos" "github.com/mesg-foundation/engine/hash" @@ -34,8 +35,7 @@ func handler(k *Keeper) cosmos.Handler { } return exec.Hash, nil default: - errmsg := fmt.Sprintf("Unrecognized execution Msg type: %v", msg.Type()) - return nil, cosmostypes.ErrUnknownRequest(errmsg) + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, fmt.Sprintf("Unrecognized execution Msg type: %v", msg.Type())) } } } diff --git a/sdk/execution/msgs.go b/sdk/execution/msgs.go index 3a4086d3d..8a72432f1 100644 --- a/sdk/execution/msgs.go +++ b/sdk/execution/msgs.go @@ -2,7 +2,9 @@ package executionsdk import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" + cosmoserrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/codec" + "github.com/mesg-foundation/engine/cosmos" "github.com/mesg-foundation/engine/protobuf/api" "github.com/mesg-foundation/engine/x/xvalidator" ) @@ -35,18 +37,18 @@ func (msg msgCreateExecution) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgCreateExecution) ValidateBasic() cosmostypes.Error { +func (msg msgCreateExecution) ValidateBasic() error { if err := xvalidator.Validate.Struct(msg); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } if !msg.Request.ParentHash.IsZero() && !msg.Request.EventHash.IsZero() { - return cosmostypes.ErrInternal("cannot have both parent and event hash") + return cosmoserrors.Wrap(cosmos.ErrValidation, "cannot have both parent and event hash") } if msg.Request.ParentHash.IsZero() && msg.Request.EventHash.IsZero() { - return cosmostypes.ErrInternal("should have at least an event hash or parent hash") + return cosmoserrors.Wrap(cosmos.ErrValidation, "should have at least an event hash or parent hash") } if msg.Request.ExecutorHash.IsZero() { - return cosmostypes.ErrInternal("should have a executor hash") + return cosmoserrors.Wrap(cosmos.ErrValidation, "should have a executor hash") } return nil } @@ -86,9 +88,9 @@ func (msg msgUpdateExecution) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgUpdateExecution) ValidateBasic() cosmostypes.Error { +func (msg msgUpdateExecution) ValidateBasic() error { if msg.Executor.Empty() { - return cosmostypes.ErrInvalidAddress("executor is missing") + return cosmoserrors.Wrap(cosmoserrors.ErrInvalidAddress, "executor is missing") } return nil } diff --git a/sdk/instance/module.go b/sdk/instance/module.go index bae6f11f7..db691c72f 100644 --- a/sdk/instance/module.go +++ b/sdk/instance/module.go @@ -4,6 +4,7 @@ import ( "fmt" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/mesg-foundation/engine/codec" "github.com/mesg-foundation/engine/cosmos" @@ -23,7 +24,7 @@ func NewModule(k *Keeper) module.AppModule { func handler(k *Keeper) cosmos.Handler { return func(request cosmostypes.Request, msg cosmostypes.Msg) (hash.Hash, error) { errmsg := fmt.Sprintf("Unrecognized instance Msg type: %v", msg.Type()) - return nil, cosmostypes.ErrUnknownRequest(errmsg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errmsg) } } diff --git a/sdk/modules.go b/sdk/modules.go index 521679853..88d411b7d 100644 --- a/sdk/modules.go +++ b/sdk/modules.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/distribution" - "github.com/cosmos/cosmos-sdk/x/genaccounts" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/slashing" @@ -32,7 +31,6 @@ import ( func NewBasicManager() *module.BasicManager { basicManager := module.NewBasicManager( params.AppModuleBasic{}, - genaccounts.AppModuleBasic{}, genutil.AppModuleBasic{}, auth.AppModuleBasic{}, bank.AppModuleBasic{}, @@ -89,8 +87,8 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er codec.Codec, paramsStoreKey, paramsTStoreKey, - params.DefaultCodespace, ) + accountKeeper := auth.NewAccountKeeper( codec.Codec, paramsStoreKey, @@ -100,7 +98,6 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er bankKeeper := bank.NewBaseKeeper( accountKeeper, paramsKeeper.Subspace(bank.DefaultParamspace), - bank.DefaultCodespace, modAccAddrs, ) supplyKeeper := supply.NewKeeper( @@ -113,10 +110,8 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er stakingKeeper := staking.NewKeeper( codec.Codec, stakingStoreKey, - stakingTStoreKey, supplyKeeper, paramsKeeper.Subspace(staking.DefaultParamspace), - staking.DefaultCodespace, ) distrKeeper := distribution.NewKeeper( codec.Codec, @@ -124,7 +119,6 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er paramsKeeper.Subspace(distribution.DefaultParamspace), &stakingKeeper, supplyKeeper, - distribution.DefaultCodespace, auth.FeeCollectorName, modAccAddrs, ) @@ -133,7 +127,6 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er slashingStoreKey, &stakingKeeper, paramsKeeper.Subspace(slashing.DefaultParamspace), - slashing.DefaultCodespace, ) stakingKeeper = *stakingKeeper.SetHooks( staking.NewMultiStakingHooks( @@ -154,14 +147,13 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er // init module manager manager := module.NewManager( - genaccounts.NewAppModule(accountKeeper), genutil.NewAppModule(accountKeeper, stakingKeeper, app.DeliverTx), auth.NewAppModule(accountKeeper), bank.NewAppModule(bankKeeper, accountKeeper), supply.NewAppModule(supplyKeeper, accountKeeper), - distribution.NewAppModule(distrKeeper, supplyKeeper), - slashing.NewAppModule(slashingKeeper, stakingKeeper), - staking.NewAppModule(stakingKeeper, distrKeeper, accountKeeper, supplyKeeper), + distribution.NewAppModule(distrKeeper, accountKeeper, supplyKeeper, stakingKeeper), + slashing.NewAppModule(slashingKeeper, accountKeeper, stakingKeeper), + staking.NewAppModule(stakingKeeper, accountKeeper, supplyKeeper), ownershipsdk.NewModule(ownershipKeeper), servicesdk.NewModule(serviceKeeper), @@ -173,7 +165,6 @@ func NewApp(logger log.Logger, db dbm.DB, minGasPrices string) (*bam.BaseApp, er manager.SetOrderBeginBlockers(distribution.ModuleName, slashing.ModuleName) manager.SetOrderEndBlockers(staking.ModuleName) manager.SetOrderInitGenesis( - genaccounts.ModuleName, distribution.ModuleName, staking.ModuleName, auth.ModuleName, diff --git a/sdk/ownership/module.go b/sdk/ownership/module.go index 7bd38e07b..5ed26b8e8 100644 --- a/sdk/ownership/module.go +++ b/sdk/ownership/module.go @@ -4,6 +4,7 @@ import ( "fmt" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/mesg-foundation/engine/cosmos" "github.com/mesg-foundation/engine/hash" @@ -20,8 +21,7 @@ func NewModule(k *Keeper) module.AppModule { func handler(k *Keeper) cosmos.Handler { return func(request cosmostypes.Request, msg cosmostypes.Msg) (hash.Hash, error) { - errmsg := fmt.Sprintf("Unrecognized ownership Msg type: %v", msg.Type()) - return nil, cosmostypes.ErrUnknownRequest(errmsg) + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "Unrecognized ownership Msg type: %v", msg.Type()) } } diff --git a/sdk/process/module.go b/sdk/process/module.go index 679547497..3d2cb92bf 100644 --- a/sdk/process/module.go +++ b/sdk/process/module.go @@ -4,6 +4,7 @@ import ( "fmt" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/mesg-foundation/engine/cosmos" "github.com/mesg-foundation/engine/hash" @@ -30,8 +31,7 @@ func handler(k *Keeper) cosmos.Handler { case msgDeleteProcess: return nil, k.Delete(request, &msg) default: - errmsg := fmt.Sprintf("unrecognized process msg type: %v", msg.Type()) - return nil, cosmostypes.ErrUnknownRequest(errmsg) + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized process msg type: %v", msg.Type()) } } } diff --git a/sdk/process/msgs.go b/sdk/process/msgs.go index e8780dfb1..73c053236 100644 --- a/sdk/process/msgs.go +++ b/sdk/process/msgs.go @@ -2,6 +2,7 @@ package processsdk import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" + cosmoserrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/codec" "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/process" @@ -34,12 +35,12 @@ func (msg msgCreateProcess) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgCreateProcess) ValidateBasic() cosmostypes.Error { +func (msg msgCreateProcess) ValidateBasic() error { if msg.Owner.Empty() { - return cosmostypes.ErrInvalidAddress("owner is missing") + return cosmoserrors.Wrap(cosmoserrors.ErrInvalidAddress, "owner is missing") } if err := xvalidator.Validate.Struct(msg); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } p := &process.Process{ Name: msg.Request.Name, @@ -48,7 +49,7 @@ func (msg msgCreateProcess) ValidateBasic() cosmostypes.Error { } p.Hash = hash.Dump(p) if err := p.Validate(); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } return nil } @@ -88,12 +89,12 @@ func (msg msgDeleteProcess) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgDeleteProcess) ValidateBasic() cosmostypes.Error { +func (msg msgDeleteProcess) ValidateBasic() error { if msg.Owner.Empty() { - return cosmostypes.ErrInvalidAddress("owner is missing") + return cosmoserrors.Wrap(cosmoserrors.ErrInvalidAddress, "owner is missing") } if err := xvalidator.Validate.Struct(msg); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } return nil } diff --git a/sdk/runner/module.go b/sdk/runner/module.go index 26633935a..d4ba60573 100644 --- a/sdk/runner/module.go +++ b/sdk/runner/module.go @@ -4,6 +4,7 @@ import ( "fmt" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/mesg-foundation/engine/cosmos" "github.com/mesg-foundation/engine/hash" @@ -33,8 +34,7 @@ func handler(k *Keeper) cosmos.Handler { } return nil, nil default: - errmsg := fmt.Sprintf("Unrecognized runner Msg type: %v", msg.Type()) - return nil, cosmostypes.ErrUnknownRequest(errmsg) + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, fmt.Sprintf("Unrecognized runner Msg type: %v", msg.Type())) } } } diff --git a/sdk/runner/msgs.go b/sdk/runner/msgs.go index d1bc428bd..9e9be3f43 100644 --- a/sdk/runner/msgs.go +++ b/sdk/runner/msgs.go @@ -2,6 +2,7 @@ package runnersdk import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" + cosmoserrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/codec" "github.com/mesg-foundation/engine/cosmos" "github.com/mesg-foundation/engine/hash" @@ -35,18 +36,18 @@ func (msg msgCreateRunner) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgCreateRunner) ValidateBasic() cosmostypes.Error { +func (msg msgCreateRunner) ValidateBasic() error { if err := xvalidator.Validate.Struct(msg); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } if msg.ServiceHash.IsZero() { - return cosmos.NewMesgErrorf(cosmos.CodeValidation, "serviceHash is missing") + return cosmoserrors.Wrap(cosmos.ErrValidation, "serviceHash is missing") } if msg.EnvHash.IsZero() { - return cosmos.NewMesgErrorf(cosmos.CodeValidation, "envHash is missing") + return cosmoserrors.Wrap(cosmos.ErrValidation, "envHash is missing") } if msg.Address.Empty() { - return cosmostypes.ErrInvalidAddress("address is missing") + return cosmoserrors.Wrap(cosmoserrors.ErrInvalidAddress, "address is missing") } return nil } @@ -86,15 +87,15 @@ func (msg msgDeleteRunner) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgDeleteRunner) ValidateBasic() cosmostypes.Error { +func (msg msgDeleteRunner) ValidateBasic() error { if err := xvalidator.Validate.Struct(msg); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } if msg.RunnerHash.IsZero() { - return cosmos.NewMesgErrorf(cosmos.CodeValidation, "runnerHash is missing") + return cosmoserrors.Wrap(cosmos.ErrValidation, "runnerHash is missing") } if msg.Address.Empty() { - return cosmostypes.ErrInvalidAddress("address is missing") + return cosmoserrors.Wrap(cosmoserrors.ErrInvalidAddress, "address is missing") } return nil } diff --git a/sdk/service/module.go b/sdk/service/module.go index 08a941dea..aac85aaf8 100644 --- a/sdk/service/module.go +++ b/sdk/service/module.go @@ -4,6 +4,7 @@ import ( "fmt" cosmostypes "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/mesg-foundation/engine/codec" "github.com/mesg-foundation/engine/cosmos" @@ -30,8 +31,7 @@ func handler(k *Keeper) cosmos.Handler { } return srv.Hash, nil default: - errmsg := fmt.Sprintf("Unrecognized service Msg type: %v", msg.Type()) - return nil, cosmostypes.ErrUnknownRequest(errmsg) + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "Unrecognized service Msg type: %v", msg.Type()) } } } diff --git a/sdk/service/msgs.go b/sdk/service/msgs.go index ae8751b66..2749b75d4 100644 --- a/sdk/service/msgs.go +++ b/sdk/service/msgs.go @@ -2,6 +2,7 @@ package servicesdk import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" + cosmoserrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/codec" "github.com/mesg-foundation/engine/protobuf/api" "github.com/mesg-foundation/engine/x/xvalidator" @@ -32,12 +33,12 @@ func (msg msgCreateService) Type() string { } // ValidateBasic runs stateless checks on the message. -func (msg msgCreateService) ValidateBasic() cosmostypes.Error { +func (msg msgCreateService) ValidateBasic() error { if err := xvalidator.Validate.Struct(msg); err != nil { - return cosmostypes.ErrInternal(err.Error()) + return err } if msg.Owner.Empty() { - return cosmostypes.ErrInvalidAddress("owner is missing") + return cosmoserrors.Wrap(cosmoserrors.ErrInvalidAddress, "owner is missing") } return nil }