upgrades

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsensusParamsReaderWriter

type ConsensusParamsReaderWriter interface {
	StoreConsensusParams(ctx sdk.Context, cp tmproto.ConsensusParams) error
	GetConsensusParams(ctx sdk.Context) tmproto.ConsensusParams
}

ConsensusParamsReaderWriter defines the interface for reading and writing consensus params

type Toolbox

type Toolbox struct {
	AppCodec      codec.Codec
	ModuleManager *module.Manager
	ReaderWriter  ConsensusParamsReaderWriter
	keepers.AppKeepers
}

Toolbox contains all the modules necessary for an upgrade

func (Toolbox) UpgradeAlreadyApplied added in v0.5.0

func (b Toolbox) UpgradeAlreadyApplied(vm module.VersionMap) bool

UpgradeAlreadyApplied reports whether every module managed by the module manager is already stored at its current consensus version -- i.e. this upgrade handler has run before.

It is the idempotency guard for one-shot migrations: if a plan is re-scheduled by mistake (same name re-registered at a new height, crash-restart replay, operator error), re-running non-idempotent migrations can corrupt state or hard-stop the chain. Handlers must check this before their custom steps and return early when it is true.

Only modules present in the manager are compared: one removed by this upgrade (e.g. capability in v0.4.0) is irrelevant, and one missing from vm was added by this upgrade, so the first run has not completed and the result is false.

Modules with no ConsensusVersion (IBC light clients 06-solomachine and 07-tendermint, plus genesis-only and legacy modules) carry no migratable consensus state and must be SKIPPED -- returning false for them makes the guard unreachable on any manager containing one, silently disabling idempotency protection for every handler that relies on it.

PRECONDITION: only sound for an upgrade that makes vm disagree with the current versions on its first run -- i.e. it bumps some managed module's ConsensusVersion, or adds a module that reports one. Dropping a module does NOT qualify, and neither does adding one without a ConsensusVersion: both are skipped by the loop below, so if nothing else moved, the guard reports "applied" on the first legitimate run and skips every migration (this bit v0.4.1, which changes no consensus version -- rely on the migrations being idempotent instead).

There are currently NO production callers: v0.4.0 and v0.4.1 both rely on per-migration idempotency instead (v0.4.0's missing guard is a known, fenced defect -- see app/upgrades/v040/erc20_legacy_replay_test.go). The function is kept, covered by its own unit tests, as the guard for future upgrades that do bump a managed module's ConsensusVersion.

type Upgrade

type Upgrade struct {
	// Version name this upgrade is registered under, e.g. `v7`.
	UpgradeName string

	// UpgradeHandlerConstructor builds the upgrade handler.
	UpgradeHandlerConstructor func(*module.Manager, module.Configurator, Toolbox) upgradetypes.UpgradeHandler

	// StoreUpgrades is required for any module added, removed or renamed.
	StoreUpgrades *store.StoreUpgrades
}

Upgrade is one registered upgrade: its version name, a constructor for the handler, and any store upgrades.

type UpgradeRouter added in v0.5.0

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

func NewUpgradeRouter

func NewUpgradeRouter() *UpgradeRouter

NewUpgradeRouter returns an empty router.

func (*UpgradeRouter) Register added in v0.5.0

func (r *UpgradeRouter) Register(u Upgrade) *UpgradeRouter

func (*UpgradeRouter) Routers added in v0.5.0

func (r *UpgradeRouter) Routers() map[string]Upgrade

func (*UpgradeRouter) UpgradeInfo added in v0.5.0

func (r *UpgradeRouter) UpgradeInfo(planName string) Upgrade

Directories

Path Synopsis
Package v050 implements the v0.5.0 upgrade plan: the single governance plan a v0.3.3 chain follows to reach the v0.4.x state.
Package v050 implements the v0.5.0 upgrade plan: the single governance plan a v0.3.3 chain follows to reach the v0.4.x state.

Jump to

Keyboard shortcuts

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