Bump SDK commit to the latest master (#239)

* Bump go.{mod,sum}

* Update client package imports

* Update app

* Fix tests

* format

* Fix CLI test
This commit is contained in:
Alexander Bezobchuk
2019-12-30 09:04:39 -05:00
committed by Federico Kunze
parent ebfbd95dc0
commit b7839f276a
12 changed files with 84 additions and 95 deletions

View File

@@ -10,7 +10,7 @@ import (
"strings"
"testing"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
clientkeys "github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/crypto/keys"
@@ -266,7 +266,7 @@ func doTransferWithGas(
kb2 := crkeys.NewInMemory()
receiveInfo, _, err := kb2.CreateMnemonic(
"receive_address", crkeys.English, client.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"),
"receive_address", crkeys.English, clientkeys.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"),
)
require.Nil(t, err)
@@ -274,7 +274,7 @@ func doTransferWithGas(
acc := getAccount(t, port, addr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := addr.String()
baseReq := rest.NewBaseReq(
@@ -314,12 +314,12 @@ func doTransferWithGasAccAuto(
acc := getAccount(t, port, addr)
receiveInfo, _, err := kb2.CreateMnemonic(
"receive_address", crkeys.English, client.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"),
"receive_address", crkeys.English, clientkeys.DefaultKeyPass, crkeys.SigningAlgo("secp256k1"),
)
require.Nil(t, err)
receiveAddr = sdk.AccAddress(receiveInfo.GetPubKey().Address())
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := addr.String()
baseReq := rest.NewBaseReq(
@@ -351,7 +351,7 @@ func signAndBroadcastGenTx(
gasAdjustment float64, simulate bool, kb crkeys.Keybase,
) (resp *http.Response, body string) {
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
var tx auth.StdTx
err := cdc.UnmarshalJSON([]byte(genTx), &tx)
@@ -370,7 +370,7 @@ func signAndBroadcastGenTx(
nil,
).WithKeybase(kb)
signedTx, err := txbldr.SignStdTx(name, client.DefaultKeyPass, tx, false)
signedTx, err := txbldr.SignStdTx(name, clientkeys.DefaultKeyPass, tx, false)
require.NoError(t, err)
return doBroadcast(t, port, signedTx)
@@ -390,7 +390,7 @@ func doDelegate(
acc := getAccount(t, port, delAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -408,7 +408,7 @@ func doDelegate(
require.Equal(t, http.StatusOK, resp.StatusCode, body)
// sign and broadcast
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -428,7 +428,7 @@ func doUndelegate(
acc := getAccount(t, port, delAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -445,7 +445,7 @@ func doUndelegate(
resp, body := Request(t, port, "POST", fmt.Sprintf("/staking/delegators/%s/unbonding_delegations", delAddr), req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -465,7 +465,7 @@ func doBeginRedelegation(
acc := getAccount(t, port, delAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -483,7 +483,7 @@ func doBeginRedelegation(
resp, body := Request(t, port, "POST", fmt.Sprintf("/staking/delegators/%s/redelegations", delAddr), req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -679,7 +679,7 @@ func doSubmitProposal(
acc := getAccount(t, port, proposerAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -699,7 +699,7 @@ func doSubmitProposal(
resp, body := Request(t, port, "POST", "/gov/proposals", req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -718,7 +718,7 @@ func doSubmitParamChangeProposal(
acc := getAccount(t, port, proposerAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -739,7 +739,7 @@ func doSubmitParamChangeProposal(
resp, body := Request(t, port, "POST", "/gov/proposals/param_change", req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -758,7 +758,7 @@ func doSubmitCommunityPoolSpendProposal(
acc := getAccount(t, port, proposerAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -778,7 +778,7 @@ func doSubmitCommunityPoolSpendProposal(
resp, body := Request(t, port, "POST", "/gov/proposals/community_pool_spend", req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -853,7 +853,7 @@ func doDeposit(
acc := getAccount(t, port, proposerAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -869,7 +869,7 @@ func doDeposit(
resp, body := Request(t, port, "POST", fmt.Sprintf("/gov/proposals/%d/deposits", proposalID), req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -912,7 +912,7 @@ func doVote(
acc := getAccount(t, port, proposerAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -928,7 +928,7 @@ func doVote(
resp, body := Request(t, port, "POST", fmt.Sprintf("/gov/proposals/%d/votes", proposalID), req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, kb)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, kb)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -1068,7 +1068,7 @@ func doUnjail(
acc := getAccount(t, port, sdk.AccAddress(valAddr.Bytes()))
from := acc.GetAddress().String()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
baseReq := rest.NewBaseReq(from, "", chainID, "", "", 1, 1, fees, nil, false)
ur := slashingrest.UnjailReq{
@@ -1080,7 +1080,7 @@ func doUnjail(
resp, body := Request(t, port, "POST", fmt.Sprintf("/slashing/validators/%s/unjail", valAddr.String()), req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, nil)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, nil)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse
@@ -1100,7 +1100,7 @@ func doWithdrawDelegatorAllRewards(
acc := getAccount(t, port, delegatorAddr)
accnum := acc.GetAccountNumber()
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
chainID := viper.GetString(flags.FlagChainID)
from := acc.GetAddress().String()
baseReq := rest.NewBaseReq(from, "", chainID, "", "", accnum, sequence, fees, nil, false)
@@ -1113,7 +1113,7 @@ func doWithdrawDelegatorAllRewards(
resp, body := Request(t, port, "POST", fmt.Sprintf("/distribution/delegators/%s/rewards", delegatorAddr), req)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, client.DefaultGasAdjustment, false, nil)
resp, body = signAndBroadcastGenTx(t, port, name, body, acc, flags.DefaultGasAdjustment, false, nil)
require.Equal(t, http.StatusOK, resp.StatusCode, body)
var txResp sdk.TxResponse