Skip to content

Commit

Permalink
Merge branch 'main' into carlos/4128-wrong-url-encoded-path-used-in-s…
Browse files Browse the repository at this point in the history
…olomachine-client
  • Loading branch information
crodriguezvega authored Aug 24, 2023
2 parents 7424f5c + cef7ee2 commit 6a74acb
Show file tree
Hide file tree
Showing 22 changed files with 199 additions and 162 deletions.
2 changes: 1 addition & 1 deletion e2e/dockerutil/dockerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
const testLabel = "ibc-test"

// GetTestContainers returns all docker containers that have been created by interchain test.
func GetTestContainers(t *testing.T, ctx context.Context, dc *dockerclient.Client) ([]dockertypes.Container, error) {
func GetTestContainers(ctx context.Context, t *testing.T, dc *dockerclient.Client) ([]dockertypes.Container, error) {
t.Helper()

testContainers, err := dc.ContainerList(ctx, dockertypes.ContainerListOptions{
Expand Down
11 changes: 7 additions & 4 deletions e2e/relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Config struct {

// New returns an implementation of ibc.Relayer depending on the provided RelayerType.
func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
t.Helper()
switch cfg.Type {
case Rly:
return newCosmosRelayer(t, cfg.Tag, logger, dockerClient, network)
Expand All @@ -46,6 +47,7 @@ func New(t *testing.T, cfg Config, logger *zap.Logger, dockerClient *dockerclien
// newCosmosRelayer returns an instance of the go relayer.
// Options are used to allow for relayer version selection and specifying the default processing option.
func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
t.Helper()
customImageOption := relayer.CustomDockerImage(rlyRelayerRepository, tag, rlyRelayerUser)
relayerProcessingOption := relayer.StartupFlags("-p", "events") // relayer processes via events

Expand All @@ -58,6 +60,7 @@ func newCosmosRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient

// newHermesRelayer returns an instance of the hermes relayer.
func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient *dockerclient.Client, network string) ibc.Relayer {
t.Helper()
customImageOption := relayer.CustomDockerImage(hermesRelayerRepository, tag, hermesRelayerUser)
relayerFactory := interchaintest.NewBuiltinRelayerFactory(ibc.Hermes, logger, customImageOption)

Expand All @@ -67,18 +70,18 @@ func newHermesRelayer(t *testing.T, tag string, logger *zap.Logger, dockerClient
}

// RelayerMap is a mapping from test names to a relayer set for that test.
type RelayerMap map[string]map[ibc.Wallet]bool
type Map map[string]map[ibc.Wallet]bool

// AddRelayer adds the given relayer to the relayer set for the given test name.
func (r RelayerMap) AddRelayer(testName string, relayer ibc.Wallet) {
func (r Map) AddRelayer(testName string, ibcrelayer ibc.Wallet) {
if _, ok := r[testName]; !ok {
r[testName] = make(map[ibc.Wallet]bool)
}
r[testName][relayer] = true
r[testName][ibcrelayer] = true
}

// containsRelayer returns true if the given relayer is in the relayer set for the given test name.
func (r RelayerMap) ContainsRelayer(testName string, wallet ibc.Wallet) bool {
func (r Map) ContainsRelayer(testName string, wallet ibc.Wallet) bool {
if relayerSet, ok := r[testName]; ok {
return relayerSet[wallet]
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *ClientTestSuite) TestClientUpdateProposal_Succeeds() {
subjectClientID string
substituteClientID string
// set the trusting period to a value which will still be valid upon client creation, but invalid before the first update
badTrustingPeriod = time.Duration(time.Second * 10)
badTrustingPeriod = time.Second * 10
)

t.Run("create substitute client with correct trusting period", func(t *testing.T) {
Expand Down Expand Up @@ -314,7 +314,7 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
// extractChainPrivateKeys returns a slice of tmtypes.PrivValidator which hold the private keys for all validator
// nodes for a given chain.
func (s *ClientTestSuite) extractChainPrivateKeys(ctx context.Context, chain *cosmos.CosmosChain) []tmtypes.PrivValidator {
testContainers, err := dockerutil.GetTestContainers(s.T(), ctx, s.DockerClient)
testContainers, err := dockerutil.GetTestContainers(ctx, s.T(), s.DockerClient)
s.Require().NoError(err)

var filePvs []privval.FilePVKey
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/core/03-connection/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ func (s *ConnectionTestSuite) QueryMaxExpectedTimePerBlockParam(ctx context.Cont

// removing additional strings that are used for amino
delay := strings.ReplaceAll(res.Param.Value, "\"", "")
time, err := strconv.ParseUint(delay, 10, 64)
// convert to uint64
uinttime, err := strconv.ParseUint(delay, 10, 64)
s.Require().NoError(err)

return time
return uinttime
}

// TestMaxExpectedTimePerBlockParam tests changing the MaxExpectedTimePerBlock param using a governance proposal
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/gov_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/groups_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/incentivized_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/intertx_incentivized_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/intertx_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/localhost_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/params_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package interchain_accounts
package interchainaccounts

import (
"context"
Expand Down
3 changes: 3 additions & 0 deletions e2e/tests/transfer/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func (suite *AuthzTransferTestSuite) TestAuthz_MsgTransfer_Succeeds() {

// createMsgGrantFn initializes a TransferAuthorization and broadcasts a MsgGrant message.
createMsgGrantFn := func(t *testing.T) {
t.Helper()
transferAuth := transfertypes.TransferAuthorization{
Allocations: []transfertypes.Allocation{
{
Expand Down Expand Up @@ -83,7 +84,9 @@ func (suite *AuthzTransferTestSuite) TestAuthz_MsgTransfer_Succeeds() {
// verifyGrantFn returns a test function which asserts chainA has a grant authorization
// with the given spend limit.
verifyGrantFn := func(expectedLimit int64) func(t *testing.T) {
t.Helper()
return func(t *testing.T) {
t.Helper()
grantAuths, err := suite.QueryGranterGrants(ctx, chainA, granterAddress)

suite.Require().NoError(err)
Expand Down
22 changes: 11 additions & 11 deletions e2e/tests/transfer/incentivized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncSingleSender_Su
s.Require().Empty(packets)
})

packetId := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetID := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetFee := feetypes.NewPacketFee(testFee, chainAWallet.FormattedAddress(), nil)

t.Run("should succeed", func(t *testing.T) {
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetId, packetFee)
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetID, packetFee)
s.AssertTxSuccess(payPacketFeeTxResp)
})

Expand Down Expand Up @@ -208,11 +208,11 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_InvalidReceiverAccou
s.Require().Empty(packets)
})

packetId := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, 1)
packetID := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, 1)
packetFee := feetypes.NewPacketFee(testFee, chainAWallet.FormattedAddress(), nil)

t.Run("should succeed", func(t *testing.T) {
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetId, packetFee)
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetID, packetFee)
s.AssertTxSuccess(payPacketFeeTxResp)
})

Expand Down Expand Up @@ -424,7 +424,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_SingleSender_TimesOu
})

t.Run("pay packet fee", func(t *testing.T) {
packetId := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetID := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetFee := feetypes.NewPacketFee(testFee, chainAWallet.FormattedAddress(), nil)

t.Run("no incentivized packets", func(t *testing.T) {
Expand All @@ -434,7 +434,7 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_SingleSender_TimesOu
})

t.Run("should succeed", func(t *testing.T) {
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetId, packetFee)
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetID, packetFee)
s.AssertTxSuccess(payPacketFeeTxResp)
})

Expand Down Expand Up @@ -527,11 +527,11 @@ func (s *IncentivizedTransferTestSuite) TestPayPacketFeeAsync_SingleSender_NoCou
s.Require().Empty(packets)
})

packetId := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetID := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetFee := feetypes.NewPacketFee(testFee, chainAWallet.FormattedAddress(), nil)

t.Run("should succeed", func(t *testing.T) {
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetId, packetFee)
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet, packetID, packetFee)
s.AssertTxSuccess(payPacketFeeTxResp)
})

Expand Down Expand Up @@ -644,16 +644,16 @@ func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncMultipleSenders
s.Require().Empty(packets)
})

packetId := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetID := channeltypes.NewPacketID(channelA.PortID, channelA.ChannelID, chainATx.Packet.Sequence)
packetFee1 := feetypes.NewPacketFee(testFee, chainAWallet1.FormattedAddress(), nil)
packetFee2 := feetypes.NewPacketFee(testFee, chainAWallet2.FormattedAddress(), nil)

t.Run("paying packetFee1 should succeed", func(t *testing.T) {
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet1, packetId, packetFee1)
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet1, packetID, packetFee1)
s.AssertTxSuccess(payPacketFeeTxResp)
})
t.Run("paying packetFee2 should succeed", func(t *testing.T) {
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet2, packetId, packetFee2)
payPacketFeeTxResp = s.PayPacketFeeAsync(ctx, chainA, chainAWallet2, packetID, packetFee2)
s.AssertTxSuccess(payPacketFeeTxResp)
})

Expand Down
13 changes: 0 additions & 13 deletions e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/ibc-go/e2e/semverutil"
"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testvalues"
controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
Expand Down Expand Up @@ -680,18 +679,6 @@ func (s *UpgradeTestSuite) RegisterInterchainAccount(ctx context.Context, chain
s.AssertTxSuccess(txResp)
}

// getICAVersion returns the version which should be used in the MsgRegisterAccount broadcast from the
// controller chain.
func getICAVersion(chainAVersion, chainBVersion string) string {
chainBIsGreaterThanOrEqualToChainA := semverutil.GTE(chainBVersion, chainAVersion)
if chainBIsGreaterThanOrEqualToChainA {
// allow version to be specified by the controller chain
return ""
}
// explicitly set the version string because the host chain might not yet support incentivized channels.
return icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
}

// ClientState queries the current ClientState by clientID
func (s *UpgradeTestSuite) ClientState(ctx context.Context, chain ibc.Chain, clientID string) (*clienttypes.QueryClientStateResponse, error) {
queryClient := s.GetChainGRCPClients(chain).ClientQueryClient
Expand Down
2 changes: 1 addition & 1 deletion e2e/testsuite/diagnostics/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func Collect(t *testing.T, dc *dockerclient.Client, debugModeEnabled bool, chain
return
}

testContainers, err := dockerutil.GetTestContainers(t, ctx, dc)
testContainers, err := dockerutil.GetTestContainers(ctx, t, dc)
if err != nil {
t.Logf("failed listing containers test cleanup: %s", err)
return
Expand Down
10 changes: 5 additions & 5 deletions e2e/testsuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ func (s *E2ETestSuite) QueryInterchainAccountLegacy(ctx context.Context, chain i
func (s *E2ETestSuite) QueryIncentivizedPacketsForChannel(
ctx context.Context,
chain *cosmos.CosmosChain,
portId,
channelId string,
portID,
channelID string,
) ([]*feetypes.IdentifiedPacketFees, error) {
queryClient := s.GetChainGRCPClients(chain).FeeQueryClient
res, err := queryClient.IncentivizedPacketsForChannel(ctx, &feetypes.QueryIncentivizedPacketsForChannelRequest{
PortId: portId,
ChannelId: channelId,
PortId: portID,
ChannelId: channelID,
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -285,7 +285,7 @@ func (s *E2ETestSuite) GetBlockHeaderByHeight(ctx context.Context, chain ibc.Cha
if res.SdkBlock != nil {
return &res.SdkBlock.Header, nil
}
return &res.Block.Header, nil
return &res.SdkBlock.Header, nil
}

// GetValidatorSetByHeight returns the validators of the given chain at the specified height. The returned validators
Expand Down
Loading

0 comments on commit 6a74acb

Please sign in to comment.