From 7d68770d30cfd818281570fb82c13f18af27d67e Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Sat, 15 Jun 2019 21:48:20 +0200 Subject: [PATCH] Merge PR #46: Upgrade to latest SDK version (73700df8c) --- .pending/breaking/rest/The-auth-accounts-ad | 2 ++ app/sim_test.go | 5 ++--- cmd/gaiacli/main.go | 11 ++++----- go.mod | 2 +- go.sum | 11 +++++++-- lcd_test/helpers.go | 25 ++++++++++++--------- lcd_test/helpers_test.go | 23 ++++++++++--------- 7 files changed, 47 insertions(+), 32 deletions(-) create mode 100644 .pending/breaking/rest/The-auth-accounts-ad diff --git a/.pending/breaking/rest/The-auth-accounts-ad b/.pending/breaking/rest/The-auth-accounts-ad new file mode 100644 index 000000000..32b88a52f --- /dev/null +++ b/.pending/breaking/rest/The-auth-accounts-ad @@ -0,0 +1,2 @@ +The `/auth/accounts/{address}` now returns a `height` in the response. The +account is now nested under `account`. diff --git a/app/sim_test.go b/app/sim_test.go index 9d1b21123..3ca603224 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -26,7 +26,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/genaccounts" authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" "github.com/cosmos/cosmos-sdk/x/bank" - banksim "github.com/cosmos/cosmos-sdk/x/bank/simulation" distr "github.com/cosmos/cosmos-sdk/x/distribution" distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" "github.com/cosmos/cosmos-sdk/x/gov" @@ -605,7 +604,7 @@ func testAndRunTxs(app *GaiaApp) []simulation.WeightedOperation { }) return v }(nil), - banksim.SimulateMsgSend(app.accountKeeper, app.bankKeeper), + bank.SimulateMsgSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { @@ -616,7 +615,7 @@ func testAndRunTxs(app *GaiaApp) []simulation.WeightedOperation { }) return v }(nil), - banksim.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), + bank.SimulateSingleInputMsgMultiSend(app.accountKeeper, app.bankKeeper), }, { func(_ *rand.Rand) int { diff --git a/cmd/gaiacli/main.go b/cmd/gaiacli/main.go index 0e9247b2e..8fa636ba3 100644 --- a/cmd/gaiacli/main.go +++ b/cmd/gaiacli/main.go @@ -9,11 +9,11 @@ import ( "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" "github.com/cosmos/cosmos-sdk/x/bank" bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli" @@ -92,8 +92,8 @@ func queryCmd(cdc *amino.Codec) *cobra.Command { client.LineBreak, rpc.ValidatorCommand(cdc), rpc.BlockCommand(), - tx.SearchTxCmd(cdc), - tx.QueryTxCmd(cdc), + authcmd.QueryTxsByTagsCmd(cdc), + authcmd.QueryTxCmd(cdc), client.LineBreak, ) @@ -115,8 +115,8 @@ func txCmd(cdc *amino.Codec) *cobra.Command { authcmd.GetSignCommand(cdc), authcmd.GetMultiSignCommand(cdc), client.LineBreak, - tx.GetBroadcastCommand(cdc), - tx.GetEncodeCommand(cdc), + authcmd.GetBroadcastCommand(cdc), + authcmd.GetEncodeCommand(cdc), client.LineBreak, ) @@ -142,6 +142,7 @@ func txCmd(cdc *amino.Codec) *cobra.Command { // NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go func registerRoutes(rs *lcd.RestServer) { client.RegisterRoutes(rs.CliCtx, rs.Mux) + authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) } diff --git a/go.mod b/go.mod index 6477998f1..47418eb79 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190612155747-8c89023e9f7c + github.com/cosmos/cosmos-sdk v0.28.2-0.20190615141739-ac2e765607a6 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/google/gofuzz v1.0.0 // indirect github.com/gorilla/mux v1.7.2 // indirect diff --git a/go.sum b/go.sum index 22c771d56..2fb92dd6e 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,12 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190612155747-8c89023e9f7c h1:3kwnK0McUpltk1+Hn5ZX0lQ/NWZ+u3JWeAbf5Qtodnc= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190612155747-8c89023e9f7c/go.mod h1:MvaJDmjgAK7X1rTnpk8+c6tUFfIZ++iuNCp2sUWzprM= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190615123411-73700df8c39d h1:gZxkU0oeSSSl0U4TfvRf7FTEIWwOBSRTMXLN3Qq9w58= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190615123411-73700df8c39d/go.mod h1:MvaJDmjgAK7X1rTnpk8+c6tUFfIZ++iuNCp2sUWzprM= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190615141739-ac2e765607a6 h1:PI7DItlX43pOwKjkOdZq9syqoeN9XMv+sPwjUDPGdcY= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190615141739-ac2e765607a6/go.mod h1:MvaJDmjgAK7X1rTnpk8+c6tUFfIZ++iuNCp2sUWzprM= +github.com/cosmos/cosmos-sdk v0.35.0 h1:EPeie1aKHwnXtTzKggvabG7aAPN+DDmju2xquvjFwao= +github.com/cosmos/cosmos-sdk v0.35.0/go.mod h1:ruF+G4D7hRf34uzZQvf/SIja9fsIThU5D7GirwTMQ9I= github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -135,6 +139,7 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/otiai10/copy v0.0.0-20180813032824-7e9a647135a1/go.mod h1:pXzZSDlN+HPzSdyIBnKNN9ptD9Hx7iZMWIJPTwo4FPE= github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA= github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -216,8 +221,10 @@ github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tendermint/iavl v0.12.1/go.mod h1:EoKMMv++tDOL5qKKVnoIqtVPshRrEPeJ0WsgDOLAauM= github.com/tendermint/iavl v0.12.2 h1:Ls5p5VINCM1HRT9g5Vvs2zmDOCU/CCIvIHzd/pZ8P0E= github.com/tendermint/iavl v0.12.2/go.mod h1:EoKMMv++tDOL5qKKVnoIqtVPshRrEPeJ0WsgDOLAauM= github.com/tendermint/tendermint v0.31.5 h1:vTet8tCq3B9/J9Yo11dNZ8pOB7NtSy++bVSfkP4KzR4= diff --git a/lcd_test/helpers.go b/lcd_test/helpers.go index 234927345..6fb05ef3c 100644 --- a/lcd_test/helpers.go +++ b/lcd_test/helpers.go @@ -3,6 +3,13 @@ package lcdtest import ( "bytes" "fmt" + "io/ioutil" + "net" + "os" + "path/filepath" + "sort" + "strings" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/codec" @@ -11,37 +18,34 @@ import ( "github.com/cosmos/cosmos-sdk/tests" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth" + authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" "github.com/cosmos/cosmos-sdk/x/auth/genaccounts" "github.com/cosmos/cosmos-sdk/x/crisis" distr "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/staking" - gapp "github.com/cosmos/gaia/app" + "github.com/pkg/errors" "github.com/spf13/viper" + "github.com/tendermint/go-amino" tmcfg "github.com/tendermint/tendermint/config" - "github.com/tendermint/tendermint/libs/cli" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - "io/ioutil" - "net" - "os" - "path/filepath" - "sort" - "strings" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/secp256k1" + "github.com/tendermint/tendermint/libs/cli" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" nm "github.com/tendermint/tendermint/node" "github.com/tendermint/tendermint/p2p" pvm "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" + ctypes "github.com/tendermint/tendermint/rpc/core/types" tmrpc "github.com/tendermint/tendermint/rpc/lib/server" tmtypes "github.com/tendermint/tendermint/types" + + gapp "github.com/cosmos/gaia/app" ) // TODO: Make InitializeTestLCD safe to call in multiple tests at the same time @@ -331,6 +335,7 @@ func startLCD(logger log.Logger, listenAddr string, cdc *codec.Codec) (net.Liste // NOTE: If making updates here also update cmd/gaia/cmd/gaiacli/main.go func registerRoutes(rs *lcd.RestServer) { client.RegisterRoutes(rs.CliCtx, rs.Mux) + authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) gapp.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) } diff --git a/lcd_test/helpers_test.go b/lcd_test/helpers_test.go index ea3f4cfb8..35fdc837e 100644 --- a/lcd_test/helpers_test.go +++ b/lcd_test/helpers_test.go @@ -9,20 +9,17 @@ import ( "strings" "testing" - "github.com/spf13/viper" - "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/client" clientkeys "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" - clienttx "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys" crkeys "github.com/cosmos/cosmos-sdk/crypto/keys" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/rest" "github.com/cosmos/cosmos-sdk/x/auth" + authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" + authcutils "github.com/cosmos/cosmos-sdk/x/auth/client/utils" bankrest "github.com/cosmos/cosmos-sdk/x/bank/client/rest" distrrest "github.com/cosmos/cosmos-sdk/x/distribution/client/rest" "github.com/cosmos/cosmos-sdk/x/gov" @@ -34,7 +31,10 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingrest "github.com/cosmos/cosmos-sdk/x/staking/client/rest" + "github.com/spf13/viper" + "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/p2p" + ctypes "github.com/tendermint/tendermint/rpc/core/types" ) @@ -268,10 +268,11 @@ func deleteKey(t *testing.T, port, name, password string) { func getAccount(t *testing.T, port string, addr sdk.AccAddress) auth.Account { res, body := Request(t, port, "GET", fmt.Sprintf("/auth/accounts/%s", addr.String()), nil) require.Equal(t, http.StatusOK, res.StatusCode, body) - var acc auth.Account - err := cdc.UnmarshalJSON([]byte(body), &acc) - require.Nil(t, err) - return acc + + var acc authrest.AccountWithHeight + require.Nil(t, cdc.UnmarshalJSON([]byte(body), &acc)) + + return acc.Account } // ---------------------------------------------------------------------- @@ -280,7 +281,7 @@ func getAccount(t *testing.T, port string, addr sdk.AccAddress) auth.Account { // POST /tx/broadcast Send a signed Tx func doBroadcast(t *testing.T, port string, tx auth.StdTx) (*http.Response, string) { - txReq := clienttx.BroadcastReq{Tx: tx, Mode: "block"} + txReq := authrest.BroadcastReq{Tx: tx, Mode: "block"} req, err := cdc.MarshalJSON(txReq) require.Nil(t, err) @@ -409,7 +410,7 @@ func signAndBroadcastGenTx( require.Nil(t, err) txbldr := auth.NewTxBuilder( - utils.GetTxEncoder(cdc), + authcutils.GetTxEncoder(cdc), acc.GetAccountNumber(), acc.GetSequence(), tx.Fee.Gas,