keeper

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const UpgradeInfoFileName string = "upgrade-info.json"

Deprecated: UpgradeInfoFileName file to store upgrade information use x/upgrade/types.UpgradeInfoFilename instead.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the upgrade MsgServer interface for the provided Keeper.

Types

type Keeper

type Keeper struct {
	sdkupgradekeeper.Keeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, paramSpace sdkparamstypes.Subspace) Keeper

NewKeeper constructs an upgrade Keeper which requires the following arguments: skipUpgradeHeights - map of heights to skip an upgrade storeKey - a store key with which to access upgrade's store cdc - the app-wide binary codec homePath - root directory of the application's config vs - the interface implemented by baseapp which allows setting baseapp's protocol version field

func (Keeper) ApplyUpgrade

func (k Keeper) ApplyUpgrade(ctx sdk.Context, plan sdkupgradetypes.Plan)

ApplyUpgrade will execute the handler associated with the Plan and mark the plan as done.

func (Keeper) ClearIBCState

func (k Keeper) ClearIBCState(ctx sdk.Context, lastHeight int64)

ClearIBCState clears any planned IBC state

func (Keeper) ClearUpgradePlan

func (k Keeper) ClearUpgradePlan(ctx sdk.Context)

ClearUpgradePlan clears any schedule upgrade and associated IBC states.

func (Keeper) DowngradeVerified

func (k Keeper) DowngradeVerified() bool

DowngradeVerified returns downgradeVerified.

func (Keeper) DumpUpgradeInfoToDisk

func (k Keeper) DumpUpgradeInfoToDisk(height int64, name string) error

DumpUpgradeInfoToDisk writes upgrade information to UpgradeInfoFileName.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority(
	ctx sdk.Context,
) (authority string)

GetAuthority returns the module authority

func (Keeper) GetDoneHeight

func (k Keeper) GetDoneHeight(ctx sdk.Context, name string) int64

GetDoneHeight returns the height at which the given upgrade was executed

func (Keeper) GetLastCompletedUpgrade

func (k Keeper) GetLastCompletedUpgrade(ctx sdk.Context) (string, int64)

GetLastCompletedUpgrade returns the last applied upgrade name and height.

func (Keeper) GetModuleVersionMap

func (k Keeper) GetModuleVersionMap(ctx sdk.Context) module.VersionMap

GetModuleVersionMap returns a map of key module name and value module consensus version as defined in ADR-041.

func (Keeper) GetModuleVersions

func (k Keeper) GetModuleVersions(ctx sdk.Context) []*sdkupgradetypes.ModuleVersion

GetModuleVersions gets a slice of module consensus versions

func (Keeper) GetUpgradeInfoPath

func (k Keeper) GetUpgradeInfoPath() (string, error)

GetUpgradeInfoPath returns the upgrade info file path

func (Keeper) GetUpgradePlan

func (k Keeper) GetUpgradePlan(ctx sdk.Context) (plan sdkupgradetypes.Plan, havePlan bool)

GetUpgradePlan returns the currently scheduled Plan if any, setting havePlan to true if there is a scheduled upgrade or false if there is none

func (Keeper) GetUpgradedClient

func (k Keeper) GetUpgradedClient(ctx sdk.Context, height int64) ([]byte, bool)

GetUpgradedClient gets the expected upgraded client for the next version of this chain

func (Keeper) GetUpgradedConsensusState

func (k Keeper) GetUpgradedConsensusState(ctx sdk.Context, lastHeight int64) ([]byte, bool)

GetUpgradedConsensusState set the expected upgraded consensus state for the next version of this chain

func (Keeper) HasHandler

func (k Keeper) HasHandler(name string) bool

HasHandler returns true iff there is a handler registered for this name

func (Keeper) IsSkipHeight

func (k Keeper) IsSkipHeight(height int64) bool

IsSkipHeight checks if the given height is part of skipUpgradeHeights

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) ReadUpgradeInfoFromDisk

func (k Keeper) ReadUpgradeInfoFromDisk() (storetypes.UpgradeInfo, error)

ReadUpgradeInfoFromDisk returns the name and height of the upgrade which is written to disk by the old binary when panicking. An error is returned if the upgrade path directory cannot be created or if the file exists and cannot be read or if the upgrade info fails to unmarshal.

func (Keeper) ScheduleUpgrade

func (k Keeper) ScheduleUpgrade(ctx sdk.Context, plan sdkupgradetypes.Plan) error

ScheduleUpgrade schedules an upgrade based on the specified plan. If there is another Plan already scheduled, it will cancel and overwrite it. ScheduleUpgrade will also write the upgraded IBC ClientState to the upgraded client path if it is specified in the plan.

func (*Keeper) SetDowngradeVerified

func (k *Keeper) SetDowngradeVerified(v bool)

SetDowngradeVerified updates downgradeVerified.

func (Keeper) SetModuleVersionMap

func (k Keeper) SetModuleVersionMap(ctx sdk.Context, vm module.VersionMap)

SetModuleVersionMap saves a given version map to state

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the total set of upgrade parameters.

func (Keeper) SetUpgradeHandler

func (k Keeper) SetUpgradeHandler(name string, upgradeHandler sdkupgradetypes.UpgradeHandler)

SetUpgradeHandler sets an UpgradeHandler for the upgrade specified by name. This handler will be called when the upgrade with this name is applied. In order for an upgrade with the given name to proceed, a handler for this upgrade must be set even if it is a no-op function.

func (Keeper) SetUpgradedClient

func (k Keeper) SetUpgradedClient(ctx sdk.Context, planHeight int64, bz []byte) error

SetUpgradedClient sets the expected upgraded client for the next version of this chain at the last height the current chain will commit.

func (Keeper) SetUpgradedConsensusState

func (k Keeper) SetUpgradedConsensusState(ctx sdk.Context, planHeight int64, bz []byte) error

SetUpgradedConsensusState set the expected upgraded consensus state for the next version of this chain using the last height committed on this chain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL