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

e2e: check that IBC tokens on destination chain have metadata #4642

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
10 changes: 10 additions & 0 deletions e2e/tests/transfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() {
s.Require().Equal(expected, actualBalance.Int64())
})

if testvalues.TokenMetadataFeatureReleases.IsSupported(chainBVersion) {
t.Run("metadata for token exists on chainB", func(t *testing.T) {
balances, err := s.QueryAllBalances(ctx, chainB, chainBAddress, true)
s.Require().NoError(err)

// balance for IBC token returns a human-readable denomination
s.Require().Equal(chainBIBCToken.GetFullDenomPath(), balances[1].Denom)
})
}

t.Run("non-native IBC token transfer from chainB to chainA, receiver is source of tokens", func(t *testing.T) {
transferTxResp := s.Transfer(ctx, chainB, chainBWallet, channelA.Counterparty.PortID, channelA.Counterparty.ChannelID, testvalues.DefaultTransferAmount(chainBIBCToken.IBCDenom()), chainBAddress, chainAAddress, s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxSuccess(transferTxResp)
Expand Down
17 changes: 17 additions & 0 deletions e2e/testsuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
grouptypes "github.com/cosmos/cosmos-sdk/x/group"
Expand Down Expand Up @@ -47,6 +48,7 @@ type GRPCClients struct {
// InterTxQueryClient intertxtypes.QueryClient

// SDK query clients
BankQueryClient banktypes.QueryClient
GovQueryClient govtypesv1beta1.QueryClient
GovQueryClientV1 govtypesv1.QueryClient
GroupsQueryClient grouptypes.QueryClient
Expand Down Expand Up @@ -86,6 +88,7 @@ func (s *E2ETestSuite) InitGRPCClients(chain *cosmos.CosmosChain) {
ICAControllerQueryClient: controllertypes.NewQueryClient(grpcConn),
ICAHostQueryClient: hosttypes.NewQueryClient(grpcConn),
// InterTxQueryClient: intertxtypes.NewQueryClient(grpcConn),
BankQueryClient: banktypes.NewQueryClient(grpcConn),
GovQueryClient: govtypesv1beta1.NewQueryClient(grpcConn),
GovQueryClientV1: govtypesv1.NewQueryClient(grpcConn),
GroupsQueryClient: grouptypes.NewQueryClient(grpcConn),
Expand Down Expand Up @@ -276,6 +279,20 @@ func (s *E2ETestSuite) QueryCounterPartyPayee(ctx context.Context, chain ibc.Cha
return res.CounterpartyPayee, nil
}

// QueryBalances returns all the balances on the given chain for the provided address.
func (s *E2ETestSuite) QueryAllBalances(ctx context.Context, chain ibc.Chain, address string, resolveDenom bool) (sdk.Coins, error) {
queryClient := s.GetChainGRCPClients(chain).BankQueryClient
res, err := queryClient.AllBalances(ctx, &banktypes.QueryAllBalancesRequest{
Address: address,
ResolveDenom: resolveDenom,
})
if err != nil {
return sdk.Coins{}, err
}

return res.Balances, nil
}

// QueryProposalV1Beta1 queries the governance proposal on the given chain with the given proposal ID.
func (s *E2ETestSuite) QueryProposalV1Beta1(ctx context.Context, chain ibc.Chain, proposalID uint64) (govtypesv1beta1.Proposal, error) {
queryClient := s.GetChainGRCPClients(chain).GovQueryClient
Expand Down
5 changes: 5 additions & 0 deletions e2e/testvalues/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ func SolomachineClientID(id int) string {
return fmt.Sprintf("06-solomachine-%d", id)
}

// TokenMetadataFeatureReleases represents the releases the token metadata was released in.
var TokenMetadataFeatureReleases = semverutil.FeatureReleases{
MajorVersion: "v8",
}

// GovGenesisFeatureReleases represents the releases the governance module genesis
// was upgraded from v1beta1 to v1.
var GovGenesisFeatureReleases = semverutil.FeatureReleases{
Expand Down
Loading