upgrade

package
v0.7.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = 1

	CodeInvalidMsgType     sdk.CodeType = 200
	CodeUnSupportedMsgType sdk.CodeType = 201
	CodeUnknownRequest     sdk.CodeType = sdk.CodeUnknownRequest
	CodeNotCurrentProposal sdk.CodeType = 203
	CodeNotValidator       sdk.CodeType = 204
	CodeDoubleSwitch       sdk.CodeType = 205
)
View Source
const MsgRoute = "upgrade"

name to idetify transaction types

Variables

View Source
var (
	Inited           bool
	ModuleListBucket map[int64]ModuleLifeTimeList
)
View Source
var (
	DoingSwitchKey = []byte("d") // whether system is doing switch
)
View Source
var (
	KVStoreKeyListKey = []byte("k/")
)
View Source
var Threshold = sdk.NewDecWithPrec(95, 2)

Functions

func EndBlocker

func EndBlocker(ctx sdk.Context, keeper Keeper) (tags sdk.Tags)

do switch

func GetCurrentVersionKey

func GetCurrentVersionKey() []byte

func GetDoingSwitchKey

func GetDoingSwitchKey() []byte

func GetProposalIDKey

func GetProposalIDKey(proposalID uint64) []byte

func GetStartHeightKey

func GetStartHeightKey(height int64) []byte

func GetSwitchKey

func GetSwitchKey(proposalID uint64, switchVoterAddr sdk.AccAddress) []byte

func GetVersionIDKey

func GetVersionIDKey(versionID int64) []byte

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, router bam.Router, data GenesisState)

InitGenesis - build the genesis version For first Version

func InitGenesis_commitID

func InitGenesis_commitID(ctx sdk.Context, k Keeper)

"main:acc:ibc:stake:slashing:fee:gov:upgrade"

func IntToHexString added in v0.7.0

func IntToHexString(i int64) string

func NewError

func NewError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error

func NewHandler

func NewHandler(k Keeper) sdk.Handler

func RegisterCodec added in v0.7.0

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func RegisterModuleList

func RegisterModuleList(router bam.Router)

func UintToHexString added in v0.7.0

func UintToHexString(i uint64) string

Types

type GenesisState added in v0.6.0

type GenesisState struct {
	SwitchPeriod int64 `json:"switch_period"`
}

GenesisState - all upgrade state that must be provided at genesis

func DefaultGenesisState added in v0.6.0

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func DefaultGenesisStateForTest added in v0.6.0

func DefaultGenesisStateForTest() GenesisState

get raw genesis raw message for testing

func WriteGenesis added in v0.7.0

func WriteGenesis(ctx sdk.Context, k Keeper) GenesisState

WriteGenesis - output genesis parameters

type Keeper

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

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, sk stake.Keeper) Keeper

func (Keeper) AddNewVersion

func (k Keeper) AddNewVersion(ctx sdk.Context, version Version)

func (Keeper) DoSwitchBegin

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

func (Keeper) DoSwitchEnd

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

func (Keeper) GetCurrentVersion

func (k Keeper) GetCurrentVersion(ctx sdk.Context) *Version

func (Keeper) GetCurrentVersionByStore

func (k Keeper) GetCurrentVersionByStore(kvStore sdk.KVStore) *Version

func (Keeper) GetDoingSwitch

func (k Keeper) GetDoingSwitch(ctx sdk.Context) bool

func (Keeper) GetKVStoreKeylist

func (keeper Keeper) GetKVStoreKeylist(ctx sdk.Context) string

func (Keeper) GetMsgTypeInCurrentVersion

func (k Keeper) GetMsgTypeInCurrentVersion(ctx sdk.Context, msg sdk.Msg) (string, sdk.Error)

func (Keeper) GetSwitch

func (k Keeper) GetSwitch(ctx sdk.Context, propsalID uint64, address sdk.AccAddress) (MsgSwitch, bool)

func (Keeper) GetVersionByHeight

func (k Keeper) GetVersionByHeight(ctx sdk.Context, blockHeight int64) *Version

func (Keeper) GetVersionByProposalId

func (k Keeper) GetVersionByProposalId(ctx sdk.Context, proposalId uint64) *Version

func (Keeper) GetVersionByVersionId

func (k Keeper) GetVersionByVersionId(versionId int64) *Version

func (Keeper) GetVersionList

func (k Keeper) GetVersionList(ctx sdk.Context) VersionList

func (Keeper) GetVersionListByStore added in v0.6.0

func (k Keeper) GetVersionListByStore(kvStore sdk.KVStore) VersionList

func (Keeper) OnlyRunAfterVersionId

func (k Keeper) OnlyRunAfterVersionId(ctx sdk.Context, versionId int64) bool

func (Keeper) RefreshVersionList added in v0.6.0

func (k Keeper) RefreshVersionList(kvStore sdk.KVStore)

func (Keeper) SetDoingSwitch

func (k Keeper) SetDoingSwitch(ctx sdk.Context, doing bool)

func (Keeper) SetKVStoreKeylist

func (keeper Keeper) SetKVStoreKeylist(ctx sdk.Context)

run when do switch

func (Keeper) SetSwitch

func (k Keeper) SetSwitch(ctx sdk.Context, propsalID uint64, address sdk.AccAddress, cmsg MsgSwitch)

type ModuleLifeTime

type ModuleLifeTime struct {
	Start   int64
	End     int64
	Handler string
	Store   []string
}

func GetModuleFromBucket

func GetModuleFromBucket(verId int64, handler string) ModuleLifeTime

func NewModuleLifeTime

func NewModuleLifeTime(start int64, end int64, handler string, store []string) ModuleLifeTime

type ModuleLifeTimeList

type ModuleLifeTimeList []ModuleLifeTime

func GetModuleListFromBucket

func GetModuleListFromBucket(verId int64) (ModuleLifeTimeList, bool)

func NewModuleLifeTimeList

func NewModuleLifeTimeList() ModuleLifeTimeList

func (ModuleLifeTimeList) BuildModuleLifeTime

func (mlist ModuleLifeTimeList) BuildModuleLifeTime(start int64, handler string, store []string) ModuleLifeTimeList

type MsgSwitch

type MsgSwitch struct {
	Title      string
	ProposalID uint64
	Voter      sdk.AccAddress
}

func NewMsgSwitch

func NewMsgSwitch(title string, proposalID uint64, voter sdk.AccAddress) MsgSwitch

func (MsgSwitch) GetSignBytes

func (msg MsgSwitch) GetSignBytes() []byte

func (MsgSwitch) GetSigners

func (msg MsgSwitch) GetSigners() []sdk.AccAddress

func (MsgSwitch) Route added in v0.7.0

func (msg MsgSwitch) Route() string

func (MsgSwitch) Type

func (msg MsgSwitch) Type() string

func (MsgSwitch) ValidateBasic

func (msg MsgSwitch) ValidateBasic() sdk.Error

type Version

type Version struct {
	Id         int64
	ProposalID uint64
	Start      int64
	ModuleList ModuleLifeTimeList
}

func NewVersion

func NewVersion(id int64, proposalID uint64, start int64, moduleList ModuleLifeTimeList) Version

type VersionList

type VersionList []Version
var VersionListCached VersionList

func NewVersionList

func NewVersionList() VersionList

func (VersionList) AddVersion

func (m VersionList) AddVersion(v Version)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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