Skip to content

Commit

Permalink
run golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Aug 13, 2023
1 parent 84d5112 commit 92a7796
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 45 deletions.
6 changes: 3 additions & 3 deletions testutil/crypto/crypto.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package crypto

import (
"encoding/binary"

cryptoEd25519 "crypto/ed25519"
"encoding/binary"

sdkcryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdkcryptoEd25519 "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
sdkcryptoSecp256k1 "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdkcryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdktypes "github.com/cosmos/cosmos-sdk/types"
sdkstakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"

tmcrypto "github.com/cometbft/cometbft/crypto"
tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto"
tmtypes "github.com/cometbft/cometbft/types"

providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
)

// CryptoIdentity is a test helper for generating keys and addresses of
Expand Down
13 changes: 7 additions & 6 deletions testutil/ibc_testing/generic_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import (
"fmt"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
testutil "github.com/cosmos/interchain-security/v3/testutil/integration"
testkeeper "github.com/cosmos/interchain-security/v3/testutil/keeper"
consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"

"github.com/stretchr/testify/suite"

sdk "github.com/cosmos/cosmos-sdk/types"

tmencoding "github.com/cometbft/cometbft/crypto/encoding"
tmtypes "github.com/cometbft/cometbft/types"

ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
testutil "github.com/cosmos/interchain-security/v3/testutil/integration"
testkeeper "github.com/cosmos/interchain-security/v3/testutil/keeper"
consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
)

// Contains generic setup code for running integration tests against a provider, consumer,
Expand Down
2 changes: 1 addition & 1 deletion testutil/ibc_testing/specific_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"encoding/json"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"

appConsumer "github.com/cosmos/interchain-security/v3/app/consumer"
appConsumerDemocracy "github.com/cosmos/interchain-security/v3/app/consumer-democracy"
appProvider "github.com/cosmos/interchain-security/v3/app/provider"
ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
)

// ProviderAppIniter implements ibctesting.AppIniter for a provider app
Expand Down
4 changes: 3 additions & 1 deletion testutil/integration/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"time"

"cosmossdk.io/math"
abci "github.com/cometbft/cometbft/abci/types"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -16,6 +16,8 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"

abci "github.com/cometbft/cometbft/abci/types"

ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
providerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/provider/keeper"
Expand Down
27 changes: 12 additions & 15 deletions testutil/keeper/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ package keeper
import (
time "time"

sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/golang/mock/gomock"

clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
"github.com/cosmos/interchain-security/v3/x/ccv/types"
"github.com/golang/mock/gomock"
extra "github.com/oxyno-zeta/gomock-extra-matcher"

host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
ccv "github.com/cosmos/interchain-security/v3/x/ccv/types"
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

extra "github.com/oxyno-zeta/gomock-extra-matcher"
providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
"github.com/cosmos/interchain-security/v3/x/ccv/types"
)

//
Expand Down Expand Up @@ -68,7 +65,7 @@ func GetMocksForSetConsumerChain(ctx sdk.Context, mocks *MockedKeepers,
chainIDToInject string,
) []*gomock.Call {
return []*gomock.Call{
mocks.MockChannelKeeper.EXPECT().GetChannel(ctx, ccv.ProviderPortID, gomock.Any()).Return(
mocks.MockChannelKeeper.EXPECT().GetChannel(ctx, types.ProviderPortID, gomock.Any()).Return(
channeltypes.Channel{
State: channeltypes.OPEN,
ConnectionHops: []string{"connectionID"},
Expand All @@ -88,11 +85,11 @@ func GetMocksForSetConsumerChain(ctx sdk.Context, mocks *MockedKeepers,
func GetMocksForStopConsumerChain(ctx sdk.Context, mocks *MockedKeepers) []*gomock.Call {
dummyCap := &capabilitytypes.Capability{}
return []*gomock.Call{
mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), ccv.ProviderPortID, "channelID").Return(
mocks.MockChannelKeeper.EXPECT().GetChannel(gomock.Any(), types.ProviderPortID, "channelID").Return(
channeltypes.Channel{State: channeltypes.OPEN}, true,
).Times(1),
mocks.MockScopedKeeper.EXPECT().GetCapability(gomock.Any(), gomock.Any()).Return(dummyCap, true).Times(1),
mocks.MockChannelKeeper.EXPECT().ChanCloseInit(gomock.Any(), ccv.ProviderPortID, "channelID", dummyCap).Times(1),
mocks.MockChannelKeeper.EXPECT().ChanCloseInit(gomock.Any(), types.ProviderPortID, "channelID", dummyCap).Times(1),
}
}

Expand Down Expand Up @@ -137,7 +134,7 @@ func ExpectCreateClientMock(ctx sdk.Context, mocks MockedKeepers, clientID strin

func ExpectGetCapabilityMock(ctx sdk.Context, mocks MockedKeepers, times int) *gomock.Call {
return mocks.MockScopedKeeper.EXPECT().GetCapability(
ctx, host.PortPath(ccv.ConsumerPortID),
ctx, host.PortPath(types.ConsumerPortID),
).Return(nil, true).Times(times)
}

Expand Down
26 changes: 13 additions & 13 deletions testutil/keeper/unit_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ import (
"testing"
"time"

abci "github.com/cometbft/cometbft/abci/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

tmdb "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

tmdb "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
providerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/provider/keeper"
providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
"github.com/cosmos/interchain-security/v3/x/ccv/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"

clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
)

// Parameters needed to instantiate an in-memory keeper
Expand Down
6 changes: 4 additions & 2 deletions testutil/simibc/chain_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package simibc
import (
"time"

abci "github.com/cometbft/cometbft/abci/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"

abci "github.com/cometbft/cometbft/abci/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

ibctestingcore "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/core"
ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
)
Expand Down
12 changes: 8 additions & 4 deletions testutil/simibc/relay_util.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package simibc

import (
errorsmod "cosmossdk.io/errors"
tmtypes "github.com/cometbft/cometbft/types"
sdk "github.com/cosmos/cosmos-sdk/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/stretchr/testify/require"

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"

tmtypes "github.com/cometbft/cometbft/types"

simapp "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/simapp"
ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
"github.com/stretchr/testify/require"
)

// UpdateReceiverClient DELIVERs a header to the receiving endpoint
Expand Down
1 change: 1 addition & 0 deletions testutil/simibc/relayed_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"

ibctesting "github.com/cosmos/interchain-security/v3/legacy_ibc_testing/testing"
)

Expand Down

0 comments on commit 92a7796

Please sign in to comment.