Skip to content

Commit

Permalink
nit: Remove duplicate definition of transferChannelOptions. (#3638)
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored May 24, 2023
1 parent df918d2 commit b5a613d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 29 deletions.
12 changes: 1 addition & 11 deletions e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
Expand Down Expand Up @@ -51,7 +50,7 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, chainB := s.GetChains()

chainBDenom := chainB.Config().Denom
Expand Down Expand Up @@ -120,12 +119,3 @@ func (s *ConnectionTestSuite) TestMaxExpectedTimePerBlockParam() {
})
})
}

// transferChannelOptions configures both of the chains to have non-incentivized transfer channels.
func transferChannelOptions() func(options *ibc.CreateChannelOptions) {
return func(opts *ibc.CreateChannelOptions) {
opts.Version = transfertypes.Version
opts.SourcePortName = transfertypes.PortID
opts.DestPortName = transfertypes.PortID
}
}
4 changes: 2 additions & 2 deletions e2e/tests/transfer/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_MsgTransfer_Succeeds() {
t := suite.T()
ctx := context.TODO()

relayer, channelA := suite.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := suite.SetupChainsRelayerAndChannel(ctx, suite.TransferChannelOptions())
chainA, chainB := suite.GetChains()

chainADenom := chainA.Config().Denom
Expand Down Expand Up @@ -177,7 +177,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_InvalidTransferAuthorizations() {
t := suite.T()
ctx := context.TODO()

relayer, channelA := suite.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := suite.SetupChainsRelayerAndChannel(ctx, suite.TransferChannelOptions())
chainA, chainB := suite.GetChains()

chainADenom := chainA.Config().Denom
Expand Down
21 changes: 6 additions & 15 deletions e2e/tests/transfer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *TransferTestSuite) TestMsgTransfer_Succeeds_Nonincentivized() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, chainB := s.GetChains()

chainADenom := chainA.Config().Denom
Expand Down Expand Up @@ -155,7 +155,7 @@ func (s *TransferTestSuite) TestMsgTransfer_Fails_InvalidAddress() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, chainB := s.GetChains()

chainADenom := chainA.Config().Denom
Expand Down Expand Up @@ -199,7 +199,7 @@ func (s *TransferTestSuite) TestMsgTransfer_Timeout_Nonincentivized() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, _ := s.GetChains()
chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
chainBWallet := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount)
Expand Down Expand Up @@ -247,7 +247,7 @@ func (s *TransferTestSuite) TestSendEnabledParam() {
t := s.T()
ctx := context.TODO()

_, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
_, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, chainB := s.GetChains()

chainADenom := chainA.Config().Denom
Expand Down Expand Up @@ -295,7 +295,7 @@ func (s *TransferTestSuite) TestReceiveEnabledParam() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, chainB := s.GetChains()

chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
Expand Down Expand Up @@ -413,7 +413,7 @@ func (s *TransferTestSuite) TestMsgTransfer_WithMemo() {
t := s.T()
ctx := context.TODO()

relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
relayer, channelA := s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, chainB := s.GetChains()

chainADenom := chainA.Config().Denom
Expand Down Expand Up @@ -472,12 +472,3 @@ func (s *TransferTestSuite) TestMsgTransfer_WithMemo() {
}
})
}

// transferChannelOptions configures both of the chains to have non-incentivized transfer channels.
func transferChannelOptions() func(options *ibc.CreateChannelOptions) {
return func(opts *ibc.CreateChannelOptions) {
opts.Version = transfertypes.Version
opts.SourcePortName = transfertypes.PortID
opts.DestPortName = transfertypes.PortID
}
}
2 changes: 1 addition & 1 deletion e2e/tests/transfer/localhost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s *LocalhostTransferTestSuite) TestMsgTransfer_Localhost() {
t := s.T()
ctx := context.TODO()

_, _ = s.SetupChainsRelayerAndChannel(ctx, transferChannelOptions())
_, _ = s.SetupChainsRelayerAndChannel(ctx, s.TransferChannelOptions())
chainA, _ := s.GetChains()

chainADenom := chainA.Config().Denom
Expand Down
9 changes: 9 additions & 0 deletions e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,15 @@ func (s *E2ETestSuite) GetRelayerExecReporter() *testreporter.RelayerExecReporte
return rep.RelayerExecReporter(s.T())
}

// TransferChannelOptions configures both of the chains to have non-incentivized transfer channels.
func (s *E2ETestSuite) TransferChannelOptions() func(options *ibc.CreateChannelOptions) {
return func(opts *ibc.CreateChannelOptions) {
opts.Version = transfertypes.Version
opts.SourcePortName = transfertypes.PortID
opts.DestPortName = transfertypes.PortID
}
}

// GetTimeoutHeight returns a timeout height of 1000 blocks above the current block height.
// This function should be used when the timeout is never expected to be reached
func (s *E2ETestSuite) GetTimeoutHeight(ctx context.Context, chain *cosmos.CosmosChain) clienttypes.Height {
Expand Down

0 comments on commit b5a613d

Please sign in to comment.