states

package
v6.0.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0, MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDealStatesAgainstSectors

func CheckDealStatesAgainstSectors(acc *builtin.MessageAccumulator, minerSummaries map[addr.Address]*miner.StateSummary, marketSummary *market.StateSummary)

func CheckMinersAgainstPower

func CheckMinersAgainstPower(acc *builtin.MessageAccumulator, minerSummaries map[addr.Address]*miner.StateSummary, powerSummary *power.StateSummary)

func CheckStateInvariants

func CheckStateInvariants(tree *Tree, expectedBalanceTotal abi.TokenAmount, priorEpoch abi.ChainEpoch) (*builtin.MessageAccumulator, error)

Within this code, Go errors are not expected, but are often converted to messages so that execution can continue to find more errors rather than fail with no insight. Only errors thar are particularly troublesome to recover from should propagate as Go errors.

func MinerEligibleForElection

func MinerEligibleForElection(store adt.Store, mstate *miner.State, pstate *power.State, maddr addr.Address, currEpoch abi.ChainEpoch) (bool, error)

Tests whether a miner is eligible to win an election given the immediately prior state of the miner and system actors.

func MinerPoStLookbackEligibleForElection

func MinerPoStLookbackEligibleForElection(store adt.Store, pstate *power.State, mAddr addr.Address) (bool, error)

Tests whether a miner is eligible for election given a Winning PoSt lookback state. The power state must be the state of the power actor at Winning PoSt lookback epoch.

Types

type Actor

type Actor = states0.Actor

Value type of the top level of the state tree. Represents the on-chain state of a single actor.

type Actor struct {
	Code       cid.Cid // CID representing the code associated with the actor
	Head       cid.Cid // CID of the head state object for the actor
	CallSeqNum uint64  // CallSeqNum for the next message to be received by the actor (non-zero for accounts only)
	Balance    big.Int // Token balance of the actor
}

type Tree

type Tree struct {
	Map   *adt.Map
	Store adt.Store
}

A specialization of a map of ID-addresses to actor heads.

func LoadTree

func LoadTree(s adt.Store, r cid.Cid) (*Tree, error)

Loads a tree from a root CID and store.

func NewTree

func NewTree(store adt.Store) (*Tree, error)

Initializes a new, empty state tree backed by a store.

func (*Tree) Flush

func (t *Tree) Flush() (cid.Cid, error)

Writes the tree root node to the store, and returns its CID.

func (*Tree) ForEach

func (t *Tree) ForEach(fn func(addr address.Address, actor *Actor) error) error

Traverses all entries in the tree.

func (*Tree) ForEachKey

func (t *Tree) ForEachKey(fn func(addr address.Address) error) error

Traverses all keys in the tree, without decoding the actor states.

func (*Tree) GetActor

func (t *Tree) GetActor(addr address.Address) (*Actor, bool, error)

Loads the state associated with an address.

func (*Tree) SetActor

func (t *Tree) SetActor(addr address.Address, actor *Actor) error

Sets the state associated with an address, overwriting if it already present.

Jump to

Keyboard shortcuts

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