Skip to content

Commit 318aea4

Browse files
committed
refactor: fix lint errors
Signed-off-by: Artur Troian <[email protected]>
1 parent 0d2d6e4 commit 318aea4

File tree

20 files changed

+64
-107
lines changed

20 files changed

+64
-107
lines changed

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ linters:
1313
- ineffassign
1414
- misspell
1515
- prealloc
16-
- revive
1716
- staticcheck
1817
- unparam
1918
- unused

app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func OrderEndBlockers(_ []string) []string {
323323
}
324324
}
325325

326-
func getGenesisTime(appOpts servertypes.AppOptions, homePath string) time.Time { // nolint: unused,deadcode
326+
func getGenesisTime(appOpts servertypes.AppOptions, homePath string) time.Time { // nolint: unused
327327
if v := appOpts.Get("GenesisTime"); v != nil {
328328
// in tests, GenesisTime is supplied using appOpts
329329
genTime, ok := v.(time.Time)

app/app_test.go

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/sim_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ func TestAppImportExport(t *testing.T) {
291291
appB,
292292
[][]byte{},
293293
},
294-
//{
294+
// {
295295
// ibchost.StoreKey,
296296
// appA,
297297
// appB,
298298
// [][]byte{},
299-
//},
299+
// },
300300
{
301301
ibctransfertypes.StoreKey,
302302
appA,

app/types/app.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
2828
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
2929
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
30+
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
3031
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
3132
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
3233
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
@@ -98,7 +99,8 @@ type AppKeepers struct {
9899
Distr distrkeeper.Keeper
99100
Gov *govkeeper.Keeper
100101
Upgrade *upgradekeeper.Keeper
101-
Params paramskeeper.Keeper //nolint: staticcheck
102+
Crisis *crisiskeeper.Keeper //nolint: staticcheck
103+
Params paramskeeper.Keeper //nolint: staticcheck
102104
ConsensusParams *consensusparamkeeper.Keeper
103105
IBC *ibckeeper.Keeper
104106
Evidence *evidencekeeper.Keeper
@@ -195,7 +197,7 @@ func (app *App) InitSpecialKeepers(
195197
cdc codec.Codec,
196198
legacyAmino *codec.LegacyAmino,
197199
bApp *baseapp.BaseApp,
198-
_ uint,
200+
invCheckPeriod uint,
199201
skipUpgradeHeights map[int64]bool,
200202
homePath string) {
201203

@@ -236,14 +238,14 @@ func (app *App) InitSpecialKeepers(
236238
// any further modules from creating scoped sub-keepers.
237239
app.Keepers.Cosmos.Cap.Seal()
238240

239-
//app.Keepers.Cosmos.Crisis = crisiskeeper.NewKeeper(
240-
// cdc, runtime.NewKVStoreService(app.keys[crisistypes.StoreKey]),
241-
// invCheckPeriod,
242-
// app.Keepers.Cosmos.Bank,
243-
// authtypes.FeeCollectorName,
244-
// authtypes.NewModuleAddress(govtypes.ModuleName).String(),
245-
// addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
246-
//)
241+
app.Keepers.Cosmos.Crisis = crisiskeeper.NewKeeper( //nolint: staticcheck
242+
cdc, runtime.NewKVStoreService(app.keys[crisistypes.StoreKey]),
243+
invCheckPeriod,
244+
app.Keepers.Cosmos.Bank,
245+
authtypes.FeeCollectorName,
246+
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
247+
addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
248+
)
247249

248250
app.Keepers.Cosmos.Upgrade = upgradekeeper.NewKeeper(
249251
skipUpgradeHeights,
@@ -574,14 +576,14 @@ func FindStructField[C any](obj interface{}, fieldName string) (C, error) {
574576

575577
field := rValue.Elem().FieldByName(fieldName)
576578
if !field.IsValid() {
577-
return *new(C), fmt.Errorf("interface `%s` does not have the field `%s`", // nolint: goerr113
579+
return *new(C), fmt.Errorf("interface `%s` does not have the field `%s`",
578580
rValue.Type(),
579581
fieldName)
580582
}
581583

582584
res, valid := field.Interface().(C)
583585
if !valid {
584-
return *new(C), fmt.Errorf( // nolint: goerr113
586+
return *new(C), fmt.Errorf(
585587
"object's `%s` expected type `%s` does not match actual `%s`",
586588
fieldName,
587589
reflect.TypeOf(*new(C)), field.Type().String())

cmd/akash/cmd/genesis.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"time"
77

88
sdkmath "cosmossdk.io/math"
9+
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
910
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
1011
"github.com/spf13/cobra"
1112

@@ -137,7 +138,7 @@ func PrepareGenesis(clientCtx client.Context, appState map[string]json.RawMessag
137138
distributionGenState := distributiontypes.DefaultGenesisState()
138139
distributionGenState.Params = genesisParams.DistributionParams
139140
// TODO Set initial community pool
140-
// distributionGenState.FeePool.CommunityPool = sdk.NewDecCoins()
141+
distributionGenState.FeePool.CommunityPool = sdk.NewDecCoins()
141142
distributionGenStateBz, err := cdc.MarshalJSON(distributionGenState)
142143
if err != nil {
143144
return nil, nil, fmt.Errorf("failed to marshal distribution genesis state: %w", err)
@@ -156,15 +157,15 @@ func PrepareGenesis(clientCtx client.Context, appState map[string]json.RawMessag
156157
appState[govtypes.ModuleName] = govGenStateBz
157158

158159
// crisis module genesis
159-
//crisisGenState := crisistypes.DefaultGenesisState()
160-
//crisisGenState.ConstantFee = genesisParams.CrisisConstantFee
161-
//// TODO Set initial community pool
162-
//// distributionGenState.FeePool.CommunityPool = sdk.NewDecCoins()
163-
//crisisGenStateBz, err := cdc.MarshalJSON(crisisGenState)
164-
//if err != nil {
165-
// return nil, nil, fmt.Errorf("failed to marshal crisis genesis state: %w", err)
166-
//}
167-
//appState[crisistypes.ModuleName] = crisisGenStateBz
160+
crisisGenState := crisistypes.DefaultGenesisState()
161+
crisisGenState.ConstantFee = genesisParams.CrisisConstantFee
162+
// TODO Set initial community pool
163+
// distributionGenState.FeePool.CommunityPool = sdk.NewDecCoins()
164+
crisisGenStateBz, err := cdc.MarshalJSON(crisisGenState)
165+
if err != nil {
166+
return nil, nil, fmt.Errorf("failed to marshal crisis genesis state: %w", err)
167+
}
168+
appState[crisistypes.ModuleName] = crisisGenStateBz
168169

169170
// slashing module genesis
170171
slashingGenState := slashingtypes.DefaultGenesisState()

cmd/akash/cmd/root.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"os"
66

7+
"github.com/cosmos/cosmos-sdk/x/crisis"
78
"github.com/rs/zerolog"
89
"github.com/spf13/cobra"
910
"pkg.akt.dev/go/cli"
@@ -44,9 +45,6 @@ func NewRootCmd() (*cobra.Command, sdkutil.EncodingConfig) {
4445
PersistentPreRunE: GetPersistentPreRunE(encodingConfig, []string{"AKASH"}),
4546
}
4647

47-
// register akash api routes
48-
//cmtrpc.Routes["akash"] = cmtrpcsrv.NewRPCFunc(client.RPCAkash, "")
49-
5048
initRootCmd(rootCmd, encodingConfig)
5149

5250
return rootCmd, encodingConfig
@@ -144,8 +142,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig sdkutil.EncodingConfig)
144142
rootCmd.SetErr(rootCmd.ErrOrStderr())
145143
}
146144

147-
func addModuleInitFlags(_ *cobra.Command) {
148-
//crisis.AddModuleInitFlags(startCmd)
145+
func addModuleInitFlags(startCmd *cobra.Command) {
146+
crisis.AddModuleInitFlags(startCmd) //nolint: staticcheck
149147
}
150148

151149
// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter

cmd/akash/cmd/testnetify/testnetify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ you want to test the upgrade handler itself.
9393
if err != nil {
9494
return err
9595
}
96-
cfgFile, err := os.Open(cfgFilePath)
96+
cfgFile, err := os.Open(cfgFilePath) //nolint: gosec
9797
if err != nil {
9898
return err
9999
}

cmd/akash/cmd/testnetify/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func openTraceWriter(traceWriterFile string) (w io.WriteCloser, err error) {
4545
if traceWriterFile == "" {
4646
return
4747
}
48-
return os.OpenFile(
48+
return os.OpenFile( //nolint: gosec
4949
traceWriterFile,
5050
os.O_WRONLY|os.O_APPEND|os.O_CREATE,
5151
0o666,

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ require (
4848
google.golang.org/grpc v1.72.2
4949
gopkg.in/yaml.v3 v3.0.1
5050
gotest.tools/v3 v3.5.2
51-
pkg.akt.dev/go v0.0.3-rc1
52-
pkg.akt.dev/go/cli v0.0.3-rc0
53-
pkg.akt.dev/go/sdl v0.0.2-rc0
51+
pkg.akt.dev/go v0.0.3-rc2
52+
pkg.akt.dev/go/cli v0.0.3-rc1
53+
pkg.akt.dev/go/sdl v0.0.2-rc1
5454
)
5555

5656
replace (
@@ -73,6 +73,8 @@ replace (
7373
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
7474
// stick with compatible version of rapid in v0.47.x line
7575
pgregory.net/rapid => pgregory.net/rapid v0.5.5
76+
77+
pkg.akt.dev/go => ../chain-sdk/go
7678
)
7779

7880
require (

0 commit comments

Comments
 (0)