Skip to content

Commit 2ac025b

Browse files
committed
fix: basic lint issues
1 parent 1f5a34c commit 2ac025b

File tree

155 files changed

+827
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+827
-193
lines changed

app/ante/handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
type HandlerOptions struct {
1515
authante.HandlerOptions
16+
1617
IBCKeeper *ibckeeper.Keeper
1718
TxCounterStoreKey storetypes.StoreKey
1819
WasmConfig wasmtypes.WasmConfig
@@ -22,9 +23,11 @@ func NewHandler(options HandlerOptions) (sdk.AnteHandler, error) {
2223
if options.AccountKeeper == nil {
2324
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
2425
}
26+
2527
if options.BankKeeper == nil {
2628
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
2729
}
30+
2831
if options.SignModeHandler == nil {
2932
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
3033
}

app/app.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type App struct {
4646
EncodingConfig
4747
Keepers
4848
StoreKeys
49+
4950
mm *sdkmodule.Manager
5051
sm *sdkmodule.SimulationManager
5152
}
@@ -107,7 +108,7 @@ func NewApp(
107108
tmos.Exit("failed to load the latest version: " + err.Error())
108109
}
109110

110-
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{})
111+
ctx := app.NewUncachedContext(true, tmproto.Header{})
111112
if err = app.WasmKeeper.InitializePinnedCodes(ctx); err != nil {
112113
tmos.Exit("failed to initialize the pinned codes: " + err.Error())
113114
}
@@ -135,6 +136,7 @@ func (a *App) InitChainer(ctx sdk.Context, req abcitypes.RequestInitChain) abcit
135136
}
136137

137138
a.UpgradeKeeper.SetModuleVersionMap(ctx, a.mm.GetVersionMap())
139+
138140
return a.mm.InitGenesis(ctx, a.Codec, state)
139141
}
140142

@@ -154,11 +156,11 @@ func (a *App) RegisterAPIRoutes(server *api.Server, _ serverconfig.APIConfig) {
154156
}
155157

156158
func (a *App) RegisterTxService(ctx client.Context) {
157-
authtx.RegisterTxService(a.BaseApp.GRPCQueryRouter(), ctx, a.BaseApp.Simulate, a.InterfaceRegistry)
159+
authtx.RegisterTxService(a.GRPCQueryRouter(), ctx, a.Simulate, a.InterfaceRegistry)
158160
}
159161

160162
func (a *App) RegisterTendermintService(ctx client.Context) {
161-
tmservice.RegisterTendermintService(ctx, a.BaseApp.GRPCQueryRouter(), a.InterfaceRegistry, a.Query)
163+
tmservice.RegisterTendermintService(ctx, a.GRPCQueryRouter(), a.InterfaceRegistry, a.Query)
162164
}
163165

164166
func (a *App) RegisterNodeService(ctx client.Context) {
@@ -167,6 +169,7 @@ func (a *App) RegisterNodeService(ctx client.Context) {
167169

168170
func (a *App) ModuleAccountAddrs() map[string]bool {
169171
addrs := make(map[string]bool)
172+
170173
for v := range ModuleAccPerms() {
171174
addr := authtypes.NewModuleAddress(v)
172175
addrs[addr.String()] = true

app/export.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ func (a *App) ExportAppStateAndValidators(
2020
height := a.LastBlockHeight() + 1
2121
if forZeroHeight {
2222
height = 0
23+
2324
a.prepForZeroHeightGenesis(ctx, jailAllowedAddrs)
2425
}
2526

26-
consensusParams := a.BaseApp.GetConsensusParams(ctx)
27+
consensusParams := a.GetConsensusParams(ctx)
2728
genState := a.mm.ExportGenesis(ctx, a.Codec)
2829

2930
validators, err := staking.WriteValidators(ctx, a.StakingKeeper)
@@ -45,11 +46,7 @@ func (a *App) ExportAppStateAndValidators(
4546
}
4647

4748
func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
48-
applyAllowedAddrs := false
49-
50-
if len(jailAllowedAddrs) > 0 {
51-
applyAllowedAddrs = true
52-
}
49+
applyAllowedAddrs := len(jailAllowedAddrs) > 0
5350

5451
allowedAddrsMap := make(map[string]bool)
5552

@@ -58,13 +55,15 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
5855
if err != nil {
5956
log.Fatal(err)
6057
}
58+
6159
allowedAddrsMap[addr] = true
6260
}
6361

6462
a.CrisisKeeper.AssertInvariants(ctx)
6563

6664
a.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) {
6765
_, _ = a.DistributionKeeper.WithdrawValidatorCommission(ctx, val.GetOperator())
66+
6867
return false
6968
})
7069

@@ -79,6 +78,7 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
7978
if err != nil {
8079
panic(err)
8180
}
81+
8282
_, _ = a.DistributionKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr)
8383
}
8484

@@ -96,6 +96,7 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
9696
a.DistributionKeeper.SetFeePool(ctx, feePool)
9797

9898
a.DistributionKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator())
99+
99100
return false
100101
})
101102

@@ -104,10 +105,12 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
104105
if err != nil {
105106
panic(err)
106107
}
108+
107109
delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress)
108110
if err != nil {
109111
panic(err)
110112
}
113+
111114
a.DistributionKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr)
112115
a.DistributionKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr)
113116
}
@@ -118,15 +121,19 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
118121
for i := range red.Entries {
119122
red.Entries[i].CreationHeight = 0
120123
}
124+
121125
a.StakingKeeper.SetRedelegation(ctx, red)
126+
122127
return false
123128
})
124129

125130
a.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) {
126131
for i := range ubd.Entries {
127132
ubd.Entries[i].CreationHeight = 0
128133
}
134+
129135
a.StakingKeeper.SetUnbondingDelegation(ctx, ubd)
136+
130137
return false
131138
})
132139

@@ -136,6 +143,7 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
136143

137144
for ; iterator.Valid(); iterator.Next() {
138145
addr := sdk.ValAddress(iterator.Key()[1:])
146+
139147
validator, found := a.StakingKeeper.GetValidator(ctx, addr)
140148
if !found {
141149
panic("expected validator, not found")
@@ -147,6 +155,7 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
147155
}
148156

149157
a.StakingKeeper.SetValidator(ctx, validator)
158+
150159
counter++
151160
}
152161

@@ -162,6 +171,7 @@ func (a *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []strin
162171
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
163172
info.StartHeight = 0
164173
a.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
174+
165175
return false
166176
},
167177
)

app/keeper.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ type Keepers struct {
124124

125125
func (k *Keepers) Subspace(v string) paramstypes.Subspace {
126126
subspace, _ := k.ParamsKeeper.GetSubspace(v)
127+
127128
return subspace
128129
}
129130

@@ -303,17 +304,19 @@ func NewKeepers(
303304

304305
// Cosmos IBC port router
305306
var ibcICAControllerIBCModule ibcporttypes.IBCModule
307+
306308
ibcICAControllerIBCModule = ibcicacontroller.NewIBCMiddleware(ibcICAControllerIBCModule, k.IBCICAControllerKeeper)
307309
ibcICAControllerIBCModule = ibcfee.NewIBCMiddleware(ibcICAControllerIBCModule, k.IBCFeeKeeper)
308310

309-
var ibcICAHostIBCModule ibcporttypes.IBCModule
310-
ibcICAHostIBCModule = ibcicahost.NewIBCModule(k.IBCICAHostKeeper)
311+
var ibcICAHostIBCModule ibcporttypes.IBCModule = ibcicahost.NewIBCModule(k.IBCICAHostKeeper)
311312

312313
var ibcTransferIBCModule ibcporttypes.IBCModule
314+
313315
ibcTransferIBCModule = ibctransfer.NewIBCModule(k.IBCTransferKeeper)
314316
ibcTransferIBCModule = ibcfee.NewIBCMiddleware(ibcTransferIBCModule, k.IBCFeeKeeper)
315317

316318
var wasmIBCModule ibcporttypes.IBCModule
319+
317320
wasmIBCModule = wasm.NewIBCHandler(k.WasmKeeper, k.IBCKeeper.ChannelKeeper, k.IBCKeeper.ChannelKeeper)
318321
wasmIBCModule = ibcfee.NewIBCMiddleware(wasmIBCModule, k.IBCFeeKeeper)
319322

@@ -325,5 +328,6 @@ func NewKeepers(
325328
k.IBCKeeper.SetRouter(ibcPortRouter)
326329

327330
k.CapabilityKeeper.Seal()
331+
328332
return k
329333
}

app/module.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ func ModuleAccPerms() map[string][]string {
152152

153153
func BlockedAccAddrs() map[string]bool {
154154
accAddrs := make(map[string]bool)
155+
155156
for v := range ModuleAccPerms() {
156157
accAddr := authtypes.NewModuleAddress(v)
157158
accAddrs[accAddr.String()] = true

app/upgrade.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func UpgradeHandler(
7777
if !ok {
7878
return nil, fmt.Errorf("params subspace does not exist for module: %s", name)
7979
}
80+
8081
if subspace.HasKeyTable() {
8182
continue
8283
}
@@ -98,12 +99,14 @@ func UpgradeHandler(
9899
}
99100

100101
govParams := keepers.GovKeeper.GetParams(ctx)
102+
101103
govParams.MinInitialDepositRatio = sdkmath.LegacyNewDecWithPrec(2, 1).String()
102104
if err := keepers.GovKeeper.SetParams(ctx, govParams); err != nil {
103105
return nil, err
104106
}
105107

106108
stakingParams := keepers.StakingKeeper.GetParams(ctx)
109+
107110
stakingParams.MinCommissionRate = sdkmath.LegacyNewDecWithPrec(5, 2)
108111
if err := keepers.StakingKeeper.SetParams(ctx, stakingParams); err != nil {
109112
return nil, err
@@ -116,6 +119,7 @@ func UpgradeHandler(
116119
}
117120

118121
validator.Commission.Rate = stakingParams.MinCommissionRate
122+
119123
validator.Commission.UpdateTime = ctx.BlockTime()
120124
if validator.Commission.MaxRate.LT(validator.Commission.Rate) {
121125
validator.Commission.MaxRate = validator.Commission.Rate

cmd/sentinelhub/config.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const flagOverwriteConfigWithDefaults = "overwrite-config-with-defaults"
1717
func applyRecommendedValues(cfg interface{}) {
1818
switch c := cfg.(type) {
1919
case *serverconfig.Config:
20-
c.BaseConfig.MinGasPrices = "0.1udvpn"
20+
c.MinGasPrices = "0.1udvpn"
2121
c.StateSync.SnapshotInterval = 1000
2222
case *tmcfg.Config:
2323
c.Consensus.TimeoutCommit = 3 * time.Second
@@ -28,14 +28,17 @@ func applyRecommendedValues(cfg interface{}) {
2828
func initAppConfig() (string, interface{}) {
2929
cfg := serverconfig.DefaultConfig()
3030
cfgTemplate := serverconfig.DefaultConfigTemplate
31+
3132
applyRecommendedValues(cfg)
33+
3234
return cfgTemplate, cfg
3335
}
3436

3537
// initTendermintConfig initializes the Tendermint configuration with defaults.
3638
func initTendermintConfig() *tmcfg.Config {
3739
cfg := tmcfg.DefaultConfig()
3840
applyRecommendedValues(cfg)
41+
3942
return cfg
4043
}
4144

@@ -50,21 +53,25 @@ func overwriteConfig(name string, cfg interface{}, write func(string, interface{
5053

5154
v := viper.New()
5255
v.SetConfigFile(cfgPath)
56+
5357
if err := v.ReadInConfig(); err != nil {
5458
return err
5559
}
60+
5661
if err := v.Unmarshal(cfg); err != nil {
5762
return err
5863
}
5964

6065
applyRecommendedValues(cfg)
66+
6167
return write(cfgPath, cfg)
6268
}
6369

6470
// overwriteAppConfig updates and writes the app configuration.
6571
func overwriteAppConfig() error {
6672
return overwriteConfig("app.toml", serverconfig.DefaultConfig(), func(cfgPath string, cfg interface{}) error {
6773
serverconfig.WriteConfigFile(cfgPath, cfg.(*serverconfig.Config))
74+
6875
return nil
6976
})
7077
}
@@ -73,6 +80,7 @@ func overwriteAppConfig() error {
7380
func overwriteTendermintConfig() error {
7481
return overwriteConfig("config.toml", tmcfg.DefaultConfig(), func(cfgPath string, cfg interface{}) error {
7582
tmcfg.WriteConfigFile(cfgPath, cfg.(*tmcfg.Config))
83+
7684
return nil
7785
})
7886
}

cmd/sentinelhub/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func HomeDir() (string, error) {
1919
}
2020

2121
dir = path.Join(dir, ".sentinelhub")
22+
2223
return dir, nil
2324
}
2425

0 commit comments

Comments
 (0)