Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: linter fixes for feegrant and upgrade #15642

Merged
merged 11 commits into from
Apr 3, 2023
2 changes: 0 additions & 2 deletions x/feegrant/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
)

// Simulation operation weights constants
//
//nolint:gosec // These aren't harcoded credentials.
const (
OpWeightMsgGrantAllowance = "op_weight_msg_grant_fee_allowance"
OpWeightMsgRevokeAllowance = "op_weight_msg_grant_revoke_allowance"
Expand Down
2 changes: 1 addition & 1 deletion x/upgrade/internal/conv/string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (s *StringSuite) TestUnsafeStrToBytes() {
b := unsafeConvertStr()
runtime.GC()
<-time.NewTimer(2 * time.Millisecond).C
b2 := append(b, 'd') //nolint:gocritic // append is fine here
b2 := append(b, 'd')
s.Equal("abc", string(b))
s.Equal("abcd", string(b2))
}
Expand Down
8 changes: 3 additions & 5 deletions x/upgrade/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ func (k Keeper) AppliedPlan(c context.Context, req *types.QueryAppliedPlanReques
}

// UpgradedConsensusState implements the Query/UpgradedConsensusState gRPC method
//
//nolint:staticcheck
func (k Keeper) UpgradedConsensusState(c context.Context, req *types.QueryUpgradedConsensusStateRequest) (*types.QueryUpgradedConsensusStateResponse, error) {
func (k Keeper) UpgradedConsensusState(c context.Context, req *types.QueryUpgradedConsensusStateRequest) (*types.QueryUpgradedConsensusStateResponse, error) { //nolint:staticcheck // we're using a deprecated call for compatibility
ctx := sdk.UnwrapSDKContext(c)

consState, found := k.GetUpgradedConsensusState(ctx, req.LastHeight)
if !found {
return &types.QueryUpgradedConsensusStateResponse{}, nil
return &types.QueryUpgradedConsensusStateResponse{}, nil //nolint:staticcheck // we're using a deprecated call for compatibility
}

return &types.QueryUpgradedConsensusStateResponse{
return &types.QueryUpgradedConsensusStateResponse{ //nolint:staticcheck // we're using a deprecated call for compatibility
UpgradedConsensusState: consState,
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion x/upgrade/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (s *KeeperTestSuite) TestMigrations() {
vmBefore := s.upgradeKeeper.GetModuleVersionMap(s.ctx)
s.upgradeKeeper.SetUpgradeHandler("dummy", func(_ sdk.Context, _ types.Plan, vm module.VersionMap) (module.VersionMap, error) {
// simulate upgrading the bank module
vm["bank"] = vm["bank"] + 1 //nolint:gocritic
vm["bank"]++
return vm, nil
})
dummyPlan := types.Plan{
Expand Down
10 changes: 4 additions & 6 deletions x/upgrade/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ func init() {
)
}

//nolint:revive
type UpgradeInputs struct {
type ModuleInputs struct {
depinject.In

Config *modulev1.Module
Expand All @@ -182,8 +181,7 @@ type UpgradeInputs struct {
AppOpts servertypes.AppOptions `optional:"true"`
}

//nolint:revive
type UpgradeOutputs struct {
type ModuleOutputs struct {
depinject.Out

UpgradeKeeper *keeper.Keeper
Expand All @@ -192,7 +190,7 @@ type UpgradeOutputs struct {
BaseAppOption runtime.BaseAppOption
}

func ProvideModule(in UpgradeInputs) UpgradeOutputs {
func ProvideModule(in ModuleInputs) ModuleOutputs {
var (
homePath string
skipUpgradeHeights = make(map[int64]bool)
Expand Down Expand Up @@ -220,7 +218,7 @@ func ProvideModule(in UpgradeInputs) UpgradeOutputs {
m := NewAppModule(k)
gh := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewSoftwareUpgradeProposalHandler(k)}

return UpgradeOutputs{UpgradeKeeper: k, Module: m, GovHandler: gh, BaseAppOption: baseappOpt}
return ModuleOutputs{UpgradeKeeper: k, Module: m, GovHandler: gh, BaseAppOption: baseappOpt}
}

func PopulateVersionMap(upgradeKeeper *keeper.Keeper, modules map[string]appmodule.AppModule) {
Expand Down
4 changes: 1 addition & 3 deletions x/upgrade/plan/downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ type TestZip []*TestFile

func NewTestZip(testFiles ...*TestFile) TestZip {
tz := make([]*TestFile, len(testFiles))
for i, tf := range testFiles { //nolint:gosimple
tz[i] = tf
}
copy(tz, testFiles)
return tz
}

Expand Down
2 changes: 1 addition & 1 deletion x/upgrade/types/storeloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestSetLoader(t *testing.T) {
data, err := json.Marshal(upgradeInfo)
require.NoError(t, err)

err = os.WriteFile(upgradeInfoFilePath, data, 0o644) //nolint:gosec
err = os.WriteFile(upgradeInfoFilePath, data, 0o600)
require.NoError(t, err)

// make sure it exists before running everything
Expand Down