Skip to content

Commit

Permalink
chore: update golangci to 1.60.3
Browse files Browse the repository at this point in the history
Also fix issues the updated version identified.
  • Loading branch information
Thomasvdam committed Aug 27, 2024
1 parent 8266a87 commit 4493a12
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fmt:
### Linting ###
###############################################################################

golangci_version=v1.53.3
golangci_version=v1.60.3

lint-install:
@echo "--> Installing golangci-lint $(golangci_version)"
Expand Down
1 change: 0 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ import (

"github.com/sedaprotocol/seda-chain/app/keepers"
appparams "github.com/sedaprotocol/seda-chain/app/params"

// Used in cosmos-sdk when registering the route for swagger docs.
_ "github.com/sedaprotocol/seda-chain/client/docs/statik"
dataproxy "github.com/sedaprotocol/seda-chain/x/data-proxy"
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (s *IntegrationTestSuite) execGetSeedQuery(
}

func (s *IntegrationTestSuite) validateGetSeedResponse(expectEmpty bool) func([]byte, []byte) bool {
return func(stdOut, stdErr []byte) bool {
return func(stdOut, _ []byte) bool {
var getSeedResponse struct {
Data struct {
BlockHeight int `json:"block_height"`
Expand Down
17 changes: 9 additions & 8 deletions interchaintest/chain_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosCha

newWithdrawAddr := testAddresses[0]

t.Run("misc queries", func(t *testing.T) {
t.Run("misc queries", func(_ *testing.T) {
slashes, err := chain.DistributionQueryValidatorSlashes(ctx, valAddr)
require.NoError(err)
require.EqualValues(0, len(slashes))
Expand All @@ -295,7 +295,7 @@ func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosCha
require.EqualValues(chain.Config().Denom, comm.Commission[0].Denom)
})

t.Run("withdraw-all-rewards", func(t *testing.T) {
t.Run("withdraw-all-rewards", func(_ *testing.T) {
err = node.StakingDelegate(ctx, users[2].KeyName(), valAddr, fmt.Sprintf("%d%s", uint64(100*math.Pow10(6)), chain.Config().Denom))
require.NoError(err)

Expand All @@ -312,12 +312,12 @@ func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosCha
require.True(after.GT(before))
})

t.Run("fund-pools", func(t *testing.T) {
t.Run("fund-pools", func(_ *testing.T) {
bal, err := chain.BankQueryBalance(ctx, acc.String(), chain.Config().Denom)
require.NoError(err)
fmt.Printf("CP balance: %+v\n", bal)

amount := uint64(9_000 * math.Pow10(6))
amount := int64(9_000 * math.Pow10(6))

err = node.DistributionFundCommunityPool(ctx, users[0].KeyName(), fmt.Sprintf("%d%s", amount, chain.Config().Denom))
require.NoError(err)
Expand All @@ -329,15 +329,15 @@ func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosCha
require.NoError(err)
fmt.Printf("New CP balance: %+v\n", bal2) // 9147579661

require.True(bal2.Sub(bal).GT(sdkmath.NewInt(int64(amount))))
require.True(bal2.Sub(bal).GT(sdkmath.NewInt(amount)))

// queries
coins, err := chain.DistributionQueryCommunityPool(ctx)
require.NoError(err)
require.True(coins.AmountOf(chain.Config().Denom).GT(sdkmath.LegacyNewDec(int64(amount))))
require.True(coins.AmountOf(chain.Config().Denom).GT(sdkmath.LegacyNewDec((amount))))
})

t.Run("set-custiom-withdraw-address", func(t *testing.T) {
t.Run("set-custiom-withdraw-address", func(_ *testing.T) {
err = node.DistributionSetWithdrawAddr(ctx, users[0].KeyName(), newWithdrawAddr)
require.NoError(err)

Expand All @@ -346,7 +346,7 @@ func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosCha
require.EqualValues(withdrawAddr, newWithdrawAddr)
})

t.Run("delegator", func(t *testing.T) {
t.Run("delegator", func(_ *testing.T) {
delRewards, err := chain.DistributionQueryDelegationTotalRewards(ctx, delAddr)
require.NoError(err)
r := delRewards.Rewards[0]
Expand Down Expand Up @@ -489,6 +489,7 @@ func testStaking(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, u
height, err := chain.Height(ctx)
require.NoError(t, err)

//nolint:gosec // G115: Test will fail if conversion overflows
searchHeight := int64(height - 1)

hi, err := chain.StakingQueryHistoricalInfo(ctx, searchHeight)
Expand Down
4 changes: 3 additions & 1 deletion interchaintest/chain_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChai
require.NoError(t, err, "error fetching height before upgrade")

// this should timeout due to chain halt at upgrade height
//nolint:gosec // G115: Test will fail if conversion overflows
_ = testutil.WaitForBlocks(timeoutCtx, int(haltHeight-currentHeight), chain)

currentHeight, err = chain.Height(ctx)
Expand All @@ -225,7 +226,8 @@ func SubmitUpgradeProposal(t *testing.T, ctx context.Context, chain *cosmos.Cosm
upgradeMsg := &upgradetypes.MsgSoftwareUpgrade{
Authority: "seda10d07y265gmmuvt4z0w9aw880jnsr700jvvla4j", // gov module account; sedad q auth module-account gov
Plan: upgradetypes.Plan{
Name: upgradeName,
Name: upgradeName,
//nolint:gosec // G115: Test will fail if conversion overflows
Height: int64(haltHeight),
},
}
Expand Down
1 change: 1 addition & 0 deletions interchaintest/state_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestStateSync(t *testing.T) {
latestHeight, err := chain.Height(ctx)
require.NoError(t, err, "failed to fetch latest chain height")

//nolint:gosec // G115: Test will fail if conversion overflows
trustHeight := int64(latestHeight) - stateSyncSnapshotInterval

firstFullNode := chain.FullNodes[0]
Expand Down
2 changes: 1 addition & 1 deletion simulation/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func appStateRandomizedFn(

appParams.GetOrGenerate(
StakePerAccount, &initialStake, r,
func(r *rand.Rand) {
func(_ *rand.Rand) {
initialStake = math.NewIntFromBigInt(initialStakeAmount)
},
)
Expand Down
22 changes: 11 additions & 11 deletions x/data-proxy/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
s.Run("Updating the fee for a proxy that already has a pending update should cancel the old update", func() {
s.SetupTest()

firstUpdateHeight := int64(types.DefaultMinFeeUpdateDelay + 100)
secondUpdateHeight := int64(types.DefaultMinFeeUpdateDelay + 37)
firstUpdateHeight := types.DefaultMinFeeUpdateDelay + 100
secondUpdateHeight := types.DefaultMinFeeUpdateDelay + 37

err = s.keeper.SetDataProxyConfig(s.ctx, pubKeyBytes, initialProxyConfig)
s.Require().NoError(err)
Expand All @@ -371,7 +371,7 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
NewPayoutAddress: types.DoNotModifyField,
NewMemo: types.DoNotModifyField,
NewFee: s.NewFeeFromString("1337"),
FeeUpdateDelay: uint32(firstUpdateHeight),
FeeUpdateDelay: firstUpdateHeight,
PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3",
}

Expand All @@ -383,7 +383,7 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
s.Require().NoError(err)
s.Require().NotNil(firstProxyConfig.FeeUpdate)

firstUpdateScheduled, err := s.keeper.HasFeeUpdate(s.ctx, firstUpdateHeight, pubKeyBytes)
firstUpdateScheduled, err := s.keeper.HasFeeUpdate(s.ctx, int64(firstUpdateHeight), pubKeyBytes)
s.Require().NoError(err)
s.Require().True(firstUpdateScheduled)

Expand All @@ -392,7 +392,7 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
NewPayoutAddress: types.DoNotModifyField,
NewMemo: types.DoNotModifyField,
NewFee: s.NewFeeFromString("1984"),
FeeUpdateDelay: uint32(secondUpdateHeight),
FeeUpdateDelay: secondUpdateHeight,
PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3",
}

Expand All @@ -404,11 +404,11 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
s.Require().NoError(err)
s.Require().NotNil(secondProxyConfig.FeeUpdate)

secondUpdateScheduled, err := s.keeper.HasFeeUpdate(s.ctx, secondUpdateHeight, pubKeyBytes)
secondUpdateScheduled, err := s.keeper.HasFeeUpdate(s.ctx, int64(secondUpdateHeight), pubKeyBytes)
s.Require().NoError(err)
s.Require().True(secondUpdateScheduled)

firstUpdateNoLongerScheduled, err := s.keeper.HasFeeUpdate(s.ctx, firstUpdateHeight, pubKeyBytes)
firstUpdateNoLongerScheduled, err := s.keeper.HasFeeUpdate(s.ctx, int64(firstUpdateHeight), pubKeyBytes)
s.Require().NoError(err)
s.Require().False(firstUpdateNoLongerScheduled)
})
Expand Down Expand Up @@ -447,12 +447,12 @@ func (s *KeeperTestSuite) TestMsgServer_UpdateParamsErrors() {
authority := s.keeper.GetAuthority()
cases := []struct {
name string
input types.MsgUpdateParams
input *types.MsgUpdateParams
wantErr error
}{
{
name: "invalid minimum update delay",
input: types.MsgUpdateParams{
input: &types.MsgUpdateParams{
Authority: authority,
Params: types.Params{
MinFeeUpdateDelay: 0,
Expand All @@ -462,7 +462,7 @@ func (s *KeeperTestSuite) TestMsgServer_UpdateParamsErrors() {
},
{
name: "invalid authority",
input: types.MsgUpdateParams{
input: &types.MsgUpdateParams{
Authority: "seda1ucv5709wlf9jn84ynyjzyzeavwvurmdyxat26l",
Params: types.Params{
MinFeeUpdateDelay: 8000,
Expand All @@ -475,7 +475,7 @@ func (s *KeeperTestSuite) TestMsgServer_UpdateParamsErrors() {
s.SetupTest()
for _, tt := range cases {
s.Run(tt.name, func() {
res, err := s.msgSrvr.UpdateParams(s.ctx, &tt.input)
res, err := s.msgSrvr.UpdateParams(s.ctx, tt.input)
s.Require().ErrorIs(err, tt.wantErr)
s.Require().Nil(res)
})
Expand Down
2 changes: 1 addition & 1 deletion x/tally/keeper/filter_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"fmt"
"math"
"math/rand"
"slices"
"testing"
"time"

"github.com/stretchr/testify/require"
"slices"

"github.com/sedaprotocol/seda-chain/x/tally/keeper"
"github.com/sedaprotocol/seda-chain/x/tally/types"
Expand Down
1 change: 0 additions & 1 deletion x/tally/types/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"bytes"
"encoding/binary"

"slices"

"golang.org/x/exp/constraints"
Expand Down
12 changes: 6 additions & 6 deletions x/wasm-storage/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ func (s *KeeperTestSuite) TestUpdateParams() {
authority := s.keeper.GetAuthority()
cases := []struct {
name string
input types.MsgUpdateParams
input *types.MsgUpdateParams
expErrMsg string
}{
{
name: "happy path",
input: types.MsgUpdateParams{
input: &types.MsgUpdateParams{
Authority: s.authority,
Params: types.Params{
MaxWasmSize: 1000000, // 1 MB
Expand All @@ -217,7 +217,7 @@ func (s *KeeperTestSuite) TestUpdateParams() {
},
{
name: "invalid authority",
input: types.MsgUpdateParams{
input: &types.MsgUpdateParams{
Authority: "seda1ucv5709wlf9jn84ynyjzyzeavwvurmdyxat26l",
Params: types.Params{
MaxWasmSize: 1, // 1 MB
Expand All @@ -228,7 +228,7 @@ func (s *KeeperTestSuite) TestUpdateParams() {
},
{
name: "invalid max wasm size",
input: types.MsgUpdateParams{
input: &types.MsgUpdateParams{
Authority: authority,
Params: types.Params{
MaxWasmSize: 0, // 0 MB
Expand All @@ -239,7 +239,7 @@ func (s *KeeperTestSuite) TestUpdateParams() {
},
{
name: "invalid wasm time to live",
input: types.MsgUpdateParams{
input: &types.MsgUpdateParams{
Authority: authority,
Params: types.Params{
MaxWasmSize: 111110,
Expand All @@ -253,7 +253,7 @@ func (s *KeeperTestSuite) TestUpdateParams() {
s.SetupTest()
for _, tc := range cases {
s.Run(tc.name, func() {
_, err := s.msgSrvr.UpdateParams(s.ctx, &tc.input)
_, err := s.msgSrvr.UpdateParams(s.ctx, tc.input)
if tc.expErrMsg != "" {
s.Require().Error(err)
s.Require().Equal(tc.expErrMsg, err.Error())
Expand Down

0 comments on commit 4493a12

Please sign in to comment.