Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(bank): migrate bech32 encoding #15567

Merged
merged 25 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* The signature of `NewSigVerificationDecorator` has been changed to accept a `x/tx/signing.HandlerMap`.
* The signature of `VerifySignature` has been changed to accept a `x/tx/signing.HandlerMap` and other structs from `x/tx` as arguments.
* The signature of `NewTxConfigWithTextual` has been deprecated and its signature changed to accept a `SignModeOptions`.
* (x/bank) [#15567](https://github.com/cosmos/cosmos-sdk/pull/15567) `GenesisBalance.GetAddress` now returns a string instead of `sdk.AccAddress`
* `MsgSendExec` test helper function now takes a address.Codec
* (x/genutil) [#15567](https://github.com/cosmos/cosmos-sdk/pull/15567) `CollectGenTxsCmd` & `GenTxCmd` takes a address.Codec to be able to decode addresses
* (x/genutil) [#15999](https://github.com/cosmos/cosmos-sdk/pull/15999) Genutil now takes the `GenesisTxHanlder` interface instead of deliverTx. The interface is implemented on baseapp
* (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16040) Remove unused aliases in math.go
* (x/gov) [#16106](https://github.com/cosmos/cosmos-sdk/pull/16106) Remove gRPC query methods from Keeper
Expand All @@ -215,6 +218,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Remove: errors unused errors

* (sims) [#16155](https://github.com/cosmos/cosmos-sdk/pull/16155)
* `simulation.NewOperationMsg` now marshals the operation msg as proto bytes instead of legacy amino JSON bytes.
* `simulation.NewOperationMsg` is now 2-arity instead of 3-arity with the obsolete argument `codec.ProtoCodec` removed.
* The field `OperationMsg.Msg` is now of type `[]byte` instead of `json.RawMessage`.
* (cli) [#16209](https://github.com/cosmos/cosmos-sdk/pull/16209) Add API `StartCmdWithOptions` to create customized start command.
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved

* `simulation.NewOperationMsg` now marshals the operation msg as proto bytes instead of legacy amino JSON bytes.
* `simulation.NewOperationMsg` is now 2-arity instead of 3-arity with the obsolete argument `codec.ProtoCodec` removed.
Expand Down
12 changes: 5 additions & 7 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import (
"io"
"os"

cmtcfg "github.com/cometbft/cometbft/config"
dbm "github.com/cosmos/cosmos-db"
"github.com/spf13/cobra"
"github.com/spf13/viper"

"cosmossdk.io/log"
"cosmossdk.io/simapp"
"cosmossdk.io/simapp/params"
confixcmd "cosmossdk.io/tools/confix/cmd"
rosettaCmd "cosmossdk.io/tools/rosetta/cmd"
cmtcfg "github.com/cometbft/cometbft/config"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
"github.com/cosmos/cosmos-sdk/client/debug"
Expand All @@ -39,6 +36,8 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

// NewRootCmd creates a new root command for simd. It is called once in the
Expand Down Expand Up @@ -201,12 +200,11 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, b
rootCmd.AddCommand(
rpc.StatusCommand(),
genesisCommand(encodingConfig, basicManager),
queryCommand(),
txCommand(),
queryCommand(),
keys.Commands(simapp.DefaultNodeHome),
)

// add rosetta
rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec))
}

Expand Down
34 changes: 20 additions & 14 deletions tests/e2e/auth/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec/address"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
Expand Down Expand Up @@ -143,7 +143,7 @@ func (s *E2ETestSuite) TestCLISignGenOnly() {
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
}
generatedStd, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.NewSendTxCmd(), args)
generatedStd, err := clitestutil.ExecTestCLICmd(val.ClientCtx, bank.NewSendTxCmd(addresscodec.NewBech32Codec("cosmos")), args)
s.Require().NoError(err)
opFile := testutil.WriteToNewTempFile(s.T(), generatedStd.String())
defer opFile.Close()
Expand Down Expand Up @@ -691,7 +691,7 @@ func (s *E2ETestSuite) TestCLISendGenerateSignAndBroadcast() {
s.Require().NoError(err)
s.Require().Equal(0, len(sigs))

resp, err := clitestutil.QueryBalancesExec(val1.ClientCtx, val1.Address)
resp, err := clitestutil.QueryBalancesExec(val1.ClientCtx, val1.Address, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)

var balRes banktypes.QueryAllBalancesResponse
Expand Down Expand Up @@ -756,7 +756,7 @@ func (s *E2ETestSuite) TestCLISendGenerateSignAndBroadcast() {
s.Require().NoError(s.network.WaitForNextBlock())

// Ensure foo has right amount of funds
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, val1.Address)
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, val1.Address, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)

err = val1.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &balRes)
Expand All @@ -778,7 +778,7 @@ func (s *E2ETestSuite) TestCLISendGenerateSignAndBroadcast() {

// Ensure destiny account state
err = s.network.RetryForBlocks(func() error {
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, addr)
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, addr, addresscodec.NewBech32Codec("cosmos"))
return err
}, 3)
s.Require().NoError(err)
Expand All @@ -788,7 +788,7 @@ func (s *E2ETestSuite) TestCLISendGenerateSignAndBroadcast() {
s.Require().Equal(sendTokens.Amount, balRes.Balances.AmountOf(s.cfg.BondDenom))

// Ensure origin account state
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, val1.Address)
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, val1.Address, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)

err = val1.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &balRes)
Expand Down Expand Up @@ -826,6 +826,7 @@ func (s *E2ETestSuite) TestCLIMultisignInsufficientCosigners() {
sdk.NewCoins(
sdk.NewInt64Coin(s.cfg.BondDenom, 5),
),
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -909,7 +910,7 @@ func (s *E2ETestSuite) TestCLIMultisignSortSignatures() {

addr, err := multisigRecord.GetAddress()
s.Require().NoError(err)
resp, err := clitestutil.QueryBalancesExec(val1.ClientCtx, addr)
resp, err := clitestutil.QueryBalancesExec(val1.ClientCtx, addr, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)

var balRes banktypes.QueryAllBalancesResponse
Expand All @@ -927,7 +928,7 @@ func (s *E2ETestSuite) TestCLIMultisignSortSignatures() {
s.Require().NoError(err)
s.Require().NoError(s.network.WaitForNextBlock())

resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, addr)
resp, err = clitestutil.QueryBalancesExec(val1.ClientCtx, addr, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)

err = val1.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &balRes)
Expand All @@ -943,6 +944,7 @@ func (s *E2ETestSuite) TestCLIMultisignSortSignatures() {
sdk.NewCoins(
sdk.NewInt64Coin(s.cfg.BondDenom, 5),
),
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -1020,6 +1022,7 @@ func (s *E2ETestSuite) TestSignWithMultisig() {
sdk.NewCoins(
sdk.NewInt64Coin(s.cfg.BondDenom, 5),
),
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -1067,7 +1070,7 @@ func (s *E2ETestSuite) TestCLIMultisign() {

var balRes banktypes.QueryAllBalancesResponse
err = s.network.RetryForBlocks(func() error {
resp, err := clitestutil.QueryBalancesExec(val1.ClientCtx, addr)
resp, err := clitestutil.QueryBalancesExec(val1.ClientCtx, addr, addresscodec.NewBech32Codec("cosmos"))
if err != nil {
return err
}
Expand All @@ -1084,6 +1087,7 @@ func (s *E2ETestSuite) TestCLIMultisign() {
sdk.NewCoins(
sdk.NewInt64Coin(s.cfg.BondDenom, 5),
),
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -1177,6 +1181,7 @@ func (s *E2ETestSuite) TestSignBatchMultisig() {
sdk.NewCoins(
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(1)),
),
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -1242,6 +1247,7 @@ func (s *E2ETestSuite) TestMultisignBatch() {
sdk.NewCoins(
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(1)),
),
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand All @@ -1254,7 +1260,7 @@ func (s *E2ETestSuite) TestMultisignBatch() {
defer filename.Close()
val.ClientCtx.HomeDir = strings.Replace(val.ClientCtx.HomeDir, "simd", "simcli", 1)

queryResJSON, err := authclitestutil.QueryAccountExec(val.ClientCtx, addr, address.NewBech32Codec("cosmos"))
queryResJSON, err := authclitestutil.QueryAccountExec(val.ClientCtx, addr, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)
var account sdk.AccountI
s.Require().NoError(val.ClientCtx.Codec.UnmarshalInterfaceJSON(queryResJSON.Bytes(), &account))
Expand Down Expand Up @@ -1322,7 +1328,7 @@ func (s *E2ETestSuite) TestGetAccountCmd() {
s.Run(tc.name, func() {
clientCtx := val.ClientCtx

out, err := authclitestutil.QueryAccountExec(clientCtx, tc.address, address.NewBech32Codec("cosmos"))
out, err := authclitestutil.QueryAccountExec(clientCtx, tc.address, addresscodec.NewBech32Codec("cosmos"))
if tc.expectErr {
s.Require().Error(err)
s.Require().NotEqual("internal", err.Error())
Expand Down Expand Up @@ -1618,7 +1624,7 @@ func (s *E2ETestSuite) TestSignWithMultiSignersAminoJSON() {
require.Equal(uint32(0), txRes.Code, txRes.RawLog)

// Make sure the addr1's balance got funded.
queryResJSON, err := clitestutil.QueryBalancesExec(val0.ClientCtx, addr1)
queryResJSON, err := clitestutil.QueryBalancesExec(val0.ClientCtx, addr1, addresscodec.NewBech32Codec("cosmos"))
require.NoError(err)
var queryRes banktypes.QueryAllBalancesResponse
err = val0.ClientCtx.Codec.UnmarshalJSON(queryResJSON.Bytes(), &queryRes)
Expand Down Expand Up @@ -1950,11 +1956,11 @@ func (s *E2ETestSuite) createBankMsg(val *network.Validator, toAddr sdk.AccAddre
}

flags = append(flags, extraFlags...)
return clitestutil.MsgSendExec(val.ClientCtx, val.Address, toAddr, amount, flags...)
return clitestutil.MsgSendExec(val.ClientCtx, val.Address, toAddr, amount, addresscodec.NewBech32Codec("cosmos"), flags...)
}

func (s *E2ETestSuite) getBalances(clientCtx client.Context, addr sdk.AccAddress, denom string) math.Int {
resp, err := clitestutil.QueryBalancesExec(clientCtx, addr)
resp, err := clitestutil.QueryBalancesExec(clientCtx, addr, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)

var balRes banktypes.QueryAllBalancesResponse
Expand Down
9 changes: 6 additions & 3 deletions tests/e2e/authz/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// without this import amino json encoding will fail when resolving any types
_ "cosmossdk.io/api/cosmos/authz/v1beta1"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec/address"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil"
Expand Down Expand Up @@ -149,7 +149,7 @@ func (s *E2ETestSuite) msgSendExec(grantee sdk.AccAddress) {
val.ClientCtx,
val.Address,
grantee,
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(200))), addresscodec.NewBech32Codec("cosmos"), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
)
Expand Down Expand Up @@ -308,7 +308,7 @@ func (s *E2ETestSuite) TestCmdRevokeAuthorizations() {
for _, tc := range testCases {
tc := tc
s.Run(tc.name, func() {
cmd := cli.NewCmdRevokeAuthorization(address.NewBech32Codec("cosmos"))
cmd := cli.NewCmdRevokeAuthorization(addresscodec.NewBech32Codec("cosmos"))
clientCtx := val.ClientCtx

out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
Expand Down Expand Up @@ -501,6 +501,7 @@ func (s *E2ETestSuite) TestNewExecGrantAuthorized() {
val.Address,
grantee,
tokens,
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down Expand Up @@ -615,6 +616,7 @@ func (s *E2ETestSuite) TestExecSendAuthzWithAllowList() {
val.Address,
allowedAddr,
tokens,
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand All @@ -629,6 +631,7 @@ func (s *E2ETestSuite) TestExecSendAuthzWithAllowList() {
val.Address,
notAllowedAddr,
tokens,
addresscodec.NewBech32Codec("cosmos"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down
11 changes: 6 additions & 5 deletions tests/e2e/bank/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/testutil"

"github.com/cosmos/cosmos-sdk/client/flags"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -153,7 +154,7 @@ func (s *E2ETestSuite) TestGetBalancesCmd() {
tc := tc

s.Run(tc.name, func() {
cmd := cli.GetBalancesCmd()
cmd := cli.GetBalancesCmd(addresscodec.NewBech32Codec("cosmos"))
out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, tc.args)

if tc.expectErr {
Expand Down Expand Up @@ -384,7 +385,7 @@ func (s *E2ETestSuite) TestNewSendTxCmdGenOnly() {
fmt.Sprintf("--%s=true", flags.FlagGenerateOnly),
}

bz, err := clitestutil.MsgSendExec(clientCtx, from, to, amount, args...)
bz, err := clitestutil.MsgSendExec(clientCtx, from, to, amount, addresscodec.NewBech32Codec("cosmos"), args...)
s.Require().NoError(err)
tx, err := s.cfg.TxConfig.TxJSONDecoder()(bz.Bytes())
s.Require().NoError(err)
Expand Down Expand Up @@ -413,7 +414,7 @@ func (s *E2ETestSuite) TestNewSendTxCmdDryRun() {
r, w, _ := os.Pipe()
os.Stderr = w

_, err := clitestutil.MsgSendExec(clientCtx, from, to, amount, args...)
_, err := clitestutil.MsgSendExec(clientCtx, from, to, amount, addresscodec.NewBech32Codec("cosmos"), args...)
s.Require().NoError(err)

w.Close()
Expand Down Expand Up @@ -511,7 +512,7 @@ func (s *E2ETestSuite) TestNewSendTxCmd() {
s.Run(tc.name, func() {
clientCtx := val.ClientCtx

bz, err := clitestutil.MsgSendExec(clientCtx, tc.from, tc.to, tc.amount, tc.args...)
bz, err := clitestutil.MsgSendExec(clientCtx, tc.from, tc.to, tc.amount, addresscodec.NewBech32Codec("cosmos"), tc.args...)
if tc.expectErr {
s.Require().Error(err)
} else {
Expand Down Expand Up @@ -674,5 +675,5 @@ func MsgMultiSendExec(clientCtx client.Context, from sdk.AccAddress, to []sdk.Ac
args = append(args, amount.String())
args = append(args, extraArgs...)

return clitestutil.ExecTestCLICmd(clientCtx, cli.NewMultiSendTxCmd(), args)
return clitestutil.ExecTestCLICmd(clientCtx, cli.NewMultiSendTxCmd(addresscodec.NewBech32Codec("cosmos")), args)
}
3 changes: 2 additions & 1 deletion tests/e2e/distribution/withdraw_all_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/client/flags"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil"
Expand Down Expand Up @@ -63,7 +64,7 @@ func (s *WithdrawAllTestSuite) TestNewWithdrawAllRewardsGenerateOnly() {
val.ClientCtx,
val.Address,
newAddr,
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(2000))), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(2000))), addresscodec.NewBech32Codec("cosmos"), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
)
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/gov/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/client/flags"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
"github.com/cosmos/cosmos-sdk/testutil/network"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -352,7 +353,7 @@ func (s *E2ETestSuite) TestNewCmdCancelProposal() {
var balRes banktypes.QueryAllBalancesResponse
var newBalance banktypes.QueryAllBalancesResponse
if !tc.expectErr && tc.expectedCode == 0 {
resp, err := clitestutil.QueryBalancesExec(clientCtx, val.Address)
resp, err := clitestutil.QueryBalancesExec(clientCtx, val.Address, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)
err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &balRes)
s.Require().NoError(err)
Expand All @@ -368,7 +369,7 @@ func (s *E2ETestSuite) TestNewCmdCancelProposal() {
s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, resp.TxHash, tc.expectedCode))

if !tc.expectErr && tc.expectedCode == 0 {
resp, err := clitestutil.QueryBalancesExec(clientCtx, val.Address)
resp, err := clitestutil.QueryBalancesExec(clientCtx, val.Address, addresscodec.NewBech32Codec("cosmos"))
s.Require().NoError(err)
err = val.ClientCtx.Codec.UnmarshalJSON(resp.Bytes(), &newBalance)
s.Require().NoError(err)
Expand Down
Loading