From 0bc286786860f68cd20031168e3c74ec3c5bdd39 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Wed, 12 Sep 2018 23:20:48 -0700 Subject: [PATCH 1/3] rename wire to codec --- PENDING.md | 1 + baseapp/baseapp.go | 4 +- baseapp/baseapp_test.go | 26 +++++------ client/context/context.go | 6 +-- client/context/query.go | 4 +- client/keys/{wire.go => codec.go} | 8 ++-- client/lcd/{wire.go => codec.go} | 0 client/lcd/lcd_test.go | 6 +-- client/lcd/root.go | 6 +-- client/lcd/test_helpers.go | 6 +-- client/rpc/block.go | 2 +- client/rpc/{wire.go => codec.go} | 0 client/tx/query.go | 14 +++--- client/tx/root.go | 6 +-- client/tx/search.go | 10 ++--- cmd/gaia/app/app.go | 26 +++++------ cmd/gaia/app/app_test.go | 4 +- cmd/gaia/app/genesis.go | 14 +++--- cmd/gaia/cli_test/cli_test.go | 6 +-- cmd/gaia/cmd/gaiadebug/hack.go | 22 ++++----- wire/wire.go => codec/codec.go | 6 +-- crypto/keys/{wire.go => codec.go} | 0 docs/sdk/core/app2.md | 6 +-- docs/sdk/core/examples/app2.go | 8 ++-- docs/sdk/core/examples/app3.go | 8 ++-- docs/sdk/core/examples/app4.go | 4 +- .../simple-governance/app-codec.md | 14 +++--- .../simple-governance/app-rest.md | 2 +- .../simple-governance/app-structure.md | 2 +- .../simple-governance/intro.md | 2 +- .../simple-governance/module-cli.md | 2 +- .../simple-governance/module-codec.md | 13 ++++++ .../simple-governance/module-init.md | 4 +- .../simple-governance/module-keeper.md | 2 +- .../simple-governance/module-wire.md | 13 ------ docs/spec/ibc/appendices.md | 4 +- docs/spec/ibc/channels-and-packets.md | 2 +- docs/spec/ibc/conclusion.md | 2 +- docs/spec/ibc/references.md | 2 +- examples/basecoin/app/app.go | 22 ++++----- examples/basecoin/app/app_test.go | 6 +-- examples/basecoin/types/account.go | 4 +- examples/democoin/app/app.go | 24 +++++----- examples/democoin/app/app_test.go | 4 +- examples/democoin/cmd/democoind/main.go | 4 +- examples/democoin/types/account.go | 4 +- examples/democoin/x/assoc/validator_set.go | 6 +-- .../democoin/x/assoc/validator_set_test.go | 4 +- examples/democoin/x/cool/app_test.go | 2 +- examples/democoin/x/cool/client/cli/tx.go | 6 +-- .../democoin/x/cool/{wire.go => codec.go} | 6 +-- examples/democoin/x/cool/keeper_test.go | 4 +- examples/democoin/x/oracle/README.md | 2 +- examples/democoin/x/oracle/keeper.go | 6 +-- examples/democoin/x/oracle/keeper_keys.go | 8 ++-- examples/democoin/x/oracle/oracle_test.go | 10 ++--- examples/democoin/x/pow/app_test.go | 2 +- examples/democoin/x/pow/client/cli/tx.go | 4 +- examples/democoin/x/pow/codec.go | 10 +++++ examples/democoin/x/pow/handler_test.go | 4 +- examples/democoin/x/pow/keeper_test.go | 4 +- examples/democoin/x/pow/wire.go | 10 ----- .../x/simplestake/client/cli/commands.go | 6 +-- .../x/simplestake/{wire.go => codec.go} | 6 +-- examples/democoin/x/simplestake/keeper.go | 8 ++-- .../democoin/x/simplestake/keeper_test.go | 6 +-- examples/kvstore/kvstore | Bin 20725148 -> 20725285 bytes server/export.go | 6 +-- server/export_test.go | 4 +- server/init.go | 28 ++++++------ server/init_test.go | 4 +- server/mock/app.go | 8 ++-- server/start_test.go | 4 +- server/testnet.go | 6 +-- server/tm_cmds.go | 6 +-- server/util.go | 8 ++-- server/util_test.go | 4 +- store/{types.go => codec.go} | 0 store/wire.go | 4 +- types/{wire.go => codec.go} | 4 +- types/decimal_test.go | 10 ++--- types/errors.go | 4 +- types/lib/linear.go | 10 ++--- types/lib/linear_test.go | 8 ++-- x/auth/account.go | 6 +-- x/auth/account_test.go | 13 +++--- x/auth/ante_test.go | 20 ++++----- x/auth/client/cli/account.go | 10 ++--- x/auth/client/rest/query.go | 6 +-- x/auth/client/rest/sign.go | 6 +-- x/auth/client/txbuilder/txbuilder.go | 6 +-- x/auth/codec.go | 19 ++++++++ x/auth/feekeeper.go | 8 ++-- x/auth/feekeeper_test.go | 8 ++-- x/auth/mapper.go | 8 ++-- x/auth/mapper_test.go | 4 +- x/auth/stdtx.go | 4 +- x/auth/wire.go | 19 -------- x/bank/bench_test.go | 2 +- x/bank/client/cli/sendtx.go | 4 +- x/bank/client/rest/broadcast.go | 6 +-- x/bank/client/rest/sendtx.go | 12 ++--- x/bank/codec.go | 17 +++++++ x/bank/keeper_test.go | 8 ++-- x/bank/simulation/sim_test.go | 2 +- x/bank/wire.go | 17 ------- x/distribution/keeper.go | 4 +- x/gov/client/cli/tx.go | 22 ++++----- x/gov/client/rest/rest.go | 22 ++++----- x/gov/client/rest/util.go | 8 ++-- x/gov/{wire.go => codec.go} | 8 ++-- x/gov/keeper.go | 14 +++--- x/gov/queryable.go | 16 +++---- x/gov/simulation/sim_test.go | 4 +- x/gov/test_common.go | 4 +- x/ibc/app_test.go | 2 +- x/ibc/client/cli/ibctx.go | 4 +- x/ibc/client/cli/relay.go | 6 +-- x/ibc/client/rest/transfer.go | 6 +-- x/ibc/{wire.go => codec.go} | 6 +-- x/ibc/ibc_test.go | 8 ++-- x/ibc/mapper.go | 10 ++--- x/ibc/types.go | 6 +-- x/mock/app.go | 12 ++--- x/params/keeper.go | 8 ++-- x/params/keeper_test.go | 8 ++-- x/slashing/app_test.go | 2 +- x/slashing/client/cli/query.go | 6 +-- x/slashing/client/cli/tx.go | 4 +- x/slashing/client/rest/query.go | 6 +-- x/slashing/client/rest/rest.go | 4 +- x/slashing/client/rest/tx.go | 6 +-- x/slashing/codec.go | 12 +++++ x/slashing/keeper.go | 6 +-- x/slashing/msg.go | 4 +- x/slashing/test_common.go | 16 +++---- x/slashing/wire.go | 12 ----- x/stake/app_test.go | 2 +- x/stake/client/cli/query.go | 42 +++++++++--------- x/stake/client/cli/tx.go | 22 ++++----- x/stake/client/rest/query.go | 24 +++++----- x/stake/client/rest/rest.go | 4 +- x/stake/client/rest/tx.go | 8 ++-- x/stake/client/rest/utils.go | 16 +++---- x/stake/keeper/keeper.go | 6 +-- x/stake/keeper/test_common.go | 8 ++-- x/stake/simulation/sim_test.go | 2 +- x/stake/stake.go | 2 +- x/stake/types/{wire.go => codec.go} | 14 +++--- x/stake/types/delegation.go | 20 ++++----- x/stake/types/params.go | 6 +-- x/stake/types/pool.go | 6 +-- x/stake/types/validator.go | 12 ++--- x/stake/types/validator_test.go | 6 +-- 154 files changed, 614 insertions(+), 614 deletions(-) rename client/keys/{wire.go => codec.go} (70%) rename client/lcd/{wire.go => codec.go} (100%) rename client/rpc/{wire.go => codec.go} (100%) rename wire/wire.go => codec/codec.go (93%) rename crypto/keys/{wire.go => codec.go} (100%) create mode 100644 docs/sdk/sdk-by-examples/simple-governance/module-codec.md delete mode 100644 docs/sdk/sdk-by-examples/simple-governance/module-wire.md rename examples/democoin/x/cool/{wire.go => codec.go} (53%) create mode 100644 examples/democoin/x/pow/codec.go delete mode 100644 examples/democoin/x/pow/wire.go rename examples/democoin/x/simplestake/{wire.go => codec.go} (57%) rename store/{types.go => codec.go} (100%) rename types/{wire.go => codec.go} (60%) create mode 100644 x/auth/codec.go delete mode 100644 x/auth/wire.go create mode 100644 x/bank/codec.go delete mode 100644 x/bank/wire.go rename x/gov/{wire.go => codec.go} (70%) rename x/ibc/{wire.go => codec.go} (59%) create mode 100644 x/slashing/codec.go delete mode 100644 x/slashing/wire.go rename x/stake/types/{wire.go => codec.go} (77%) diff --git a/PENDING.md b/PENDING.md index 33b60198c24d..6d6754dc5a85 100644 --- a/PENDING.md +++ b/PENDING.md @@ -45,6 +45,7 @@ BREAKING CHANGES * [tools] Removed gocyclo [#2211](https://github.com/cosmos/cosmos-sdk/issues/2211) * [baseapp] Remove `SetTxDecoder` in favor of requiring the decoder be set in baseapp initialization. [#1441](https://github.com/cosmos/cosmos-sdk/issues/1441) * [store] Change storeInfo within the root multistore to use tmhash instead of ripemd160 \#2308 + * [codec] \#2324 All referrences to wire have been renamed to codec. Additionally, wire.NewCodec is now codec.New(). * Tendermint diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 10d9f55f7751..ac27080c5e25 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -17,7 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) // Key to store the header in the DB itself. @@ -331,7 +331,7 @@ func handleQueryApp(app *BaseApp, path []string, req abci.RequestQuery) (res abc } // Encode with json - value := wire.Cdc.MustMarshalBinary(result) + value := codec.Cdc.MustMarshalBinary(result) return abci.ResponseQuery{ Code: uint32(sdk.ABCICodeOK), Value: value, diff --git a/baseapp/baseapp_test.go b/baseapp/baseapp_test.go index b8716278621b..8ce69f0a1b3b 100644 --- a/baseapp/baseapp_test.go +++ b/baseapp/baseapp_test.go @@ -14,8 +14,8 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" ) var ( @@ -34,14 +34,14 @@ func defaultLogger() log.Logger { func newBaseApp(name string, options ...func(*BaseApp)) *BaseApp { logger := defaultLogger() db := dbm.NewMemDB() - codec := wire.NewCodec() + codec := codec.New() registerTestCodec(codec) return NewBaseApp(name, logger, db, testTxDecoder(codec), options...) } -func registerTestCodec(cdc *wire.Codec) { +func registerTestCodec(cdc *codec.Codec) { // register Tx, Msg - sdk.RegisterWire(cdc) + sdk.RegisterCodec(cdc) // register test types cdc.RegisterConcrete(&txTest{}, "cosmos-sdk/baseapp/txTest", nil) @@ -350,7 +350,7 @@ func (msg msgCounter2) ValidateBasic() sdk.Error { } // amino decode -func testTxDecoder(cdc *wire.Codec) sdk.TxDecoder { +func testTxDecoder(cdc *codec.Codec) sdk.TxDecoder { return func(txBytes []byte) (sdk.Tx, sdk.Error) { var tx txTest if len(txBytes) == 0 { @@ -448,7 +448,7 @@ func TestCheckTx(t *testing.T) { app.InitChain(abci.RequestInitChain{}) // Create same codec used in txDecoder - codec := wire.NewCodec() + codec := codec.New() registerTestCodec(codec) for i := int64(0); i < nTxs; i++ { @@ -489,7 +489,7 @@ func TestDeliverTx(t *testing.T) { app := setupBaseApp(t, anteOpt, routerOpt) // Create same codec used in txDecoder - codec := wire.NewCodec() + codec := codec.New() registerTestCodec(codec) nBlocks := 3 @@ -532,7 +532,7 @@ func TestMultiMsgDeliverTx(t *testing.T) { app := setupBaseApp(t, anteOpt, routerOpt) // Create same codec used in txDecoder - codec := wire.NewCodec() + codec := codec.New() registerTestCodec(codec) // run a multi-msg tx @@ -613,8 +613,8 @@ func TestSimulateTx(t *testing.T) { app.InitChain(abci.RequestInitChain{}) // Create same codec used in txDecoder - codec := wire.NewCodec() - registerTestCodec(codec) + cdc := codec.New() + registerTestCodec(cdc) nBlocks := 3 for blockN := 0; blockN < nBlocks; blockN++ { @@ -634,7 +634,7 @@ func TestSimulateTx(t *testing.T) { require.Equal(t, gasConsumed, result.GasUsed) // simulate by calling Query with encoded tx - txBytes, err := codec.MarshalBinary(tx) + txBytes, err := cdc.MarshalBinary(tx) require.Nil(t, err) query := abci.RequestQuery{ Path: "/app/simulate", @@ -644,7 +644,7 @@ func TestSimulateTx(t *testing.T) { require.True(t, queryResult.IsOK(), queryResult.Log) var res sdk.Result - wire.Cdc.MustUnmarshalBinary(queryResult.Value, &res) + codec.Cdc.MustUnmarshalBinary(queryResult.Value, &res) require.Nil(t, err, "Result unmarshalling failed") require.True(t, res.IsOK(), res.Log) require.Equal(t, gasConsumed, res.GasUsed, res.Log) @@ -721,7 +721,7 @@ func TestRunInvalidTransaction(t *testing.T) { tx.Msgs = append(tx.Msgs, msgNoDecode{}) // new codec so we can encode the tx, but we shouldn't be able to decode - newCdc := wire.NewCodec() + newCdc := codec.New() registerTestCodec(newCdc) newCdc.RegisterConcrete(&msgNoDecode{}, "cosmos-sdk/baseapp/msgNoDecode", nil) diff --git a/client/context/context.go b/client/context/context.go index 3e785a28e2ff..0983c970ff0f 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -6,7 +6,7 @@ import ( "io" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/spf13/viper" @@ -22,7 +22,7 @@ const ctxAccStoreName = "acc" // CLIContext implements a typical CLI context created in SDK modules for // transaction handling and queries. type CLIContext struct { - Codec *wire.Codec + Codec *codec.Codec AccDecoder auth.AccountDecoder Client rpcclient.Client Logger io.Writer @@ -98,7 +98,7 @@ func createCertifier() tmlite.Certifier { } // WithCodec returns a copy of the context with an updated codec. -func (ctx CLIContext) WithCodec(cdc *wire.Codec) CLIContext { +func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext { ctx.Codec = cdc return ctx } diff --git a/client/context/query.go b/client/context/query.go index fc35e53515a6..30cd2db3003d 100644 --- a/client/context/query.go +++ b/client/context/query.go @@ -12,8 +12,8 @@ import ( "strings" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" - "github.com/cosmos/cosmos-sdk/wire" abci "github.com/tendermint/tendermint/abci/types" cmn "github.com/tendermint/tendermint/libs/common" tmliteProxy "github.com/tendermint/tendermint/lite/proxy" @@ -343,7 +343,7 @@ func (ctx CLIContext) verifyProof(path string, resp abci.ResponseQuery) error { } var multiStoreProof store.MultiStoreProof - cdc := wire.NewCodec() + cdc := codec.New() err = cdc.UnmarshalBinary(resp.Proof, &multiStoreProof) if err != nil { return errors.Wrap(err, "failed to unmarshalBinary rangeProof") diff --git a/client/keys/wire.go b/client/keys/codec.go similarity index 70% rename from client/keys/wire.go rename to client/keys/codec.go index a163f995a2ae..6bbb16850711 100644 --- a/client/keys/wire.go +++ b/client/keys/codec.go @@ -1,14 +1,14 @@ package keys import ( - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) -var cdc *wire.Codec +var cdc *codec.Codec func init() { - cdc = wire.NewCodec() - wire.RegisterCrypto(cdc) + cdc = codec.New() + codec.RegisterCrypto(cdc) } // marshal keys diff --git a/client/lcd/wire.go b/client/lcd/codec.go similarity index 100% rename from client/lcd/wire.go rename to client/lcd/codec.go diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index b3c27bfbab7a..2f8688965119 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -24,7 +24,7 @@ import ( rpc "github.com/cosmos/cosmos-sdk/client/rpc" tests "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" "github.com/cosmos/cosmos-sdk/x/gov" @@ -61,7 +61,7 @@ func TestKeys(t *testing.T) { require.Equal(t, http.StatusOK, res.StatusCode, body) var resp keys.KeyOutput - err = wire.Cdc.UnmarshalJSON([]byte(body), &resp) + err = codec.Cdc.UnmarshalJSON([]byte(body), &resp) require.Nil(t, err, body) addr2Bech32 := resp.Address @@ -181,7 +181,7 @@ func TestBlock(t *testing.T) { res, body = Request(t, port, "GET", "/blocks/1", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - err = wire.Cdc.UnmarshalJSON([]byte(body), &resultBlock) + err = codec.Cdc.UnmarshalJSON([]byte(body), &resultBlock) require.Nil(t, err, "Couldn't parse block") require.NotEqual(t, ctypes.ResultBlock{}, resultBlock) diff --git a/client/lcd/root.go b/client/lcd/root.go index f18ee5dfd420..088344b846b6 100644 --- a/client/lcd/root.go +++ b/client/lcd/root.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth/client/rest" bank "github.com/cosmos/cosmos-sdk/x/bank/client/rest" gov "github.com/cosmos/cosmos-sdk/x/gov/client/rest" @@ -27,7 +27,7 @@ import ( // ServeCommand will generate a long-running rest server // (aka Light Client Daemon) that exposes functionality similar // to the cli, but over rest -func ServeCommand(cdc *wire.Codec) *cobra.Command { +func ServeCommand(cdc *codec.Codec) *cobra.Command { flagListenAddr := "laddr" flagCORS := "cors" flagMaxOpenConnections := "max-open" @@ -71,7 +71,7 @@ func ServeCommand(cdc *wire.Codec) *cobra.Command { return cmd } -func createHandler(cdc *wire.Codec) http.Handler { +func createHandler(cdc *codec.Codec) http.Handler { r := mux.NewRouter() kb, err := keys.GetKeyBase() //XXX diff --git a/client/lcd/test_helpers.go b/client/lcd/test_helpers.go index 59369040771d..1b487a8fe3f0 100644 --- a/client/lcd/test_helpers.go +++ b/client/lcd/test_helpers.go @@ -19,7 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/spf13/viper" @@ -176,7 +176,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress genesisState.StakeData.Pool.LooseTokens = genesisState.StakeData.Pool.LooseTokens.Add(sdk.NewDec(100)) } - appState, err := wire.MarshalJSONIndent(cdc, genesisState) + appState, err := codec.MarshalJSONIndent(cdc, genesisState) require.NoError(t, err) genDoc.AppState = appState @@ -245,7 +245,7 @@ func startTM( // startLCD starts the LCD. // // NOTE: This causes the thread to block. -func startLCD(logger log.Logger, listenAddr string, cdc *wire.Codec) (net.Listener, error) { +func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec) (net.Listener, error) { return tmrpc.StartHTTPServer(listenAddr, createHandler(cdc), logger, tmrpc.Config{}) } diff --git a/client/rpc/block.go b/client/rpc/block.go index d16f383424f3..4e6ed0c5fe5b 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -42,7 +42,7 @@ func getBlock(cliCtx context.CLIContext, height *int64) ([]byte, error) { } // TODO move maarshalling into cmd/rest functions - // output, err := tmwire.MarshalJSON(res) + // output, err := tmcodec.MarshalJSON(res) output, err := cdc.MarshalJSON(res) if err != nil { return nil, err diff --git a/client/rpc/wire.go b/client/rpc/codec.go similarity index 100% rename from client/rpc/wire.go rename to client/rpc/codec.go diff --git a/client/tx/query.go b/client/tx/query.go index f95776b1092f..20a455d79b56 100644 --- a/client/tx/query.go +++ b/client/tx/query.go @@ -16,13 +16,13 @@ import ( "github.com/cosmos/cosmos-sdk/client" "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/wire" "github.com/cosmos/cosmos-sdk/x/auth" ) // QueryTxCmd implements the default command for a tx query. -func QueryTxCmd(cdc *wire.Codec) *cobra.Command { +func QueryTxCmd(cdc *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "tx [hash]", Short: "Matches this txhash over all committed blocks", @@ -51,7 +51,7 @@ func QueryTxCmd(cdc *wire.Codec) *cobra.Command { return cmd } -func queryTx(cdc *wire.Codec, cliCtx context.CLIContext, hashHexStr string, trustNode bool) ([]byte, error) { +func queryTx(cdc *codec.Codec, cliCtx context.CLIContext, hashHexStr string, trustNode bool) ([]byte, error) { hash, err := hex.DecodeString(hashHexStr) if err != nil { return nil, err @@ -72,10 +72,10 @@ func queryTx(cdc *wire.Codec, cliCtx context.CLIContext, hashHexStr string, trus return nil, err } - return wire.MarshalJSONIndent(cdc, info) + return codec.MarshalJSONIndent(cdc, info) } -func formatTxResult(cdc *wire.Codec, res *ctypes.ResultTx) (Info, error) { +func formatTxResult(cdc *codec.Codec, res *ctypes.ResultTx) (Info, error) { // TODO: verify the proof if requested tx, err := parseTx(cdc, res.Tx) if err != nil { @@ -98,7 +98,7 @@ type Info struct { Result abci.ResponseDeliverTx `json:"result"` } -func parseTx(cdc *wire.Codec, txBytes []byte) (sdk.Tx, error) { +func parseTx(cdc *codec.Codec, txBytes []byte) (sdk.Tx, error) { var tx auth.StdTx err := cdc.UnmarshalBinary(txBytes, &tx) @@ -112,7 +112,7 @@ func parseTx(cdc *wire.Codec, txBytes []byte) (sdk.Tx, error) { // REST // transaction query REST handler -func QueryTxRequestHandlerFn(cdc *wire.Codec, cliCtx context.CLIContext) http.HandlerFunc { +func QueryTxRequestHandlerFn(cdc *codec.Codec, cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) hashHexStr := vars["hash"] diff --git a/client/tx/root.go b/client/tx/root.go index 7e18d5aae126..19376a25b188 100644 --- a/client/tx/root.go +++ b/client/tx/root.go @@ -5,11 +5,11 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) // AddCommands adds a number of tx-query related subcommands -func AddCommands(cmd *cobra.Command, cdc *wire.Codec) { +func AddCommands(cmd *cobra.Command, cdc *codec.Codec) { cmd.AddCommand( SearchTxCmd(cdc), QueryTxCmd(cdc), @@ -17,7 +17,7 @@ func AddCommands(cmd *cobra.Command, cdc *wire.Codec) { } // register REST routes -func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *wire.Codec) { +func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) { r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(cdc, cliCtx)).Methods("GET") r.HandleFunc("/txs", SearchTxRequestHandlerFn(cliCtx, cdc)).Methods("GET") // r.HandleFunc("/txs/sign", SignTxRequstHandler).Methods("POST") diff --git a/client/tx/search.go b/client/tx/search.go index 06b3c0972963..000dc57ebb50 100644 --- a/client/tx/search.go +++ b/client/tx/search.go @@ -9,8 +9,8 @@ import ( "github.com/cosmos/cosmos-sdk/client" "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/wire" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -24,7 +24,7 @@ const ( ) // default client command to search through tagged transactions -func SearchTxCmd(cdc *wire.Codec) *cobra.Command { +func SearchTxCmd(cdc *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "txs", Short: "Search for all transactions that match the given tags.", @@ -70,7 +70,7 @@ $ gaiacli tendermint txs --tag test1,test2 --any return cmd } -func searchTxs(cliCtx context.CLIContext, cdc *wire.Codec, tags []string) ([]Info, error) { +func searchTxs(cliCtx context.CLIContext, cdc *codec.Codec, tags []string) ([]Info, error) { if len(tags) == 0 { return nil, errors.New("must declare at least one tag to search") } @@ -103,7 +103,7 @@ func searchTxs(cliCtx context.CLIContext, cdc *wire.Codec, tags []string) ([]Inf } // parse the indexed txs into an array of Info -func FormatTxResults(cdc *wire.Codec, res []*ctypes.ResultTx) ([]Info, error) { +func FormatTxResults(cdc *codec.Codec, res []*ctypes.ResultTx) ([]Info, error) { var err error out := make([]Info, len(res)) for i := range res { @@ -119,7 +119,7 @@ func FormatTxResults(cdc *wire.Codec, res []*ctypes.ResultTx) ([]Info, error) { // REST // Search Tx REST Handler -func SearchTxRequestHandlerFn(cliCtx context.CLIContext, cdc *wire.Codec) http.HandlerFunc { +func SearchTxRequestHandlerFn(cliCtx context.CLIContext, cdc *codec.Codec) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { tag := r.FormValue("tag") if tag == "" { diff --git a/cmd/gaia/app/app.go b/cmd/gaia/app/app.go index 7cf235b163f0..627fb5987e92 100644 --- a/cmd/gaia/app/app.go +++ b/cmd/gaia/app/app.go @@ -12,8 +12,8 @@ import ( tmtypes "github.com/tendermint/tendermint/types" 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/wire" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/gov" @@ -36,7 +36,7 @@ var ( // Extended ABCI application type GaiaApp struct { *bam.BaseApp - cdc *wire.Codec + cdc *codec.Codec // keys to access the substores keyMain *sdk.KVStoreKey @@ -128,16 +128,16 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptio } // custom tx codec -func MakeCodec() *wire.Codec { - var cdc = wire.NewCodec() - ibc.RegisterWire(cdc) - bank.RegisterWire(cdc) - stake.RegisterWire(cdc) - slashing.RegisterWire(cdc) - gov.RegisterWire(cdc) - auth.RegisterWire(cdc) - sdk.RegisterWire(cdc) - wire.RegisterCrypto(cdc) +func MakeCodec() *codec.Codec { + var cdc = codec.New() + ibc.RegisterCodec(cdc) + bank.RegisterCodec(cdc) + stake.RegisterCodec(cdc) + slashing.RegisterCodec(cdc) + gov.RegisterCodec(cdc) + auth.RegisterCodec(cdc) + sdk.RegisterCodec(cdc) + codec.RegisterCrypto(cdc) return cdc } @@ -222,7 +222,7 @@ func (app *GaiaApp) ExportAppStateAndValidators() (appState json.RawMessage, val StakeData: stake.WriteGenesis(ctx, app.stakeKeeper), GovData: gov.WriteGenesis(ctx, app.govKeeper), } - appState, err = wire.MarshalJSONIndent(app.cdc, genState) + appState, err = codec.MarshalJSONIndent(app.cdc, genState) if err != nil { return nil, nil, err } diff --git a/cmd/gaia/app/app_test.go b/cmd/gaia/app/app_test.go index 63d650cef6ed..0fb45863cafd 100644 --- a/cmd/gaia/app/app_test.go +++ b/cmd/gaia/app/app_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/stake" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func setGenesis(gapp *GaiaApp, accs ...*auth.BaseAccount) error { StakeData: stake.DefaultGenesisState(), } - stateBytes, err := wire.MarshalJSONIndent(gapp.cdc, genesisState) + stateBytes, err := codec.MarshalJSONIndent(gapp.cdc, genesisState) if err != nil { return err } diff --git a/cmd/gaia/app/genesis.go b/cmd/gaia/app/genesis.go index 10c7e4126e21..a7069d64befc 100644 --- a/cmd/gaia/app/genesis.go +++ b/cmd/gaia/app/genesis.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/stake" @@ -92,7 +92,7 @@ type GaiaGenTx struct { // GaiaAppGenTx generates a Gaia genesis transaction. func GaiaAppGenTx( - cdc *wire.Codec, pk crypto.PubKey, genTxConfig config.GenTx, + cdc *codec.Codec, pk crypto.PubKey, genTxConfig config.GenTx, ) (appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { if genTxConfig.Name == "" { return nil, nil, tmtypes.GenesisValidator{}, errors.New("Must specify --name (validator moniker)") @@ -136,7 +136,7 @@ func GaiaAppGenTx( } // Generate a gaia genesis transaction without flags -func GaiaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.AccAddress, name string) ( +func GaiaAppGenTxNF(cdc *codec.Codec, pk crypto.PubKey, addr sdk.AccAddress, name string) ( appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error) { var bz []byte @@ -145,7 +145,7 @@ func GaiaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.AccAddress, name Address: addr, PubKey: sdk.MustBech32ifyConsPub(pk), } - bz, err = wire.MarshalJSONIndent(cdc, gaiaGenTx) + bz, err = codec.MarshalJSONIndent(cdc, gaiaGenTx) if err != nil { return } @@ -160,7 +160,7 @@ func GaiaAppGenTxNF(cdc *wire.Codec, pk crypto.PubKey, addr sdk.AccAddress, name // Create the core parameters for genesis initialization for gaia // note that the pubkey input is this machines pubkey -func GaiaAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (genesisState GenesisState, err error) { +func GaiaAppGenState(cdc *codec.Codec, appGenTxs []json.RawMessage) (genesisState GenesisState, err error) { if len(appGenTxs) == 0 { err = errors.New("must provide at least genesis transaction") @@ -280,13 +280,13 @@ func validateGenesisStateAccounts(accs []GenesisAccount) (err error) { } // GaiaAppGenState but with JSON -func GaiaAppGenStateJSON(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { +func GaiaAppGenStateJSON(cdc *codec.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { // create the final app state genesisState, err := GaiaAppGenState(cdc, appGenTxs) if err != nil { return nil, err } - appState, err = wire.MarshalJSONIndent(cdc, genesisState) + appState, err = codec.MarshalJSONIndent(cdc, genesisState) return } diff --git a/cmd/gaia/cli_test/cli_test.go b/cmd/gaia/cli_test/cli_test.go index 43f35925e31b..edab0d2d7939 100644 --- a/cmd/gaia/cli_test/cli_test.go +++ b/cmd/gaia/cli_test/cli_test.go @@ -21,7 +21,7 @@ import ( "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/stake" @@ -549,8 +549,8 @@ func executeGetAccount(t *testing.T, cmdStr string) auth.BaseAccount { require.NoError(t, err, "out %v, err %v", out, err) value := initRes["value"] var acc auth.BaseAccount - cdc := wire.NewCodec() - wire.RegisterCrypto(cdc) + cdc := codec.NewCodec() + codec.RegisterCrypto(cdc) err = cdc.UnmarshalJSON(value, &acc) require.NoError(t, err, "value %v, err %v", string(value), err) return acc diff --git a/cmd/gaia/cmd/gaiadebug/hack.go b/cmd/gaia/cmd/gaiadebug/hack.go index d0a0ad9d723a..3ff2730f467e 100644 --- a/cmd/gaia/cmd/gaiadebug/hack.go +++ b/cmd/gaia/cmd/gaiadebug/hack.go @@ -21,7 +21,7 @@ import ( bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" @@ -127,7 +127,7 @@ var ( // Extended ABCI application type GaiaApp struct { *bam.BaseApp - cdc *wire.Codec + cdc *codec.Codec // keys to access the substores keyMain *sdk.KVStoreKey @@ -204,15 +204,15 @@ func NewGaiaApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.BaseAp } // custom tx codec -func MakeCodec() *wire.Codec { - var cdc = wire.NewCodec() - ibc.RegisterWire(cdc) - bank.RegisterWire(cdc) - stake.RegisterWire(cdc) - slashing.RegisterWire(cdc) - auth.RegisterWire(cdc) - sdk.RegisterWire(cdc) - wire.RegisterCrypto(cdc) +func MakeCodec() *codec.Codec { + var cdc = codec.New() + ibc.RegisterCodec(cdc) + bank.RegisterCodec(cdc) + stake.RegisterCodec(cdc) + slashing.RegisterCodec(cdc) + auth.RegisterCodec(cdc) + sdk.RegisterCodec(cdc) + codec.RegisterCrypto(cdc) cdc.Seal() return cdc } diff --git a/wire/wire.go b/codec/codec.go similarity index 93% rename from wire/wire.go rename to codec/codec.go index 683149c99c59..175eb89c134f 100644 --- a/wire/wire.go +++ b/codec/codec.go @@ -1,4 +1,4 @@ -package wire +package codec import ( "bytes" @@ -11,7 +11,7 @@ import ( // amino codec to marshal/unmarshal type Codec = amino.Codec -func NewCodec() *Codec { +func New() *Codec { cdc := amino.NewCodec() return cdc } @@ -42,7 +42,7 @@ func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) { var Cdc *Codec func init() { - cdc := NewCodec() + cdc := New() RegisterCrypto(cdc) Cdc = cdc.Seal() } diff --git a/crypto/keys/wire.go b/crypto/keys/codec.go similarity index 100% rename from crypto/keys/wire.go rename to crypto/keys/codec.go diff --git a/docs/sdk/core/app2.md b/docs/sdk/core/app2.md index 9a689cca608c..6477617fb13d 100644 --- a/docs/sdk/core/app2.md +++ b/docs/sdk/core/app2.md @@ -139,8 +139,8 @@ Amino can also be used for persistent storage of interfaces. To use Amino, simply create a codec, and then register types: ``` -func NewCodec() *wire.Codec { - cdc := wire.NewCodec() +func NewCodec() *codec.Codec { + cdc := codec.New() cdc.RegisterInterface((*sdk.Msg)(nil), nil) cdc.RegisterConcrete(MsgSend{}, "example/MsgSend", nil) cdc.RegisterConcrete(MsgIssue{}, "example/MsgIssue", nil) @@ -175,7 +175,7 @@ func (tx app2Tx) GetMsgs() []sdk.Msg { } // Amino decode app2Tx. Capable of decoding both MsgSend and MsgIssue -func tx2Decoder(cdc *wire.Codec) sdk.TxDecoder { +func tx2Decoder(cdc *codec.Codec) sdk.TxDecoder { return func(txBytes []byte) (sdk.Tx, sdk.Error) { var tx app2Tx err := cdc.UnmarshalBinary(txBytes, &tx) diff --git a/docs/sdk/core/examples/app2.go b/docs/sdk/core/examples/app2.go index 5f23abe071b9..17b6b129ad7b 100644 --- a/docs/sdk/core/examples/app2.go +++ b/docs/sdk/core/examples/app2.go @@ -14,7 +14,7 @@ import ( bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) const ( @@ -25,8 +25,8 @@ var ( issuer = ed25519.GenPrivKey().PubKey().Address() ) -func NewCodec() *wire.Codec { - cdc := wire.NewCodec() +func NewCodec() *codec.Codec { + cdc := codec.New() cdc.RegisterInterface((*sdk.Msg)(nil), nil) cdc.RegisterConcrete(MsgSend{}, "example/MsgSend", nil) cdc.RegisterConcrete(MsgIssue{}, "example/MsgIssue", nil) @@ -196,7 +196,7 @@ func (tx app2Tx) GetSignature() []byte { } // Amino decode app2Tx. Capable of decoding both MsgSend and MsgIssue -func tx2Decoder(cdc *wire.Codec) sdk.TxDecoder { +func tx2Decoder(cdc *codec.Codec) sdk.TxDecoder { return func(txBytes []byte) (sdk.Tx, sdk.Error) { var tx app2Tx err := cdc.UnmarshalBinary(txBytes, &tx) diff --git a/docs/sdk/core/examples/app3.go b/docs/sdk/core/examples/app3.go index 787c75d96e6d..fdb40902fa0e 100644 --- a/docs/sdk/core/examples/app3.go +++ b/docs/sdk/core/examples/app3.go @@ -8,7 +8,7 @@ import ( bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -51,12 +51,12 @@ func NewApp3(logger log.Logger, db dbm.DB) *bapp.BaseApp { } // Update codec from app2 to register imported modules -func UpdatedCodec() *wire.Codec { - cdc := wire.NewCodec() +func UpdatedCodec() *codec.Codec { + cdc := codec.New() cdc.RegisterInterface((*sdk.Msg)(nil), nil) cdc.RegisterConcrete(MsgSend{}, "example/MsgSend", nil) cdc.RegisterConcrete(MsgIssue{}, "example/MsgIssue", nil) - auth.RegisterWire(cdc) + auth.RegisterCodec(cdc) cryptoAmino.RegisterAmino(cdc) return cdc } diff --git a/docs/sdk/core/examples/app4.go b/docs/sdk/core/examples/app4.go index 620913bb690e..835f33e2db82 100644 --- a/docs/sdk/core/examples/app4.go +++ b/docs/sdk/core/examples/app4.go @@ -8,7 +8,7 @@ import ( bapp "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -76,7 +76,7 @@ func (ga *GenesisAccount) ToAccount() (acc *auth.BaseAccount, err error) { // InitChainer will set initial balances for accounts as well as initial coin metadata // MsgIssue can no longer be used to create new coin -func NewInitChainer(cdc *wire.Codec, accountMapper auth.AccountMapper) sdk.InitChainer { +func NewInitChainer(cdc *codec.Codec, accountMapper auth.AccountMapper) sdk.InitChainer { return func(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { stateJSON := req.AppStateBytes diff --git a/docs/sdk/sdk-by-examples/simple-governance/app-codec.md b/docs/sdk/sdk-by-examples/simple-governance/app-codec.md index 9d35b43631b1..d994ba19c92f 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/app-codec.md +++ b/docs/sdk/sdk-by-examples/simple-governance/app-codec.md @@ -5,13 +5,13 @@ Finally, we need to define the `MakeCodec()` function and register the concrete types and interface from the various modules. ```go -func MakeCodec() *wire.Codec { - var cdc = wire.NewCodec() - wire.RegisterCrypto(cdc) // Register crypto. - sdk.RegisterWire(cdc) // Register Msgs - bank.RegisterWire(cdc) - simplestake.RegisterWire(cdc) - simpleGov.RegisterWire(cdc) +func MakeCodec() *codec.Codec { + var cdc = codec.New() + codec.RegisterCrypto(cdc) // Register crypto. + sdk.RegisterCodec(cdc) // Register Msgs + bank.RegisterCodec(cdc) + simplestake.RegisterCodec(cdc) + simpleGov.RegisterCodec(cdc) // Register AppAccount cdc.RegisterInterface((*auth.Account)(nil), nil) diff --git a/docs/sdk/sdk-by-examples/simple-governance/app-rest.md b/docs/sdk/sdk-by-examples/simple-governance/app-rest.md index 7e8469ad6ae7..828d52c858b1 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/app-rest.md +++ b/docs/sdk/sdk-by-examples/simple-governance/app-rest.md @@ -13,7 +13,7 @@ var SimpleGovAppInit = server.AppInit{ } // SimpleGovAppGenState sets up the app_state and appends the simpleGov app state -func SimpleGovAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { +func SimpleGovAppGenState(cdc *codec.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { appState, err = server.SimpleAppGenState(cdc, appGenTxs) if err != nil { return diff --git a/docs/sdk/sdk-by-examples/simple-governance/app-structure.md b/docs/sdk/sdk-by-examples/simple-governance/app-structure.md index 7cec5aa5c8f9..ce9ba5fef3d0 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/app-structure.md +++ b/docs/sdk/sdk-by-examples/simple-governance/app-structure.md @@ -28,7 +28,7 @@ Then, let us define the structure of our application. // Extended ABCI application type SimpleGovApp struct { *bam.BaseApp - cdc *wire.Codec + cdc *codec.Codec // keys to access the substores capKeyMainStore *sdk.KVStoreKey diff --git a/docs/sdk/sdk-by-examples/simple-governance/intro.md b/docs/sdk/sdk-by-examples/simple-governance/intro.md index ab4b5b6a5bca..fe1c7639e945 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/intro.md +++ b/docs/sdk/sdk-by-examples/simple-governance/intro.md @@ -28,7 +28,7 @@ Before getting in the bulk of the code, we will start by some introductory conte + [Types](module-types.md) + [Keeper](module-keeper.md) + [Handler](module-handler.md) - + [Wire](module-wire.md) + + [Wire](module-codec.md) + [Errors](module-errors.md) + Command-Line Interface and Rest API * [Command-Line Interface](module-cli.md) diff --git a/docs/sdk/sdk-by-examples/simple-governance/module-cli.md b/docs/sdk/sdk-by-examples/simple-governance/module-cli.md index b7e3143e3ca1..4cdf331a9a04 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/module-cli.md +++ b/docs/sdk/sdk-by-examples/simple-governance/module-cli.md @@ -14,7 +14,7 @@ The CLI builds on top of [Cobra](https://github.com/spf13/cobra). Here is the sc ) // Main command function. One function for each command. - func Command(codec *wire.Codec) *cobra.Command { + func Command(codec *codec.Codec) *cobra.Command { // Create the command to return command := &cobra.Command{ Use: "actual command", diff --git a/docs/sdk/sdk-by-examples/simple-governance/module-codec.md b/docs/sdk/sdk-by-examples/simple-governance/module-codec.md new file mode 100644 index 000000000000..067b87d521d6 --- /dev/null +++ b/docs/sdk/sdk-by-examples/simple-governance/module-codec.md @@ -0,0 +1,13 @@ +## Wire + +**File: [`x/simple_governance/codec.go`](https://github.com/cosmos/cosmos-sdk/blob/fedekunze/module_tutorial/examples/simpleGov/x/simple_governance/codec.go)** + +The `codec.go` file allows developers to register the concrete message types of their module into the codec. In our case, we have two messages to declare: + +```go +func RegisterCodec(cdc *codec.Codec) { + cdc.RegisterConcrete(SubmitProposalMsg{}, "simple_governance/SubmitProposalMsg", nil) + cdc.RegisterConcrete(VoteMsg{}, "simple_governance/VoteMsg", nil) +} +``` +Don't forget to call this function in `app.go` (see [Application - Bridging it all together](app-structure.md)) for more). \ No newline at end of file diff --git a/docs/sdk/sdk-by-examples/simple-governance/module-init.md b/docs/sdk/sdk-by-examples/simple-governance/module-init.md index d018b512ffe2..33bdfd5000ba 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/module-init.md +++ b/docs/sdk/sdk-by-examples/simple-governance/module-init.md @@ -7,7 +7,7 @@ cd x/ mkdir simple_governance cd simple_governance mkdir -p client/cli client/rest -touch client/cli/simple_governance.go client/rest/simple_governance.go errors.go handler.go handler_test.go keeper_keys.go keeper_test.go keeper.go test_common.go test_types.go types.go wire.go +touch client/cli/simple_governance.go client/rest/simple_governance.go errors.go handler.go handler_test.go keeper_keys.go keeper_test.go keeper.go test_common.go test_types.go types.go codec.go ``` Let us start by adding the files we will need. Your module's folder should look something like that: @@ -25,7 +25,7 @@ x ├─── keeper_keys.go ├─── keeper.go ├─── types.go - └─── wire.go + └─── codec.go ``` Let us go into the detail of each of these files. \ No newline at end of file diff --git a/docs/sdk/sdk-by-examples/simple-governance/module-keeper.md b/docs/sdk/sdk-by-examples/simple-governance/module-keeper.md index 851593a78b02..99c7cd566c3d 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/module-keeper.md +++ b/docs/sdk/sdk-by-examples/simple-governance/module-keeper.md @@ -47,7 +47,7 @@ With all that in mind, we can define the structure of our `Keeper`: ```go type Keeper struct { SimpleGov sdk.StoreKey // Key to our module's store - cdc *wire.Codec // Codec to encore/decode structs + cdc *codec.Codec // Codec to encore/decode structs ck bank.Keeper // Needed to handle deposits. This module onlyl requires read/writes to Atom balance sm stake.Keeper // Needed to compute voting power. This module only needs read access to the staking store. codespace sdk.CodespaceType // Reserves space for error codes diff --git a/docs/sdk/sdk-by-examples/simple-governance/module-wire.md b/docs/sdk/sdk-by-examples/simple-governance/module-wire.md deleted file mode 100644 index f889db91a447..000000000000 --- a/docs/sdk/sdk-by-examples/simple-governance/module-wire.md +++ /dev/null @@ -1,13 +0,0 @@ -## Wire - -**File: [`x/simple_governance/wire.go`](https://github.com/cosmos/cosmos-sdk/blob/fedekunze/module_tutorial/examples/simpleGov/x/simple_governance/wire.go)** - -The `wire.go` file allows developers to register the concrete message types of their module into the codec. In our case, we have two messages to declare: - -```go -func RegisterWire(cdc *wire.Codec) { - cdc.RegisterConcrete(SubmitProposalMsg{}, "simple_governance/SubmitProposalMsg", nil) - cdc.RegisterConcrete(VoteMsg{}, "simple_governance/VoteMsg", nil) -} -``` -Don't forget to call this function in `app.go` (see [Application - Bridging it all together](app-structure.md)) for more). \ No newline at end of file diff --git a/docs/spec/ibc/appendices.md b/docs/spec/ibc/appendices.md index 751924f4692d..6bf3fdec0ff0 100644 --- a/docs/spec/ibc/appendices.md +++ b/docs/spec/ibc/appendices.md @@ -8,7 +8,7 @@ The specification has focused on semantics and functionality of the IBC protocol In defining a standard binary encoding for all the "universal" components, we wish to make use of a standardized library, with efficient serialization and support in multiple languages. We considered two main formats: Ethereum's RLP[[6](./references.md#6)] and Google's Protobuf[[7](./references.md#7)]. We decided for protobuf, as it is more widely supported, is more expressive for different data types, and supports code generation for very efficient (de)serialization codecs. It does have a learning curve and more setup to generate the code from the type specifications, but the ibc data types should not change often and this code generation setup only needs to happen once per language (and can be exposed in a common repo), so this is not a strong counter-argument. Efficiency, expressiveness, and wider support rule in its favor. It is also widely used in gRPC and in many microservice architectures. -The tendermint-specific data structures are encoded with go-wire[[8](./references.md#8)], the native binary encoding used inside of tendermint. Most blockchains define their own formats, and until some universal format for headers and signatures among blockchains emerge, it seems very premature to enforce any encoding here. These are defined as arbitrary byte slices in the protocol, to be parsed in an consensus engine-dependent manner. +The tendermint-specific data structures are encoded with go-codec[[8](./references.md#8)], the native binary encoding used inside of tendermint. Most blockchains define their own formats, and until some universal format for headers and signatures among blockchains emerge, it seems very premature to enforce any encoding here. These are defined as arbitrary byte slices in the protocol, to be parsed in an consensus engine-dependent manner. For the following appendixes, the data structure specifications will be in proto3[[9](./references.md#9)] format. @@ -61,7 +61,7 @@ The IBC protocol does not handle these kinds of errors. They must be handled ind **TODO: clean this all up** -This is a mess now, we need to figure out what formats we use, define go-wire, etc. or just point to the source???? Will do more later, need help here from the tendermint core team. +This is a mess now, we need to figure out what formats we use, define go-codec, etc. or just point to the source???? Will do more later, need help here from the tendermint core team. In order to prove a merkle root, we must fully define the headers, signatures, and validator information returned from the Tendermint consensus engine, as well as the rules by which to verify a header. We also define here the messages used for creating and removing connections to other blockchains as well as how to handle forks. diff --git a/docs/spec/ibc/channels-and-packets.md b/docs/spec/ibc/channels-and-packets.md index 0951ca6572fc..faa371eea48b 100644 --- a/docs/spec/ibc/channels-and-packets.md +++ b/docs/spec/ibc/channels-and-packets.md @@ -28,7 +28,7 @@ Every transaction on the same chain already has a well-defined causality relatio For example, an application may wish to allow a single tokenized asset to be transferred between and held on multiple blockchains while preserving fungibility and conservation of supply. The application can mint asset vouchers on chain `B` when a particular IBC packet is committed to chain `B`, and require outgoing sends of that packet on chain `A` to escrow an equal amount of the asset on chain `A` until the vouchers are later redeemed back to chain `A` with an IBC packet in the reverse direction. This ordering guarantee along with correct application logic can ensure that total supply is preserved across both chains and that any vouchers minted on chain `B` can later be redeemed back to chain `A`. -This section provides definitions for packets and channels, a high-level specification of the queue interface, and a list of the necessary proofs. To implement wire-compatible IBC, chain `A` and chain `B` must also use a common encoding format. An example binary encoding format can be found in [Appendix C](appendices.md#appendix-c-merkle-proof-formats). +This section provides definitions for packets and channels, a high-level specification of the queue interface, and a list of the necessary proofs. To implement codec-compatible IBC, chain `A` and chain `B` must also use a common encoding format. An example binary encoding format can be found in [Appendix C](appendices.md#appendix-c-merkle-proof-formats). ### 3.2 Definitions diff --git a/docs/spec/ibc/conclusion.md b/docs/spec/ibc/conclusion.md index f85ae8599464..25f0f4e4bbfc 100644 --- a/docs/spec/ibc/conclusion.md +++ b/docs/spec/ibc/conclusion.md @@ -6,4 +6,4 @@ We have demonstrated a secure, performant, and flexible protocol for cross-block This document defines solely a message queue protocol - not the application-level semantics which must sit on top of it to enable asset transfer between two chains. We will shortly release a separate paper on Cosmos IBC that defines the application logic used for direct value transfer as well as routing over the Cosmos hub. That paper builds upon the IBC protocol defined here and provides a first example of how to reason about application logic and global invariants in the context of IBC. -There is a reference implementation of the Cosmos IBC protocol as part of the Cosmos SDK, written in Golang and released under the Apache license. To facilitate implementations in other langauages which are wire-compatible with the Cosmos implementation, the following appendices define exact message and binary encoding formats. +There is a reference implementation of the Cosmos IBC protocol as part of the Cosmos SDK, written in Golang and released under the Apache license. To facilitate implementations in other langauages which are codec-compatible with the Cosmos implementation, the following appendices define exact message and binary encoding formats. diff --git a/docs/spec/ibc/references.md b/docs/spec/ibc/references.md index ba9fbee69775..ad84bb955964 100644 --- a/docs/spec/ibc/references.md +++ b/docs/spec/ibc/references.md @@ -24,7 +24,7 @@ [https://developers.google.com/protocol-buffers/](https://developers.google.com/protocol-buffers/) ##### 8: -[https://github.com/tendermint/go-wire](https://github.com/tendermint/go-wire) +[https://github.com/tendermint/go-codec](https://github.com/tendermint/go-codec) ##### 9: [https://developers.google.com/protocol-buffers/docs/proto3](https://developers.google.com/protocol-buffers/docs/proto3) diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 6330e9f31e26..2ad2a1c580ea 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -6,7 +6,7 @@ import ( bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" @@ -27,7 +27,7 @@ const ( // integral app types. type BasecoinApp struct { *bam.BaseApp - cdc *wire.Codec + cdc *codec.Codec // keys to access the multistore keyMain *sdk.KVStoreKey @@ -93,16 +93,16 @@ func NewBasecoinApp(logger log.Logger, db dbm.DB, baseAppOptions ...func(*bam.Ba return app } -// MakeCodec creates a new wire codec and registers all the necessary types +// MakeCodec creates a new codec codec and registers all the necessary types // with the codec. -func MakeCodec() *wire.Codec { - cdc := wire.NewCodec() +func MakeCodec() *codec.Codec { + cdc := codec.New() - wire.RegisterCrypto(cdc) - sdk.RegisterWire(cdc) - bank.RegisterWire(cdc) - ibc.RegisterWire(cdc) - auth.RegisterWire(cdc) + codec.RegisterCrypto(cdc) + sdk.RegisterCodec(cdc) + bank.RegisterCodec(cdc) + ibc.RegisterCodec(cdc) + auth.RegisterCodec(cdc) // register custom type cdc.RegisterConcrete(&types.AppAccount{}, "basecoin/Account", nil) @@ -173,7 +173,7 @@ func (app *BasecoinApp) ExportAppStateAndValidators() (appState json.RawMessage, app.accountMapper.IterateAccounts(ctx, appendAccountsFn) genState := types.GenesisState{Accounts: accounts} - appState, err = wire.MarshalJSONIndent(app.cdc, genState) + appState, err = codec.MarshalJSONIndent(app.cdc, genState) if err != nil { return nil, nil, err } diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index dad8191b356c..2f3ea5c49f5d 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/examples/basecoin/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -22,7 +22,7 @@ func setGenesis(baseApp *BasecoinApp, accounts ...*types.AppAccount) (types.Gene } genesisState := types.GenesisState{Accounts: genAccts} - stateBytes, err := wire.MarshalJSONIndent(baseApp.cdc, genesisState) + stateBytes, err := codec.MarshalJSONIndent(baseApp.cdc, genesisState) if err != nil { return types.GenesisState{}, err } @@ -67,7 +67,7 @@ func TestGenesis(t *testing.T) { // reload app and ensure the account is still there baseApp = NewBasecoinApp(logger, db) - stateBytes, err := wire.MarshalJSONIndent(baseApp.cdc, genState) + stateBytes, err := codec.MarshalJSONIndent(baseApp.cdc, genState) require.Nil(t, err) // initialize the chain with the expected genesis state diff --git a/examples/basecoin/types/account.go b/examples/basecoin/types/account.go index 45774ae4350b..2a84c95fb9a5 100644 --- a/examples/basecoin/types/account.go +++ b/examples/basecoin/types/account.go @@ -2,7 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" ) @@ -30,7 +30,7 @@ func NewAppAccount(name string, baseAcct auth.BaseAccount) *AppAccount { // GetAccountDecoder returns the AccountDecoder function for the custom // AppAccount. -func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder { +func GetAccountDecoder(cdc *codec.Codec) auth.AccountDecoder { return func(accBytes []byte) (auth.Account, error) { if len(accBytes) == 0 { return nil, sdk.ErrTxDecode("accBytes are empty") diff --git a/examples/democoin/app/app.go b/examples/democoin/app/app.go index e66dc0cb3de6..69d96ab4c0ab 100644 --- a/examples/democoin/app/app.go +++ b/examples/democoin/app/app.go @@ -11,7 +11,7 @@ import ( bam "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" @@ -30,7 +30,7 @@ const ( // Extended ABCI application type DemocoinApp struct { *bam.BaseApp - cdc *wire.Codec + cdc *codec.Codec // keys to access the substores capKeyMainStore *sdk.KVStoreKey @@ -103,15 +103,15 @@ func NewDemocoinApp(logger log.Logger, db dbm.DB) *DemocoinApp { } // custom tx codec -func MakeCodec() *wire.Codec { - var cdc = wire.NewCodec() - wire.RegisterCrypto(cdc) // Register crypto. - sdk.RegisterWire(cdc) // Register Msgs - cool.RegisterWire(cdc) - pow.RegisterWire(cdc) - bank.RegisterWire(cdc) - ibc.RegisterWire(cdc) - simplestake.RegisterWire(cdc) +func MakeCodec() *codec.Codec { + var cdc = codec.New() + codec.RegisterCrypto(cdc) // Register crypto. + sdk.RegisterCodec(cdc) // Register Msgs + cool.RegisterCodec(cdc) + pow.RegisterCodec(cdc) + bank.RegisterCodec(cdc) + ibc.RegisterCodec(cdc) + simplestake.RegisterCodec(cdc) // Register AppAccount cdc.RegisterInterface((*auth.Account)(nil), nil) @@ -182,7 +182,7 @@ func (app *DemocoinApp) ExportAppStateAndValidators() (appState json.RawMessage, POWGenesis: pow.WriteGenesis(ctx, app.powKeeper), CoolGenesis: cool.WriteGenesis(ctx, app.coolKeeper), } - appState, err = wire.MarshalJSONIndent(app.cdc, genState) + appState, err = codec.MarshalJSONIndent(app.cdc, genState) if err != nil { return nil, nil, err } diff --git a/examples/democoin/app/app_test.go b/examples/democoin/app/app_test.go index e964dbad2541..6bdc70c3d66d 100644 --- a/examples/democoin/app/app_test.go +++ b/examples/democoin/app/app_test.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/examples/democoin/types" "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -27,7 +27,7 @@ func setGenesis(bapp *DemocoinApp, trend string, accs ...auth.BaseAccount) error CoolGenesis: cool.Genesis{trend}, } - stateBytes, err := wire.MarshalJSONIndent(bapp.cdc, genesisState) + stateBytes, err := codec.MarshalJSONIndent(bapp.cdc, genesisState) if err != nil { return err } diff --git a/examples/democoin/cmd/democoind/main.go b/examples/democoin/cmd/democoind/main.go index 528cafe1c7ef..1b5b947b0fdd 100644 --- a/examples/democoin/cmd/democoind/main.go +++ b/examples/democoin/cmd/democoind/main.go @@ -15,7 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/examples/democoin/app" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) // init parameters @@ -25,7 +25,7 @@ var CoolAppInit = server.AppInit{ } // coolGenAppParams sets up the app_state and appends the cool app state -func CoolAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { +func CoolAppGenState(cdc *codec.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error) { appState, err = server.SimpleAppGenState(cdc, appGenTxs) if err != nil { return diff --git a/examples/democoin/types/account.go b/examples/democoin/types/account.go index 8eb9b0ae4278..bb09c9a7dd1e 100644 --- a/examples/democoin/types/account.go +++ b/examples/democoin/types/account.go @@ -2,7 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool" @@ -31,7 +31,7 @@ func (acc AppAccount) GetName() string { return acc.Name } func (acc *AppAccount) SetName(name string) { acc.Name = name } // Get the AccountDecoder function for the custom AppAccount -func GetAccountDecoder(cdc *wire.Codec) auth.AccountDecoder { +func GetAccountDecoder(cdc *codec.Codec) auth.AccountDecoder { return func(accBytes []byte) (res auth.Account, err error) { if len(accBytes) == 0 { return nil, sdk.ErrTxDecode("accBytes are empty") diff --git a/examples/democoin/x/assoc/validator_set.go b/examples/democoin/x/assoc/validator_set.go index 7515e1ad6022..d3c230b78036 100644 --- a/examples/democoin/x/assoc/validator_set.go +++ b/examples/democoin/x/assoc/validator_set.go @@ -4,7 +4,7 @@ import ( "bytes" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) // ValidatorSet defines @@ -12,7 +12,7 @@ type ValidatorSet struct { sdk.ValidatorSet store sdk.KVStore - cdc *wire.Codec + cdc *codec.Codec maxAssoc int addrLen int @@ -21,7 +21,7 @@ type ValidatorSet struct { var _ sdk.ValidatorSet = ValidatorSet{} // NewValidatorSet returns new ValidatorSet with underlying ValidatorSet -func NewValidatorSet(cdc *wire.Codec, store sdk.KVStore, valset sdk.ValidatorSet, maxAssoc int, addrLen int) ValidatorSet { +func NewValidatorSet(cdc *codec.Codec, store sdk.KVStore, valset sdk.ValidatorSet, maxAssoc int, addrLen int) ValidatorSet { if maxAssoc < 0 || addrLen < 0 { panic("Cannot use negative integer for NewValidatorSet") } diff --git a/examples/democoin/x/assoc/validator_set_test.go b/examples/democoin/x/assoc/validator_set_test.go index eac23b25e221..e0bcf8ded116 100644 --- a/examples/democoin/x/assoc/validator_set_test.go +++ b/examples/democoin/x/assoc/validator_set_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/examples/democoin/mock" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) func defaultContext(key sdk.StoreKey) sdk.Context { @@ -36,7 +36,7 @@ func TestValidatorSet(t *testing.T) { {addr2, sdk.NewDec(2)}, }} - valset := NewValidatorSet(wire.NewCodec(), ctx.KVStore(key).Prefix([]byte("assoc")), base, 1, 5) + valset := NewValidatorSet(codec.New(), ctx.KVStore(key).Prefix([]byte("assoc")), base, 1, 5) require.Equal(t, base.Validator(ctx, addr1), valset.Validator(ctx, addr1)) require.Equal(t, base.Validator(ctx, addr2), valset.Validator(ctx, addr2)) diff --git a/examples/democoin/x/cool/app_test.go b/examples/democoin/x/cool/app_test.go index 3349928eb299..35a656cebc8f 100644 --- a/examples/democoin/x/cool/app_test.go +++ b/examples/democoin/x/cool/app_test.go @@ -47,7 +47,7 @@ var ( func getMockApp(t *testing.T) *mock.App { mapp := mock.NewApp() - RegisterWire(mapp.Cdc) + RegisterCodec(mapp.Cdc) keyCool := sdk.NewKVStoreKey("cool") bankKeeper := bank.NewBaseKeeper(mapp.AccountMapper) keeper := NewKeeper(keyCool, bankKeeper, mapp.RegisterCodespace(DefaultCodespace)) diff --git a/examples/democoin/x/cool/client/cli/tx.go b/examples/democoin/x/cool/client/cli/tx.go index 1e41ff5b251b..412a22bbd872 100644 --- a/examples/democoin/x/cool/client/cli/tx.go +++ b/examples/democoin/x/cool/client/cli/tx.go @@ -9,13 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" ) // QuizTxCmd invokes the coolness quiz transaction. -func QuizTxCmd(cdc *wire.Codec) *cobra.Command { +func QuizTxCmd(cdc *codec.Codec) *cobra.Command { return &cobra.Command{ Use: "cool [answer]", Short: "What's cooler than being cool?", @@ -40,7 +40,7 @@ func QuizTxCmd(cdc *wire.Codec) *cobra.Command { } // SetTrendTxCmd sends a new cool trend transaction. -func SetTrendTxCmd(cdc *wire.Codec) *cobra.Command { +func SetTrendTxCmd(cdc *codec.Codec) *cobra.Command { return &cobra.Command{ Use: "setcool [answer]", Short: "You're so cool, tell us what is cool!", diff --git a/examples/democoin/x/cool/wire.go b/examples/democoin/x/cool/codec.go similarity index 53% rename from examples/democoin/x/cool/wire.go rename to examples/democoin/x/cool/codec.go index 63666888a956..491c006177d1 100644 --- a/examples/democoin/x/cool/wire.go +++ b/examples/democoin/x/cool/codec.go @@ -1,11 +1,11 @@ package cool import ( - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) -// Register concrete types on wire codec -func RegisterWire(cdc *wire.Codec) { +// Register concrete types on codec codec +func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgQuiz{}, "cool/Quiz", nil) cdc.RegisterConcrete(MsgSetTrend{}, "cool/SetTrend", nil) } diff --git a/examples/democoin/x/cool/keeper_test.go b/examples/democoin/x/cool/keeper_test.go index 50b38fc3ee04..47a6ed04e40a 100644 --- a/examples/democoin/x/cool/keeper_test.go +++ b/examples/democoin/x/cool/keeper_test.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -26,7 +26,7 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) { func TestCoolKeeper(t *testing.T) { ms, capKey := setupMultiStore() - cdc := wire.NewCodec() + cdc := codec.New() auth.RegisterBaseAccount(cdc) am := auth.NewAccountMapper(cdc, capKey, auth.ProtoBaseAccount) diff --git a/examples/democoin/x/oracle/README.md b/examples/democoin/x/oracle/README.md index 0cfcb820d5b8..b840dc0e8b6c 100644 --- a/examples/democoin/x/oracle/README.md +++ b/examples/democoin/x/oracle/README.md @@ -38,7 +38,7 @@ func NewHandler(keeper Keeper) sdk.Handler { In the previous example, the keeper has an `oracle.Keeper`. `oracle.Keeper`s are generated by `NewKeeper`. ```go -func NewKeeper(key sdk.StoreKey, cdc *wire.Codec, valset sdk.ValidatorSet, supermaj sdk.Dec, timeout int64) Keeper { +func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, valset sdk.ValidatorSet, supermaj sdk.Dec, timeout int64) Keeper { return Keeper { cdc: cdc, key: key, diff --git a/examples/democoin/x/oracle/keeper.go b/examples/democoin/x/oracle/keeper.go index 0406f560a050..e55cd7083c0d 100644 --- a/examples/democoin/x/oracle/keeper.go +++ b/examples/democoin/x/oracle/keeper.go @@ -1,7 +1,7 @@ package oracle import ( - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -9,7 +9,7 @@ import ( // Keeper of the oracle store type Keeper struct { key sdk.StoreKey - cdc *wire.Codec + cdc *codec.Codec valset sdk.ValidatorSet @@ -18,7 +18,7 @@ type Keeper struct { } // NewKeeper constructs a new keeper -func NewKeeper(key sdk.StoreKey, cdc *wire.Codec, valset sdk.ValidatorSet, supermaj sdk.Dec, timeout int64) Keeper { +func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, valset sdk.ValidatorSet, supermaj sdk.Dec, timeout int64) Keeper { if timeout < 0 { panic("Timeout should not be negative") } diff --git a/examples/democoin/x/oracle/keeper_keys.go b/examples/democoin/x/oracle/keeper_keys.go index f657e8027981..b5e648d83cbf 100644 --- a/examples/democoin/x/oracle/keeper_keys.go +++ b/examples/democoin/x/oracle/keeper_keys.go @@ -2,22 +2,22 @@ package oracle import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) // GetInfoKey returns the key for OracleInfo -func GetInfoKey(p Payload, cdc *wire.Codec) []byte { +func GetInfoKey(p Payload, cdc *codec.Codec) []byte { bz := cdc.MustMarshalBinary(p) return append([]byte{0x00}, bz...) } // GetSignPrefix returns the prefix for signs -func GetSignPrefix(p Payload, cdc *wire.Codec) []byte { +func GetSignPrefix(p Payload, cdc *codec.Codec) []byte { bz := cdc.MustMarshalBinary(p) return append([]byte{0x01}, bz...) } // GetSignKey returns the key for sign -func GetSignKey(p Payload, signer sdk.AccAddress, cdc *wire.Codec) []byte { +func GetSignKey(p Payload, signer sdk.AccAddress, cdc *codec.Codec) []byte { return append(GetSignPrefix(p, cdc), signer...) } diff --git a/examples/democoin/x/oracle/oracle_test.go b/examples/democoin/x/oracle/oracle_test.go index f4971c8b1484..b1d08e6c1051 100644 --- a/examples/democoin/x/oracle/oracle_test.go +++ b/examples/democoin/x/oracle/oracle_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/examples/democoin/mock" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) func defaultContext(keys ...sdk.StoreKey) sdk.Context { @@ -39,8 +39,8 @@ func (o seqOracle) ValidateBasic() sdk.Error { return nil } -func makeCodec() *wire.Codec { - var cdc = wire.NewCodec() +func makeCodec() *codec.Codec { + var cdc = codec.New() cdc.RegisterInterface((*sdk.Msg)(nil), nil) cdc.RegisterConcrete(Msg{}, "test/Oracle", nil) @@ -79,7 +79,7 @@ func getSequence(ctx sdk.Context, key sdk.StoreKey) int { if seqbz == nil { seq = 0 } else { - wire.NewCodec().MustUnmarshalBinary(seqbz, &seq) + codec.New().MustUnmarshalBinary(seqbz, &seq) } return seq @@ -93,7 +93,7 @@ func handleSeqOracle(ctx sdk.Context, key sdk.StoreKey, o seqOracle) sdk.Error { return sdk.NewError(sdk.CodespaceRoot, 1, "") } - bz := wire.NewCodec().MustMarshalBinary(seq + 1) + bz := codec.New().MustMarshalBinary(seq + 1) store.Set([]byte("seq"), bz) return nil diff --git a/examples/democoin/x/pow/app_test.go b/examples/democoin/x/pow/app_test.go index 0a4f95cf1574..6e6f07f77098 100644 --- a/examples/democoin/x/pow/app_test.go +++ b/examples/democoin/x/pow/app_test.go @@ -23,7 +23,7 @@ var ( func getMockApp(t *testing.T) *mock.App { mapp := mock.NewApp() - RegisterWire(mapp.Cdc) + RegisterCodec(mapp.Cdc) keyPOW := sdk.NewKVStoreKey("pow") bankKeeper := bank.NewBaseKeeper(mapp.AccountMapper) config := Config{"pow", 1} diff --git a/examples/democoin/x/pow/client/cli/tx.go b/examples/democoin/x/pow/client/cli/tx.go index 15102b128a39..dda4233b6cb1 100644 --- a/examples/democoin/x/pow/client/cli/tx.go +++ b/examples/democoin/x/pow/client/cli/tx.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/examples/democoin/x/pow" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" @@ -16,7 +16,7 @@ import ( ) // command to mine some pow! -func MineCmd(cdc *wire.Codec) *cobra.Command { +func MineCmd(cdc *codec.Codec) *cobra.Command { return &cobra.Command{ Use: "mine [difficulty] [count] [nonce] [solution]", Short: "Mine some coins with proof-of-work!", diff --git a/examples/democoin/x/pow/codec.go b/examples/democoin/x/pow/codec.go new file mode 100644 index 000000000000..8f4296f17a43 --- /dev/null +++ b/examples/democoin/x/pow/codec.go @@ -0,0 +1,10 @@ +package pow + +import ( + "github.com/cosmos/cosmos-sdk/codec" +) + +// Register concrete types on codec codec +func RegisterCodec(cdc *codec.Codec) { + cdc.RegisterConcrete(MsgMine{}, "pow/Mine", nil) +} diff --git a/examples/democoin/x/pow/handler_test.go b/examples/democoin/x/pow/handler_test.go index 03613f7166e0..e5c7d914ad6a 100644 --- a/examples/democoin/x/pow/handler_test.go +++ b/examples/democoin/x/pow/handler_test.go @@ -9,14 +9,14 @@ import ( "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" - wire "github.com/cosmos/cosmos-sdk/wire" + codec "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) func TestPowHandler(t *testing.T) { ms, capKey := setupMultiStore() - cdc := wire.NewCodec() + cdc := codec.New() auth.RegisterBaseAccount(cdc) am := auth.NewAccountMapper(cdc, capKey, auth.ProtoBaseAccount) diff --git a/examples/democoin/x/pow/keeper_test.go b/examples/democoin/x/pow/keeper_test.go index dbab3e617896..e96f92f84f2e 100644 --- a/examples/democoin/x/pow/keeper_test.go +++ b/examples/democoin/x/pow/keeper_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -29,7 +29,7 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey) { func TestPowKeeperGetSet(t *testing.T) { ms, capKey := setupMultiStore() - cdc := wire.NewCodec() + cdc := codec.New() auth.RegisterBaseAccount(cdc) am := auth.NewAccountMapper(cdc, capKey, auth.ProtoBaseAccount) diff --git a/examples/democoin/x/pow/wire.go b/examples/democoin/x/pow/wire.go deleted file mode 100644 index 3d7f61486e26..000000000000 --- a/examples/democoin/x/pow/wire.go +++ /dev/null @@ -1,10 +0,0 @@ -package pow - -import ( - "github.com/cosmos/cosmos-sdk/wire" -) - -// Register concrete types on wire codec -func RegisterWire(cdc *wire.Codec) { - cdc.RegisterConcrete(MsgMine{}, "pow/Mine", nil) -} diff --git a/examples/democoin/x/simplestake/client/cli/commands.go b/examples/democoin/x/simplestake/client/cli/commands.go index 9f6eb40f7e93..042a311b0cce 100644 --- a/examples/democoin/x/simplestake/client/cli/commands.go +++ b/examples/democoin/x/simplestake/client/cli/commands.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/examples/democoin/x/simplestake" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" @@ -25,7 +25,7 @@ const ( ) // simple bond tx -func BondTxCmd(cdc *wire.Codec) *cobra.Command { +func BondTxCmd(cdc *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "bond", Short: "Bond to a validator", @@ -79,7 +79,7 @@ func BondTxCmd(cdc *wire.Codec) *cobra.Command { } // simple unbond tx -func UnbondTxCmd(cdc *wire.Codec) *cobra.Command { +func UnbondTxCmd(cdc *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "unbond", Short: "Unbond from a validator", diff --git a/examples/democoin/x/simplestake/wire.go b/examples/democoin/x/simplestake/codec.go similarity index 57% rename from examples/democoin/x/simplestake/wire.go rename to examples/democoin/x/simplestake/codec.go index 4ef971b44811..7813fd64234f 100644 --- a/examples/democoin/x/simplestake/wire.go +++ b/examples/democoin/x/simplestake/codec.go @@ -1,11 +1,11 @@ package simplestake import ( - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" ) -// Register concrete types on wire codec -func RegisterWire(cdc *wire.Codec) { +// Register concrete types on codec codec +func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgBond{}, "simplestake/BondMsg", nil) cdc.RegisterConcrete(MsgUnbond{}, "simplestake/UnbondMsg", nil) } diff --git a/examples/democoin/x/simplestake/keeper.go b/examples/democoin/x/simplestake/keeper.go index eb3f3407929b..21e4ea796f3f 100644 --- a/examples/democoin/x/simplestake/keeper.go +++ b/examples/democoin/x/simplestake/keeper.go @@ -4,7 +4,7 @@ import ( "github.com/tendermint/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -17,13 +17,13 @@ type Keeper struct { ck bank.Keeper key sdk.StoreKey - cdc *wire.Codec + cdc *codec.Codec codespace sdk.CodespaceType } func NewKeeper(key sdk.StoreKey, bankKeeper bank.Keeper, codespace sdk.CodespaceType) Keeper { - cdc := wire.NewCodec() - wire.RegisterCrypto(cdc) + cdc := codec.New() + codec.RegisterCrypto(cdc) return Keeper{ key: key, cdc: cdc, diff --git a/examples/democoin/x/simplestake/keeper_test.go b/examples/democoin/x/simplestake/keeper_test.go index 417356f66c3b..ee83f34ac951 100644 --- a/examples/democoin/x/simplestake/keeper_test.go +++ b/examples/democoin/x/simplestake/keeper_test.go @@ -14,7 +14,7 @@ import ( "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/wire" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) @@ -32,7 +32,7 @@ func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey, *sdk.KVStoreKey) { func TestKeeperGetSet(t *testing.T) { ms, authKey, capKey := setupMultiStore() - cdc := wire.NewCodec() + cdc := codec.New() auth.RegisterBaseAccount(cdc) accountMapper := auth.NewAccountMapper(cdc, authKey, auth.ProtoBaseAccount) @@ -60,7 +60,7 @@ func TestKeeperGetSet(t *testing.T) { func TestBonding(t *testing.T) { ms, authKey, capKey := setupMultiStore() - cdc := wire.NewCodec() + cdc := codec.New() auth.RegisterBaseAccount(cdc) ctx := sdk.NewContext(ms, abci.Header{}, false, log.NewNopLogger()) diff --git a/examples/kvstore/kvstore b/examples/kvstore/kvstore index 5dd8b5eeaf7814de34a5d4ad3ac4a03eb6e32106..6de98cc563792f9f400bb17077d5d66a2d910500 100755 GIT binary patch delta 3487 zcmZ{mdt6k<6~`TAc`xq;Tzo9@5EYh(JPfaBP^yU%QKPj15fO-0K?V>LA0*-ECTfaA z<6w%tTa6fNVzgSXLG-rq86Zte(uhhl1{#A+3!9oIjW+bmy|c1>`sp9v-<~-$bLPy< z-kE8--|u$dLBHGcKwvnG04LCaGq`{&xPd!(fG6m|3%tPxe8CU=Api^z2tg1GBf$tE zFbYP)7#IsC2!(MF2H_9^kuV;jU;<2pNe~S&V1`(TgLp`Q$&d(1kPIm>1s;J^NP~39 zfJ}H4rouFM46_c+a$z3KhXwEyEQCeyb65<&IPtV+ zv#zLod2x~K)BN<#0%0H2<;@8Z_7A4KF*U+AHs&Q}3VYsXdDW4^Zhw&1yUat4lU+_% z7gn)`g8WgI>jnA95~KiGiWDNtkRoI`QjCZ zxm?&6`zqd#5cW<3&9cw^dK|srF8uq`=y+kX_)=#W$%rl$%Ih5t(Y})D~ z9CH`ZFg7xW28nWF4jnJdf*cy?(2c#4L;W4f@~IrUOXSZmOxpkHc4iR`aO~E*h@Nv6 zj-yNHM9q|ME}>7_lZr2Sn2(xYc?q>wspY*TG-Ry06{f0Z*A$x~man1ZRpqIs8d_df zYEo;osrQx)okLKmy)5I>q}%hTSWPF1l&pj1hpTC@@T$Xll~Mcp$COc%y>o6AjTX&b z7&MO!nzyTHwrGHZ2C`|@_9V0<%c~!b!}m*;s;QSf__6iWIG95u`);u8zk$Yxs_73+ zxq1UlweO1cWg70iqIlKvIfa!gQ^mUQsrbxZQCYRHa8-4&qnF_XJq8CGB^Pg|DNe$H zv0?}7!hC0yRZUL#-w+eFQcs6wa^6;Y#6A}sIh-XlQ2Q69F6y2Js(0wXJ{VFCl?NKA zZ)CW-rRrYew`VHhb23F#nj|3xhYQQL4H#Qo@f=c}u zDudmxYpfMLk2kA#C)!)K3$sCCp_T{jE%Jl*)BBF-vec_$-*c@^ zGo5%>7N2`2llh!)bz$FZ>TqW}&b3}~sEDiR7%87V-};riyE;&;y-&9Eg>5p4kOMwy zT}U2w5ME2?l~&{oau!jLKO%oZ-b2nI=aCD@MdT848F?RRlRK}pD`i?loAp8nn>(%j zakeAkMBwf-ojTb#ts{K6c2TLh6tTjyZFy|zkEdMa!&x03;@gv3Xvap+hf&5_7T0zl zA0U55K14o3t{@*HpCF$ie?dM&uF8vRI~R-7NBntCJT~CsaLl&9Cy81oXwCz0xb_9CdEE&*){8i3?uf9Db z`b;+8v3Fl-zGFY$UpL>GuQjmP%y*ElkzV93@;Brgc7Oc%i z?`N~<{k}#1DeL|2IlZmLk`2newi6=x?#k~h-If1BzDIsQ{*C;I+(#ZD|B<^Ze|qX2 zt^JU*XK~oTItTYS_I=oZcu0wM+S#)=e4x$#D8aKQN}NOD*!eViV3mmCcIjqvjdNx*cMM zJY0x${7VCA7eQa_HW2@VqOfOcAZZq#sFKwZNbYSE!=+6LB1+nnU~<#ys{W0Jk$5R| zK@iE7th0kja(&aaV4^f#8%buxiD12MMzU2rX6tKa8VO1Wmr-0sa~VUFnwewCqv8XS zT1J@2fx#nFTIFOS;%_dU8?@_4f$R&v=C3VTaoTjHMN%>m z?-;4j97n>0|4MBviIUK#S;+Kd({NGvZU~3noI0Pm2zpLJYQVia>Cee^zt@*;{_x58Bwz$J3okuzu>k>6l h-B*V%CrN9|_r4L@fxGgBz7* z)sPGtb=D?oZIq;maSWkMo0QV%+KQ&}QDSVR7}Go?(b!fZId|>?Yd)WTKKi zd(S=h&di-TIDFH6@7{=8*;z^55XLm3%M{49)|g_02V?XJOYn`5gvnlSOkwl0XzXu!eS_dCGZsd z^!U?Whn(xmX^Esh^z@4>xIN;s^wBVG?`oDt)NvcpzBF|fw}l@st)0qk-|*5K&nng| zuULjGM^+%uAVtWt$V#LbDM3mlc|}=gjxt2pWG&0)gS)L|=5FhANI9|!S&dX6YmiE$ zO6s;&@43RKUDjChgd4Xf%r(m4 z3PXi7Q1~{N`YTs>Gh*I-&9g@8A{pmV$(8rXZ=umbqLEJG%>_mp8^N|wW7<$%qR|$| zSJNs}RhFiXR#ld1*cG1kH6slepGCs7ZG0JmlCiarhWuZ7E@H__9tn%TpyDadET_|W zaCkX=Y_!tS(IS-@ETwex0$W0NDGdvEEc}1e?NvsD$Lkid?`uk{%4nRu24M}I&O7#^ zQ&#@tJt;8J+Lb2U8@4N0lrFHmqN1d%s6t~ZD#N|g#IY+0qU6vq{h-m1B^w8&ImRXJW*w4kl0;XK#F^)!*Y4Wmwa zy`E+{-aYRY>dE^kTb<+B)Qw%3EQu{N!+ES7E!^8my~dk<3o1=1GZq(B)Rs7u!lLP^ zKaNU!w$TpzCMk1P@1%zDRKlg5)Z3xyv&-I;G`r}GsmeAe4{T`_)s&W(R1|BpYjxVS zS(>sclX8E|>rPT+En-4yk#$HNvL4xhY(##B)FTbZCZrK*LN+5mN172pT97S>8F?Pr ziflu+Bdy3UkQWdOvIE(P>_T2d+K`u!m!)+lh3C8ZvaZIAOcLbi5mzCquKlaASg_FD z((Wmwt#3a+7Mm_*ZfM`h_g#F`btVawK5J+X<+~>)yUZjBqE$7Ms0H_yc3+_Y+N+hZ zBEeufn?xlzx3o9$AnTtiShrx$Pg)#%8qF9)b|ZU`SCGBPK4d>4B39%8@=N4ZPzH<8~UZy|3Z$B}oC6NrSIMBbIGTRP{=^=6N{&R9}6 zr>eMQrSQe6&R6-4w4Ls3IvOuN#ZMy1>*z%vzJcb*%uC2+ zkL@3IW?OGR@(FSU`4qW|{2lp+Wb3{5?t6T|w&sC!?s}RBGPol!kjh;a45az8t)Ev# z*A$s%P3XVrDI91W2om%GL+<8%Fo671+6RN*9N{C{bl2@;&*-k(PwMY=*9&~cvrM?= z?Ii5@d@xeb6t}BhPP%R|_vo)9pCLDp&yjy2Um#y1Um;&hJ^GtxukuOu_zl@V@Spk( zQ65{Y90$h)w70f)H{+#XC0@png-JA=us1|@DenK_BbCo@CH z6|3^XO(4mldS5Wf6a2JqC0jx-hY&gR@&jZ+63_FTM=06G{~j%O=7$oLFea0kgfodC z@}2pSWHx{9#cXE{Ie7o!CEmbTfs#)&xQtrMZnW}lmnbrSlX7-h2AiV@$`mHiOk$X5 znM`F8%Os9TJd Date: Wed, 12 Sep 2018 23:39:17 -0700 Subject: [PATCH 2/3] fix formatting and cli --- baseapp/baseapp.go | 2 +- client/lcd/lcd_test.go | 2 +- client/lcd/test_helpers.go | 2 +- cmd/gaia/app/genesis.go | 2 +- cmd/gaia/cli_test/cli_test.go | 4 ++-- docs/sdk/core/examples/app2.go | 2 +- docs/sdk/core/examples/app3.go | 2 +- docs/sdk/core/examples/app4.go | 2 +- examples/basecoin/app/app.go | 2 +- examples/basecoin/app/app_test.go | 2 +- examples/basecoin/types/account.go | 2 +- examples/democoin/app/app.go | 2 +- examples/democoin/app/app_test.go | 2 +- examples/democoin/cmd/democoind/main.go | 2 +- examples/democoin/types/account.go | 2 +- examples/democoin/x/assoc/validator_set.go | 2 +- examples/democoin/x/assoc/validator_set_test.go | 2 +- examples/democoin/x/cool/client/cli/tx.go | 2 +- examples/democoin/x/cool/keeper_test.go | 2 +- examples/democoin/x/oracle/keeper_keys.go | 2 +- examples/democoin/x/oracle/oracle_test.go | 2 +- examples/democoin/x/pow/client/cli/tx.go | 2 +- examples/democoin/x/pow/handler_test.go | 2 +- examples/democoin/x/pow/keeper_test.go | 2 +- examples/democoin/x/simplestake/client/cli/commands.go | 2 +- examples/democoin/x/simplestake/keeper.go | 2 +- examples/democoin/x/simplestake/keeper_test.go | 2 +- server/export_test.go | 2 +- server/init.go | 2 +- server/init_test.go | 2 +- server/mock/app.go | 2 +- server/start_test.go | 2 +- server/util.go | 2 +- x/auth/account.go | 2 +- x/auth/ante_test.go | 2 +- x/auth/client/cli/account.go | 2 +- x/auth/client/rest/query.go | 2 +- x/auth/client/txbuilder/txbuilder.go | 2 +- x/auth/feekeeper.go | 2 +- x/auth/feekeeper_test.go | 2 +- x/auth/mapper.go | 2 +- x/auth/mapper_test.go | 2 +- x/auth/stdtx.go | 2 +- x/bank/client/cli/sendtx.go | 2 +- x/bank/client/rest/sendtx.go | 2 +- x/bank/keeper_test.go | 2 +- x/gov/client/cli/tx.go | 2 +- x/gov/client/rest/rest.go | 2 +- x/gov/client/rest/util.go | 2 +- x/gov/keeper.go | 2 +- x/gov/queryable.go | 2 +- x/gov/simulation/msgs.go | 1 - x/ibc/client/cli/ibctx.go | 2 +- x/ibc/client/cli/relay.go | 2 +- x/ibc/client/rest/transfer.go | 2 +- x/ibc/ibc_test.go | 2 +- x/ibc/mapper.go | 2 +- x/ibc/types.go | 2 +- x/mock/app.go | 2 +- x/params/keeper.go | 2 +- x/params/keeper_test.go | 2 +- x/slashing/client/cli/query.go | 2 +- x/slashing/client/cli/tx.go | 2 +- x/slashing/client/rest/query.go | 2 +- x/slashing/client/rest/rest.go | 2 +- x/slashing/client/rest/tx.go | 2 +- x/slashing/keeper.go | 2 +- x/slashing/msg.go | 2 +- x/slashing/test_common.go | 2 +- x/stake/client/cli/query.go | 2 +- x/stake/client/cli/tx.go | 2 +- x/stake/client/rest/query.go | 2 +- x/stake/client/rest/rest.go | 2 +- x/stake/client/rest/tx.go | 2 +- x/stake/client/rest/utils.go | 2 +- x/stake/keeper/keeper.go | 2 +- x/stake/keeper/test_common.go | 2 +- x/stake/stake.go | 2 +- x/stake/types/delegation.go | 2 +- x/stake/types/params.go | 2 +- x/stake/types/pool.go | 2 +- x/stake/types/validator.go | 2 +- x/stake/types/validator_test.go | 2 +- 83 files changed, 83 insertions(+), 84 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index ac27080c5e25..1f9944014267 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -14,10 +14,10 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/codec" ) // Key to store the header in the DB itself. diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index 2f8688965119..312ac397b2e4 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -22,9 +22,9 @@ import ( client "github.com/cosmos/cosmos-sdk/client" keys "github.com/cosmos/cosmos-sdk/client/keys" rpc "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/codec" tests "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" "github.com/cosmos/cosmos-sdk/x/gov" diff --git a/client/lcd/test_helpers.go b/client/lcd/test_helpers.go index 1b487a8fe3f0..1075c078b9ec 100644 --- a/client/lcd/test_helpers.go +++ b/client/lcd/test_helpers.go @@ -15,11 +15,11 @@ import ( "github.com/cosmos/cosmos-sdk/client" keys "github.com/cosmos/cosmos-sdk/client/keys" gapp "github.com/cosmos/cosmos-sdk/cmd/gaia/app" + "github.com/cosmos/cosmos-sdk/codec" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/spf13/viper" diff --git a/cmd/gaia/app/genesis.go b/cmd/gaia/app/genesis.go index a7069d64befc..e19ee616acf4 100644 --- a/cmd/gaia/app/genesis.go +++ b/cmd/gaia/app/genesis.go @@ -6,10 +6,10 @@ import ( "fmt" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/stake" diff --git a/cmd/gaia/cli_test/cli_test.go b/cmd/gaia/cli_test/cli_test.go index edab0d2d7939..3d9f86789aaf 100644 --- a/cmd/gaia/cli_test/cli_test.go +++ b/cmd/gaia/cli_test/cli_test.go @@ -18,10 +18,10 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" "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/tests" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/stake" @@ -549,7 +549,7 @@ func executeGetAccount(t *testing.T, cmdStr string) auth.BaseAccount { require.NoError(t, err, "out %v, err %v", out, err) value := initRes["value"] var acc auth.BaseAccount - cdc := codec.NewCodec() + cdc := codec.New() codec.RegisterCrypto(cdc) err = cdc.UnmarshalJSON(value, &acc) require.NoError(t, err, "value %v, err %v", string(value), err) diff --git a/docs/sdk/core/examples/app2.go b/docs/sdk/core/examples/app2.go index 17b6b129ad7b..837c9f44fa5d 100644 --- a/docs/sdk/core/examples/app2.go +++ b/docs/sdk/core/examples/app2.go @@ -13,8 +13,8 @@ import ( "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( diff --git a/docs/sdk/core/examples/app3.go b/docs/sdk/core/examples/app3.go index fdb40902fa0e..9a101c281620 100644 --- a/docs/sdk/core/examples/app3.go +++ b/docs/sdk/core/examples/app3.go @@ -7,8 +7,8 @@ import ( "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/docs/sdk/core/examples/app4.go b/docs/sdk/core/examples/app4.go index 835f33e2db82..e4fa515ee232 100644 --- a/docs/sdk/core/examples/app4.go +++ b/docs/sdk/core/examples/app4.go @@ -7,8 +7,8 @@ import ( "github.com/tendermint/tendermint/libs/log" bapp "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index 2ad2a1c580ea..657cbcf0fdb8 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -4,9 +4,9 @@ import ( "encoding/json" bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/ibc" diff --git a/examples/basecoin/app/app_test.go b/examples/basecoin/app/app_test.go index 2f3ea5c49f5d..24237e6029d2 100644 --- a/examples/basecoin/app/app_test.go +++ b/examples/basecoin/app/app_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/basecoin/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" diff --git a/examples/basecoin/types/account.go b/examples/basecoin/types/account.go index 2a84c95fb9a5..04d3e371efdc 100644 --- a/examples/basecoin/types/account.go +++ b/examples/basecoin/types/account.go @@ -1,8 +1,8 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" ) diff --git a/examples/democoin/app/app.go b/examples/democoin/app/app.go index 69d96ab4c0ab..0449f6251edb 100644 --- a/examples/democoin/app/app.go +++ b/examples/democoin/app/app.go @@ -10,8 +10,8 @@ import ( tmtypes "github.com/tendermint/tendermint/types" bam "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + 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/ibc" diff --git a/examples/democoin/app/app_test.go b/examples/democoin/app/app_test.go index 6bdc70c3d66d..eeea84bd463c 100644 --- a/examples/democoin/app/app_test.go +++ b/examples/democoin/app/app_test.go @@ -4,10 +4,10 @@ import ( "os" "testing" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/types" "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" diff --git a/examples/democoin/cmd/democoind/main.go b/examples/democoin/cmd/democoind/main.go index 1b5b947b0fdd..e22b0fc3e043 100644 --- a/examples/democoin/cmd/democoind/main.go +++ b/examples/democoin/cmd/democoind/main.go @@ -13,9 +13,9 @@ import ( "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/app" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/codec" ) // init parameters diff --git a/examples/democoin/types/account.go b/examples/democoin/types/account.go index bb09c9a7dd1e..ad57c944d385 100644 --- a/examples/democoin/types/account.go +++ b/examples/democoin/types/account.go @@ -1,8 +1,8 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool" diff --git a/examples/democoin/x/assoc/validator_set.go b/examples/democoin/x/assoc/validator_set.go index d3c230b78036..69b35501f317 100644 --- a/examples/democoin/x/assoc/validator_set.go +++ b/examples/democoin/x/assoc/validator_set.go @@ -3,8 +3,8 @@ package assoc import ( "bytes" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // ValidatorSet defines diff --git a/examples/democoin/x/assoc/validator_set_test.go b/examples/democoin/x/assoc/validator_set_test.go index e0bcf8ded116..9fc6526f8d3e 100644 --- a/examples/democoin/x/assoc/validator_set_test.go +++ b/examples/democoin/x/assoc/validator_set_test.go @@ -9,10 +9,10 @@ import ( abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tendermint/libs/db" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/mock" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" ) func defaultContext(key sdk.StoreKey) sdk.Context { diff --git a/examples/democoin/x/cool/client/cli/tx.go b/examples/democoin/x/cool/client/cli/tx.go index 412a22bbd872..2f78bba460f5 100644 --- a/examples/democoin/x/cool/client/cli/tx.go +++ b/examples/democoin/x/cool/client/cli/tx.go @@ -7,9 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/x/cool" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" ) diff --git a/examples/democoin/x/cool/keeper_test.go b/examples/democoin/x/cool/keeper_test.go index 47a6ed04e40a..e3af7790e4b2 100644 --- a/examples/democoin/x/cool/keeper_test.go +++ b/examples/democoin/x/cool/keeper_test.go @@ -8,9 +8,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tendermint/libs/db" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/examples/democoin/x/oracle/keeper_keys.go b/examples/democoin/x/oracle/keeper_keys.go index b5e648d83cbf..9b71aeaa1815 100644 --- a/examples/democoin/x/oracle/keeper_keys.go +++ b/examples/democoin/x/oracle/keeper_keys.go @@ -1,8 +1,8 @@ package oracle import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // GetInfoKey returns the key for OracleInfo diff --git a/examples/democoin/x/oracle/oracle_test.go b/examples/democoin/x/oracle/oracle_test.go index b1d08e6c1051..416d933f2d25 100644 --- a/examples/democoin/x/oracle/oracle_test.go +++ b/examples/democoin/x/oracle/oracle_test.go @@ -9,10 +9,10 @@ import ( abci "github.com/tendermint/tendermint/abci/types" dbm "github.com/tendermint/tendermint/libs/db" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/mock" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" ) func defaultContext(keys ...sdk.StoreKey) sdk.Context { diff --git a/examples/democoin/x/pow/client/cli/tx.go b/examples/democoin/x/pow/client/cli/tx.go index dda4233b6cb1..f1d708c89708 100644 --- a/examples/democoin/x/pow/client/cli/tx.go +++ b/examples/democoin/x/pow/client/cli/tx.go @@ -6,9 +6,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/x/pow" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" diff --git a/examples/democoin/x/pow/handler_test.go b/examples/democoin/x/pow/handler_test.go index e5c7d914ad6a..8166ddfc5321 100644 --- a/examples/democoin/x/pow/handler_test.go +++ b/examples/democoin/x/pow/handler_test.go @@ -8,8 +8,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/examples/democoin/x/pow/keeper_test.go b/examples/democoin/x/pow/keeper_test.go index e96f92f84f2e..dbd974c4d076 100644 --- a/examples/democoin/x/pow/keeper_test.go +++ b/examples/democoin/x/pow/keeper_test.go @@ -9,9 +9,9 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" auth "github.com/cosmos/cosmos-sdk/x/auth" bank "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/examples/democoin/x/simplestake/client/cli/commands.go b/examples/democoin/x/simplestake/client/cli/commands.go index 042a311b0cce..d09bf64f37cf 100644 --- a/examples/democoin/x/simplestake/client/cli/commands.go +++ b/examples/democoin/x/simplestake/client/cli/commands.go @@ -7,9 +7,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/examples/democoin/x/simplestake" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" diff --git a/examples/democoin/x/simplestake/keeper.go b/examples/democoin/x/simplestake/keeper.go index 21e4ea796f3f..7bdc17937b55 100644 --- a/examples/democoin/x/simplestake/keeper.go +++ b/examples/democoin/x/simplestake/keeper.go @@ -3,8 +3,8 @@ package simplestake import ( "github.com/tendermint/tendermint/crypto" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/examples/democoin/x/simplestake/keeper_test.go b/examples/democoin/x/simplestake/keeper_test.go index ee83f34ac951..68f28bd91b07 100644 --- a/examples/democoin/x/simplestake/keeper_test.go +++ b/examples/democoin/x/simplestake/keeper_test.go @@ -12,9 +12,9 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/server/export_test.go b/server/export_test.go index bd4f9766ac9e..999ba3c00581 100644 --- a/server/export_test.go +++ b/server/export_test.go @@ -2,8 +2,8 @@ package server import ( "bytes" - "github.com/cosmos/cosmos-sdk/server/mock" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server/mock" "github.com/stretchr/testify/require" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" "github.com/tendermint/tendermint/libs/log" diff --git a/server/init.go b/server/init.go index 9766773c0f80..adec4fba3975 100644 --- a/server/init.go +++ b/server/init.go @@ -26,9 +26,9 @@ import ( tmtypes "github.com/tendermint/tendermint/types" clkeys "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/codec" serverconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" ) //Parameter names, for init gen-tx command diff --git a/server/init_test.go b/server/init_test.go index f716bb9cd1a3..1913ac671722 100644 --- a/server/init_test.go +++ b/server/init_test.go @@ -7,8 +7,8 @@ import ( "github.com/tendermint/tendermint/libs/log" - "github.com/cosmos/cosmos-sdk/server/mock" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server/mock" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" ) diff --git a/server/mock/app.go b/server/mock/app.go index 81ab7a7f74f0..abdec6be5081 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -12,9 +12,9 @@ import ( tmtypes "github.com/tendermint/tendermint/types" bam "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" gc "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" ) // NewApp creates a simple mock kvstore app for testing. It should work diff --git a/server/start_test.go b/server/start_test.go index f56d804ffc40..db9fcd40f840 100644 --- a/server/start_test.go +++ b/server/start_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/server/mock" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/server/mock" "github.com/tendermint/tendermint/abci/server" tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands" "github.com/tendermint/tendermint/libs/log" diff --git a/server/util.go b/server/util.go index e1f7bfa59a8c..22dbd78678a6 100644 --- a/server/util.go +++ b/server/util.go @@ -11,8 +11,8 @@ import ( "github.com/spf13/viper" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/codec" + "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" diff --git a/x/auth/account.go b/x/auth/account.go index 79c9cd47a267..ceadd3951067 100644 --- a/x/auth/account.go +++ b/x/auth/account.go @@ -3,8 +3,8 @@ package auth import ( "errors" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" ) diff --git a/x/auth/ante_test.go b/x/auth/ante_test.go index dfd5056af1a3..75fd130436d1 100644 --- a/x/auth/ante_test.go +++ b/x/auth/ante_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - sdk "github.com/cosmos/cosmos-sdk/types" 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" diff --git a/x/auth/client/cli/account.go b/x/auth/client/cli/account.go index ce0d806ae51e..13c3230cf9be 100644 --- a/x/auth/client/cli/account.go +++ b/x/auth/client/cli/account.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client/context" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" ) diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index 5407ca5dce32..db11cedb9f3c 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -6,8 +6,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" diff --git a/x/auth/client/txbuilder/txbuilder.go b/x/auth/client/txbuilder/txbuilder.go index 634c76993309..030ddb72a4a9 100644 --- a/x/auth/client/txbuilder/txbuilder.go +++ b/x/auth/client/txbuilder/txbuilder.go @@ -3,8 +3,8 @@ package context import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/keys" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/pkg/errors" diff --git a/x/auth/feekeeper.go b/x/auth/feekeeper.go index 681636f239ec..d2cf7ce62748 100644 --- a/x/auth/feekeeper.go +++ b/x/auth/feekeeper.go @@ -1,8 +1,8 @@ package auth import ( - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/auth/feekeeper_test.go b/x/auth/feekeeper_test.go index 7eff2c98c6fe..82bbe9c35da3 100644 --- a/x/auth/feekeeper_test.go +++ b/x/auth/feekeeper_test.go @@ -8,8 +8,8 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/auth/mapper.go b/x/auth/mapper.go index d38b5fcbbe42..51565c0c940c 100644 --- a/x/auth/mapper.go +++ b/x/auth/mapper.go @@ -1,8 +1,8 @@ package auth import ( - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" ) diff --git a/x/auth/mapper_test.go b/x/auth/mapper_test.go index cb749a3c81a9..96dc57b79fc7 100644 --- a/x/auth/mapper_test.go +++ b/x/auth/mapper_test.go @@ -9,9 +9,9 @@ import ( 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" - codec "github.com/cosmos/cosmos-sdk/codec" ) func setupMultiStore() (sdk.MultiStore, *sdk.KVStoreKey, *sdk.KVStoreKey) { diff --git a/x/auth/stdtx.go b/x/auth/stdtx.go index 27a8ed2bac84..e38dc0c7ee24 100644 --- a/x/auth/stdtx.go +++ b/x/auth/stdtx.go @@ -3,8 +3,8 @@ package auth import ( "encoding/json" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto" ) diff --git a/x/bank/client/cli/sendtx.go b/x/bank/client/cli/sendtx.go index b7dfee4c5c10..31fe182991d3 100644 --- a/x/bank/client/cli/sendtx.go +++ b/x/bank/client/cli/sendtx.go @@ -5,8 +5,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/bank/client" diff --git a/x/bank/client/rest/sendtx.go b/x/bank/client/rest/sendtx.go index 6cca7e7f81fb..242614d118c6 100644 --- a/x/bank/client/rest/sendtx.go +++ b/x/bank/client/rest/sendtx.go @@ -7,9 +7,9 @@ import ( cliclient "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" "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/bank/client" diff --git a/x/bank/keeper_test.go b/x/bank/keeper_test.go index 7583f09759bd..c48410c154e3 100644 --- a/x/bank/keeper_test.go +++ b/x/bank/keeper_test.go @@ -10,9 +10,9 @@ import ( 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" - codec "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" ) diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index b76ff631b646..77364665a129 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -6,8 +6,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/gov" diff --git a/x/gov/client/rest/rest.go b/x/gov/client/rest/rest.go index c6565766113a..059c0bb1cfdc 100644 --- a/x/gov/client/rest/rest.go +++ b/x/gov/client/rest/rest.go @@ -6,8 +6,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/gorilla/mux" diff --git a/x/gov/client/rest/util.go b/x/gov/client/rest/util.go index 3d2560d1c6e2..0bc1a8804e3a 100644 --- a/x/gov/client/rest/util.go +++ b/x/gov/client/rest/util.go @@ -9,8 +9,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" ) diff --git a/x/gov/keeper.go b/x/gov/keeper.go index 31fdd19db9ac..bebcf51e78d2 100644 --- a/x/gov/keeper.go +++ b/x/gov/keeper.go @@ -1,8 +1,8 @@ package gov import ( - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/params" ) diff --git a/x/gov/queryable.go b/x/gov/queryable.go index 85b8832b7b7f..f20bb46f7885 100644 --- a/x/gov/queryable.go +++ b/x/gov/queryable.go @@ -3,8 +3,8 @@ package gov import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/x/gov/simulation/msgs.go b/x/gov/simulation/msgs.go index 3eb21b79a5cd..478b4be0f0a7 100644 --- a/x/gov/simulation/msgs.go +++ b/x/gov/simulation/msgs.go @@ -156,7 +156,6 @@ func SimulateMsgVote(k gov.Keeper, sk stake.Keeper) simulation.Operation { return operationSimulateMsgVote(k, sk, nil, -1) } - // nolint: unparam func operationSimulateMsgVote(k gov.Keeper, sk stake.Keeper, key crypto.PrivKey, proposalID int64) simulation.Operation { return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, keys []crypto.PrivKey, event func(string)) (action string, fOp []simulation.FutureOperation, err error) { diff --git a/x/ibc/client/cli/ibctx.go b/x/ibc/client/cli/ibctx.go index ad1ace9e1b5e..d34d6687b816 100644 --- a/x/ibc/client/cli/ibctx.go +++ b/x/ibc/client/cli/ibctx.go @@ -7,8 +7,8 @@ import ( "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" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/ibc" diff --git a/x/ibc/client/cli/relay.go b/x/ibc/client/cli/relay.go index 6835f5b58200..a2b626b2c6d5 100644 --- a/x/ibc/client/cli/relay.go +++ b/x/ibc/client/cli/relay.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/keys" - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" diff --git a/x/ibc/client/rest/transfer.go b/x/ibc/client/rest/transfer.go index 097deeda9a0d..e44ea240be25 100644 --- a/x/ibc/client/rest/transfer.go +++ b/x/ibc/client/rest/transfer.go @@ -7,9 +7,9 @@ import ( "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" "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/ibc" diff --git a/x/ibc/ibc_test.go b/x/ibc/ibc_test.go index 614069d05b14..c8e7492be7f1 100644 --- a/x/ibc/ibc_test.go +++ b/x/ibc/ibc_test.go @@ -10,9 +10,9 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" ) diff --git a/x/ibc/mapper.go b/x/ibc/mapper.go index a0c5c26ebfbd..95c88b62fbc1 100644 --- a/x/ibc/mapper.go +++ b/x/ibc/mapper.go @@ -3,8 +3,8 @@ package ibc import ( "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // IBC Mapper diff --git a/x/ibc/types.go b/x/ibc/types.go index 3550d8557871..0dcc0813d835 100644 --- a/x/ibc/types.go +++ b/x/ibc/types.go @@ -3,8 +3,8 @@ package ibc import ( "encoding/json" - sdk "github.com/cosmos/cosmos-sdk/types" codec "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( diff --git a/x/mock/app.go b/x/mock/app.go index 8d01f1153fc7..1fe411fbc555 100644 --- a/x/mock/app.go +++ b/x/mock/app.go @@ -6,8 +6,8 @@ import ( "os" bam "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" "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" diff --git a/x/params/keeper.go b/x/params/keeper.go index 313b64b5d941..ca158ad4297a 100644 --- a/x/params/keeper.go +++ b/x/params/keeper.go @@ -4,8 +4,8 @@ import ( "fmt" "reflect" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // Keeper manages global parameter store diff --git a/x/params/keeper_test.go b/x/params/keeper_test.go index a0971fc2086c..7eac7319f073 100644 --- a/x/params/keeper_test.go +++ b/x/params/keeper_test.go @@ -9,9 +9,9 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" ) func defaultContext(key sdk.StoreKey) sdk.Context { diff --git a/x/slashing/client/cli/query.go b/x/slashing/client/cli/query.go index 3917cbcddc1a..50ccc6c0eaeb 100644 --- a/x/slashing/client/cli/query.go +++ b/x/slashing/client/cli/query.go @@ -8,8 +8,8 @@ import ( "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/context" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" // XXX fix + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/slashing" ) diff --git a/x/slashing/client/cli/tx.go b/x/slashing/client/cli/tx.go index 9bdac60a69aa..9d7e46578cd5 100644 --- a/x/slashing/client/cli/tx.go +++ b/x/slashing/client/cli/tx.go @@ -5,8 +5,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/slashing" diff --git a/x/slashing/client/rest/query.go b/x/slashing/client/rest/query.go index 38f619b22168..e83f1a235dcd 100644 --- a/x/slashing/client/rest/query.go +++ b/x/slashing/client/rest/query.go @@ -5,8 +5,8 @@ import ( "net/http" "github.com/cosmos/cosmos-sdk/client/context" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/slashing" "github.com/gorilla/mux" ) diff --git a/x/slashing/client/rest/rest.go b/x/slashing/client/rest/rest.go index 5ed984e058f4..507fcb517fc4 100644 --- a/x/slashing/client/rest/rest.go +++ b/x/slashing/client/rest/rest.go @@ -2,8 +2,8 @@ package rest import ( "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/gorilla/mux" ) diff --git a/x/slashing/client/rest/tx.go b/x/slashing/client/rest/tx.go index 355b9d23f1f5..45b1b6471a6d 100644 --- a/x/slashing/client/rest/tx.go +++ b/x/slashing/client/rest/tx.go @@ -10,9 +10,9 @@ import ( "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" "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/slashing" diff --git a/x/slashing/keeper.go b/x/slashing/keeper.go index 00123c1824dd..5a008ccec57f 100644 --- a/x/slashing/keeper.go +++ b/x/slashing/keeper.go @@ -6,8 +6,8 @@ import ( tmtypes "github.com/tendermint/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" diff --git a/x/slashing/msg.go b/x/slashing/msg.go index f4e51261f22f..58aae2498d63 100644 --- a/x/slashing/msg.go +++ b/x/slashing/msg.go @@ -1,8 +1,8 @@ package slashing import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) var cdc = codec.New() diff --git a/x/slashing/test_common.go b/x/slashing/test_common.go index 7ca8e190b6ee..db2293a2f9c9 100644 --- a/x/slashing/test_common.go +++ b/x/slashing/test_common.go @@ -14,9 +14,9 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/params" diff --git a/x/stake/client/cli/query.go b/x/stake/client/cli/query.go index 108070a73bee..26b57c2a6970 100644 --- a/x/stake/client/cli/query.go +++ b/x/stake/client/cli/query.go @@ -8,8 +8,8 @@ import ( "github.com/tendermint/tendermint/libs/cli" "github.com/cosmos/cosmos-sdk/client/context" - sdk "github.com/cosmos/cosmos-sdk/types" "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" ) diff --git a/x/stake/client/cli/tx.go b/x/stake/client/cli/tx.go index 736a3f448483..f91717328394 100644 --- a/x/stake/client/cli/tx.go +++ b/x/stake/client/cli/tx.go @@ -7,8 +7,8 @@ import ( "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/codec" + sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/stake" diff --git a/x/stake/client/rest/query.go b/x/stake/client/rest/query.go index 4b5855483c8b..ca1d71b9aef3 100644 --- a/x/stake/client/rest/query.go +++ b/x/stake/client/rest/query.go @@ -7,8 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "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/tags" "github.com/cosmos/cosmos-sdk/x/stake/types" diff --git a/x/stake/client/rest/rest.go b/x/stake/client/rest/rest.go index 5ed984e058f4..507fcb517fc4 100644 --- a/x/stake/client/rest/rest.go +++ b/x/stake/client/rest/rest.go @@ -2,8 +2,8 @@ package rest import ( "github.com/cosmos/cosmos-sdk/client/context" - "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/gorilla/mux" ) diff --git a/x/stake/client/rest/tx.go b/x/stake/client/rest/tx.go index 236a4fd8051c..b71684360208 100644 --- a/x/stake/client/rest/tx.go +++ b/x/stake/client/rest/tx.go @@ -9,9 +9,9 @@ import ( "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" "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/stake" diff --git a/x/stake/client/rest/utils.go b/x/stake/client/rest/utils.go index 6555dedab2d8..6bd91e7401c2 100644 --- a/x/stake/client/rest/utils.go +++ b/x/stake/client/rest/utils.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "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/tags" "github.com/cosmos/cosmos-sdk/x/stake/types" diff --git a/x/stake/keeper/keeper.go b/x/stake/keeper/keeper.go index 7213a1ac030f..a3754f750444 100644 --- a/x/stake/keeper/keeper.go +++ b/x/stake/keeper/keeper.go @@ -1,8 +1,8 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/stake/types" diff --git a/x/stake/keeper/test_common.go b/x/stake/keeper/test_common.go index 0ef6c06f0d63..03d4642b671b 100644 --- a/x/stake/keeper/test_common.go +++ b/x/stake/keeper/test_common.go @@ -14,9 +14,9 @@ import ( dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/stake/types" diff --git a/x/stake/stake.go b/x/stake/stake.go index 65bfe0c6afaf..74be3a702ee1 100644 --- a/x/stake/stake.go +++ b/x/stake/stake.go @@ -65,7 +65,7 @@ var ( NewDescription = types.NewDescription NewGenesisState = types.NewGenesisState DefaultGenesisState = types.DefaultGenesisState - RegisterCodec = types.RegisterCodec + RegisterCodec = types.RegisterCodec NewMsgCreateValidator = types.NewMsgCreateValidator NewMsgCreateValidatorOnBehalfOf = types.NewMsgCreateValidatorOnBehalfOf diff --git a/x/stake/types/delegation.go b/x/stake/types/delegation.go index 8f5e0b3f01a3..e6bf11e732ba 100644 --- a/x/stake/types/delegation.go +++ b/x/stake/types/delegation.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // Delegation represents the bond with tokens held by an account. It is diff --git a/x/stake/types/params.go b/x/stake/types/params.go index e568628b9d01..4dcc3782a859 100644 --- a/x/stake/types/params.go +++ b/x/stake/types/params.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // defaultUnbondingTime reflects three weeks in seconds as the default diff --git a/x/stake/types/pool.go b/x/stake/types/pool.go index 3ce06b4f5780..c7cb6974868e 100644 --- a/x/stake/types/pool.go +++ b/x/stake/types/pool.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // Pool - dynamic parameters of the current state diff --git a/x/stake/types/validator.go b/x/stake/types/validator.go index c6b42e54380a..6c5066a78301 100644 --- a/x/stake/types/validator.go +++ b/x/stake/types/validator.go @@ -9,8 +9,8 @@ import ( "github.com/tendermint/tendermint/crypto" tmtypes "github.com/tendermint/tendermint/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" ) // Validator defines the total amount of bond shares and their exchange rate to diff --git a/x/stake/types/validator_test.go b/x/stake/types/validator_test.go index 60cbad6ac5eb..eceffbad39c6 100644 --- a/x/stake/types/validator_test.go +++ b/x/stake/types/validator_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" From 4a10624358d6e5163b2d682d8cbcd0bf25e8603c Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Thu, 13 Sep 2018 08:57:46 -0700 Subject: [PATCH 3/3] fix the docs --- docs/sdk/sdk-by-examples/simple-governance/module-codec.md | 2 +- docs/spec/ibc/appendices.md | 4 ++-- docs/spec/ibc/channels-and-packets.md | 2 +- docs/spec/ibc/conclusion.md | 2 +- docs/spec/ibc/references.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/sdk/sdk-by-examples/simple-governance/module-codec.md b/docs/sdk/sdk-by-examples/simple-governance/module-codec.md index 067b87d521d6..68b03b93653b 100644 --- a/docs/sdk/sdk-by-examples/simple-governance/module-codec.md +++ b/docs/sdk/sdk-by-examples/simple-governance/module-codec.md @@ -1,4 +1,4 @@ -## Wire +## Codec **File: [`x/simple_governance/codec.go`](https://github.com/cosmos/cosmos-sdk/blob/fedekunze/module_tutorial/examples/simpleGov/x/simple_governance/codec.go)** diff --git a/docs/spec/ibc/appendices.md b/docs/spec/ibc/appendices.md index 6bf3fdec0ff0..a3d04960d374 100644 --- a/docs/spec/ibc/appendices.md +++ b/docs/spec/ibc/appendices.md @@ -8,7 +8,7 @@ The specification has focused on semantics and functionality of the IBC protocol In defining a standard binary encoding for all the "universal" components, we wish to make use of a standardized library, with efficient serialization and support in multiple languages. We considered two main formats: Ethereum's RLP[[6](./references.md#6)] and Google's Protobuf[[7](./references.md#7)]. We decided for protobuf, as it is more widely supported, is more expressive for different data types, and supports code generation for very efficient (de)serialization codecs. It does have a learning curve and more setup to generate the code from the type specifications, but the ibc data types should not change often and this code generation setup only needs to happen once per language (and can be exposed in a common repo), so this is not a strong counter-argument. Efficiency, expressiveness, and wider support rule in its favor. It is also widely used in gRPC and in many microservice architectures. -The tendermint-specific data structures are encoded with go-codec[[8](./references.md#8)], the native binary encoding used inside of tendermint. Most blockchains define their own formats, and until some universal format for headers and signatures among blockchains emerge, it seems very premature to enforce any encoding here. These are defined as arbitrary byte slices in the protocol, to be parsed in an consensus engine-dependent manner. +The tendermint-specific data structures are encoded with go-amino[[8](./references.md#8)], the native binary encoding used inside of tendermint. Most blockchains define their own formats, and until some universal format for headers and signatures among blockchains emerge, it seems very premature to enforce any encoding here. These are defined as arbitrary byte slices in the protocol, to be parsed in an consensus engine-dependent manner. For the following appendixes, the data structure specifications will be in proto3[[9](./references.md#9)] format. @@ -61,7 +61,7 @@ The IBC protocol does not handle these kinds of errors. They must be handled ind **TODO: clean this all up** -This is a mess now, we need to figure out what formats we use, define go-codec, etc. or just point to the source???? Will do more later, need help here from the tendermint core team. +This is a mess now, we need to figure out what formats we use, define go-amino, etc. or just point to the source???? Will do more later, need help here from the tendermint core team. In order to prove a merkle root, we must fully define the headers, signatures, and validator information returned from the Tendermint consensus engine, as well as the rules by which to verify a header. We also define here the messages used for creating and removing connections to other blockchains as well as how to handle forks. diff --git a/docs/spec/ibc/channels-and-packets.md b/docs/spec/ibc/channels-and-packets.md index faa371eea48b..56ea93b5a418 100644 --- a/docs/spec/ibc/channels-and-packets.md +++ b/docs/spec/ibc/channels-and-packets.md @@ -28,7 +28,7 @@ Every transaction on the same chain already has a well-defined causality relatio For example, an application may wish to allow a single tokenized asset to be transferred between and held on multiple blockchains while preserving fungibility and conservation of supply. The application can mint asset vouchers on chain `B` when a particular IBC packet is committed to chain `B`, and require outgoing sends of that packet on chain `A` to escrow an equal amount of the asset on chain `A` until the vouchers are later redeemed back to chain `A` with an IBC packet in the reverse direction. This ordering guarantee along with correct application logic can ensure that total supply is preserved across both chains and that any vouchers minted on chain `B` can later be redeemed back to chain `A`. -This section provides definitions for packets and channels, a high-level specification of the queue interface, and a list of the necessary proofs. To implement codec-compatible IBC, chain `A` and chain `B` must also use a common encoding format. An example binary encoding format can be found in [Appendix C](appendices.md#appendix-c-merkle-proof-formats). +This section provides definitions for packets and channels, a high-level specification of the queue interface, and a list of the necessary proofs. To implement amino-compatible IBC, chain `A` and chain `B` must also use a common encoding format. An example binary encoding format can be found in [Appendix C](appendices.md#appendix-c-merkle-proof-formats). ### 3.2 Definitions diff --git a/docs/spec/ibc/conclusion.md b/docs/spec/ibc/conclusion.md index 25f0f4e4bbfc..0c4fae18e802 100644 --- a/docs/spec/ibc/conclusion.md +++ b/docs/spec/ibc/conclusion.md @@ -6,4 +6,4 @@ We have demonstrated a secure, performant, and flexible protocol for cross-block This document defines solely a message queue protocol - not the application-level semantics which must sit on top of it to enable asset transfer between two chains. We will shortly release a separate paper on Cosmos IBC that defines the application logic used for direct value transfer as well as routing over the Cosmos hub. That paper builds upon the IBC protocol defined here and provides a first example of how to reason about application logic and global invariants in the context of IBC. -There is a reference implementation of the Cosmos IBC protocol as part of the Cosmos SDK, written in Golang and released under the Apache license. To facilitate implementations in other langauages which are codec-compatible with the Cosmos implementation, the following appendices define exact message and binary encoding formats. +There is a reference implementation of the Cosmos IBC protocol as part of the Cosmos SDK, written in Golang and released under the Apache license. To facilitate implementations in other langauages which are amino-compatible with the Cosmos implementation, the following appendices define exact message and binary encoding formats. diff --git a/docs/spec/ibc/references.md b/docs/spec/ibc/references.md index ad84bb955964..715086e1bcef 100644 --- a/docs/spec/ibc/references.md +++ b/docs/spec/ibc/references.md @@ -24,7 +24,7 @@ [https://developers.google.com/protocol-buffers/](https://developers.google.com/protocol-buffers/) ##### 8: -[https://github.com/tendermint/go-codec](https://github.com/tendermint/go-codec) +[https://github.com/tendermint/go-amino](https://github.com/tendermint/go-amino) ##### 9: [https://developers.google.com/protocol-buffers/docs/proto3](https://developers.google.com/protocol-buffers/docs/proto3)