-
Notifications
You must be signed in to change notification settings - Fork 610
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
Conversation
https://github.com/cosmos/ibc-go into cian/issue#1911-support-backwards-compatibility-tests
…terchain-accounts-sample-test
e2e/interchain_accounts_test.go
Outdated
"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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
This reverts commit 789cef4.
There was a problem hiding this 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
There was a problem hiding this 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
.
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 | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
e2e/testsuite/grpc_query.go
Outdated
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 | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM nice job!
@@ -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( |
There was a problem hiding this comment.
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
err := relayer.StopRelayer(ctx, s.GetRelayerExecReporter()) | ||
s.Require().NoError(err) |
There was a problem hiding this comment.
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)
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) | ||
}) | ||
}) | ||
} |
There was a problem hiding this comment.
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
Description
banktypes.MsgSend
for happy path scenariocloses: #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.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes