state

package
v0.0.6-0...-3c1b1dd Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	Code() cid.Cid
	Head() cid.Cid
	CallSeqNum() uint64
	Balance() big.Int
}

Actor is an abstraction over the actor states stored in the root of the state tree.

type Applier

type Applier interface {
	ApplyMessage(epoch abi.ChainEpoch, msg *types.Message) (types.ApplyMessageResult, error)
	ApplySignedMessage(epoch abi.ChainEpoch, msg *types.SignedMessage) (types.ApplyMessageResult, error)
	ApplyTipSetMessages(epoch abi.ChainEpoch, blocks []types.BlockMessagesInfo, rnd RandomnessSource) (types.ApplyTipSetResult, error)
}

Applier applies abstract messages to states.

type Factories

type Factories interface {
	NewStateAndApplier(syscalls runtime.Syscalls) (VMWrapper, Applier)

	NewKeyManager() KeyManager

	NewValidationConfig() ValidationConfig
}

Factories wraps up all the implementation-specific integration points.

type KeyManager

type KeyManager interface {
	// Creates a new secp private key and returns the associated address.
	NewSECP256k1AccountAddress() address.Address

	// Creates a new BLS private key and returns the associated address.
	NewBLSAccountAddress() address.Address

	// Sign data with addr's key.
	Sign(addr address.Address, data []byte) (crypto.Signature, error)
}

TODO this needs to be implemented by chain validation. Providing these methods over RPC doesn't add a lot of value.

type RandomnessSource

type RandomnessSource interface {
	Randomness(ctx context.Context, tag crypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
}

RandomnessSource provides randomness to actors.

type RandomnessType

type RandomnessType int

Specifies a domain for randomness generation.

type VMWrapper

type VMWrapper interface {
	// Instantiate a new VM
	NewVM()

	// Returns the CID of the root node of the state tree.
	Root() cid.Cid

	// Get the value at key from vm store
	StoreGet(key cid.Cid, out runtime.CBORUnmarshaler) error

	// Put `value` into vm store
	StorePut(value runtime.CBORMarshaler) (cid.Cid, error)

	// Returns the actor state at `address` (or an error if there is none).
	Actor(address address.Address) (Actor, error)

	// Set state on an actor in the state tree. The actors head is the cid of `state`.
	SetActorState(addr address.Address, balance abi.TokenAmount, state runtime.CBORMarshaler) (Actor, error)

	// Installs a new actor in the state tree, going through the init actor when appropriate and returning the ID address of the actor.
	CreateActor(code cid.Cid, addr address.Address, balance abi.TokenAmount, state runtime.CBORMarshaler) (Actor, address.Address, error)
}

VMWrapper abstracts the inspection and mutation of an implementation-specific state tree and storage. The interface wraps a single, mutable state.

type ValidationConfig

type ValidationConfig interface {
	ValidateGas() bool
	ValidateExitCode() bool
	ValidateReturnValue() bool
	ValidateStateRoot() bool
}

Jump to

Keyboard shortcuts

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