From 7ecb27cf5c99cca0ea78c340775cae2c11c8e62c Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 20 May 2024 00:01:36 +0800 Subject: [PATCH 1/6] Update .golangci.yml --- .golangci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 35ef949a4..e957651e1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,6 +7,7 @@ linters: disable-all: true enable: - bodyclose + - copyloopvar - dogsled - errcheck - goconst @@ -18,6 +19,7 @@ linters: - gosimple - govet - ineffassign + - maintidx - misspell - nakedret - exportloopref From 4c1ef529dd03139db2c60269a92cffbf6d3c9d28 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 20 May 2024 15:33:36 +0800 Subject: [PATCH 2/6] lint juno --- app/upgrades/v16/upgrades.go | 1 - app/upgrades/v17/upgrades.go | 1 - x/clock/keeper/msg_server_test.go | 3 --- x/clock/keeper/querier_test.go | 4 ---- x/cw-hooks/keeper/msg_server_test.go | 2 -- x/drip/keeper/grpc_query_test.go | 1 - x/drip/keeper/msg_server_test.go | 2 -- x/feepay/keeper/msg_server_test.go | 8 -------- x/feepay/keeper/querier_test.go | 1 - x/feeshare/keeper/msg_server_test.go | 4 ---- x/mint/client/testutil/suite.go | 6 ------ x/mint/simulation/decoder_test.go | 1 - x/mint/simulation/genesis_test.go | 1 - x/tokenfactory/bindings/validate_queries_test.go | 2 -- 14 files changed, 37 deletions(-) diff --git a/app/upgrades/v16/upgrades.go b/app/upgrades/v16/upgrades.go index 5f97f7509..9deb10cf1 100644 --- a/app/upgrades/v16/upgrades.go +++ b/app/upgrades/v16/upgrades.go @@ -53,7 +53,6 @@ func CreateV16UpgradeHandler( // https://github.com/cosmos/cosmos-sdk/pull/12363/files // Set param key table for params module migration for _, subspace := range keepers.ParamsKeeper.GetSubspaces() { - subspace := subspace var keyTable paramstypes.KeyTable switch subspace.Name() { diff --git a/app/upgrades/v17/upgrades.go b/app/upgrades/v17/upgrades.go index 3c034216f..71205e89a 100644 --- a/app/upgrades/v17/upgrades.go +++ b/app/upgrades/v17/upgrades.go @@ -96,7 +96,6 @@ func migrateChainOwnedSubDaos(ctx sdk.Context, logger log.Logger, ak authkeeper. distrAddr := ak.GetModuleAddress(distrtypes.ModuleName) for _, dao := range subDaos { - dao := dao logger.Info("migrating " + dao + " to the gov module") cAddr := sdk.MustAccAddressFromBech32(dao) diff --git a/x/clock/keeper/msg_server_test.go b/x/clock/keeper/msg_server_test.go index e8d76cf98..f62228420 100644 --- a/x/clock/keeper/msg_server_test.go +++ b/x/clock/keeper/msg_server_test.go @@ -71,7 +71,6 @@ func (s *IntegrationTestSuite) TestRegisterClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { // Set params params := types.DefaultParams() @@ -158,7 +157,6 @@ func (s *IntegrationTestSuite) TestUnregisterClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { s.RegisterClockContract(addr.String(), contractAddress) s.RegisterClockContract(addr2.String(), contractAddressWithAdmin) @@ -284,7 +282,6 @@ func (s *IntegrationTestSuite) TestUnjailClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { s.RegisterClockContract(addr.String(), contractAddress) s.JailClockContract(contractAddress) diff --git a/x/clock/keeper/querier_test.go b/x/clock/keeper/querier_test.go index 85abbfce1..56cf5bade 100644 --- a/x/clock/keeper/querier_test.go +++ b/x/clock/keeper/querier_test.go @@ -30,7 +30,6 @@ func (s *IntegrationTestSuite) TestQueryClockParams() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Set params err := s.app.AppKeepers.ClockKeeper.SetParams(s.ctx, tc.params) @@ -78,7 +77,6 @@ func (s *IntegrationTestSuite) TestQueryClockContracts() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Loop through contracts & register for _, contract := range tc.contracts { @@ -135,7 +133,6 @@ func (s *IntegrationTestSuite) TestQueryJailedClockContracts() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Loop through contracts & register for _, contract := range tc.contracts { @@ -214,7 +211,6 @@ func (s *IntegrationTestSuite) TestQueryClockContract() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { // Query contract resp, err := s.queryClient.ClockContract(s.ctx, &types.QueryClockContract{ diff --git a/x/cw-hooks/keeper/msg_server_test.go b/x/cw-hooks/keeper/msg_server_test.go index 44969d915..1ce1f0a3f 100644 --- a/x/cw-hooks/keeper/msg_server_test.go +++ b/x/cw-hooks/keeper/msg_server_test.go @@ -75,7 +75,6 @@ func (s *IntegrationTestSuite) TestRegisterContracts() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) // staking @@ -166,7 +165,6 @@ func (s *IntegrationTestSuite) TestUnRegisterContracts() { shouldErr: true, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) // staking diff --git a/x/drip/keeper/grpc_query_test.go b/x/drip/keeper/grpc_query_test.go index 38e4c4bca..c26677b52 100644 --- a/x/drip/keeper/grpc_query_test.go +++ b/x/drip/keeper/grpc_query_test.go @@ -44,7 +44,6 @@ func (s *IntegrationTestSuite) TestDripQueryParams() { }, }, } { - tc := tc s.Run(tc.desc, func() { // Set the params to what is expected, then query and ensure the query is the same err := s.app.AppKeepers.DripKeeper.SetParams(s.ctx, tc.Expected) diff --git a/x/drip/keeper/msg_server_test.go b/x/drip/keeper/msg_server_test.go index feecdfb9b..bc7b0e804 100644 --- a/x/drip/keeper/msg_server_test.go +++ b/x/drip/keeper/msg_server_test.go @@ -71,7 +71,6 @@ func (s *IntegrationTestSuite) TestDripDistributeTokensMsgs() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { msg := types.MsgDistributeTokens{ SenderAddress: tc.senderAddr, @@ -135,7 +134,6 @@ func (s *IntegrationTestSuite) TestUpdateDripParams() { success: false, }, } { - tc := tc s.Run(tc.desc, func() { params := types.Params{ EnableDrip: tc.isEnabled, diff --git a/x/feepay/keeper/msg_server_test.go b/x/feepay/keeper/msg_server_test.go index de340e245..c1631e5b0 100644 --- a/x/feepay/keeper/msg_server_test.go +++ b/x/feepay/keeper/msg_server_test.go @@ -63,8 +63,6 @@ func (s *IntegrationTestSuite) TestRegisterFeePayContract() { shouldErr: true, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.RegisterFeePayContract(s.ctx, &types.MsgRegisterFeePayContract{ SenderAddress: tc.senderAddress, @@ -138,8 +136,6 @@ func (s *IntegrationTestSuite) TestUnregisterFeePayContract() { shouldErr: true, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.UnregisterFeePayContract(s.ctx, &types.MsgUnregisterFeePayContract{ SenderAddress: tc.senderAddress, @@ -208,8 +204,6 @@ func (s *IntegrationTestSuite) TestFundFeePayContract() { shouldErr: false, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.FundFeePayContract(s.ctx, &types.MsgFundFeePayContract{ SenderAddress: tc.senderAddress, @@ -295,8 +289,6 @@ func (s *IntegrationTestSuite) TestUpdateFeePayContractWalletLimit() { shouldErr: false, }, } { - tc := tc - s.Run(tc.desc, func() { _, err := s.app.AppKeepers.FeePayKeeper.UpdateFeePayContractWalletLimit(s.ctx, &types.MsgUpdateFeePayContractWalletLimit{ SenderAddress: tc.senderAddress, diff --git a/x/feepay/keeper/querier_test.go b/x/feepay/keeper/querier_test.go index 9dde08e92..f56a34432 100644 --- a/x/feepay/keeper/querier_test.go +++ b/x/feepay/keeper/querier_test.go @@ -49,7 +49,6 @@ func (s *IntegrationTestSuite) TestQueryContractBalance() { {balance: 0}, {balance: 1_000_000}, } { - bal := bal // Instantiate the contractAddr contractAddr := s.InstantiateContract(sender.String(), "") diff --git a/x/feeshare/keeper/msg_server_test.go b/x/feeshare/keeper/msg_server_test.go index ef562ed44..dc53af56d 100644 --- a/x/feeshare/keeper/msg_server_test.go +++ b/x/feeshare/keeper/msg_server_test.go @@ -97,7 +97,6 @@ func (s *IntegrationTestSuite) TestGetContractAdminOrCreatorAddress() { shouldErr: true, }, } { - tc := tc s.Run(tc.desc, func() { if !tc.shouldErr { _, err := s.app.AppKeepers.FeeShareKeeper.GetContractAdminOrCreatorAddress(s.ctx, sdk.MustAccAddressFromBech32(tc.contractAddress), tc.deployerAddress) @@ -222,7 +221,6 @@ func (s *IntegrationTestSuite) TestRegisterFeeShare() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) if !tc.shouldErr { @@ -317,7 +315,6 @@ func (s *IntegrationTestSuite) TestUpdateFeeShare() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) if !tc.shouldErr { @@ -383,7 +380,6 @@ func (s *IntegrationTestSuite) TestCancelFeeShare() { shouldErr: false, }, } { - tc := tc s.Run(tc.desc, func() { goCtx := sdk.WrapSDKContext(s.ctx) if !tc.shouldErr { diff --git a/x/mint/client/testutil/suite.go b/x/mint/client/testutil/suite.go index d6f2be556..782101db1 100644 --- a/x/mint/client/testutil/suite.go +++ b/x/mint/client/testutil/suite.go @@ -79,8 +79,6 @@ mint_denom: stake`, } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryParams() clientCtx := val.ClientCtx @@ -113,8 +111,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryInflation() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryInflation() clientCtx := val.ClientCtx @@ -147,8 +143,6 @@ func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() { } for _, tc := range testCases { - tc := tc - s.Run(tc.name, func() { cmd := cli.GetCmdQueryAnnualProvisions() clientCtx := val.ClientCtx diff --git a/x/mint/simulation/decoder_test.go b/x/mint/simulation/decoder_test.go index a965261e2..00ad975d6 100644 --- a/x/mint/simulation/decoder_test.go +++ b/x/mint/simulation/decoder_test.go @@ -35,7 +35,6 @@ func TestDecodeStore(t *testing.T) { } for i, tt := range tests { - i, tt := i, tt t.Run(tt.name, func(t *testing.T) { switch i { case len(tests) - 1: diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index 8459062ec..ea58749c0 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -77,7 +77,6 @@ func TestRandomizedGenState1(t *testing.T) { } for _, tt := range tests { - tt := tt require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) } } diff --git a/x/tokenfactory/bindings/validate_queries_test.go b/x/tokenfactory/bindings/validate_queries_test.go index 0dc35c888..322102783 100644 --- a/x/tokenfactory/bindings/validate_queries_test.go +++ b/x/tokenfactory/bindings/validate_queries_test.go @@ -101,8 +101,6 @@ func TestDenomAdmin(t *testing.T) { } for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { resp, err := queryPlugin.GetDenomAdmin(ctx, tc.denom) if tc.expectErr { From 96592775f0541ad4b1ff178f0ec4f61ce7c1f44f Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 8 Jul 2024 11:48:09 +0800 Subject: [PATCH 3/6] use latest golangci-lint-action --- .github/workflows/golangci-lint.yml | 2 +- app/keepers/keepers.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 1585e7787..c50dd8b51 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - name: golangci-lint-junod - uses: golangci/golangci-lint-action@v4 + uses: golangci/golangci-lint-action@v6 with: version: latest args: --timeout 10m diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 9840b0bcb..35ec41c99 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -202,7 +202,7 @@ type AppKeepers struct { HooksICS4Wrapper ibc_hooks.ICS4Middleware } -func NewAppKeepers( +func NewAppKeepers( //nolint:maintidx // TODO: make this function less complex so it doesn't trigger the maintainability index appCodec codec.Codec, bApp *baseapp.BaseApp, cdc *codec.LegacyAmino, From 58af040c03f4dd1296cc81204523cb395fe50ce4 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Mon, 8 Jul 2024 00:16:14 +0700 Subject: [PATCH 4/6] ci --- .github/workflows/interchaintest-E2E.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/interchaintest-E2E.yml b/.github/workflows/interchaintest-E2E.yml index 81452ea5a..417550215 100644 --- a/.github/workflows/interchaintest-E2E.yml +++ b/.github/workflows/interchaintest-E2E.yml @@ -99,4 +99,19 @@ jobs: docker image ls -a - name: Run Test + id: run_test + continue-on-error: true run: make ${{ matrix.test }} + + - name: Retry Failed Test + if: steps.run_test.outcome == 'failure' + run: | + for i in 1 2; do + echo "Retry attempt $i" + if make ${{ matrix.test }}; then + echo "Test passed on retry" + exit 0 + fi + done + echo "Test failed after retries" + exit 1 From 041a2bbf772bacf3f6678bf0c7ffe9d6bc47a474 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Mon, 8 Jul 2024 12:27:04 +0800 Subject: [PATCH 5/6] Update interchaintest-E2E.yml --- .github/workflows/interchaintest-E2E.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/interchaintest-E2E.yml b/.github/workflows/interchaintest-E2E.yml index 417550215..0b68a8834 100644 --- a/.github/workflows/interchaintest-E2E.yml +++ b/.github/workflows/interchaintest-E2E.yml @@ -106,7 +106,7 @@ jobs: - name: Retry Failed Test if: steps.run_test.outcome == 'failure' run: | - for i in 1 2; do + for i in 1 2 3; do echo "Retry attempt $i" if make ${{ matrix.test }}; then echo "Test passed on retry" From e7333da25246d425e68272f4910840fb9dabc7db Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Wed, 10 Jul 2024 23:58:41 +0800 Subject: [PATCH 6/6] lint --- app/upgrades/v23/upgrades.go | 1 - 1 file changed, 1 deletion(-) diff --git a/app/upgrades/v23/upgrades.go b/app/upgrades/v23/upgrades.go index 344b9a5c6..9c252d7a1 100644 --- a/app/upgrades/v23/upgrades.go +++ b/app/upgrades/v23/upgrades.go @@ -50,7 +50,6 @@ func CreateV23UpgradeHandler( // migrate ICQ params for _, subspace := range keepers.ParamsKeeper.GetSubspaces() { - subspace := subspace var keyTable paramstypes.KeyTable if subspace.Name() == icqtypes.ModuleName {