Skip to content

Commit 652ccf9

Browse files
committed
style: make golangci linter happy again
1 parent e857c8c commit 652ccf9

File tree

9 files changed

+50
-54
lines changed

9 files changed

+50
-54
lines changed

app/app.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func New(
441441
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
442442
app.AccountKeeper.AddressCodec(),
443443
)
444-
app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper)
444+
app.SetCircuitBreaker(&app.CircuitKeeper)
445445

446446
groupConfig := group.DefaultConfig()
447447
/*
@@ -904,7 +904,7 @@ func New(
904904
if err := app.LoadLatestVersion(); err != nil {
905905
tmos.Exit(err.Error())
906906
}
907-
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{})
907+
ctx := app.NewUncachedContext(true, tmproto.Header{})
908908

909909
// Initialize pinned codes in wasmvm as they are not persisted there
910910
if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil {
@@ -1136,15 +1136,15 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) {
11361136

11371137
// RegisterTxService implements the Application.RegisterTxService method.
11381138
func (app *App) RegisterTxService(clientCtx client.Context) {
1139-
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
1139+
authtx.RegisterTxService(app.GRPCQueryRouter(), clientCtx, app.Simulate, app.interfaceRegistry)
11401140
}
11411141

11421142
// RegisterTendermintService implements the Application.RegisterTendermintService method.
11431143
func (app *App) RegisterTendermintService(clientCtx client.Context) {
11441144
cmtApp := server.NewCometABCIWrapper(app)
11451145
cmtservice.RegisterTendermintService(
11461146
clientCtx,
1147-
app.BaseApp.GRPCQueryRouter(),
1147+
app.GRPCQueryRouter(),
11481148
app.interfaceRegistry,
11491149
cmtApp.Query,
11501150
)

app/export.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (app *App) ExportAppStateAndValidators(
5252
AppState: appState,
5353
Validators: validators,
5454
Height: height,
55-
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
55+
ConsensusParams: app.GetConsensusParams(ctx),
5656
}, nil
5757
}
5858

@@ -63,12 +63,8 @@ func (app *App) ExportAppStateAndValidators(
6363
//
6464
//nolint:funlen,gocognit,gocyclo,cyclop
6565
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
66-
applyAllowedAddrs := false
67-
6866
// check if there is a allowed address list
69-
if len(jailAllowedAddrs) > 0 {
70-
applyAllowedAddrs = true
71-
}
67+
applyAllowedAddrs := len(jailAllowedAddrs) > 0
7268

7369
allowedAddrsMap := make(map[string]bool)
7470

x/logic/keeper/grpc_query_ask.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ import (
1414

1515
func (k Keeper) Ask(ctx goctx.Context, req *types.QueryServiceAskRequest) (response *types.QueryServiceAskResponse, err error) {
1616
if req == nil {
17-
return nil, errorsmod.Wrap(types.InvalidArgument, "request is nil")
17+
return nil, errorsmod.Wrap(types.ErrInvalidArgument, "request is nil")
1818
}
1919

2020
sdkCtx := withSafeGasMeter(sdk.UnwrapSDKContext(ctx))
2121
defer func() {
2222
if r := recover(); r != nil {
2323
if gasError, ok := r.(storetypes.ErrorOutOfGas); ok {
2424
response, err = nil, errorsmod.Wrapf(
25-
types.LimitExceeded, "out of gas: %s <%s> (%d/%d)",
25+
types.ErrLimitExceeded, "out of gas: %s <%s> (%d/%d)",
2626
types.ModuleName, gasError.Descriptor, sdkCtx.GasMeter().GasConsumed(), sdkCtx.GasMeter().Limit())
2727

2828
return
@@ -49,7 +49,7 @@ func checkLimits(request *types.QueryServiceAskRequest, limits types.Limits) err
4949
size := uint64(len(request.GetQuery()))
5050

5151
if limits.MaxSize != 0 && size > limits.MaxSize {
52-
return errorsmod.Wrapf(types.LimitExceeded, "query: %d > MaxSize: %d", size, limits.MaxSize)
52+
return errorsmod.Wrapf(types.ErrLimitExceeded, "query: %d > MaxSize: %d", size, limits.MaxSize)
5353
}
5454

5555
return nil

x/logic/keeper/interpreter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ func (k Keeper) execute(
5252

5353
i, userOutput, err := k.newInterpreter(ctx, params)
5454
if err != nil {
55-
return nil, errorsmod.Wrapf(types.Internal, "error creating interpreter: %v", err.Error())
55+
return nil, errorsmod.Wrapf(types.ErrInternal, "error creating interpreter: %v", err.Error())
5656
}
5757
if err := i.ExecContext(ctx, program); err != nil {
58-
return nil, errorsmod.Wrapf(types.InvalidArgument, "error compiling query: %v", err.Error())
58+
return nil, errorsmod.Wrapf(types.ErrInvalidArgument, "error compiling query: %v", err.Error())
5959
}
6060

6161
answer, err := k.queryInterpreter(ctx, i, query, calculateSolutionLimit(solutionsLimit, params.GetLimits().MaxResultCount))
@@ -183,7 +183,7 @@ func gasMeterHookFn(ctx context.Context, gasPolicy types.GasPolicy) engine.HookF
183183
switch rType := r.(type) {
184184
case storetypes.ErrorOutOfGas:
185185
err = errorsmod.Wrapf(
186-
types.LimitExceeded, "out of gas: %s <%s> (%d/%d)",
186+
types.ErrLimitExceeded, "out of gas: %s <%s> (%d/%d)",
187187
types.ModuleName, rType.Descriptor, sdkctx.GasMeter().GasConsumed(), sdkctx.GasMeter().Limit())
188188
default:
189189
panic(r)

x/logic/types/errors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
)
88

99
var (
10-
InvalidArgument = sdkerrors.RegisterWithGRPCCode(ModuleName, 1, codes.InvalidArgument, "invalid argument")
10+
ErrInvalidArgument = sdkerrors.RegisterWithGRPCCode(ModuleName, 1, codes.InvalidArgument, "invalid argument")
1111
// LimitExceeded is returned when a limit is exceeded.
12-
LimitExceeded = sdkerrors.RegisterWithGRPCCode(ModuleName, 2, codes.InvalidArgument, "limit exceeded")
12+
ErrLimitExceeded = sdkerrors.RegisterWithGRPCCode(ModuleName, 2, codes.InvalidArgument, "limit exceeded")
1313
// Internal is returned when an internal error occurs.
14-
Internal = sdkerrors.RegisterWithGRPCCode(ModuleName, 3, codes.Internal, "internal error")
14+
ErrInternal = sdkerrors.RegisterWithGRPCCode(ModuleName, 3, codes.Internal, "internal error")
1515
)

x/logic/util/prolog.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func QueryInterpreter(
3535
p := engine.NewParser(&i.VM, strings.NewReader(query))
3636
t, err := p.Term()
3737
if err != nil {
38-
return nil, errorsmod.Wrapf(types.InvalidArgument, "error executing query: %v", err.Error())
38+
return nil, errorsmod.Wrapf(types.ErrInvalidArgument, "error executing query: %v", err.Error())
3939
}
4040

4141
var env *engine.Env
@@ -52,20 +52,20 @@ func QueryInterpreter(
5252
vars := parsedVarsToVars(p.Vars)
5353
results, err := envsToResults(envs, p.Vars, i)
5454
if err != nil {
55-
return nil, errorsmod.Wrapf(types.InvalidArgument, "error executing query: %v", err.Error())
55+
return nil, errorsmod.Wrapf(types.ErrInvalidArgument, "error executing query: %v", err.Error())
5656
}
5757

5858
if callErr != nil {
5959
if uint64(len(results)) < solutionsLimit {
6060
// error is not part of the look-ahead and should be included in the solutions
61-
if errors.Is(callErr, types.LimitExceeded) {
61+
if errors.Is(callErr, types.ErrLimitExceeded) {
6262
return nil, callErr
6363
}
6464

6565
var err engine.Exception
6666
if errors.As(callErr, &err) {
6767
if err, ok := isPanicError(err.Term()); ok {
68-
return nil, errorsmod.Wrapf(types.LimitExceeded, "%s", err)
68+
return nil, errorsmod.Wrapf(types.ErrLimitExceeded, "%s", err)
6969
}
7070
}
7171

@@ -76,7 +76,7 @@ func QueryInterpreter(
7676
sdkCtx := sdk.UnwrapSDKContext(ctx)
7777
if sdkCtx.GasMeter().IsOutOfGas() {
7878
return errorsmod.Wrapf(
79-
types.LimitExceeded, "out of gas: %s <%s> (%d/%d)",
79+
types.ErrLimitExceeded, "out of gas: %s <%s> (%d/%d)",
8080
types.ModuleName, callErr.Error(), sdkCtx.GasMeter().GasConsumed(), sdkCtx.GasMeter().Limit())
8181
}
8282
return nil

x/mint/module_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
2626
), &accountKeeper)
2727
require.NoError(t, err)
2828

29-
ctx := app.BaseApp.NewContext(false)
29+
ctx := app.NewContext(false)
3030
acc := accountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.ModuleName))
3131
require.NotNil(t, acc)
3232
}

x/vesting/msg_server.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context,
5252
}
5353

5454
ctx := sdk.UnwrapSDKContext(goCtx)
55-
if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
55+
if err := s.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
5656
return nil, err
5757
}
5858

59-
if s.BankKeeper.BlockedAddr(to) {
59+
if s.BlockedAddr(to) {
6060
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
6161
}
6262

63-
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
63+
if acc := s.GetAccount(ctx, to); acc != nil {
6464
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
6565
}
6666

6767
baseAccount := authtypes.NewBaseAccountWithAddress(to)
68-
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
68+
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
6969
baseVestingAccount, err := types.NewBaseVestingAccount(baseAccount, msg.Amount.Sort(), msg.EndTime)
7070
if err != nil {
7171
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
@@ -78,7 +78,7 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context,
7878
vestingAccount = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix())
7979
}
8080

81-
s.AccountKeeper.SetAccount(ctx, vestingAccount)
81+
s.SetAccount(ctx, vestingAccount)
8282

8383
defer func() {
8484
telemetry.IncrCounter(1, "new", "account")
@@ -94,7 +94,7 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context,
9494
}
9595
}()
9696

97-
if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil {
97+
if err = s.SendCoins(ctx, from, to, msg.Amount); err != nil {
9898
return nil, err
9999
}
100100

@@ -119,26 +119,26 @@ func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context,
119119
}
120120

121121
ctx := sdk.UnwrapSDKContext(goCtx)
122-
if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
122+
if err := s.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
123123
return nil, err
124124
}
125125

126-
if s.BankKeeper.BlockedAddr(to) {
126+
if s.BlockedAddr(to) {
127127
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
128128
}
129129

130-
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
130+
if acc := s.GetAccount(ctx, to); acc != nil {
131131
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
132132
}
133133

134134
baseAccount := authtypes.NewBaseAccountWithAddress(to)
135-
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
135+
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
136136
vestingAccount, err := types.NewPermanentLockedAccount(baseAccount, msg.Amount)
137137
if err != nil {
138138
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
139139
}
140140

141-
s.AccountKeeper.SetAccount(ctx, vestingAccount)
141+
s.SetAccount(ctx, vestingAccount)
142142

143143
defer func() {
144144
telemetry.IncrCounter(1, "new", "account")
@@ -154,7 +154,7 @@ func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context,
154154
}
155155
}()
156156

157-
if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil {
157+
if err = s.SendCoins(ctx, from, to, msg.Amount); err != nil {
158158
return nil, err
159159
}
160160

@@ -193,27 +193,27 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context,
193193
totalCoins = totalCoins.Add(period.Amount...)
194194
}
195195

196-
if s.BankKeeper.BlockedAddr(to) {
196+
if s.BlockedAddr(to) {
197197
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
198198
}
199199

200200
ctx := sdk.UnwrapSDKContext(goCtx)
201-
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
201+
if acc := s.GetAccount(ctx, to); acc != nil {
202202
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
203203
}
204204

205-
if err := s.BankKeeper.IsSendEnabledCoins(ctx, totalCoins...); err != nil {
205+
if err := s.IsSendEnabledCoins(ctx, totalCoins...); err != nil {
206206
return nil, err
207207
}
208208

209209
baseAccount := authtypes.NewBaseAccountWithAddress(to)
210-
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
210+
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
211211
vestingAccount, err := types.NewPeriodicVestingAccount(baseAccount, totalCoins.Sort(), msg.StartTime, msg.VestingPeriods)
212212
if err != nil {
213213
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
214214
}
215215

216-
s.AccountKeeper.SetAccount(ctx, vestingAccount)
216+
s.SetAccount(ctx, vestingAccount)
217217

218218
defer func() {
219219
telemetry.IncrCounter(1, "new", "account")
@@ -229,7 +229,7 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context,
229229
}
230230
}()
231231

232-
if err = s.BankKeeper.SendCoins(ctx, from, to, totalCoins); err != nil {
232+
if err = s.SendCoins(ctx, from, to, totalCoins); err != nil {
233233
return nil, err
234234
}
235235

@@ -262,28 +262,28 @@ func (s msgServer) CreateCliffVestingAccount(goCtx context.Context,
262262
}
263263

264264
ctx := sdk.UnwrapSDKContext(goCtx)
265-
if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
265+
if err := s.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
266266
return nil, err
267267
}
268268

269-
if s.BankKeeper.BlockedAddr(to) {
269+
if s.BlockedAddr(to) {
270270
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
271271
}
272272

273-
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
273+
if acc := s.GetAccount(ctx, to); acc != nil {
274274
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
275275
}
276276

277277
baseAccount := authtypes.NewBaseAccountWithAddress(to)
278-
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
278+
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
279279
baseVestingAccount, err := types.NewBaseVestingAccount(baseAccount, msg.Amount.Sort(), msg.EndTime)
280280
if err != nil {
281281
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
282282
}
283283

284284
vestingAccount := types.NewCliffVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix(), msg.CliffTime)
285285

286-
s.AccountKeeper.SetAccount(ctx, vestingAccount)
286+
s.SetAccount(ctx, vestingAccount)
287287

288288
defer func() {
289289
telemetry.IncrCounter(1, "new", "account")
@@ -299,7 +299,7 @@ func (s msgServer) CreateCliffVestingAccount(goCtx context.Context,
299299
}
300300
}()
301301

302-
if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil {
302+
if err = s.SendCoins(ctx, from, to, msg.Amount); err != nil {
303303
return nil, err
304304
}
305305

x/vesting/types/vesting_account.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coi
234234
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
235235
// defined as the vesting coins that are not delegated.
236236
func (cva ContinuousVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
237-
return cva.BaseVestingAccount.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime))
237+
return cva.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime))
238238
}
239239

240240
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -343,7 +343,7 @@ func (pva PeriodicVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
343343
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
344344
// defined as the vesting coins that are not delegated.
345345
func (pva PeriodicVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
346-
return pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(blockTime))
346+
return pva.LockedCoinsFromVesting(pva.GetVestingCoins(blockTime))
347347
}
348348

349349
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -446,7 +446,7 @@ func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
446446
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
447447
// defined as the vesting coins that are not delegated.
448448
func (dva DelayedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
449-
return dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(blockTime))
449+
return dva.LockedCoinsFromVesting(dva.GetVestingCoins(blockTime))
450450
}
451451

452452
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -502,7 +502,7 @@ func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {
502502
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
503503
// defined as the vesting coins that are not delegated.
504504
func (plva PermanentLockedAccount) LockedCoins(_ time.Time) sdk.Coins {
505-
return plva.BaseVestingAccount.LockedCoinsFromVesting(plva.OriginalVesting)
505+
return plva.LockedCoinsFromVesting(plva.OriginalVesting)
506506
}
507507

508508
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -604,7 +604,7 @@ func (cva CliffVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins {
604604
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
605605
// defined as the vesting coins that are not delegated.
606606
func (cva CliffVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
607-
return cva.BaseVestingAccount.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime))
607+
return cva.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime))
608608
}
609609

610610
// TrackDelegation tracks a desired delegation amount by setting the appropriate

0 commit comments

Comments
 (0)