Skip to content

Commit

Permalink
chore: moving fee queries to E2ETestSuite (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan authored Aug 19, 2022
1 parent 30dd6a9 commit 995b647
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 62 deletions.
31 changes: 0 additions & 31 deletions e2e/fee_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ func (s *FeeMiddlewareTestSuite) RegisterCounterPartyPayee(ctx context.Context,
return s.BroadcastMessages(ctx, chain, user, msg)
}

// QueryCounterPartyPayee queries the counterparty payee of the given chain and relayer address on the specified channel.
func (s *FeeMiddlewareTestSuite) QueryCounterPartyPayee(ctx context.Context, chain ibc.Chain, relayerAddress, channelID string) (string, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.CounterpartyPayee(ctx, &feetypes.QueryCounterpartyPayeeRequest{
ChannelId: channelID,
Relayer: relayerAddress,
})
if err != nil {
return "", err
}
return res.CounterpartyPayee, nil
}

// PayPacketFeeAsync broadcasts a MsgPayPacketFeeAsync message.
func (s *FeeMiddlewareTestSuite) PayPacketFeeAsync(
ctx context.Context,
Expand All @@ -59,24 +46,6 @@ func (s *FeeMiddlewareTestSuite) PayPacketFeeAsync(
return s.BroadcastMessages(ctx, chain, user, msg)
}

// QueryIncentivizedPacketsForChannel queries the incentivized packets on the specified channel.
func (s *FeeMiddlewareTestSuite) QueryIncentivizedPacketsForChannel(
ctx context.Context,
chain *cosmos.CosmosChain,
portId,
channelId string,
) ([]*feetypes.IdentifiedPacketFees, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.IncentivizedPacketsForChannel(ctx, &feetypes.QueryIncentivizedPacketsForChannelRequest{
PortId: portId,
ChannelId: channelId,
})
if err != nil {
return nil, err
}
return res.IncentivizedPackets, err
}

func (s *FeeMiddlewareTestSuite) TestMsgPayPacketFee_AsyncSingleSender_Succeeds() {
t := s.T()
ctx := context.TODO()
Expand Down
31 changes: 0 additions & 31 deletions e2e/interchain_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,44 +36,13 @@ func (s *InterchainAccountsTestSuite) RegisterInterchainAccount(ctx context.Cont
return err
}

// QueryIncentivizedPacketsForChannel queries the incentivized packets on the specified channel.
func (s *InterchainAccountsTestSuite) QueryIncentivizedPacketsForChannel(
ctx context.Context,
chain *cosmos.CosmosChain,
portId,
channelId string,
) ([]*feetypes.IdentifiedPacketFees, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.IncentivizedPacketsForChannel(ctx, &feetypes.QueryIncentivizedPacketsForChannelRequest{
PortId: portId,
ChannelId: channelId,
})
if err != nil {
return nil, err
}
return res.IncentivizedPackets, err
}

// RegisterCounterPartyPayee broadcasts a MsgRegisterCounterpartyPayee message.
func (s *InterchainAccountsTestSuite) RegisterCounterPartyPayee(ctx context.Context, chain *cosmos.CosmosChain,
user *ibctest.User, portID, channelID, relayerAddr, counterpartyPayeeAddr string) (sdk.TxResponse, error) {
msg := feetypes.NewMsgRegisterCounterpartyPayee(portID, channelID, relayerAddr, counterpartyPayeeAddr)
return s.BroadcastMessages(ctx, chain, user, msg)
}

// QueryCounterPartyPayee queries the counterparty payee of the given chain and relayer address on the specified channel.
func (s *InterchainAccountsTestSuite) QueryCounterPartyPayee(ctx context.Context, chain ibc.Chain, relayerAddress, channelID string) (string, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.CounterpartyPayee(ctx, &feetypes.QueryCounterpartyPayeeRequest{
ChannelId: channelID,
Relayer: relayerAddress,
})
if err != nil {
return "", err
}
return res.CounterpartyPayee, nil
}

func (s *InterchainAccountsTestSuite) TestMsgSubmitTx_SuccessfulTransfer() {
t := s.T()
ctx := context.TODO()
Expand Down
33 changes: 33 additions & 0 deletions e2e/testsuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"context"

intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
"github.com/strangelove-ventures/ibctest/chain/cosmos"
"github.com/strangelove-ventures/ibctest/ibc"

feetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types"
clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types"
ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported"
Expand Down Expand Up @@ -55,3 +57,34 @@ func (s *E2ETestSuite) QueryInterchainAccount(ctx context.Context, chain ibc.Cha
}
return res.InterchainAccountAddress, nil
}

// QueryIncentivizedPacketsForChannel queries the incentivized packets on the specified channel.
func (s *E2ETestSuite) QueryIncentivizedPacketsForChannel(
ctx context.Context,
chain *cosmos.CosmosChain,
portId,
channelId string,
) ([]*feetypes.IdentifiedPacketFees, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.IncentivizedPacketsForChannel(ctx, &feetypes.QueryIncentivizedPacketsForChannelRequest{
PortId: portId,
ChannelId: channelId,
})
if err != nil {
return nil, err
}
return res.IncentivizedPackets, err
}

// QueryCounterPartyPayee queries the counterparty payee of the given chain and relayer address on the specified channel.
func (s *E2ETestSuite) QueryCounterPartyPayee(ctx context.Context, chain ibc.Chain, relayerAddress, channelID string) (string, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.CounterpartyPayee(ctx, &feetypes.QueryCounterpartyPayeeRequest{
ChannelId: channelID,
Relayer: relayerAddress,
})
if err != nil {
return "", err
}
return res.CounterpartyPayee, nil
}

0 comments on commit 995b647

Please sign in to comment.