fork

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 67 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MigrationMaxWorkerCount    int
	EnvMigrationMaxWorkerCount = "VENUS_MIGRATION_MAX_WORKER_COUNT"
)
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

func LiteMigration added in v1.6.0

func LiteMigration(ctx context.Context, bstore blockstoreutil.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, oldAv actorstypes.Version, newAv actorstypes.Version, oldStateTreeVersion vmstate.StateTreeVersion, newStateTreeVersion vmstate.StateTreeVersion) (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 blockstoreutil.Blockstore,
	networkParams *config.NetworkParamsConfig,
	metadataDs dstore.Batching,
) (*ChainFork, error)

func (*ChainFork) GetForkUpgrade

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

func (*ChainFork) GetNetworkVersion added in v1.2.0

func (c *ChainFork) GetNetworkVersion(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) HasExpensiveForkBetween added in v1.6.0

func (c *ChainFork) HasExpensiveForkBetween(parent, height abi.ChainEpoch) bool

Returns true executing tipsets between the specified heights would trigger an expensive migration. NOTE: migrations occurring _at_ the target height are not included, as they're executed _after_ the target height.

func (*ChainFork) ParentState

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

func (*ChainFork) PreUpgradeActorsV10 added in v1.10.0

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

func (*ChainFork) PreUpgradeActorsV11 added in v1.11.0

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

func (*ChainFork) PreUpgradeActorsV12 added in v1.14.0

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

func (*ChainFork) PreUpgradeActorsV13 added in v1.15.0

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

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) PreUpgradeActorsV5 added in v0.9.7

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

func (*ChainFork) PreUpgradeActorsV6 added in v1.1.0

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

func (*ChainFork) PreUpgradeActorsV7 added in v1.2.0

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

func (*ChainFork) PreUpgradeActorsV8 added in v1.6.0

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

func (*ChainFork) PreUpgradeActorsV9 added in v1.8.0

func (c *ChainFork) PreUpgradeActorsV9(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) UpgradeActorsV10 added in v1.10.0

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

func (*ChainFork) UpgradeActorsV11 added in v1.11.0

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

func (*ChainFork) UpgradeActorsV12 added in v1.14.0

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

func (*ChainFork) UpgradeActorsV13 added in v1.15.0

func (c *ChainFork) UpgradeActorsV13(ctx context.Context,
	cache MigrationCache,
	root cid.Cid,
	epoch abi.ChainEpoch,
	ts *types.TipSet,
) (cid.Cid, 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) UpgradeActorsV5 added in v0.9.7

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

func (*ChainFork) UpgradeActorsV6 added in v1.1.0

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

func (*ChainFork) UpgradeActorsV7 added in v1.2.0

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

func (*ChainFork) UpgradeActorsV8 added in v1.6.0

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

func (*ChainFork) UpgradeActorsV9 added in v1.8.0

func (c *ChainFork) UpgradeActorsV9(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)
	GetNetworkVersion(ctx context.Context, height abi.ChainEpoch) network.Version
	HasExpensiveFork(ctx context.Context, height abi.ChainEpoch) bool
	HasExpensiveForkBetween(parent, height abi.ChainEpoch) bool
	GetForkUpgrade() *config.ForkUpgradeConfig
	Start(ctx context.Context) error
}

type Migration added in v1.10.0

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

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

NewMockFork mock for test

func (*MockFork) GetForkUpgrade

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

func (*MockFork) GetNetworkVersion added in v1.2.0

func (mockFork *MockFork) GetNetworkVersion(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) HasExpensiveForkBetween added in v1.6.0

func (mockFork *MockFork) HasExpensiveForkBetween(parent, 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 DefaultUpgradeSchedule added in v1.2.0

func DefaultUpgradeSchedule(cf *ChainFork, upgradeHeight *config.ForkUpgradeConfig) UpgradeSchedule

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