types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeightPatchesList

func GetHeightPatchesList() map[int64]IHeightPatch

func GetUpgradesList

func GetUpgradesList() map[string]UpgradeInitFn

func IterateMigrations

func IterateMigrations(fn func(module string, version uint64, initfn NewMigrationFn))

func MigrateValue

func MigrateValue(store storetypes.KVStore, cdc codec.BinaryCodec, prefixBz []byte, pStart, pEnd []byte, migrator ValueMigrator) (err error)

MigrateValue is a helper function that migrates values stored in a KV store for the given key prefix using the given value migrator function.

func ModuleMigrations

func ModuleMigrations(module string, migrator Migrator, fn func(string, uint64, sdkmodule.MigrationHandler))

func RegisterHeightPatch

func RegisterHeightPatch(height int64, patch IHeightPatch)

func RegisterMigration

func RegisterMigration(module string, version uint64, initFn NewMigrationFn)

RegisterMigration registers module migration within particular network upgrade

  • module: module name
  • version: current module version
  • initFn: migrator fn

func RegisterUpgrade

func RegisterUpgrade(name string, fn UpgradeInitFn)

Types

type IHeightPatch

type IHeightPatch interface {
	Name() string
	Begin(sdk.Context, *apptypes.AppKeepers)
}

IHeightPatch defines an interface for a non-software upgrade proposal Height Patch at a given height to implement. There is one time code that can be added for the start of the Patch, in `Begin`. Any other change in the code should be height-gated, if the goal is to have old and new binaries to be compatible prior to the upgrade height.

type IUpgrade

type IUpgrade interface {
	// StoreLoader add|rename|remove stores (aka modules)
	// function may return nil if there is changes to stores
	StoreLoader() *storetypes.StoreUpgrades
	UpgradeHandler() upgradetypes.UpgradeHandler
}

IUpgrade defines an interface to run a SoftwareUpgradeProposal

type Migration

type Migration interface {
	GetHandler() sdkmodule.MigrationHandler
}

type Migrator

type Migrator interface {
	StoreKey() storetypes.StoreKey
	Codec() codec.BinaryCodec
}

func NewMigrator

func NewMigrator(cdc codec.BinaryCodec, skey storetypes.StoreKey) Migrator

type NewMigrationFn

type NewMigrationFn func(Migrator) Migration

type UpgradeInitFn

type UpgradeInitFn func(log.Logger, *apptypes.App) (IUpgrade, error)

type ValueMigrator

type ValueMigrator func(fromBz []byte, cdc codec.BinaryCodec) proto.Message

ValueMigrator migrates a value to the new protobuf type given its old protobuf serialized bytes.

Jump to

Keyboard shortcuts

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