migrations

package
v0.2402.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package migrations implements upgrade migration handlers.

Index

Constants

View Source
const (
	// Consensus240 is the name of the upgrade that enables features introduced in Oasis Core 24.0.
	//
	// This upgrade enables the key manager CHURP extension and updates the MaxTxSize/MaxBlockSize
	// in order to accommodate larger node registrations.
	Consensus240 = "consensus240"
)
View Source
const Consensus242 = "consensus242"

Consensus242 is the name of the upgrade that enables features introduced in Oasis Core 24.2.

This upgrade includes:

  • The `MayQuery“ field in the CHURP SGX policy, which defines which enclave identities are allowed to query runtime key shares.
View Source
const (
	// DummyUpgradeHandler is the name of the dummy upgrade, for use in the upgrade descriptor.
	DummyUpgradeHandler = "__e2e-test-valid"
)
View Source
const (
	// EmptyHandler is the name of the upgrade handler that doesn't perform any updates. This is
	// useful for upgrades that bump protocol versions but don't need any state migrations.
	EmptyHandler = "empty"
)
View Source
const (
	// ModuleName is the migration module name.
	ModuleName = "upgrade-migrations"
)

Variables

View Source
var (

	// ErrMissingMigrationHandler is error returned when a migration handler is not registered.
	ErrMissingMigrationHandler = fmt.Errorf("missing migration handler")
)
View Source
var (
	TestEntity entity.Entity
)
View Source
var Version242 = version.MustFromString("24.2")

Version242 is the Oasis Core 24.2 version.

Functions

func Register

func Register(name upgradeApi.HandlerName, handler Handler)

Register registers a new migration handler, by upgrade name.

Types

type Context

type Context struct {
	// Upgrade is the currently pending upgrade structure.
	Upgrade *upgradeApi.PendingUpgrade

	// DataDir is the node's data directory.
	DataDir string

	Logger *logging.Logger
}

Context defines the common context used by migration handlers.

func NewContext

func NewContext(upgrade *upgradeApi.PendingUpgrade, dataDir string) *Context

NewContext returns a new upgrade migration context.

type Handler

type Handler interface {
	// HasStartupUpgrade returns true iff the handler requires a startup upgrade.
	HasStartupUpgrade() bool

	// StartupUpgrade is called by the upgrade manager to perform
	// the node startup portion of the upgrade.
	StartupUpgrade() error

	// ConsensusUpgrade is called by the upgrade manager to perform
	// the consensus portion of the upgrade. The interface argument is
	// a private structure passed to Backend.ConsensusUpgrade by the
	// consensus backend.
	//
	// This method will be called twice, once in BeginBlock and once in
	// EndBlock.
	ConsensusUpgrade(interface{}) error
}

Handler is the interface used by migration handlers.

func GetHandler

func GetHandler(name upgradeApi.HandlerName) (Handler, error)

GetHandler returns the handler associated with the upgrade described in the context.

type Handler240 added in v0.2400.0

type Handler240 struct{}

Handler240 is the upgrade handler that transitions Oasis Core from version 23.0.x to 24.0.0.

func (*Handler240) ConsensusUpgrade added in v0.2400.0

func (h *Handler240) ConsensusUpgrade(privateCtx interface{}) error

ConsensusUpgrade implements Handler.

func (*Handler240) HasStartupUpgrade added in v0.2400.0

func (h *Handler240) HasStartupUpgrade() bool

HasStartupUpgrade implements Handler.

func (*Handler240) StartupUpgrade added in v0.2400.0

func (h *Handler240) StartupUpgrade() error

StartupUpgrade implements Handler.

type Handler242 added in v0.2402.0

type Handler242 struct{}

Handler242 is the upgrade handler that transitions Oasis Core from version 24.1 to 24.2.

func (*Handler242) ConsensusUpgrade added in v0.2402.0

func (h *Handler242) ConsensusUpgrade(privateCtx interface{}) error

ConsensusUpgrade implements Handler.

func (*Handler242) HasStartupUpgrade added in v0.2402.0

func (h *Handler242) HasStartupUpgrade() bool

HasStartupUpgrade implements Handler.

func (*Handler242) StartupUpgrade added in v0.2402.0

func (h *Handler242) StartupUpgrade() error

StartupUpgrade implements Handler.

Jump to

Keyboard shortcuts

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