diff --git a/.golangci.yml b/.golangci.yml index 71e76f042a9..e7a994cc19f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,32 +21,24 @@ linters: - nakedret - staticcheck - thelper + - typecheck - stylecheck - revive - typecheck + - tenv - unconvert - unused - misspell issues: exclude-rules: - - text: 'unused-parameter' + - text: 'differs only by capitalization to method' linters: - revive - - text: 'SA1019:' - linters: - - staticcheck - text: 'Use of weak random number generator' linters: - gosec - - text: 'ST1003:' - linters: - - stylecheck - # FIXME: Disabled until golangci-lint updates stylecheck with this fix: - # https://github.com/dominikh/go-tools/issues/389 - - text: 'ST1016:' - linters: - - stylecheck + max-issues-per-linter: 10000 max-same-issues: 10000 @@ -73,6 +65,56 @@ linters-settings: require-explanation: false require-specific: false revive: + enable-all-rules: true + # Do NOT whine about the following, full explanation found in: + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#description-of-available-rules rules: + - name: use-any + disabled: true - name: if-return disabled: true + - name: max-public-structs + disabled: true + - name: cognitive-complexity + disabled: true + - name: argument-limit + disabled: true + - name: cyclomatic + disabled: true + - name: file-header + disabled: true + - name: function-length + disabled: true + - name: function-result-limit + disabled: true + - name: line-length-limit + disabled: true + - name: flag-parameter + disabled: true + - name: add-constant + disabled: true + - name: empty-lines + disabled: true + - name: banned-characters + disabled: true + - name: deep-exit + disabled: true + - name: confusing-results + disabled: true + - name: unused-parameter + disabled: true + - name: modifies-value-receiver + disabled: true + - name: early-return + disabled: true + - name: confusing-naming + disabled: true + - name: defer + disabled: true + - name: unhandled-error + disabled: false + arguments: + - 'fmt.Printf' + - 'fmt.Print' + - 'fmt.Println' + - 'myFunction' diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index 1aebb18691a..9ddc57829e1 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -16,12 +16,11 @@ import ( tmtypes "github.com/cometbft/cometbft/types" tmversion "github.com/cometbft/cometbft/version" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/ibc" test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + testifysuite "github.com/stretchr/testify/suite" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" @@ -40,7 +39,7 @@ const ( ) func TestClientTestSuite(t *testing.T) { - suite.Run(t, new(ClientTestSuite)) + testifysuite.Run(t, new(ClientTestSuite)) } type ClientTestSuite struct { diff --git a/e2e/tests/core/03-connection/connection_test.go b/e2e/tests/core/03-connection/connection_test.go index 991b44d6d1d..a309ec2e7a9 100644 --- a/e2e/tests/core/03-connection/connection_test.go +++ b/e2e/tests/core/03-connection/connection_test.go @@ -10,19 +10,18 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "github.com/cosmos/ibc-go/e2e/testsuite" "github.com/cosmos/ibc-go/e2e/testvalues" 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" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) func TestConnectionTestSuite(t *testing.T) { - suite.Run(t, new(ConnectionTestSuite)) + testifysuite.Run(t, new(ConnectionTestSuite)) } type ConnectionTestSuite struct { diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index c31e1b63880..ce0aecf521a 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -5,15 +5,14 @@ import ( "testing" "time" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/gogoproto/proto" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/ibc" test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/gogoproto/proto" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/e2e/testsuite" "github.com/cosmos/ibc-go/e2e/testvalues" @@ -24,7 +23,7 @@ import ( ) func TestInterchainAccountsTestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsTestSuite)) + testifysuite.Run(t, new(InterchainAccountsTestSuite)) } type InterchainAccountsTestSuite struct { diff --git a/e2e/tests/interchain_accounts/gov_test.go b/e2e/tests/interchain_accounts/gov_test.go index 2daa2be095d..43efeef9bcf 100644 --- a/e2e/tests/interchain_accounts/gov_test.go +++ b/e2e/tests/interchain_accounts/gov_test.go @@ -10,20 +10,19 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/gogoproto/proto" - "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "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" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" + "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) func TestInterchainAccountsGovTestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsGovTestSuite)) + testifysuite.Run(t, new(InterchainAccountsGovTestSuite)) } type InterchainAccountsGovTestSuite struct { diff --git a/e2e/tests/interchain_accounts/groups_test.go b/e2e/tests/interchain_accounts/groups_test.go index de24999cddb..7123de937c2 100644 --- a/e2e/tests/interchain_accounts/groups_test.go +++ b/e2e/tests/interchain_accounts/groups_test.go @@ -9,16 +9,15 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" grouptypes "github.com/cosmos/cosmos-sdk/x/group" "github.com/cosmos/gogoproto/proto" - interchaintest "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "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" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) const ( @@ -53,7 +52,7 @@ const ( ) func TestInterchainAccountsGroupsTestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsGroupsTestSuite)) + testifysuite.Run(t, new(InterchainAccountsGroupsTestSuite)) } type InterchainAccountsGroupsTestSuite struct { diff --git a/e2e/tests/interchain_accounts/incentivized_test.go b/e2e/tests/interchain_accounts/incentivized_test.go index 2d3dc532e0a..dae0daf4a7b 100644 --- a/e2e/tests/interchain_accounts/incentivized_test.go +++ b/e2e/tests/interchain_accounts/incentivized_test.go @@ -8,21 +8,20 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/gogoproto/proto" - interchaintest "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "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" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) func TestIncentivizedInterchainAccountsTestSuite(t *testing.T) { - suite.Run(t, new(IncentivizedInterchainAccountsTestSuite)) + testifysuite.Run(t, new(IncentivizedInterchainAccountsTestSuite)) } type IncentivizedInterchainAccountsTestSuite struct { diff --git a/e2e/tests/interchain_accounts/intertx_incentivized_test.go b/e2e/tests/interchain_accounts/intertx_incentivized_test.go index 08cd59ca9d8..406e58e9b2f 100644 --- a/e2e/tests/interchain_accounts/intertx_incentivized_test.go +++ b/e2e/tests/interchain_accounts/intertx_incentivized_test.go @@ -6,19 +6,18 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/e2e/testvalues" + feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" + ibctesting "github.com/cosmos/ibc-go/v7/testing" intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/ibc" test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/ibc-go/e2e/testvalues" - feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" + testifysuite "github.com/stretchr/testify/suite" ) func TestIncentivizedInterTxTestSuite(t *testing.T) { - suite.Run(t, new(IncentivizedInterTxTestSuite)) + testifysuite.Run(t, new(IncentivizedInterTxTestSuite)) } type IncentivizedInterTxTestSuite struct { diff --git a/e2e/tests/interchain_accounts/intertx_test.go b/e2e/tests/interchain_accounts/intertx_test.go index 13c03083e59..c460e468100 100644 --- a/e2e/tests/interchain_accounts/intertx_test.go +++ b/e2e/tests/interchain_accounts/intertx_test.go @@ -4,15 +4,14 @@ import ( "context" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v7/ibc" test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/e2e/testsuite" "github.com/cosmos/ibc-go/e2e/testvalues" @@ -23,7 +22,7 @@ import ( ) func TestInterTxTestSuite(t *testing.T) { - suite.Run(t, new(InterTxTestSuite)) + testifysuite.Run(t, new(InterTxTestSuite)) } type InterTxTestSuite struct { diff --git a/e2e/tests/interchain_accounts/localhost_test.go b/e2e/tests/interchain_accounts/localhost_test.go index 7a0b1181893..a05fe20abba 100644 --- a/e2e/tests/interchain_accounts/localhost_test.go +++ b/e2e/tests/interchain_accounts/localhost_test.go @@ -8,6 +8,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/gogoproto/proto" + "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" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -15,17 +17,14 @@ import ( "github.com/cosmos/ibc-go/v7/modules/core/exported" localhost "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost" ibctesting "github.com/cosmos/ibc-go/v7/testing" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/ibc-go/e2e/testsuite" - "github.com/cosmos/ibc-go/e2e/testvalues" "github.com/strangelove-ventures/interchaintest/v7" "github.com/strangelove-ventures/interchaintest/v7/ibc" test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) func TestInterchainAccountsLocalhostTestSuite(t *testing.T) { - suite.Run(t, new(LocalhostInterchainAccountsTestSuite)) + testifysuite.Run(t, new(LocalhostInterchainAccountsTestSuite)) } type LocalhostInterchainAccountsTestSuite struct { diff --git a/e2e/tests/interchain_accounts/params_test.go b/e2e/tests/interchain_accounts/params_test.go index efc9283a6c2..79708655b5b 100644 --- a/e2e/tests/interchain_accounts/params_test.go +++ b/e2e/tests/interchain_accounts/params_test.go @@ -6,19 +6,18 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - "github.com/stretchr/testify/suite" - "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" hosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + testifysuite "github.com/stretchr/testify/suite" ) func TestInterchainAccountsParamsTestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsParamsTestSuite)) + testifysuite.Run(t, new(InterchainAccountsParamsTestSuite)) } type InterchainAccountsParamsTestSuite struct { diff --git a/e2e/tests/transfer/authz_test.go b/e2e/tests/transfer/authz_test.go index 3e8fe322bc0..a87f9fb90a4 100644 --- a/e2e/tests/transfer/authz_test.go +++ b/e2e/tests/transfer/authz_test.go @@ -9,17 +9,16 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/authz" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "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" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) func TestAuthzTransferTestSuite(t *testing.T) { - suite.Run(t, new(AuthzTransferTestSuite)) + testifysuite.Run(t, new(AuthzTransferTestSuite)) } type AuthzTransferTestSuite struct { diff --git a/e2e/tests/transfer/base_test.go b/e2e/tests/transfer/base_test.go index a94867084ea..3b0b6d5afc3 100644 --- a/e2e/tests/transfer/base_test.go +++ b/e2e/tests/transfer/base_test.go @@ -11,17 +11,16 @@ import ( paramsproposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "github.com/cosmos/ibc-go/e2e/testsuite" "github.com/cosmos/ibc-go/e2e/testvalues" ibctesting "github.com/cosmos/ibc-go/v7/testing" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) func TestTransferTestSuite(t *testing.T) { - suite.Run(t, new(TransferTestSuite)) + testifysuite.Run(t, new(TransferTestSuite)) } type TransferTestSuite struct { diff --git a/e2e/tests/transfer/incentivized_test.go b/e2e/tests/transfer/incentivized_test.go index 108bca5d3e7..86b5ae57676 100644 --- a/e2e/tests/transfer/incentivized_test.go +++ b/e2e/tests/transfer/incentivized_test.go @@ -6,14 +6,13 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "github.com/cosmos/ibc-go/e2e/testvalues" feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) type IncentivizedTransferTestSuite struct { @@ -21,7 +20,7 @@ type IncentivizedTransferTestSuite struct { } func TestIncentivizedTransferTestSuite(t *testing.T) { - suite.Run(t, new(IncentivizedTransferTestSuite)) + testifysuite.Run(t, new(IncentivizedTransferTestSuite)) } func (s *IncentivizedTransferTestSuite) TestMsgPayPacketFee_AsyncSingleSender_Succeeds() { diff --git a/e2e/tests/transfer/localhost_test.go b/e2e/tests/transfer/localhost_test.go index efca34f1fd4..efe2257e47e 100644 --- a/e2e/tests/transfer/localhost_test.go +++ b/e2e/tests/transfer/localhost_test.go @@ -4,8 +4,6 @@ import ( "context" "testing" - "github.com/stretchr/testify/suite" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/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" @@ -13,13 +11,14 @@ import ( localhost "github.com/cosmos/ibc-go/v7/modules/light-clients/09-localhost" ibctesting "github.com/cosmos/ibc-go/v7/testing" test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/e2e/testsuite" "github.com/cosmos/ibc-go/e2e/testvalues" ) func TestTransferLocalhostTestSuite(t *testing.T) { - suite.Run(t, new(LocalhostTransferTestSuite)) + testifysuite.Run(t, new(LocalhostTransferTestSuite)) } type LocalhostTransferTestSuite struct { diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index 4f83f0933b9..f7ed23f21ba 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -11,13 +11,6 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/gogoproto/proto" - intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" - interchaintest "github.com/strangelove-ventures/interchaintest/v7" - "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" - "github.com/strangelove-ventures/interchaintest/v7/ibc" - test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" - "github.com/cosmos/ibc-go/e2e/semverutil" "github.com/cosmos/ibc-go/e2e/testsuite" "github.com/cosmos/ibc-go/e2e/testvalues" @@ -29,6 +22,12 @@ import ( "github.com/cosmos/ibc-go/v7/modules/core/exported" solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" ibctesting "github.com/cosmos/ibc-go/v7/testing" + intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types" + interchaintest "github.com/strangelove-ventures/interchaintest/v7" + "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" + "github.com/strangelove-ventures/interchaintest/v7/ibc" + test "github.com/strangelove-ventures/interchaintest/v7/testutil" + testifysuite "github.com/stretchr/testify/suite" ) const ( @@ -42,7 +41,7 @@ func TestUpgradeTestSuite(t *testing.T) { t.Fatalf("%s and %s must be set when running an upgrade test", testsuite.ChainUpgradeTagEnv, testsuite.ChainUpgradePlanEnv) } - suite.Run(t, new(UpgradeTestSuite)) + testifysuite.Run(t, new(UpgradeTestSuite)) } type UpgradeTestSuite struct { diff --git a/e2e/testsuite/testsuite.go b/e2e/testsuite/testsuite.go index 9bddf7908ed..e045a4ab70d 100644 --- a/e2e/testsuite/testsuite.go +++ b/e2e/testsuite/testsuite.go @@ -11,7 +11,7 @@ import ( "github.com/strangelove-ventures/interchaintest/v7/ibc" "github.com/strangelove-ventures/interchaintest/v7/testreporter" test "github.com/strangelove-ventures/interchaintest/v7/testutil" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "go.uber.org/zap" "go.uber.org/zap/zaptest" @@ -32,7 +32,7 @@ const ( // E2ETestSuite has methods and functionality which can be shared among all test suites. type E2ETestSuite struct { - suite.Suite + testifysuite.Suite grpcClients map[string]GRPCClients paths map[string]pathPair diff --git a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go index 232d22b07c9..fe287dee6ec 100644 --- a/modules/apps/27-interchain-accounts/controller/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/controller/client/cli/tx.go @@ -80,7 +80,6 @@ appropriate relative timeoutTimestamp must be provided with flag {relative-packe var icaMsgData icatypes.InterchainAccountPacketData msgContentOrFileName := args[1] if err := cdc.UnmarshalJSON([]byte(msgContentOrFileName), &icaMsgData); err != nil { - // check for file path if JSON input is not provided contents, err := os.ReadFile(msgContentOrFileName) if err != nil { diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go index 2c9bcead23a..1ccd5206604 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware.go @@ -79,7 +79,7 @@ func (im IBCMiddleware) OnChanOpenInit( } // OnChanOpenTry implements the IBCMiddleware interface -func (im IBCMiddleware) OnChanOpenTry( +func (IBCMiddleware) OnChanOpenTry( ctx sdk.Context, order channeltypes.Order, connectionHops []string, @@ -127,7 +127,7 @@ func (im IBCMiddleware) OnChanOpenAck( } // OnChanOpenConfirm implements the IBCMiddleware interface -func (im IBCMiddleware) OnChanOpenConfirm( +func (IBCMiddleware) OnChanOpenConfirm( ctx sdk.Context, portID, channelID string, @@ -136,7 +136,7 @@ func (im IBCMiddleware) OnChanOpenConfirm( } // OnChanCloseInit implements the IBCMiddleware interface -func (im IBCMiddleware) OnChanCloseInit( +func (IBCMiddleware) OnChanCloseInit( ctx sdk.Context, portID, channelID string, @@ -168,7 +168,7 @@ func (im IBCMiddleware) OnChanCloseConfirm( } // OnRecvPacket implements the IBCMiddleware interface -func (im IBCMiddleware) OnRecvPacket( +func (IBCMiddleware) OnRecvPacket( ctx sdk.Context, packet channeltypes.Packet, _ sdk.AccAddress, @@ -230,7 +230,7 @@ func (im IBCMiddleware) OnTimeoutPacket( } // SendPacket implements the ICS4 Wrapper interface -func (im IBCMiddleware) SendPacket( +func (IBCMiddleware) SendPacket( ctx sdk.Context, chanCap *capabilitytypes.Capability, sourcePort string, @@ -243,7 +243,7 @@ func (im IBCMiddleware) SendPacket( } // WriteAcknowledgement implements the ICS4 Wrapper interface -func (im IBCMiddleware) WriteAcknowledgement( +func (IBCMiddleware) WriteAcknowledgement( ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, @@ -260,7 +260,7 @@ func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string) // UnmarshalPacketData attempts to unmarshal the provided packet data bytes // into an InterchainAccountPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCMiddleware) UnmarshalPacketData(bz []byte) (interface{}, error) { +func (IBCMiddleware) UnmarshalPacketData(bz []byte) (interface{}, error) { var packetData icatypes.InterchainAccountPacketData if err := icatypes.ModuleCdc.UnmarshalJSON(bz, &packetData); err != nil { return nil, err diff --git a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go index 071d6695868..0bf4af8496a 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_middleware_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,7 +38,7 @@ var ( ) type InterchainAccountsTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -49,7 +49,7 @@ type InterchainAccountsTestSuite struct { } func TestICATestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsTestSuite)) + testifysuite.Run(t, new(InterchainAccountsTestSuite)) } func (suite *InterchainAccountsTestSuite) SetupTest() { diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 8084c8e5d66..3fff058df99 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -129,7 +129,7 @@ func (k Keeper) OnChanOpenAck( } // OnChanCloseConfirm removes the active channel stored in state -func (k Keeper) OnChanCloseConfirm( +func (Keeper) OnChanCloseConfirm( ctx sdk.Context, portID, channelID string, diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index df65da0dad7..7a7b3533e5f 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -74,7 +74,7 @@ func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper) { } // Logger returns the application logger, scoped to the associated module -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go index 08fb3ded7da..3fc9b5c2e84 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -35,7 +35,7 @@ var ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -105,7 +105,7 @@ func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) erro } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } func (suite *KeeperTestSuite) TestGetAllPorts() { diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay.go b/modules/apps/27-interchain-accounts/controller/keeper/relay.go index 412d2cb2f0c..651af21966d 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay.go @@ -55,6 +55,6 @@ func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketDa // OnTimeoutPacket removes the active channel associated with the provided packet, the underlying channel end is closed // due to the semantics of ORDERED channels -func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error { +func (Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error { return nil } diff --git a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go index c079459c0aa..5c6ce64e154 100644 --- a/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go +++ b/modules/apps/27-interchain-accounts/controller/migrations/v6/migrations_test.go @@ -3,7 +3,7 @@ package v6_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,7 +18,7 @@ import ( ) type MigrationsTestSuite struct { - suite.Suite + testifysuite.Suite chainA *ibctesting.TestChain chainB *ibctesting.TestChain @@ -58,7 +58,7 @@ func (suite *MigrationsTestSuite) SetupPath() error { return suite.path.EndpointB.ChanOpenConfirm() } -func (suite *MigrationsTestSuite) RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error { +func (*MigrationsTestSuite) RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error { portID, err := icatypes.NewControllerPortID(owner) if err != nil { return err @@ -81,7 +81,7 @@ func (suite *MigrationsTestSuite) RegisterInterchainAccount(endpoint *ibctesting } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(MigrationsTestSuite)) + testifysuite.Run(t, new(MigrationsTestSuite)) } func (suite *MigrationsTestSuite) TestMigrateICS27ChannelCapability() { diff --git a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go index a83bdec50b4..0f258eb6216 100644 --- a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go +++ b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go @@ -3,7 +3,7 @@ package types_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" genesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" @@ -21,11 +21,11 @@ var ( ) type GenesisTypesTestSuite struct { - suite.Suite + testifysuite.Suite } func TestGenesisTypesTestSuite(t *testing.T) { - suite.Run(t, new(GenesisTypesTestSuite)) + testifysuite.Run(t, new(GenesisTypesTestSuite)) } func (suite *GenesisTypesTestSuite) TestValidateGenesisState() { diff --git a/modules/apps/27-interchain-accounts/host/ibc_module.go b/modules/apps/27-interchain-accounts/host/ibc_module.go index 012130c2efc..6efd8c47cb8 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module.go @@ -29,7 +29,7 @@ func NewIBCModule(k keeper.Keeper) IBCModule { } // OnChanOpenInit implements the IBCModule interface -func (im IBCModule) OnChanOpenInit( +func (IBCModule) OnChanOpenInit( ctx sdk.Context, order channeltypes.Order, connectionHops []string, @@ -61,7 +61,7 @@ func (im IBCModule) OnChanOpenTry( } // OnChanOpenAck implements the IBCModule interface -func (im IBCModule) OnChanOpenAck( +func (IBCModule) OnChanOpenAck( ctx sdk.Context, portID, channelID string, @@ -85,7 +85,7 @@ func (im IBCModule) OnChanOpenConfirm( } // OnChanCloseInit implements the IBCModule interface -func (im IBCModule) OnChanCloseInit( +func (IBCModule) OnChanCloseInit( ctx sdk.Context, portID, channelID string, @@ -132,7 +132,7 @@ func (im IBCModule) OnRecvPacket( } // OnAcknowledgementPacket implements the IBCModule interface -func (im IBCModule) OnAcknowledgementPacket( +func (IBCModule) OnAcknowledgementPacket( ctx sdk.Context, packet channeltypes.Packet, acknowledgement []byte, @@ -142,7 +142,7 @@ func (im IBCModule) OnAcknowledgementPacket( } // OnTimeoutPacket implements the IBCModule interface -func (im IBCModule) OnTimeoutPacket( +func (IBCModule) OnTimeoutPacket( ctx sdk.Context, packet channeltypes.Packet, relayer sdk.AccAddress, diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 35687bbdc1b..05f9c7d520f 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" @@ -42,7 +42,7 @@ var ( ) type InterchainAccountsTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -52,7 +52,7 @@ type InterchainAccountsTestSuite struct { } func TestICATestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsTestSuite)) + testifysuite.Run(t, new(InterchainAccountsTestSuite)) } func (suite *InterchainAccountsTestSuite) SetupTest() { diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index f565ad65a7d..7b4f2254235 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -123,7 +123,7 @@ func (k Keeper) OnChanOpenConfirm( } // OnChanCloseConfirm removes the active channel stored in state -func (k Keeper) OnChanCloseConfirm( +func (Keeper) OnChanCloseConfirm( ctx sdk.Context, portID, channelID string, diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 7f51d2edb23..bad9fc67692 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -82,7 +82,7 @@ func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper) { } // Logger returns the application logger, scoped to the associated module -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s-%s", exported.ModuleName, icatypes.ModuleName)) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go index 6e4b5f1e1ee..cb03e1371e3 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" genesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" @@ -43,7 +43,7 @@ var ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -124,7 +124,7 @@ func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) erro } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } func (suite *KeeperTestSuite) TestGetInterchainAccountAddress() { diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index 31e58cfbcb8..1dceea8aa15 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -203,11 +203,11 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 3 } // BeginBlock implements the AppModule interface -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { } // EndBlock implements the AppModule interface -func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { +func (AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -219,11 +219,11 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // WeightedOperations is unimplemented. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { +func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { return nil } // RegisterStoreDecoder registers a decoder for interchain accounts module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +func (AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore() } diff --git a/modules/apps/27-interchain-accounts/module_test.go b/modules/apps/27-interchain-accounts/module_test.go index 2ee638f081a..da6e3136622 100644 --- a/modules/apps/27-interchain-accounts/module_test.go +++ b/modules/apps/27-interchain-accounts/module_test.go @@ -3,7 +3,7 @@ package ica_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/baseapp" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -21,13 +21,13 @@ import ( ) type InterchainAccountsTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator } func TestICATestSuite(t *testing.T) { - suite.Run(t, new(InterchainAccountsTestSuite)) + testifysuite.Run(t, new(InterchainAccountsTestSuite)) } func (suite *InterchainAccountsTestSuite) SetupTest() { diff --git a/modules/apps/27-interchain-accounts/types/account.go b/modules/apps/27-interchain-accounts/types/account.go index 5fc1466e52d..03431d3e63a 100644 --- a/modules/apps/27-interchain-accounts/types/account.go +++ b/modules/apps/27-interchain-accounts/types/account.go @@ -77,12 +77,12 @@ func NewInterchainAccount(ba *authtypes.BaseAccount, accountOwner string) *Inter } // SetPubKey implements the authtypes.AccountI interface -func (ia InterchainAccount) SetPubKey(pubKey crypto.PubKey) error { +func (InterchainAccount) SetPubKey(pubkey crypto.PubKey) error { return errorsmod.Wrap(ErrUnsupported, "cannot set public key for interchain account") } // SetSequence implements the authtypes.AccountI interface -func (ia InterchainAccount) SetSequence(seq uint64) error { +func (InterchainAccount) SetSequence(seq uint64) error { return errorsmod.Wrap(ErrUnsupported, "cannot set sequence number for interchain account") } diff --git a/modules/apps/27-interchain-accounts/types/account_test.go b/modules/apps/27-interchain-accounts/types/account_test.go index 50eadc8aad3..69ba9dfcdfe 100644 --- a/modules/apps/27-interchain-accounts/types/account_test.go +++ b/modules/apps/27-interchain-accounts/types/account_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" @@ -24,7 +24,7 @@ var ( ) type TypesTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -40,7 +40,7 @@ func (suite *TypesTestSuite) SetupTest() { } func TestTypesTestSuite(t *testing.T) { - suite.Run(t, new(TypesTestSuite)) + testifysuite.Run(t, new(TypesTestSuite)) } func (suite *TypesTestSuite) TestGenerateAddress() { diff --git a/modules/apps/29-fee/fee_test.go b/modules/apps/29-fee/fee_test.go index 0505a186132..390bfd4e571 100644 --- a/modules/apps/29-fee/fee_test.go +++ b/modules/apps/29-fee/fee_test.go @@ -3,7 +3,7 @@ package fee_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -13,7 +13,7 @@ import ( ) type FeeTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -48,7 +48,7 @@ func (suite *FeeTestSuite) SetupTest() { } func TestIBCFeeTestSuite(t *testing.T) { - suite.Run(t, new(FeeTestSuite)) + testifysuite.Run(t, new(FeeTestSuite)) } func (suite *FeeTestSuite) CreateMockPacket() channeltypes.Packet { diff --git a/modules/apps/29-fee/ibc_middleware_test.go b/modules/apps/29-fee/ibc_middleware_test.go index a36f9c6a381..b2a740a06e5 100644 --- a/modules/apps/29-fee/ibc_middleware_test.go +++ b/modules/apps/29-fee/ibc_middleware_test.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - fee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" + ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" feekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -1069,7 +1069,7 @@ func (suite *FeeTestSuite) TestGetAppVersion() { cbs, ok := suite.chainA.App.GetIBCKeeper().Router.GetRoute(module) suite.Require().True(ok) - feeModule := cbs.(fee.IBCMiddleware) + feeModule := cbs.(ibcfee.IBCMiddleware) appVersion, found := feeModule.GetAppVersion(suite.chainA.GetContext(), portID, channelID) @@ -1101,7 +1101,7 @@ func (suite *FeeTestSuite) TestPacketDataUnmarshalerInterface() { func (suite *FeeTestSuite) TestPacketDataUnmarshalerInterfaceError() { // test the case when the underlying application cannot be casted to a PacketDataUnmarshaler - mockFeeMiddleware := fee.NewIBCMiddleware(nil, feekeeper.Keeper{}) + mockFeeMiddleware := ibcfee.NewIBCMiddleware(nil, feekeeper.Keeper{}) _, err := mockFeeMiddleware.UnmarshalPacketData(ibcmock.MockPacketData) expError := errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app does not implement %T", (*porttypes.PacketDataUnmarshaler)(nil)) diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 39c85b2244e..fd810553d8b 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -58,7 +58,7 @@ func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper) { } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName) } diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index aa9641b82db..9cf73d3ffba 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" @@ -26,7 +26,7 @@ var ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } // helper function diff --git a/modules/apps/29-fee/module.go b/modules/apps/29-fee/module.go index e2981cd97f6..95818469cfb 100644 --- a/modules/apps/29-fee/module.go +++ b/modules/apps/29-fee/module.go @@ -120,11 +120,11 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock implements the AppModule interface -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { } // EndBlock implements the AppModule interface -func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { +func (AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -135,10 +135,10 @@ func (AppModule) GenerateGenesisState(_ *module.SimulationState) { } // RegisterStoreDecoder registers a decoder for 29-fee module's types -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { +func (AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the 29-fee module operations with their respective weights. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 9063a4101a6..56c5869d765 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -163,12 +163,12 @@ func (msg MsgPayPacketFee) GetSigners() []sdk.AccAddress { } // Type implements legacytx.LegacyMsg -func (msg MsgPayPacketFee) Type() string { +func (MsgPayPacketFee) Type() string { return TypeMsgPayPacketFee } // Route implements legacytx.LegacyMsg -func (msg MsgPayPacketFee) Route() string { +func (MsgPayPacketFee) Route() string { return RouterKey } @@ -205,12 +205,12 @@ func (msg MsgPayPacketFeeAsync) GetSigners() []sdk.AccAddress { } // Type implements legacytx.LegacyMsg -func (msg MsgPayPacketFeeAsync) Type() string { +func (MsgPayPacketFeeAsync) Type() string { return TypeMsgPayPacketFeeAsync } // Route implements legacytx.LegacyMsg -func (msg MsgPayPacketFeeAsync) Route() string { +func (MsgPayPacketFeeAsync) Route() string { return RouterKey } diff --git a/modules/apps/transfer/ibc_module.go b/modules/apps/transfer/ibc_module.go index 29f76b3d19b..da807cef434 100644 --- a/modules/apps/transfer/ibc_module.go +++ b/modules/apps/transfer/ibc_module.go @@ -41,7 +41,7 @@ func NewIBCModule(k keeper.Keeper) IBCModule { // supported version. Only 2^32 channels are allowed to be created. func ValidateTransferChannelParams( ctx sdk.Context, - keeper keeper.Keeper, + transferkeeper keeper.Keeper, order channeltypes.Order, portID string, channelID string, @@ -60,7 +60,7 @@ func ValidateTransferChannelParams( } // Require portID is the portID transfer module is bound to - boundPort := keeper.GetPort(ctx) + boundPort := transferkeeper.GetPort(ctx) if boundPort != portID { return errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) } @@ -127,7 +127,7 @@ func (im IBCModule) OnChanOpenTry( } // OnChanOpenAck implements the IBCModule interface -func (im IBCModule) OnChanOpenAck( +func (IBCModule) OnChanOpenAck( ctx sdk.Context, portID, channelID string, @@ -141,7 +141,7 @@ func (im IBCModule) OnChanOpenAck( } // OnChanOpenConfirm implements the IBCModule interface -func (im IBCModule) OnChanOpenConfirm( +func (IBCModule) OnChanOpenConfirm( ctx sdk.Context, portID, channelID string, @@ -150,7 +150,7 @@ func (im IBCModule) OnChanOpenConfirm( } // OnChanCloseInit implements the IBCModule interface -func (im IBCModule) OnChanCloseInit( +func (IBCModule) OnChanCloseInit( ctx sdk.Context, portID, channelID string, @@ -160,7 +160,7 @@ func (im IBCModule) OnChanCloseInit( } // OnChanCloseConfirm implements the IBCModule interface -func (im IBCModule) OnChanCloseConfirm( +func (IBCModule) OnChanCloseConfirm( ctx sdk.Context, portID, channelID string, @@ -310,7 +310,7 @@ func (im IBCModule) OnTimeoutPacket( // UnmarshalPacketData attempts to unmarshal the provided packet data bytes // into a FungibleTokenPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCModule) UnmarshalPacketData(bz []byte) (interface{}, error) { +func (IBCModule) UnmarshalPacketData(bz []byte) (interface{}, error) { var packetData types.FungibleTokenPacketData if err := types.ModuleCdc.UnmarshalJSON(bz, &packetData); err != nil { return nil, err diff --git a/modules/apps/transfer/keeper/grpc_query.go b/modules/apps/transfer/keeper/grpc_query.go index f33db868d35..de30f1d1b1d 100644 --- a/modules/apps/transfer/keeper/grpc_query.go +++ b/modules/apps/transfer/keeper/grpc_query.go @@ -112,7 +112,7 @@ func (k Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) ( } // EscrowAddress implements the EscrowAddress gRPC method -func (k Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error) { +func (Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } diff --git a/modules/apps/transfer/keeper/keeper.go b/modules/apps/transfer/keeper/keeper.go index ee04ff1572f..d21f34190f1 100644 --- a/modules/apps/transfer/keeper/keeper.go +++ b/modules/apps/transfer/keeper/keeper.go @@ -90,7 +90,7 @@ func (k Keeper) GetAuthority() string { } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName) } @@ -242,9 +242,9 @@ func (k Keeper) GetAllTotalEscrowed(ctx sdk.Context) sdk.Coins { // IterateTokensInEscrow iterates over the denomination escrows in the store // and performs a callback function. Denominations for which an invalid value // (i.e. not integer) is stored, will be skipped. -func (k Keeper) IterateTokensInEscrow(ctx sdk.Context, prefix []byte, cb func(denomEscrow sdk.Coin) bool) { +func (k Keeper) IterateTokensInEscrow(ctx sdk.Context, storeprefix []byte, cb func(denomEscrow sdk.Coin) bool) { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, prefix) + iterator := storetypes.KVStorePrefixIterator(store, storeprefix) defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { diff --git a/modules/apps/transfer/keeper/keeper_test.go b/modules/apps/transfer/keeper/keeper_test.go index af2a338c28b..739c18fdf5e 100644 --- a/modules/apps/transfer/keeper/keeper_test.go +++ b/modules/apps/transfer/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" @@ -20,7 +20,7 @@ import ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -41,7 +41,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } func (suite *KeeperTestSuite) TestSetGetTotalEscrowForDenom() { diff --git a/modules/apps/transfer/keeper/mbt_relay_test.go b/modules/apps/transfer/keeper/mbt_relay_test.go index 6c5f7a406fe..1b091350a86 100644 --- a/modules/apps/transfer/keeper/mbt_relay_test.go +++ b/modules/apps/transfer/keeper/mbt_relay_test.go @@ -1,8 +1,8 @@ package keeper_test -/// This file is a test driver for model-based tests generated from the TLA+ model of token transfer -/// Written by Andrey Kuprianov within the scope of IBC Audit performed by Informal Systems. -/// In case of any questions please don't hesitate to contact andrey@informal.systems. +// This file is a test driver for model-based tests generated from the TLA+ model of token transfer +// Written by Andrey Kuprianov within the scope of IBC Audit performed by Informal Systems. +// In case of any questions please don't hesitate to contact andrey@informal.systems. import ( "encoding/json" @@ -269,13 +269,13 @@ func BankOfChain(chain *ibctesting.TestChain) Bank { } // Check that the state of the bank is the bankBefore + expectedBankChange -func (suite *KeeperTestSuite) CheckBankBalances(chain *ibctesting.TestChain, bankBefore *Bank, expectedBankChange *Bank) error { +func (*KeeperTestSuite) CheckBankBalances(chain *ibctesting.TestChain, bankBefore *Bank, expectedBankChange *Bank) error { bankAfter := BankOfChain(chain) bankChange := bankAfter.Sub(bankBefore) diff := bankChange.Sub(expectedBankChange) - NonZeroString := diff.NonZeroString() - if len(NonZeroString) != 0 { - return errorsmod.Wrap(ibcerrors.ErrInvalidCoins, "Unexpected changes in the bank: \n"+NonZeroString) + nonZeroString := diff.NonZeroString() + if len(nonZeroString) != 0 { + return errorsmod.Wrap(ibcerrors.ErrInvalidCoins, "Unexpected changes in the bank: \n"+nonZeroString) } return nil } diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index 8d84ff0311b..ad9c4e39b39 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -139,11 +139,11 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock implements the AppModule interface -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { } // EndBlock implements the AppModule interface -func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { +func (AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -160,6 +160,6 @@ func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the transfer module operations with their respective weights. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } diff --git a/modules/apps/transfer/transfer_test.go b/modules/apps/transfer/transfer_test.go index 8b68e6570a2..a5232b9e702 100644 --- a/modules/apps/transfer/transfer_test.go +++ b/modules/apps/transfer/transfer_test.go @@ -3,7 +3,7 @@ package transfer_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" @@ -15,7 +15,7 @@ import ( ) type TransferTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -134,5 +134,5 @@ func (suite *TransferTestSuite) TestHandleMsgTransfer() { } func TestTransferTestSuite(t *testing.T) { - suite.Run(t, new(TransferTestSuite)) + testifysuite.Run(t, new(TransferTestSuite)) } diff --git a/modules/apps/transfer/types/trace.go b/modules/apps/transfer/types/trace.go index f539ba65cf4..d9151f93faa 100644 --- a/modules/apps/transfer/types/trace.go +++ b/modules/apps/transfer/types/trace.go @@ -86,8 +86,8 @@ func (dt DenomTrace) IsNativeDenom() bool { // the elements that constitute the complete denom. func extractPathAndBaseFromFullDenom(fullDenomItems []string) (string, string) { var ( - path []string - baseDenom []string + pathSlice []string + baseDenomSlice []string ) length := len(fullDenomItems) @@ -102,14 +102,17 @@ func extractPathAndBaseFromFullDenom(fullDenomItems []string) (string, string) { // as an IBC denomination. The hash used to store the token internally on our chain // will be the same value as the base denomination being correctly parsed. if i < length-1 && length > 2 && channeltypes.IsValidChannelID(fullDenomItems[i+1]) { - path = append(path, fullDenomItems[i], fullDenomItems[i+1]) + pathSlice = append(pathSlice, fullDenomItems[i], fullDenomItems[i+1]) } else { - baseDenom = fullDenomItems[i:] + baseDenomSlice = fullDenomItems[i:] break } } - return strings.Join(path, "/"), strings.Join(baseDenom, "/") + path := strings.Join(pathSlice, "/") + baseDenom := strings.Join(baseDenomSlice, "/") + + return path, baseDenom } func validateTraceIdentifiers(identifiers []string) error { diff --git a/modules/apps/transfer/types/transfer_authorization.go b/modules/apps/transfer/types/transfer_authorization.go index c276064e422..f8537f0174c 100644 --- a/modules/apps/transfer/types/transfer_authorization.go +++ b/modules/apps/transfer/types/transfer_authorization.go @@ -27,7 +27,7 @@ func NewTransferAuthorization(allocations ...Allocation) *TransferAuthorization } // MsgTypeURL implements Authorization.MsgTypeURL. -func (a TransferAuthorization) MsgTypeURL() string { +func (TransferAuthorization) MsgTypeURL() string { return sdk.MsgTypeURL(&MsgTransfer{}) } diff --git a/modules/apps/transfer/types/types_test.go b/modules/apps/transfer/types/types_test.go index 86069b1a887..d17bf91bf49 100644 --- a/modules/apps/transfer/types/types_test.go +++ b/modules/apps/transfer/types/types_test.go @@ -3,14 +3,14 @@ package types_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibctesting "github.com/cosmos/ibc-go/v7/testing" ) type TypesTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -36,5 +36,5 @@ func NewTransferPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { } func TestTypesTestSuite(t *testing.T) { - suite.Run(t, new(TypesTestSuite)) + testifysuite.Run(t, new(TypesTestSuite)) } diff --git a/modules/capability/capability_test.go b/modules/capability/capability_test.go index 1ed4cb1457e..70e27d8123b 100644 --- a/modules/capability/capability_test.go +++ b/modules/capability/capability_test.go @@ -3,12 +3,11 @@ package capability_test import ( "testing" - "github.com/stretchr/testify/suite" - "cosmossdk.io/log" "cosmossdk.io/store" "cosmossdk.io/store/metrics" storetypes "cosmossdk.io/store/types" + testifysuite "github.com/stretchr/testify/suite" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/codec" @@ -26,7 +25,7 @@ import ( const mockMemStoreKey = "memory:mock" type CapabilityTestSuite struct { - suite.Suite + testifysuite.Suite cdc codec.Codec ctx sdk.Context @@ -125,5 +124,5 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() { } func TestCapabilityTestSuite(t *testing.T) { - suite.Run(t, new(CapabilityTestSuite)) + testifysuite.Run(t, new(CapabilityTestSuite)) } diff --git a/modules/capability/keeper/keeper_test.go b/modules/capability/keeper/keeper_test.go index e606219edd1..357c2e72314 100644 --- a/modules/capability/keeper/keeper_test.go +++ b/modules/capability/keeper/keeper_test.go @@ -4,9 +4,8 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" - storetypes "cosmossdk.io/store/types" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" @@ -23,7 +22,7 @@ var ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite ctx sdk.Context keeper *keeper.Keeper @@ -308,5 +307,5 @@ func (suite *KeeperTestSuite) TestRevertCapability() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } diff --git a/modules/core/02-client/abci_test.go b/modules/core/02-client/abci_test.go index b825acee6ba..48fc0423de4 100644 --- a/modules/core/02-client/abci_test.go +++ b/modules/core/02-client/abci_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" @@ -19,7 +19,7 @@ import ( ) type ClientTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -35,7 +35,7 @@ func (suite *ClientTestSuite) SetupTest() { } func TestClientTestSuite(t *testing.T) { - suite.Run(t, new(ClientTestSuite)) + testifysuite.Run(t, new(ClientTestSuite)) } func (suite *ClientTestSuite) TestBeginBlocker() { diff --git a/modules/core/02-client/keeper/grpc_query.go b/modules/core/02-client/keeper/grpc_query.go index 3b0b671c18c..5f31c5c3bf3 100644 --- a/modules/core/02-client/keeper/grpc_query.go +++ b/modules/core/02-client/keeper/grpc_query.go @@ -247,10 +247,10 @@ func (k Keeper) ClientStatus(c context.Context, req *types.QueryClientStatusRequ ) } - status := k.GetClientStatus(ctx, clientState, req.ClientId) + clientStatus := k.GetClientStatus(ctx, clientState, req.ClientId) return &types.QueryClientStatusResponse{ - Status: status.String(), + Status: clientStatus.String(), }, nil } diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 779c81434d3..3588b117f8c 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -53,7 +53,7 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace pa } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } @@ -368,9 +368,9 @@ func (k Keeper) SetUpgradedConsensusState(ctx sdk.Context, planHeight int64, bz // IterateClientStates provides an iterator over all stored light client State // objects. For each State object, cb will be called. If the cb returns true, // the iterator will close and stop. -func (k Keeper) IterateClientStates(ctx sdk.Context, prefix []byte, cb func(clientID string, cs exported.ClientState) bool) { +func (k Keeper) IterateClientStates(ctx sdk.Context, storeprefix []byte, cb func(clientID string, cs exported.ClientState) bool) { store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, host.PrefixedClientStoreKey(prefix)) + iterator := storetypes.KVStorePrefixIterator(store, host.PrefixedClientStoreKey(storeprefix)) defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 57f1e8424af..9bb1a6704c7 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdkmath "cosmossdk.io/math" @@ -51,7 +51,7 @@ var ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -122,7 +122,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } func (suite *KeeperTestSuite) TestSetClientState() { diff --git a/modules/core/02-client/migrations/v7/solomachine.go b/modules/core/02-client/migrations/v7/solomachine.go index 333f77e5674..ac90209285a 100644 --- a/modules/core/02-client/migrations/v7/solomachine.go +++ b/modules/core/02-client/migrations/v7/solomachine.go @@ -50,80 +50,80 @@ func (cs ConsensusState) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error } // ClientType panics! -func (cs ClientState) ClientType() string { +func (ClientState) ClientType() string { panic("legacy solo machine is deprecated!") } // GetLatestHeight panics! -func (cs ClientState) GetLatestHeight() exported.Height { +func (ClientState) GetLatestHeight() exported.Height { panic("legacy solo machine is deprecated!") } // Status panics! -func (cs ClientState) Status(_ sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec) exported.Status { +func (ClientState) Status(_ sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec) exported.Status { panic("legacy solo machine is deprecated!") } // Validate panics! -func (cs ClientState) Validate() error { +func (ClientState) Validate() error { panic("legacy solo machine is deprecated!") } // ZeroCustomFields panics! -func (cs ClientState) ZeroCustomFields() exported.ClientState { +func (ClientState) ZeroCustomFields() exported.ClientState { panic("legacy solo machine is deprecated!") } // Initialize panics! -func (cs ClientState) Initialize(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, consState exported.ConsensusState) error { +func (ClientState) Initialize(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ConsensusState) error { panic("legacy solo machine is deprecated!") } // ExportMetadata panics! -func (cs ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata { +func (ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata { panic("legacy solo machine is deprecated!") } // CheckForMisbehaviour panics! -func (cs ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) bool { panic("legacy solo machine is deprecated!") } // UpdateStateOnMisbehaviour panics! -func (cs *ClientState) UpdateStateOnMisbehaviour( +func (*ClientState) UpdateStateOnMisbehaviour( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) { panic("legacy solo machine is deprecated!") } // VerifyClientMessage panics! -func (cs *ClientState) VerifyClientMessage( +func (*ClientState) VerifyClientMessage( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) error { panic("legacy solo machine is deprecated!") } // UpdateState panis! -func (cs *ClientState) UpdateState(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) []exported.Height { +func (*ClientState) UpdateState(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) []exported.Height { panic("legacy solo machine is deprecated!") } // CheckHeaderAndUpdateState panics! -func (cs *ClientState) CheckHeaderAndUpdateState( +func (*ClientState) CheckHeaderAndUpdateState( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) (exported.ClientState, exported.ConsensusState, error) { panic("legacy solo machine is deprecated!") } // CheckMisbehaviourAndUpdateState panics! -func (cs ClientState) CheckMisbehaviourAndUpdateState( +func (ClientState) CheckMisbehaviourAndUpdateState( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage, ) (exported.ClientState, error) { panic("legacy solo machine is deprecated!") } // CheckSubstituteAndUpdateState panics! -func (cs ClientState) CheckSubstituteAndUpdateState( +func (ClientState) CheckSubstituteAndUpdateState( ctx sdk.Context, _ codec.BinaryCodec, _, _ storetypes.KVStore, _ exported.ClientState, ) error { @@ -131,7 +131,7 @@ func (cs ClientState) CheckSubstituteAndUpdateState( } // VerifyUpgradeAndUpdateState panics! -func (cs ClientState) VerifyUpgradeAndUpdateState( +func (ClientState) VerifyUpgradeAndUpdateState( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientState, _ exported.ConsensusState, _, _ []byte, ) error { @@ -139,7 +139,7 @@ func (cs ClientState) VerifyUpgradeAndUpdateState( } // VerifyClientState panics! -func (cs ClientState) VerifyClientState( +func (ClientState) VerifyClientState( store storetypes.KVStore, cdc codec.BinaryCodec, _ exported.Height, _ exported.Prefix, _ string, _ []byte, clientState exported.ClientState, ) error { @@ -147,7 +147,7 @@ func (cs ClientState) VerifyClientState( } // VerifyClientConsensusState panics! -func (cs ClientState) VerifyClientConsensusState( +func (ClientState) VerifyClientConsensusState( storetypes.KVStore, codec.BinaryCodec, exported.Height, string, exported.Height, exported.Prefix, []byte, exported.ConsensusState, @@ -156,7 +156,7 @@ func (cs ClientState) VerifyClientConsensusState( } // VerifyConnectionState panics! -func (cs ClientState) VerifyConnectionState( +func (ClientState) VerifyConnectionState( storetypes.KVStore, codec.BinaryCodec, exported.Height, exported.Prefix, []byte, string, exported.ConnectionI, ) error { @@ -164,7 +164,7 @@ func (cs ClientState) VerifyConnectionState( } // VerifyChannelState panics! -func (cs ClientState) VerifyChannelState( +func (ClientState) VerifyChannelState( storetypes.KVStore, codec.BinaryCodec, exported.Height, exported.Prefix, []byte, string, string, exported.ChannelI, ) error { @@ -172,7 +172,7 @@ func (cs ClientState) VerifyChannelState( } // VerifyPacketCommitment panics! -func (cs ClientState) VerifyPacketCommitment( +func (ClientState) VerifyPacketCommitment( sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, []byte, @@ -181,7 +181,7 @@ func (cs ClientState) VerifyPacketCommitment( } // VerifyPacketAcknowledgement panics! -func (cs ClientState) VerifyPacketAcknowledgement( +func (ClientState) VerifyPacketAcknowledgement( sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, []byte, @@ -190,7 +190,7 @@ func (cs ClientState) VerifyPacketAcknowledgement( } // VerifyPacketReceiptAbsence panics! -func (cs ClientState) VerifyPacketReceiptAbsence( +func (ClientState) VerifyPacketReceiptAbsence( sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, @@ -199,7 +199,7 @@ func (cs ClientState) VerifyPacketReceiptAbsence( } // VerifyNextSequenceRecv panics! -func (cs ClientState) VerifyNextSequenceRecv( +func (ClientState) VerifyNextSequenceRecv( sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, uint64, uint64, exported.Prefix, []byte, string, string, uint64, @@ -208,14 +208,14 @@ func (cs ClientState) VerifyNextSequenceRecv( } // GetTimestampAtHeight panics! -func (cs ClientState) GetTimestampAtHeight( +func (ClientState) GetTimestampAtHeight( sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height, ) (uint64, error) { panic("legacy solo machine is deprecated!") } // VerifyMembership panics! -func (cs *ClientState) VerifyMembership( +func (*ClientState) VerifyMembership( ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, @@ -230,7 +230,7 @@ func (cs *ClientState) VerifyMembership( } // VerifyNonMembership panics! -func (cs *ClientState) VerifyNonMembership( +func (*ClientState) VerifyNonMembership( ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, @@ -249,11 +249,11 @@ func (ConsensusState) ClientType() string { } // GetTimestamp panics! -func (cs ConsensusState) GetTimestamp() uint64 { +func (ConsensusState) GetTimestamp() uint64 { panic("legacy solo machine is deprecated!") } // ValidateBasic panics! -func (cs ConsensusState) ValidateBasic() error { +func (ConsensusState) ValidateBasic() error { panic("legacy solo machine is deprecated!") } diff --git a/modules/core/02-client/migrations/v7/store_test.go b/modules/core/02-client/migrations/v7/store_test.go index 524e439a4f6..981888ac01d 100644 --- a/modules/core/02-client/migrations/v7/store_test.go +++ b/modules/core/02-client/migrations/v7/store_test.go @@ -4,7 +4,7 @@ import ( "strconv" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/codec" @@ -20,7 +20,7 @@ import ( const numCreations = 10 type MigrationsV7TestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -36,7 +36,7 @@ func (suite *MigrationsV7TestSuite) SetupTest() { } func TestIBCTestSuite(t *testing.T) { - suite.Run(t, new(MigrationsV7TestSuite)) + testifysuite.Run(t, new(MigrationsV7TestSuite)) } // create multiple solo machine clients, tendermint and localhost clients diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 2d265dcbc6c..b200524221f 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -6,7 +6,7 @@ import ( "github.com/golang/protobuf/proto" //nolint:staticcheck "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -18,7 +18,7 @@ import ( ) type TypesTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -35,7 +35,7 @@ func (suite *TypesTestSuite) SetupTest() { } func TestTypesTestSuite(t *testing.T) { - suite.Run(t, new(TypesTestSuite)) + testifysuite.Run(t, new(TypesTestSuite)) } // tests that different clients within MsgCreateClient can be marshaled diff --git a/modules/core/02-client/types/proposal.go b/modules/core/02-client/types/proposal.go index c51f4cf1900..b00169275b6 100644 --- a/modules/core/02-client/types/proposal.go +++ b/modules/core/02-client/types/proposal.go @@ -47,10 +47,10 @@ func (cup *ClientUpdateProposal) GetTitle() string { return cup.Title } func (cup *ClientUpdateProposal) GetDescription() string { return cup.Description } // ProposalRoute returns the routing key of a client update proposal. -func (cup *ClientUpdateProposal) ProposalRoute() string { return RouterKey } +func (*ClientUpdateProposal) ProposalRoute() string { return RouterKey } // ProposalType returns the type of a client update proposal. -func (cup *ClientUpdateProposal) ProposalType() string { return ProposalTypeClientUpdate } +func (*ClientUpdateProposal) ProposalType() string { return ProposalTypeClientUpdate } // ValidateBasic runs basic stateless validity checks func (cup *ClientUpdateProposal) ValidateBasic() error { @@ -94,10 +94,10 @@ func (up *UpgradeProposal) GetTitle() string { return up.Title } func (up *UpgradeProposal) GetDescription() string { return up.Description } // ProposalRoute returns the routing key of a upgrade proposal. -func (up *UpgradeProposal) ProposalRoute() string { return RouterKey } +func (*UpgradeProposal) ProposalRoute() string { return RouterKey } // ProposalType returns the upgrade proposal type. -func (up *UpgradeProposal) ProposalType() string { return ProposalTypeUpgrade } +func (*UpgradeProposal) ProposalType() string { return ProposalTypeUpgrade } // ValidateBasic runs basic stateless validity checks func (up *UpgradeProposal) ValidateBasic() error { diff --git a/modules/core/03-connection/keeper/keeper.go b/modules/core/03-connection/keeper/keeper.go index 220e09f30c4..b0a910f3e08 100644 --- a/modules/core/03-connection/keeper/keeper.go +++ b/modules/core/03-connection/keeper/keeper.go @@ -44,7 +44,7 @@ func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, legacySubspace pa } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } diff --git a/modules/core/03-connection/keeper/keeper_test.go b/modules/core/03-connection/keeper/keeper_test.go index 37f185a6d66..375ba0eb658 100644 --- a/modules/core/03-connection/keeper/keeper_test.go +++ b/modules/core/03-connection/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" @@ -13,7 +13,7 @@ import ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -29,7 +29,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } func (suite *KeeperTestSuite) TestSetAndGetConnection() { diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index 588875dd693..cc0544f91fa 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/store/iavl" "github.com/cosmos/cosmos-sdk/store/rootmulti" @@ -34,7 +34,7 @@ var ( ) type MsgTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -79,7 +79,7 @@ func (suite *MsgTestSuite) SetupTest() { } func TestMsgTestSuite(t *testing.T) { - suite.Run(t, new(MsgTestSuite)) + testifysuite.Run(t, new(MsgTestSuite)) } func (suite *MsgTestSuite) TestNewMsgConnectionOpenInit() { diff --git a/modules/core/04-channel/keeper/events.go b/modules/core/04-channel/keeper/events.go index 7f2b8b65fa8..5cb39ab6dab 100644 --- a/modules/core/04-channel/keeper/events.go +++ b/modules/core/04-channel/keeper/events.go @@ -125,7 +125,7 @@ func emitSendPacketEvent(ctx sdk.Context, packet exported.PacketI, channel types ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSendPacket, - sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), // DEPRECATED + sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, timeoutHeight.String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -153,7 +153,7 @@ func emitRecvPacketEvent(ctx sdk.Context, packet exported.PacketI, channel types ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRecvPacket, - sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), // DEPRECATED + sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -180,7 +180,7 @@ func emitWriteAcknowledgementEvent(ctx sdk.Context, packet exported.PacketI, cha ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeWriteAck, - sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), // DEPRECATED + sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyDataHex, hex.EncodeToString(packet.GetData())), sdk.NewAttribute(types.AttributeKeyTimeoutHeight, packet.GetTimeoutHeight().String()), sdk.NewAttribute(types.AttributeKeyTimeoutTimestamp, fmt.Sprintf("%d", packet.GetTimeoutTimestamp())), @@ -189,7 +189,7 @@ func emitWriteAcknowledgementEvent(ctx sdk.Context, packet exported.PacketI, cha sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), - sdk.NewAttribute(types.AttributeKeyAck, string(acknowledgement)), // DEPRECATED + sdk.NewAttribute(types.AttributeKeyAck, string(acknowledgement)), //nolint:staticcheck // DEPRECATED sdk.NewAttribute(types.AttributeKeyAckHex, hex.EncodeToString(acknowledgement)), // we only support 1-hop packets now, and that is the most important hop for a relayer // (is it going to a chain I am connected to) diff --git a/modules/core/04-channel/keeper/keeper.go b/modules/core/04-channel/keeper/keeper.go index 9bfd53f5bcf..edab92bc071 100644 --- a/modules/core/04-channel/keeper/keeper.go +++ b/modules/core/04-channel/keeper/keeper.go @@ -54,7 +54,7 @@ func NewKeeper( } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } @@ -242,7 +242,7 @@ func (k Keeper) HasPacketAcknowledgement(ctx sdk.Context, portID, channelID stri // IteratePacketSequence provides an iterator over all send, receive or ack sequences. // For each sequence, cb will be called. If the cb returns true, the iterator // will close and stop. -func (k Keeper) IteratePacketSequence(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64) bool) { +func (Keeper) IteratePacketSequence(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64) bool) { defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { portID, channelID, err := host.ParseChannelPath(string(iterator.Key())) @@ -481,7 +481,7 @@ func (k Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) } // common functionality for IteratePacketCommitment and IteratePacketAcknowledgement -func (k Keeper) iterateHashes(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { +func (Keeper) iterateHashes(ctx sdk.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64, hash []byte) bool) { defer sdk.LogDeferred(ctx.Logger(), func() error { return iterator.Close() }) for ; iterator.Valid(); iterator.Next() { diff --git a/modules/core/04-channel/keeper/keeper_test.go b/modules/core/04-channel/keeper/keeper_test.go index 92afaba9135..835e9da87c0 100644 --- a/modules/core/04-channel/keeper/keeper_test.go +++ b/modules/core/04-channel/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" @@ -14,7 +14,7 @@ import ( // KeeperTestSuite is a testing suite to test keeper functions. type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -25,7 +25,7 @@ type KeeperTestSuite struct { // TestKeeperTestSuite runs all the tests within this package. func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } // SetupTest creates a coordinator with 2 test chains. diff --git a/modules/core/04-channel/types/msgs_test.go b/modules/core/04-channel/types/msgs_test.go index ae437a476b6..f2f5d4d82ed 100644 --- a/modules/core/04-channel/types/msgs_test.go +++ b/modules/core/04-channel/types/msgs_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/store/iavl" "github.com/cosmos/cosmos-sdk/store/rootmulti" @@ -69,7 +69,7 @@ var ( ) type TypesTestSuite struct { - suite.Suite + testifysuite.Suite proof []byte } @@ -104,7 +104,7 @@ func (suite *TypesTestSuite) SetupTest() { } func TestTypesTestSuite(t *testing.T) { - suite.Run(t, new(TypesTestSuite)) + testifysuite.Run(t, new(TypesTestSuite)) } func (suite *TypesTestSuite) TestMsgChannelOpenInitValidateBasic() { diff --git a/modules/core/05-port/keeper/keeper.go b/modules/core/05-port/keeper/keeper.go index f83c42af64b..11a20255192 100644 --- a/modules/core/05-port/keeper/keeper.go +++ b/modules/core/05-port/keeper/keeper.go @@ -28,7 +28,7 @@ func NewKeeper(sck exported.ScopedKeeper) Keeper { } // Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { +func (Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+exported.ModuleName+"/"+types.SubModuleName) } diff --git a/modules/core/05-port/keeper/keeper_test.go b/modules/core/05-port/keeper/keeper_test.go index da61c501428..55e428b4e11 100644 --- a/modules/core/05-port/keeper/keeper_test.go +++ b/modules/core/05-port/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,7 +20,7 @@ var ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite ctx sdk.Context keeper *keeper.Keeper @@ -35,7 +35,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } func (suite *KeeperTestSuite) TestBind() { diff --git a/modules/core/23-commitment/types/commitment_test.go b/modules/core/23-commitment/types/commitment_test.go index 9d204e108bf..c08a94ab1bb 100644 --- a/modules/core/23-commitment/types/commitment_test.go +++ b/modules/core/23-commitment/types/commitment_test.go @@ -3,7 +3,7 @@ package types_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/store/iavl" "github.com/cosmos/cosmos-sdk/store/rootmulti" @@ -14,7 +14,7 @@ import ( ) type MerkleTestSuite struct { - suite.Suite + testifysuite.Suite store *rootmulti.Store storeKey *storetypes.KVStoreKey @@ -36,5 +36,5 @@ func (suite *MerkleTestSuite) SetupTest() { } func TestMerkleTestSuite(t *testing.T) { - suite.Run(t, new(MerkleTestSuite)) + testifysuite.Run(t, new(MerkleTestSuite)) } diff --git a/modules/core/23-commitment/types/merkle.go b/modules/core/23-commitment/types/merkle.go index 79a2c113fc6..6cf5d973bc2 100644 --- a/modules/core/23-commitment/types/merkle.go +++ b/modules/core/23-commitment/types/merkle.go @@ -205,13 +205,13 @@ func (proof MerkleProof) VerifyNonMembership(specs []*ics23.ProofSpec, root expo // BatchVerifyMembership verifies a group of key value pairs against the given root // NOTE: Currently left unimplemented as it is unused -func (proof MerkleProof) BatchVerifyMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, items map[string][]byte) error { +func (MerkleProof) BatchVerifyMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, items map[string][]byte) error { return errorsmod.Wrap(ErrInvalidProof, "batch proofs are currently unsupported") } // BatchVerifyNonMembership verifies absence of a group of keys against the given root // NOTE: Currently left unimplemented as it is unused -func (proof MerkleProof) BatchVerifyNonMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, items [][]byte) error { +func (MerkleProof) BatchVerifyNonMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, items [][]byte) error { return errorsmod.Wrap(ErrInvalidProof, "batch proofs are currently unsupported") } diff --git a/modules/core/24-host/parse.go b/modules/core/24-host/parse.go index 81074bbfcca..f838cc07b9d 100644 --- a/modules/core/24-host/parse.go +++ b/modules/core/24-host/parse.go @@ -63,7 +63,9 @@ func parseClientStatePath(path string) (string, error) { return "", errorsmod.Wrap(ErrInvalidPath, "clientID is empty") } - return split[1], nil + clientID := split[1] + + return clientID, nil } // ParseConnectionPath returns the connection ID from a full path. It returns @@ -74,7 +76,9 @@ func ParseConnectionPath(path string) (string, error) { return "", errorsmod.Wrapf(ErrInvalidPath, "cannot parse connection path %s", path) } - return split[1], nil + connectionID := split[1] + + return connectionID, nil } // ParseChannelPath returns the port and channel ID from a full path. It returns @@ -89,7 +93,10 @@ func ParseChannelPath(path string) (string, string, error) { return "", "", errorsmod.Wrapf(ErrInvalidPath, "cannot parse channel path %s", path) } - return split[2], split[4], nil + portID := split[2] + channelID := split[4] + + return portID, channelID, nil } // MustParseConnectionPath returns the connection ID from a full path. Panics diff --git a/modules/core/ante/ante_test.go b/modules/core/ante/ante_test.go index 1ec224abe58..649390d30f5 100644 --- a/modules/core/ante/ante_test.go +++ b/modules/core/ante/ante_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" @@ -17,7 +17,7 @@ import ( ) type AnteTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -42,7 +42,7 @@ func (suite *AnteTestSuite) SetupTest() { // TestAnteTestSuite runs all the tests within this package. func TestAnteTestSuite(t *testing.T) { - suite.Run(t, new(AnteTestSuite)) + testifysuite.Run(t, new(AnteTestSuite)) } // createRecvPacketMessage creates a RecvPacket message for a packet sent from chain A to chain B. @@ -337,7 +337,7 @@ func (suite *AnteTestSuite) TestAnteDecorator() { } // append non packet and update message to msgs to ensure multimsg tx should pass - msgs = append(msgs, &clienttypes.MsgSubmitMisbehaviour{}) + msgs = append(msgs, &clienttypes.MsgSubmitMisbehaviour{}) //nolint:staticcheck // we're using the deprecated message for testing return msgs }, true, diff --git a/modules/core/genesis_test.go b/modules/core/genesis_test.go index fb1472cc507..8e20fb2cf15 100644 --- a/modules/core/genesis_test.go +++ b/modules/core/genesis_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/codec" @@ -38,7 +38,7 @@ const ( var clientHeight = clienttypes.NewHeight(1, 10) type IBCTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -55,7 +55,7 @@ func (suite *IBCTestSuite) SetupTest() { } func TestIBCTestSuite(t *testing.T) { - suite.Run(t, new(IBCTestSuite)) + testifysuite.Run(t, new(IBCTestSuite)) } func (suite *IBCTestSuite) TestValidateGenesis() { diff --git a/modules/core/keeper/keeper_test.go b/modules/core/keeper/keeper_test.go index 19fb8132a07..0cf893873dc 100644 --- a/modules/core/keeper/keeper_test.go +++ b/modules/core/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -19,7 +19,7 @@ import ( ) type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -40,7 +40,7 @@ func (suite *KeeperTestSuite) SetupTest() { } func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } // MockStakingKeeper implements clienttypes.StakingKeeper used in ibckeeper.NewKeeper @@ -48,11 +48,11 @@ type MockStakingKeeper struct { mockField string } -func (d MockStakingKeeper) GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool) { +func (MockStakingKeeper) GetHistoricalInfo(_ sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool) { return stakingtypes.HistoricalInfo{}, true } -func (d MockStakingKeeper) UnbondingTime(ctx sdk.Context) time.Duration { +func (MockStakingKeeper) UnbondingTime(_ sdk.Context) time.Duration { return 0 } diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 4916403edb8..02e41a0ab83 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -85,7 +85,7 @@ func (k Keeper) UpgradeClient(goCtx context.Context, msg *clienttypes.MsgUpgrade // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. // Warning: DEPRECATED // This handler is redudant as `MsgUpdateClient` is now capable of handling both a Header and a Misbehaviour -func (k Keeper) SubmitMisbehaviour(goCtx context.Context, msg *clienttypes.MsgSubmitMisbehaviour) (*clienttypes.MsgSubmitMisbehaviourResponse, error) { +func (k Keeper) SubmitMisbehaviour(goCtx context.Context, msg *clienttypes.MsgSubmitMisbehaviour) (*clienttypes.MsgSubmitMisbehaviourResponse, error) { //nolint:staticcheck // for now, we're using msgsubmitmisbehaviour. ctx := sdk.UnwrapSDKContext(goCtx) misbehaviour, err := clienttypes.UnpackClientMessage(msg.Misbehaviour) diff --git a/modules/core/migrations/v7/genesis_test.go b/modules/core/migrations/v7/genesis_test.go index bdbacb066b8..77111b2b705 100644 --- a/modules/core/migrations/v7/genesis_test.go +++ b/modules/core/migrations/v7/genesis_test.go @@ -3,7 +3,7 @@ package v7_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -20,7 +20,7 @@ import ( ) type MigrationsV7TestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -31,7 +31,7 @@ type MigrationsV7TestSuite struct { // TestMigrationsV7TestSuite runs all the tests within this package. func TestMigrationsV7TestSuite(t *testing.T) { - suite.Run(t, new(MigrationsV7TestSuite)) + testifysuite.Run(t, new(MigrationsV7TestSuite)) } // SetupTest creates a coordinator with 2 test chains. diff --git a/modules/core/module.go b/modules/core/module.go index 501e5459f5b..5369c955bc1 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -113,7 +113,7 @@ func (AppModule) Name() string { } // RegisterInvariants registers the ibc module invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { +func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { // TODO: } @@ -179,7 +179,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { // EndBlock returns the end blocker for the ibc module. It returns no validator // updates. -func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { +func (AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -196,6 +196,6 @@ func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the ibc module operations with their respective weights. -func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } diff --git a/modules/light-clients/06-solomachine/client_state.go b/modules/light-clients/06-solomachine/client_state.go index 301cdfecc1b..85e6bad1ced 100644 --- a/modules/light-clients/06-solomachine/client_state.go +++ b/modules/light-clients/06-solomachine/client_state.go @@ -30,7 +30,7 @@ func NewClientState(latestSequence uint64, consensusState *ConsensusState) *Clie } // ClientType is Solo Machine. -func (cs ClientState) ClientType() string { +func (ClientState) ClientType() string { return exported.Solomachine } @@ -75,7 +75,7 @@ func (cs ClientState) Validate() error { } // ZeroCustomFields is not implemented for solo machine -func (cs ClientState) ZeroCustomFields() exported.ClientState { +func (ClientState) ZeroCustomFields() exported.ClientState { panic("ZeroCustomFields is not implemented as the solo machine implementation does not support upgrades.") } @@ -93,12 +93,12 @@ func (cs ClientState) Initialize(_ sdk.Context, cdc codec.BinaryCodec, clientSto } // ExportMetadata is a no-op since solomachine does not store any metadata in client store -func (cs ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata { +func (ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata { return nil } // VerifyUpgradeAndUpdateState returns an error since solomachine client does not support upgrades -func (cs ClientState) VerifyUpgradeAndUpdateState( +func (ClientState) VerifyUpgradeAndUpdateState( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientState, _ exported.ConsensusState, _, _ []byte, ) error { diff --git a/modules/light-clients/06-solomachine/misbehaviour.go b/modules/light-clients/06-solomachine/misbehaviour.go index fcfb8fdb277..becc6ca1e2f 100644 --- a/modules/light-clients/06-solomachine/misbehaviour.go +++ b/modules/light-clients/06-solomachine/misbehaviour.go @@ -12,12 +12,12 @@ import ( var _ exported.ClientMessage = (*Misbehaviour)(nil) // ClientType is a Solo Machine light client. -func (misbehaviour Misbehaviour) ClientType() string { +func (Misbehaviour) ClientType() string { return exported.Solomachine } // Type implements Misbehaviour interface. -func (misbehaviour Misbehaviour) Type() string { +func (Misbehaviour) Type() string { return exported.TypeClientMisbehaviour } diff --git a/modules/light-clients/06-solomachine/misbehaviour_handle.go b/modules/light-clients/06-solomachine/misbehaviour_handle.go index 4fe350ca973..b840135987c 100644 --- a/modules/light-clients/06-solomachine/misbehaviour_handle.go +++ b/modules/light-clients/06-solomachine/misbehaviour_handle.go @@ -12,7 +12,7 @@ import ( ) // CheckForMisbehaviour returns true for type Misbehaviour (passed VerifyClientMessage check), otherwise returns false -func (cs ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, clientMsg exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, clientMsg exported.ClientMessage) bool { if _, ok := clientMsg.(*Misbehaviour); ok { return true } diff --git a/modules/light-clients/06-solomachine/solomachine_test.go b/modules/light-clients/06-solomachine/solomachine_test.go index 3084c820049..72fbd98f0d9 100644 --- a/modules/light-clients/06-solomachine/solomachine_test.go +++ b/modules/light-clients/06-solomachine/solomachine_test.go @@ -5,7 +5,7 @@ import ( "time" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -26,7 +26,7 @@ import ( var channelIDSolomachine = "channel-on-solomachine" // channelID generated on solo machine side type SoloMachineTestSuite struct { - suite.Suite + testifysuite.Suite solomachine *ibctesting.Solomachine // singlesig public key solomachineMulti *ibctesting.Solomachine // multisig public key @@ -51,7 +51,7 @@ func (suite *SoloMachineTestSuite) SetupTest() { } func TestSoloMachineTestSuite(t *testing.T) { - suite.Run(t, new(SoloMachineTestSuite)) + testifysuite.Run(t, new(SoloMachineTestSuite)) } func (suite *SoloMachineTestSuite) SetupSolomachine() string { diff --git a/modules/light-clients/07-tendermint/client_state.go b/modules/light-clients/07-tendermint/client_state.go index 72ed5f0d3e3..c41e8c3d40e 100644 --- a/modules/light-clients/07-tendermint/client_state.go +++ b/modules/light-clients/07-tendermint/client_state.go @@ -49,7 +49,7 @@ func (cs ClientState) GetChainID() string { } // ClientType is tendermint. -func (cs ClientState) ClientType() string { +func (ClientState) ClientType() string { return exported.Tendermint } @@ -59,7 +59,7 @@ func (cs ClientState) GetLatestHeight() exported.Height { } // GetTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height. -func (cs ClientState) GetTimestampAtHeight( +func (ClientState) GetTimestampAtHeight( ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec, diff --git a/modules/light-clients/07-tendermint/genesis.go b/modules/light-clients/07-tendermint/genesis.go index d163559bd7b..00ae2ef25ed 100644 --- a/modules/light-clients/07-tendermint/genesis.go +++ b/modules/light-clients/07-tendermint/genesis.go @@ -9,7 +9,7 @@ import ( // ExportMetadata exports all the consensus metadata in the client store so they can be included in clients genesis // and imported by a ClientKeeper -func (cs ClientState) ExportMetadata(store storetypes.KVStore) []exported.GenesisMetadata { +func (ClientState) ExportMetadata(store storetypes.KVStore) []exported.GenesisMetadata { gm := make([]exported.GenesisMetadata, 0) IterateConsensusMetadata(store, func(key, val []byte) bool { gm = append(gm, clienttypes.NewGenesisMetadata(key, val)) diff --git a/modules/light-clients/07-tendermint/header.go b/modules/light-clients/07-tendermint/header.go index 1014c8a75ee..caa81e7493c 100644 --- a/modules/light-clients/07-tendermint/header.go +++ b/modules/light-clients/07-tendermint/header.go @@ -25,7 +25,7 @@ func (h Header) ConsensusState() *ConsensusState { } // ClientType defines that the Header is a Tendermint consensus algorithm -func (h Header) ClientType() string { +func (Header) ClientType() string { return exported.Tendermint } diff --git a/modules/light-clients/07-tendermint/migrations/migrations_test.go b/modules/light-clients/07-tendermint/migrations/migrations_test.go index 7a261caaf8c..906aa1f0932 100644 --- a/modules/light-clients/07-tendermint/migrations/migrations_test.go +++ b/modules/light-clients/07-tendermint/migrations/migrations_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" @@ -15,7 +15,7 @@ import ( ) type MigrationsTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -31,7 +31,7 @@ func (suite *MigrationsTestSuite) SetupTest() { } func TestTendermintTestSuite(t *testing.T) { - suite.Run(t, new(MigrationsTestSuite)) + testifysuite.Run(t, new(MigrationsTestSuite)) } // test pruning of multiple expired tendermint consensus states diff --git a/modules/light-clients/07-tendermint/misbehaviour.go b/modules/light-clients/07-tendermint/misbehaviour.go index bce812e4537..de6c97d191a 100644 --- a/modules/light-clients/07-tendermint/misbehaviour.go +++ b/modules/light-clients/07-tendermint/misbehaviour.go @@ -28,7 +28,7 @@ func NewMisbehaviour(clientID string, header1, header2 *Header) *Misbehaviour { } // ClientType is Tendermint light client -func (misbehaviour Misbehaviour) ClientType() string { +func (Misbehaviour) ClientType() string { return exported.Tendermint } diff --git a/modules/light-clients/07-tendermint/misbehaviour_handle.go b/modules/light-clients/07-tendermint/misbehaviour_handle.go index aaac72ada13..1431d86cc07 100644 --- a/modules/light-clients/07-tendermint/misbehaviour_handle.go +++ b/modules/light-clients/07-tendermint/misbehaviour_handle.go @@ -19,7 +19,7 @@ import ( // CheckForMisbehaviour detects duplicate height misbehaviour and BFT time violation misbehaviour // in a submitted Header message and verifies the correctness of a submitted Misbehaviour ClientMessage -func (cs ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool { switch msg := msg.(type) { case *Header: tmHeader := msg diff --git a/modules/light-clients/07-tendermint/tendermint_test.go b/modules/light-clients/07-tendermint/tendermint_test.go index 025c57deeb1..48887f8ab72 100644 --- a/modules/light-clients/07-tendermint/tendermint_test.go +++ b/modules/light-clients/07-tendermint/tendermint_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -37,7 +37,7 @@ var ( ) type TendermintTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -112,5 +112,5 @@ func getBothSigners(suite *TendermintTestSuite, altVal *tmtypes.Validator, altPr } func TestTendermintTestSuite(t *testing.T) { - suite.Run(t, new(TendermintTestSuite)) + testifysuite.Run(t, new(TendermintTestSuite)) } diff --git a/modules/light-clients/09-localhost/client_state.go b/modules/light-clients/09-localhost/client_state.go index 89013ffb2cb..0815126ba45 100644 --- a/modules/light-clients/09-localhost/client_state.go +++ b/modules/light-clients/09-localhost/client_state.go @@ -26,7 +26,7 @@ func NewClientState(height clienttypes.Height) exported.ClientState { } // ClientType returns the 09-localhost client type. -func (cs ClientState) ClientType() string { +func (ClientState) ClientType() string { return exported.Localhost } @@ -36,7 +36,7 @@ func (cs ClientState) GetLatestHeight() exported.Height { } // Status always returns Active. The 09-localhost status cannot be changed. -func (cs ClientState) Status(_ sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec) exported.Status { +func (ClientState) Status(_ sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec) exported.Status { return exported.Active } @@ -55,7 +55,7 @@ func (cs ClientState) ZeroCustomFields() exported.ClientState { } // Initialize ensures that initial consensus state for localhost is nil. -func (cs ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error { +func (ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error { if consState != nil { return errorsmod.Wrap(clienttypes.ErrInvalidConsensus, "initial consensus state for localhost must be nil.") } @@ -71,14 +71,14 @@ func (cs ClientState) Initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientS // GetTimestampAtHeight returns the current block time retrieved from the application context. The localhost client does not store consensus states and thus // cannot provide a timestamp for the provided height. -func (cs ClientState) GetTimestampAtHeight(ctx sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec, _ exported.Height) (uint64, error) { +func (ClientState) GetTimestampAtHeight(ctx sdk.Context, _ storetypes.KVStore, _ codec.BinaryCodec, _ exported.Height) (uint64, error) { return uint64(ctx.BlockTime().UnixNano()), nil } // VerifyMembership is a generic proof verification method which verifies the existence of a given key and value within the IBC store. // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // The caller must provide the full IBC store. -func (cs ClientState) VerifyMembership( +func (ClientState) VerifyMembership( ctx sdk.Context, store storetypes.KVStore, _ codec.BinaryCodec, @@ -119,7 +119,7 @@ func (cs ClientState) VerifyMembership( // VerifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath within the IBC store. // The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24). // The caller must provide the full IBC store. -func (cs ClientState) VerifyNonMembership( +func (ClientState) VerifyNonMembership( ctx sdk.Context, store storetypes.KVStore, _ codec.BinaryCodec, @@ -152,17 +152,17 @@ func (cs ClientState) VerifyNonMembership( } // VerifyClientMessage is unsupported by the 09-localhost client type and returns an error. -func (cs ClientState) VerifyClientMessage(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) error { +func (ClientState) VerifyClientMessage(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) error { return errorsmod.Wrap(clienttypes.ErrUpdateClientFailed, "client message verification is unsupported by the localhost client") } // CheckForMisbehaviour is unsupported by the 09-localhost client type and performs a no-op, returning false. -func (cs ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) bool { +func (ClientState) CheckForMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) bool { return false } // UpdateStateOnMisbehaviour is unsupported by the 09-localhost client type and performs a no-op. -func (cs ClientState) UpdateStateOnMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) { +func (ClientState) UpdateStateOnMisbehaviour(_ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, _ exported.ClientMessage) { } // UpdateState updates and stores as necessary any associated information for an IBC client, such as the ClientState and corresponding ConsensusState. @@ -177,18 +177,18 @@ func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, client } // ExportMetadata is a no-op for the 09-localhost client. -func (cs ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata { +func (ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata { return nil } // CheckSubstituteAndUpdateState returns an error. The localhost cannot be modified by // proposals. -func (cs ClientState) CheckSubstituteAndUpdateState(_ sdk.Context, _ codec.BinaryCodec, _, _ storetypes.KVStore, _ exported.ClientState) error { +func (ClientState) CheckSubstituteAndUpdateState(_ sdk.Context, _ codec.BinaryCodec, _, _ storetypes.KVStore, _ exported.ClientState) error { return errorsmod.Wrap(clienttypes.ErrUpdateClientFailed, "cannot update localhost client with a proposal") } // VerifyUpgradeAndUpdateState returns an error since localhost cannot be upgraded -func (cs ClientState) VerifyUpgradeAndUpdateState( +func (ClientState) VerifyUpgradeAndUpdateState( _ sdk.Context, _ codec.BinaryCodec, _ storetypes.KVStore, diff --git a/modules/light-clients/09-localhost/localhost_test.go b/modules/light-clients/09-localhost/localhost_test.go index c22ef1e35ae..555337f1cef 100644 --- a/modules/light-clients/09-localhost/localhost_test.go +++ b/modules/light-clients/09-localhost/localhost_test.go @@ -3,13 +3,13 @@ package localhost_test import ( "testing" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" ibctesting "github.com/cosmos/ibc-go/v7/testing" ) type LocalhostTestSuite struct { - suite.Suite + testifysuite.Suite coordinator ibctesting.Coordinator chain *ibctesting.TestChain @@ -21,5 +21,5 @@ func (suite *LocalhostTestSuite) SetupTest() { } func TestLocalhostTestSuite(t *testing.T) { - suite.Run(t, new(LocalhostTestSuite)) + testifysuite.Run(t, new(LocalhostTestSuite)) } diff --git a/testing/README.md b/testing/README.md index 9a9be197211..3961f7f378a 100644 --- a/testing/README.md +++ b/testing/README.md @@ -152,7 +152,7 @@ Here is an example of how to setup your testing environment in every package you ```go // KeeperTestSuite is a testing suite to test keeper functions. type KeeperTestSuite struct { - suite.Suite + testifysuite.Suite coordinator *ibctesting.Coordinator @@ -163,7 +163,7 @@ type KeeperTestSuite struct { // TestKeeperTestSuite runs all the tests within this package. func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) + testifysuite.Run(t, new(KeeperTestSuite)) } // SetupTest creates a coordinator with 2 test chains. diff --git a/testing/config.go b/testing/config.go index 9a6ace904ba..584a8d1df36 100644 --- a/testing/config.go +++ b/testing/config.go @@ -30,7 +30,7 @@ func NewTendermintConfig() *TendermintConfig { } } -func (tmcfg *TendermintConfig) GetClientType() string { +func (*TendermintConfig) GetClientType() string { return exported.Tendermint } diff --git a/testing/endpoint.go b/testing/endpoint.go index 78c725c8cb8..1965b2ed586 100644 --- a/testing/endpoint.go +++ b/testing/endpoint.go @@ -311,7 +311,7 @@ func (endpoint *Endpoint) QueryConnectionHandshakeProof() ( connectionKey := host.ConnectionKey(endpoint.Counterparty.ConnectionID) proofConnection, _ = endpoint.Counterparty.QueryProofAtHeight(connectionKey, proofHeight.GetRevisionHeight()) - return + return clientState, proofClient, proofConsensus, consensusHeight, proofConnection, proofHeight } // ChanOpenInit will construct and execute a MsgChannelOpenInit on the associated endpoint. diff --git a/testing/events.go b/testing/events.go index 733b526e3c0..3679a65f3c4 100644 --- a/testing/events.go +++ b/testing/events.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "github.com/stretchr/testify/suite" + testifysuite "github.com/stretchr/testify/suite" abci "github.com/cometbft/cometbft/abci/types" @@ -69,7 +69,7 @@ func ParsePacketFromEvents(events []abci.Event) (channeltypes.Packet, error) { packet := channeltypes.Packet{} for _, attr := range ev.Attributes { switch attr.Key { - case channeltypes.AttributeKeyData: // DEPRECATED + case channeltypes.AttributeKeyData: //nolint:staticcheck // DEPRECATED packet.Data = []byte(attr.Value) case channeltypes.AttributeKeySequence: @@ -125,7 +125,7 @@ func ParseAckFromEvents(events []abci.Event) ([]byte, error) { for _, ev := range events { if ev.Type == channeltypes.EventTypeWriteAck { for _, attr := range ev.Attributes { - if attr.Key == channeltypes.AttributeKeyAck { // DEPRECATED + if attr.Key == channeltypes.AttributeKeyAck { //nolint:staticcheck // DEPRECATED return []byte(attr.Value), nil } } @@ -137,7 +137,7 @@ func ParseAckFromEvents(events []abci.Event) ([]byte, error) { // AssertEvents asserts that expected events are present in the actual events. // Expected map needs to be a subset of actual events to pass. func AssertEvents( - suite *suite.Suite, + suite *testifysuite.Suite, expected EventsMap, actual []abci.Event, ) { diff --git a/testing/mock/ack.go b/testing/mock/ack.go index 280e848b3be..619ac098d44 100644 --- a/testing/mock/ack.go +++ b/testing/mock/ack.go @@ -13,11 +13,11 @@ func NewEmptyAcknowledgement() EmptyAcknowledgement { } // Success implements the Acknowledgement interface -func (ack EmptyAcknowledgement) Success() bool { +func (EmptyAcknowledgement) Success() bool { return true } // Acknowledgement implements the Acknowledgement interface -func (ack EmptyAcknowledgement) Acknowledgement() []byte { +func (EmptyAcknowledgement) Acknowledgement() []byte { return []byte{} } diff --git a/testing/mock/ibc_module.go b/testing/mock/ibc_module.go index f2834e435a6..a53dce74122 100644 --- a/testing/mock/ibc_module.go +++ b/testing/mock/ibc_module.go @@ -24,7 +24,7 @@ var ( // applicationCallbackError is a custom error type that will be unique for testing purposes. type applicationCallbackError struct{} -func (e applicationCallbackError) Error() string { +func (applicationCallbackError) Error() string { return "mock application callback failed" } @@ -178,7 +178,7 @@ func (im IBCModule) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, // UnmarshalPacketData returns the MockPacketData. This function implements the optional // PacketDataUnmarshaler interface required for ADR 008 support. -func (im IBCModule) UnmarshalPacketData(bz []byte) (interface{}, error) { +func (IBCModule) UnmarshalPacketData(bz []byte) (interface{}, error) { if reflect.DeepEqual(bz, MockPacketData) { return MockPacketData, nil } diff --git a/testing/mock/mock.go b/testing/mock/mock.go index 20c2641512c..26c26247b8f 100644 --- a/testing/mock/mock.go +++ b/testing/mock/mock.go @@ -80,7 +80,7 @@ func (AppModuleBasic) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, } // RegisterGRPCGatewayRoutes implements AppModuleBasic interface. -func (a AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {} +func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) {} // GetTxCmd implements AppModuleBasic interface. func (AppModuleBasic) GetTxCmd() *cobra.Command { @@ -110,7 +110,7 @@ func NewAppModule(pk PortKeeper) AppModule { func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} // RegisterServices implements the AppModule interface. -func (am AppModule) RegisterServices(module.Configurator) {} +func (AppModule) RegisterServices(module.Configurator) {} // InitGenesis implements the AppModule interface. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { @@ -129,7 +129,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. } // ExportGenesis implements the AppModule interface. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { +func (AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { return nil } @@ -137,11 +137,11 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock implements the AppModule interface -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { } // EndBlock implements the AppModule interface -func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { +func (AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/testing/path.go b/testing/path.go index 38ccc93214d..5a671928b4d 100644 --- a/testing/path.go +++ b/testing/path.go @@ -66,7 +66,6 @@ func (path *Path) RelayPacket(packet channeltypes.Packet) error { func (path *Path) RelayPacketWithResults(packet channeltypes.Packet) (*sdk.Result, []byte, error) { pc := path.EndpointA.Chain.App.GetIBCKeeper().ChannelKeeper.GetPacketCommitment(path.EndpointA.Chain.GetContext(), packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetSequence()) if bytes.Equal(pc, channeltypes.CommitPacket(path.EndpointA.Chain.App.AppCodec(), packet)) { - // packet found, relay from A to B if err := path.EndpointB.UpdateClient(); err != nil { return nil, nil, err diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 92a3ccb0326..b267158af08 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -585,7 +585,7 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - /**** Module Options ****/ + // **** Module Options **** // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment // we prefer to be more strict in what arguments the modules expect. @@ -790,8 +790,8 @@ func (app *SimApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Re } // Configurator returns the configurator for the app -func (a *SimApp) Configurator() module.Configurator { - return a.configurator +func (app *SimApp) Configurator() module.Configurator { + return app.configurator } // InitChainer application update at chain initialization @@ -836,8 +836,8 @@ func (app *SimApp) TxConfig() client.TxConfig { } // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (a *SimApp) DefaultGenesis() map[string]json.RawMessage { - return ModuleBasics.DefaultGenesis(a.appCodec) +func (app *SimApp) DefaultGenesis() map[string]json.RawMessage { + return ModuleBasics.DefaultGenesis(app.appCodec) } // GetKey returns the KVStoreKey for the provided store key. @@ -876,7 +876,7 @@ func (app *SimApp) SimulationManager() *module.SimulationManager { // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (*SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) diff --git a/testing/simapp/params/proto.go b/testing/simapp/params/proto.go index 2a38fff0400..4270c2b0dbf 100644 --- a/testing/simapp/params/proto.go +++ b/testing/simapp/params/proto.go @@ -16,12 +16,12 @@ import ( func MakeTestEncodingConfig() EncodingConfig { cdc := codec.NewLegacyAmino() interfaceRegistry := types.NewInterfaceRegistry() - codec := codec.NewProtoCodec(interfaceRegistry) + protoCdc := codec.NewProtoCodec(interfaceRegistry) return EncodingConfig{ InterfaceRegistry: interfaceRegistry, - Codec: codec, - TxConfig: tx.NewTxConfig(codec, tx.DefaultSignModes), + Codec: protoCdc, + TxConfig: tx.NewTxConfig(protoCdc, tx.DefaultSignModes), Amino: cdc, } } diff --git a/testing/simapp/simd/cmd/root.go b/testing/simapp/simd/cmd/root.go index 8716b617628..2c22eb5c911 100644 --- a/testing/simapp/simd/cmd/root.go +++ b/testing/simapp/simd/cmd/root.go @@ -191,8 +191,8 @@ func addModuleInitFlags(startCmd *cobra.Command) { func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, simapp.ModuleBasics, simapp.DefaultNodeHome) - for _, sub_cmd := range cmds { - cmd.AddCommand(sub_cmd) + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) } return cmd } diff --git a/testing/simapp/test_helpers.go b/testing/simapp/test_helpers.go index d72e9981048..377818f83eb 100644 --- a/testing/simapp/test_helpers.go +++ b/testing/simapp/test_helpers.go @@ -38,7 +38,8 @@ type SetupOptions struct { AppOpts servertypes.AppOptions } -func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { +// initSetup initializes a new SimApp. A Nop logger is set in SimApp. +func initSetup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) { db := dbm.NewMemDB() appOptions := make(simtestutil.AppOptionsMap, 0) @@ -84,7 +85,7 @@ func Setup(t *testing.T, isCheckTx bool) *SimApp { func SetupWithGenesisValSet(t *testing.T, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp { t.Helper() - app, genesisState := setup(true, 5) + app, genesisState := initSetup(true, 5) genesisState, err := simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, genAccs, balances...) require.NoError(t, err)