Merge PR #46: Upgrade to latest SDK version (73700df8c)

This commit is contained in:
Alexander Bezobchuk
2019-06-15 21:48:20 +02:00
committed by GitHub
parent 8fd398ccb0
commit 7d68770d30
7 changed files with 47 additions and 32 deletions

View File

@@ -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)
}

View File

@@ -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,