types

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of this module
	ModuleName = "upgrade"

	// RouterKey is used to route governance proposals
	RouterKey = ModuleName

	// StoreKey is the prefix under which we store this module's data
	StoreKey = ModuleName

	// QuerierKey is used to handle abci_query requests
	QuerierKey = ModuleName

	DefaultCodespace = ModuleName
)
View Source
const (
	// PlanByte specifies the Byte under which a pending upgrade plan is stored in the store
	PlanByte = 0x0
	// DoneByte is a prefix for to look up completed upgrade plan by name
	DoneByte = 0x1
)
View Source
const (
	QueryCurrent = "current"
	QueryApplied = "applied"
)

query endpoints supported by the upgrade Querier

View Source
const UpgradePlanForGravity = "UpgradeGravity"
View Source
const UpgradePlanForVM = "UpgradeVM"

Variables

View Source
var (
	ErrPermission = sdkerrors.Register(DefaultCodespace, 1707, "you have no permission to upgrade")
)
View Source
var UpgradeCodec *codec.Codec

Functions

func PlanKey

func PlanKey() []byte

PlanKey is the key under which the current plan is saved We store PlanByte as a const to keep it immutable (unlike a []byte)

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type CancelSoftwareUpgradeProposal

type CancelSoftwareUpgradeProposal struct {
	Title       string         `json:"title" yaml:"title"`
	Description string         `json:"description" yaml:"description"`
	Proposer    sdk.AccAddress `json:"proposer"`
}

Cancel Software Upgrade Proposals

func NewCancelSoftwareUpgradeProposal

func NewCancelSoftwareUpgradeProposal(proposer sdk.AccAddress) *CancelSoftwareUpgradeProposal

func (*CancelSoftwareUpgradeProposal) Bytes

func (msg *CancelSoftwareUpgradeProposal) Bytes() []byte

func (*CancelSoftwareUpgradeProposal) GetFromAddress

func (msg *CancelSoftwareUpgradeProposal) GetFromAddress() sdk.AccAddress

func (*CancelSoftwareUpgradeProposal) MsgType

func (msg *CancelSoftwareUpgradeProposal) MsgType() string

func (*CancelSoftwareUpgradeProposal) Route

func (*CancelSoftwareUpgradeProposal) ValidateBasic

func (msg *CancelSoftwareUpgradeProposal) ValidateBasic() error

type GenesisState

type GenesisState struct {
}

func NewGenesisState

func NewGenesisState() GenesisState

type Plan

type Plan struct {
	// Sets the name for the upgrade. This name will be used by the upgraded version of the software to apply any
	// special "on-upgrade" commands during the first BeginBlock method after the upgrade is applied. It is also used
	// to detect whether a software version can handle a given upgrade. If no upgrade handler with this name has been
	// set in the software, it will be assumed that the software is out-of-date when the upgrade Time or Height
	// is reached and the software will exit.
	Name string `json:"name,omitempty"`

	// The height at which the upgrade must be performed.
	// Only used if Time is not set.
	Height int64 `json:"height,omitempty"`

	// Any application specific upgrade info to be included on-chain
	// such as a git commit that validators could automatically upgrade to
	Info string `json:"info,omitempty"`
}

Plan specifies information about a planned upgrade and when it should occur

func (Plan) DueAt

func (p Plan) DueAt() string

DueAt is a string representation of when this plan is due to be executed

func (Plan) ShouldExecute

func (p Plan) ShouldExecute(ctx sdk.Context) bool

ShouldExecute returns true if the Plan is ready to execute given the current context

func (Plan) String

func (p Plan) String() string

func (Plan) ValidateBasic

func (p Plan) ValidateBasic() error

ValidateBasic does basic validation of a Plan

type QueryAppliedParams

type QueryAppliedParams struct {
	Name string
}

QueryAppliedParams is passed as data with QueryApplied

func NewQueryAppliedParams

func NewQueryAppliedParams(name string) QueryAppliedParams

NewQueryAppliedParams creates a new instance to query if a named plan was applied

type SoftwareUpgradeProposal

type SoftwareUpgradeProposal struct {
	Title       string         `json:"title" yaml:"title"`
	Description string         `json:"description" yaml:"description"`
	Plan        Plan           `json:"plan" yaml:"plan"`
	Proposer    sdk.AccAddress `json:"proposer"`
}

Software Upgrade Proposals

func NewSoftwareUpgradeProposal

func NewSoftwareUpgradeProposal(proposer sdk.AccAddress, title, description string, plan Plan) *SoftwareUpgradeProposal

func (*SoftwareUpgradeProposal) Bytes

func (msg *SoftwareUpgradeProposal) Bytes() []byte

func (*SoftwareUpgradeProposal) GetFromAddress

func (msg *SoftwareUpgradeProposal) GetFromAddress() sdk.AccAddress

func (*SoftwareUpgradeProposal) MsgType

func (msg *SoftwareUpgradeProposal) MsgType() string

func (*SoftwareUpgradeProposal) Route

func (msg *SoftwareUpgradeProposal) Route() string

func (*SoftwareUpgradeProposal) ValidateBasic

func (msg *SoftwareUpgradeProposal) ValidateBasic() error

type UpgradeHandler

type UpgradeHandler func(ctx sdk.Context, info []byte)

Jump to

Keyboard shortcuts

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