From db38442d0ea43a1db66e8c5a81dec32f6f1d050e Mon Sep 17 00:00:00 2001 From: j75689 Date: Tue, 3 Jan 2023 17:01:36 +0800 Subject: [PATCH] fix: lint error --- server/types/app.go | 3 +-- x/upgrade/abci.go | 1 - x/upgrade/keeper/keeper.go | 22 ---------------------- x/upgrade/module.go | 8 ++------ x/upgrade/types/keys.go | 3 --- x/upgrade/types/upgrade_config.go | 4 +--- 6 files changed, 4 insertions(+), 37 deletions(-) diff --git a/server/types/app.go b/server/types/app.go index 07f3def5ed..ec629c57bb 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -15,7 +15,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -70,7 +69,7 @@ type ( // AppCreator is a function that allows us to lazily initialize an // application using various configurations. - AppCreator func(log.Logger, dbm.DB, io.Writer, serverconfig.Config, string, AppOptions) Application + AppCreator func(log.Logger, dbm.DB, io.Writer, config.Config, string, AppOptions) Application // ModuleInitFlags takes a start command and adds modules specific init flags. ModuleInitFlags func(startCmd *cobra.Command) diff --git a/x/upgrade/abci.go b/x/upgrade/abci.go index c3cf87bbec..954b3ae190 100644 --- a/x/upgrade/abci.go +++ b/x/upgrade/abci.go @@ -50,7 +50,6 @@ func BeginBlocker(k keeper.Keeper, ctx sdk.Context, _ abci.RequestBeginBlock) { return } } - } // BuildUpgradeNeededMsg prints the message that notifies that an upgrade is needed. diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index a0d47de878..8aaa6f3a68 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -60,28 +60,6 @@ func (k Keeper) SetUpgradeHandler(name string, upgradeHandler types.UpgradeHandl k.upgradeHandlers[name] = upgradeHandler } -// setProtocolVersion sets the protocol version to state -func (k Keeper) setProtocolVersion(ctx sdk.Context, v uint64) { - store := ctx.KVStore(k.storeKey) - versionBytes := make([]byte, 8) - binary.BigEndian.PutUint64(versionBytes, v) - store.Set([]byte{types.ProtocolVersionByte}, versionBytes) -} - -// getProtocolVersion gets the protocol version from state -func (k Keeper) getProtocolVersion(ctx sdk.Context) uint64 { - store := ctx.KVStore(k.storeKey) - ok := store.Has([]byte{types.ProtocolVersionByte}) - if ok { - pvBytes := store.Get([]byte{types.ProtocolVersionByte}) - protocolVersion := binary.BigEndian.Uint64(pvBytes) - - return protocolVersion - } - // default value - return 0 -} - // SetModuleVersionMap saves a given version map to state func (k Keeper) SetModuleVersionMap(ctx sdk.Context, vm module.VersionMap) { if len(vm) > 0 { diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 6e89c78f49..f5c33f0df4 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -36,9 +36,7 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers the upgrade types on the LegacyAmino codec -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - -} +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the upgrade module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { @@ -57,9 +55,7 @@ func (AppModuleBasic) GetTxCmd() *cobra.Command { return nil } -func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - -} +func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {} // AppModule implements the sdk.AppModule interface type AppModule struct { diff --git a/x/upgrade/types/keys.go b/x/upgrade/types/keys.go index a8b41f4556..e1a30c77ae 100644 --- a/x/upgrade/types/keys.go +++ b/x/upgrade/types/keys.go @@ -23,9 +23,6 @@ const ( // VersionMapByte is a prefix to look up module names (key) and versions (value) VersionMapByte = 0x2 - // ProtocolVersionByte is a prefix to look up Protocol Version - ProtocolVersionByte = 0x3 - // KeyUpgradedIBCState is the key under which upgraded ibc state is stored in the upgrade store KeyUpgradedIBCState = "upgradedIBCState" diff --git a/x/upgrade/types/upgrade_config.go b/x/upgrade/types/upgrade_config.go index d7312585c5..cbe1b5e4d5 100644 --- a/x/upgrade/types/upgrade_config.go +++ b/x/upgrade/types/upgrade_config.go @@ -28,9 +28,7 @@ func (c UpgradeConfig) GetPlan(height int64) []*Plan { } // get recent upgrade plan - var ( - recentHeight = int64(math.MaxInt64) - ) + recentHeight := int64(math.MaxInt64) for vHeight, vPlans := range c { if vHeight > height { if vHeight < recentHeight {