fork

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0, MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpensiveFork = errors.New("refusing explicit call due to state fork at epoch")

Functions

func Copy

func Copy(ctx context.Context, from, to blockstore.Blockstore, root cid.Cid) error

Types

type ChainFork

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

func NewChainFork

func NewChainFork(ctx context.Context, cr chainReader, ipldstore cbor.IpldStore, bs blockstore.Blockstore, networkParams *config.NetworkParamsConfig) (*ChainFork, error)

func (*ChainFork) GetForkUpgrade

func (c *ChainFork) GetForkUpgrade() *config.ForkUpgradeConfig

func (*ChainFork) GetNtwkVersion

func (c *ChainFork) GetNtwkVersion(ctx context.Context, height abi.ChainEpoch) network.Version

func (*ChainFork) HandleStateForks

func (c *ChainFork) HandleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) HasExpensiveFork

func (c *ChainFork) HasExpensiveFork(ctx context.Context, height abi.ChainEpoch) bool

func (*ChainFork) ParentState

func (c *ChainFork) ParentState(ts *types.TipSet) cid.Cid

func (*ChainFork) PreUpgradeActorsV3 added in v0.9.1

func (c *ChainFork) PreUpgradeActorsV3(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error

func (*ChainFork) PreUpgradeActorsV4 added in v0.9.5

func (c *ChainFork) PreUpgradeActorsV4(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) error

func (*ChainFork) Start added in v0.9.1

func (c *ChainFork) Start(ctx context.Context) error

func (*ChainFork) StateTree

func (c *ChainFork) StateTree(ctx context.Context, st cid.Cid) (*vmstate.State, error)

func (*ChainFork) UpgradeActorsV2

func (c *ChainFork) UpgradeActorsV2(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeActorsV3 added in v0.9.1

func (c *ChainFork) UpgradeActorsV3(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeActorsV4 added in v0.9.5

func (c *ChainFork) UpgradeActorsV4(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeCalico

func (c *ChainFork) UpgradeCalico(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeFaucetBurnRecovery

func (c *ChainFork) UpgradeFaucetBurnRecovery(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeIgnition

func (c *ChainFork) UpgradeIgnition(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeLiftoff

func (c *ChainFork) UpgradeLiftoff(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*ChainFork) UpgradeRefuel

func (c *ChainFork) UpgradeRefuel(ctx context.Context, cache MigrationCache, root cid.Cid, epoch abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

type IFork

type IFork interface {
	HandleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)
	GetNtwkVersion(ctx context.Context, height abi.ChainEpoch) network.Version
	HasExpensiveFork(ctx context.Context, height abi.ChainEpoch) bool
	GetForkUpgrade() *config.ForkUpgradeConfig
	Start(ctx context.Context) error
}

type MigrationCache added in v0.9.1

type MigrationCache interface {
	Write(key string, value cid.Cid) error
	Read(key string) (bool, cid.Cid, error)
	Load(key string, loadFunc func() (cid.Cid, error)) (cid.Cid, error)
}

MigrationCache can be used to cache information used by a migration. This is primarily useful to "pre-compute" some migration state ahead of time, and make it accessible in the migration itself.

type MigrationFunc added in v0.9.1

type MigrationFunc func(
	ctx context.Context,
	cache MigrationCache,
	oldState cid.Cid,
	height abi.ChainEpoch,
	ts *types.TipSet,
) (newState cid.Cid, err error)

MigrationFunc is a migration function run at every upgrade.

  • The cache is a per-upgrade cache, pre-populated by pre-migrations.
  • The oldState is the state produced by the upgrade epoch.
  • The returned newState is the new state that will be used by the next epoch.
  • The height is the upgrade epoch height (already executed).
  • The tipset is the tipset for the last non-null block before the upgrade. Do not assume that ts.Height() is the upgrade height.

type MockFork

type MockFork struct{}

func NewMockFork

func NewMockFork() *MockFork

func (*MockFork) GetForkUpgrade

func (mockFork *MockFork) GetForkUpgrade() *config.ForkUpgradeConfig

func (*MockFork) GetNtwkVersion

func (mockFork *MockFork) GetNtwkVersion(ctx context.Context, height abi.ChainEpoch) network.Version

func (*MockFork) HandleStateForks

func (mockFork *MockFork) HandleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error)

func (*MockFork) HasExpensiveFork

func (mockFork *MockFork) HasExpensiveFork(ctx context.Context, height abi.ChainEpoch) bool

func (*MockFork) Start added in v0.9.1

func (mockFork *MockFork) Start(ctx context.Context) error

type PreMigration added in v0.9.1

type PreMigration struct {
	// PreMigration is the pre-migration function to run at the specified time. This function is
	// run asynchronously and must abort promptly when canceled.
	PreMigration PreMigrationFunc

	// StartWithin specifies that this pre-migration should be started at most StartWithin
	// epochs before the upgrade.
	StartWithin abi.ChainEpoch

	// DontStartWithin specifies that this pre-migration should not be started DontStartWithin
	// epochs before the final upgrade epoch.
	//
	// This should be set such that the pre-migration is likely to complete before StopWithin.
	DontStartWithin abi.ChainEpoch

	// StopWithin specifies that this pre-migration should be stopped StopWithin epochs of the
	// final upgrade epoch.
	StopWithin abi.ChainEpoch
}

PreMigration describes a pre-migration step to prepare for a network state upgrade. Pre-migrations are optimizations, are not guaranteed to run, and may be canceled and/or run multiple times.

type PreMigrationFunc added in v0.9.1

type PreMigrationFunc func(
	ctx context.Context,
	cache MigrationCache,
	oldState cid.Cid,
	height abi.ChainEpoch,
	ts *types.TipSet,
) error

PreMigrationFunc is a function run _before_ a network upgrade to pre-compute part of the network upgrade and speed it up.

type Upgrade

type Upgrade struct {
	Height    abi.ChainEpoch
	Network   network.Version
	Expensive bool
	Migration MigrationFunc

	// PreMigrations specifies a set of pre-migration functions to run at the indicated epochs.
	// These functions should fill the given cache with information that can speed up the
	// eventual full migration at the upgrade epoch.
	PreMigrations []PreMigration
}

type UpgradeSchedule

type UpgradeSchedule []Upgrade

func (UpgradeSchedule) Validate

func (us UpgradeSchedule) Validate() error

Jump to

Keyboard shortcuts

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