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: adding incentivized interchain accounts bank send test #2023

Merged
merged 39 commits into from
Aug 17, 2022

Conversation

damiannolan
Copy link
Member

Description

  • Adding incentivized interchain accounts test using banktypes.MsgSend for happy path scenario

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

chatton and others added 30 commits August 8, 2022 15:37
Comment on lines 17 to 21
"github.com/cosmos/ibc-go/e2e/testconfig"
"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
feetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types"
ibctesting "github.com/cosmos/ibc-go/v5/testing"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this import grouping for e2e? Is this okay, or should we separate ibc-go imports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont have a strong opinion, but separation seems clearer to me

@damiannolan damiannolan marked this pull request as ready for review August 17, 2022 10:17
@charleenfei charleenfei mentioned this pull request Aug 17, 2022
3 tasks
Copy link
Contributor

@charleenfei charleenfei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding my approving review, although since i also worked on this branch we should have at least one more reviewer, cc @seantking

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good just a few small comments.

I think we can hold off for my PR to be merged and then change the base branch to main.

Comment on lines +47 to +83
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
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think these are duplicates of the functions belonging to FeeMiddlewareTestSuite

If they are needed in two test suites, maybe they should go into testsuite.E2ETestSuite?

Either that or we could extract a type that has these functions and compose both of the other test suites of that type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree. Do you think we should do this in a follow up PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think that's no problem!

Comment on lines 15 to 31
func (s *E2ETestSuite) QueryClientState(ctx context.Context, chain ibc.Chain, clientID string) (ibcexported.ClientState, error) {
queryClient := s.GetChainGRCPClients(chain).ClientQueryClient
res, err := queryClient.ClientState(ctx, &clienttypes.QueryClientStateRequest{
ClientId: clientID,
})
if err != nil {
return nil, err
}

clientState, err := clienttypes.UnpackClientState(res.ClientState)
if err != nil {
return nil, err
}

return clientState, nil
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function was going to be used in one of @colin-axner 's coming tests I believe. I don't think we should remove this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow... I actually have no idea how this got removed. I never touched it 🤣
I'll put it back!

Base automatically changed from cian/issue#1941-add-interchain-accounts-sample-test to main August 17, 2022 13:46
Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM nice job!

@damiannolan damiannolan merged commit 0d5d958 into main Aug 17, 2022
@damiannolan damiannolan deleted the damian/incentivized-ica-bank-send branch August 17, 2022 17:01
@@ -40,6 +42,44 @@ func (s *InterchainAccountsTestSuite) RegisterInterchainAccount(ctx context.Cont
return err
}

// QueryIncentivizedPacketsForChannel queries the incentivized packets on the specified channel.
func (s *InterchainAccountsTestSuite) QueryIncentivizedPacketsForChannel(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put all incentivized tests under one test suite. Since ics29 was added in v4 but ics27 was added in v3. We will want to do base ics27 tests using v3 for cross compatibility purposes, but incentivization tests should only occur as far back as v4

Comment on lines +352 to +353
err := relayer.StopRelayer(ctx, s.GetRelayerExecReporter())
s.Require().NoError(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for simplicity, I wonder if we should just make this a suite function so it matches s.StartRelayer(relayer)

Comment on lines 248 to +259
s.Require().NoError(err)
})

t.Run("verify balance is the same", func(t *testing.T) {
balance, err := chainB.GetBalance(ctx, chainBAccount.Bech32Address(chainB.Config().Bech32Prefix), chainB.Config().Denom)
s.Require().NoError(err)

expected := testvalues.StartingTokenAmount
s.Require().Equal(expected, balance)
})
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the packet relay assertion removed? Without knowing that the packet was relayed, we can't be certain that the balance didn't change because a failed transfer or because the packet wasn't relayed since we are checking the receiving balance and not the sender

@chatton chatton changed the title e2e: adding incentivized interchain accounts bank send test E2E: adding incentivized interchain accounts bank send test Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants