diff --git a/.github/workflows/e2e-upgrade.yaml b/.github/workflows/e2e-upgrade.yaml index 6c9e8e43c4e..8c9f19a3668 100644 --- a/.github/workflows/e2e-upgrade.yaml +++ b/.github/workflows/e2e-upgrade.yaml @@ -71,7 +71,7 @@ jobs: chain-binary: simd chain-a-tag: v7.0.0 chain-b-tag: v7.0.0 - chain-upgrade-tag: pr-4591 # TODO: update this to a real tag once v8 is released + chain-upgrade-tag: main # TODO: update this to a real tag once v8 is released upgrade-plan-name: "v8" test-entry-point: "TestUpgradeTestSuite" test: "TestV7ToV8ChainUpgrade" diff --git a/e2e/tests/transfer/base_test.go b/e2e/tests/transfer/base_test.go index d2dd81c4659..94efe105d96 100644 --- a/e2e/tests/transfer/base_test.go +++ b/e2e/tests/transfer/base_test.go @@ -106,12 +106,8 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() { }) 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("metadata for IBC denomination exists on chainB", func(t *testing.T) { + s.AssertHumanReadableDenom(ctx, chainB, chainADenom, channelA) }) } diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index 1df81a1f3aa..2e289f10eab 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -721,21 +721,21 @@ func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() { s.Require().NoError(test.WaitForBlocks(ctx, 5, chainA), "failed to wait for blocks") t.Run("upgrade chain", func(t *testing.T) { - govProposalWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) - s.UpgradeChain(ctx, chainA, govProposalWallet, testCfg.UpgradeConfig.PlanName, testCfg.ChainConfigs[0].Tag, testCfg.UpgradeConfig.Tag) + govProposalWallet := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount) + s.UpgradeChain(ctx, chainB, govProposalWallet, testCfg.UpgradeConfig.PlanName, testCfg.ChainConfigs[0].Tag, testCfg.UpgradeConfig.Tag) }) t.Run("update params", func(t *testing.T) { - authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) + authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainB) s.Require().NoError(err) s.Require().NotNil(authority) msg := clienttypes.NewMsgUpdateParams(authority.String(), clienttypes.NewParams(exported.Tendermint, "some-client")) - s.ExecuteGovV1Proposal(ctx, msg, chainA, chainAWallet) + s.ExecuteGovV1Proposal(ctx, msg, chainB, chainBWallet) }) t.Run("query params", func(t *testing.T) { - clientParams, err := s.GetChainGRCPClients(chainA).ClientQueryClient.ClientParams(ctx, &clienttypes.QueryClientParamsRequest{}) + clientParams, err := s.GetChainGRCPClients(chainB).ClientQueryClient.ClientParams(ctx, &clienttypes.QueryClientParamsRequest{}) s.Require().NoError(err) allowedClients := clientParams.Params.AllowedClients @@ -744,6 +744,10 @@ func (s *UpgradeTestSuite) TestV7ToV8ChainUpgrade() { s.Require().Contains(allowedClients, exported.Tendermint) s.Require().Contains(allowedClients, "some-client") }) + + t.Run("query human readable ibc denom", func(t *testing.T) { + s.AssertHumanReadableDenom(ctx, chainB, chainADenom, channelA) + }) } // RegisterInterchainAccount will attempt to register an interchain account on the counterparty chain. diff --git a/e2e/testsuite/grpc_query.go b/e2e/testsuite/grpc_query.go index fb71017aa6e..42afae1501c 100644 --- a/e2e/testsuite/grpc_query.go +++ b/e2e/testsuite/grpc_query.go @@ -279,20 +279,6 @@ 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 @@ -394,3 +380,30 @@ func (s *E2ETestSuite) QueryGranterGrants(ctx context.Context, chain *cosmos.Cos return grants.Grants, 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 +} + +// QueryDenomMetadata queries the metadata for the given denom. +func (s *E2ETestSuite) QueryDenomMetadata(ctx context.Context, chain *cosmos.CosmosChain, denom string) (banktypes.Metadata, error) { + bankClient := s.GetChainGRCPClients(chain).BankQueryClient + queryRequest := &banktypes.QueryDenomMetadataRequest{ + Denom: denom, + } + res, err := bankClient.DenomMetadata(ctx, queryRequest) + if err != nil { + return banktypes.Metadata{}, err + } + return res.Metadata, nil +} diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index a0b2349c686..2e30bccd731 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -322,6 +322,21 @@ func (s *E2ETestSuite) AssertPacketRelayed(ctx context.Context, chain *cosmos.Co s.Require().Empty(commitment) } +// AssertHumanReadableDenom asserts that a human readable denom is present for a given chain. +func (s *E2ETestSuite) AssertHumanReadableDenom(ctx context.Context, chain *cosmos.CosmosChain, counterpartyNativeDenom string, counterpartyChannel ibc.ChannelOutput) { + chainIBCDenom := GetIBCToken(counterpartyNativeDenom, counterpartyChannel.Counterparty.PortID, counterpartyChannel.Counterparty.ChannelID) + + denomMetadata, err := s.QueryDenomMetadata(ctx, chain, chainIBCDenom.IBCDenom()) + s.Require().NoError(err) + + s.Require().Equal(chainIBCDenom.IBCDenom(), denomMetadata.Base, "denom metadata base does not match expected %s: got %s", chainIBCDenom.IBCDenom(), denomMetadata.Base) + expectedName := fmt.Sprintf("%s/%s/%s IBC token", counterpartyChannel.Counterparty.PortID, counterpartyChannel.Counterparty.ChannelID, counterpartyNativeDenom) + s.Require().Equal(expectedName, denomMetadata.Name, "denom metadata name does not match expected %s: got %s", expectedName, denomMetadata.Name) + expectedDisplay := fmt.Sprintf("%s/%s/%s", counterpartyChannel.Counterparty.PortID, counterpartyChannel.Counterparty.ChannelID, counterpartyNativeDenom) + s.Require().Equal(expectedDisplay, denomMetadata.Display, "denom metadata display does not match expected %s: got %s", expectedDisplay, denomMetadata.Display) + s.Require().Equal(strings.ToUpper(counterpartyNativeDenom), denomMetadata.Symbol, "denom metadata symbol does not match expected %s: got %s", strings.ToUpper(counterpartyNativeDenom), denomMetadata.Symbol) +} + // createCosmosChains creates two separate chains in docker containers. // test and can be retrieved with GetChains. func (s *E2ETestSuite) createCosmosChains(chainOptions ChainOptions) (*cosmos.CosmosChain, *cosmos.CosmosChain) { diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index a58ec865f45..5a033980d87 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -58,7 +58,6 @@ func NewKeeper( if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { panic("the IBC transfer module account has not been set") } - // set KeyTable if it has not already been set if !legacySubspace.HasKeyTable() { legacySubspace = legacySubspace.WithKeyTable(types.ParamKeyTable())