Skip to content

Commit

Permalink
test(e2e/accounts): fix build (#21725)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Sep 16, 2024
1 parent ae40e80 commit 924798f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/e2e/accounts/base_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import (
"math/rand"
"testing"

gogoany "github.com/cosmos/gogoproto/types/any"

"cosmossdk.io/simapp"
baseaccountv1 "cosmossdk.io/x/accounts/defaults/base/v1"
"cosmossdk.io/x/bank/testutil"
banktypes "cosmossdk.io/x/bank/types"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -22,7 +26,7 @@ func TestBaseAccount(t *testing.T) {
ctx := sdk.NewContext(app.CommitMultiStore(), false, app.Logger())

_, baseAccountAddr, err := ak.Init(ctx, "base", accCreator, &baseaccountv1.MsgInit{
PubKey: privKey.PubKey().Bytes(),
PubKey: toAnyPb(t, privKey.PubKey()),
}, nil)
require.NoError(t, err)

Expand Down Expand Up @@ -80,3 +84,13 @@ func bechify(t *testing.T, app *simapp.SimApp, addr []byte) string {
func fundAccount(t *testing.T, app *simapp.SimApp, ctx sdk.Context, addr sdk.AccAddress, amt string) {
require.NoError(t, testutil.FundAccount(ctx, app.BankKeeper, addr, coins(t, amt)))
}

func toAnyPb(t *testing.T, pm gogoproto.Message) *codectypes.Any {
t.Helper()
if gogoproto.MessageName(pm) == gogoproto.MessageName(&gogoany.Any{}) {
t.Fatal("no")
}
pb, err := codectypes.NewAnyWithValue(pm)
require.NoError(t, err)
return pb
}

0 comments on commit 924798f

Please sign in to comment.