style: linter fixes for feegrant and upgrade (#15642)
This commit is contained in:
parent
c3bc4dd0aa
commit
bd8b01cd12
@ -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"
|
||||
|
||||
@ -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))
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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{
|
||||
|
||||
@ -171,8 +171,7 @@ func init() {
|
||||
)
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
type UpgradeInputs struct {
|
||||
type ModuleInputs struct {
|
||||
depinject.In
|
||||
|
||||
Config *modulev1.Module
|
||||
@ -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
|
||||
@ -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)
|
||||
@ -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) {
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user