vm

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0, MIT Imports: 46 Imported by: 44

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyObjectCid cid.Cid

Functions

func Copy

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

func DecodeParams

func DecodeParams(b []byte, out interface{}) error

func DumpActorState

func DumpActorState(code cid.Cid, b []byte) (interface{}, error)

func NewBLSAccountActor

func NewBLSAccountActor() *types.Actor

func NewInvoker added in v0.2.8

func NewInvoker() *invoker

func NewSecp256k1AccountActor

func NewSecp256k1AccountActor() *types.Actor

func ResolveToKeyAddr

func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Address) (address.Address, aerrors.ActorError)

ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.

func Syscalls added in v0.2.1

func Syscalls(verifier ffiwrapper.Verifier) runtime.Syscalls

func TryCreateAccountActor

func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, aerrors.ActorError)

Creates account actors from only BLS/SECP256K1 addresses.

Types

type ApplyRet

type ApplyRet struct {
	types.MessageReceipt
	ActorErr           aerrors.ActorError
	Penalty            types.BigInt
	InternalExecutions []*types.ExecutionResult
	Duration           time.Duration
}

type Invokee

type Invokee interface {
	Exports() []interface{}
}

type Pricelist added in v0.3.0

type Pricelist interface {
	// OnChainMessage returns the gas used for storing a message of a given size in the chain.
	OnChainMessage(msgSize int) int64
	// OnChainReturnValue returns the gas used for storing the response of a message in the chain.
	OnChainReturnValue(dataSize int) int64

	// OnMethodInvocation returns the gas used when invoking a method.
	OnMethodInvocation(value abi.TokenAmount, methodNum abi.MethodNum) int64

	// OnIpldGet returns the gas used for storing an object
	OnIpldGet(dataSize int) int64
	// OnIpldPut returns the gas used for storing an object
	OnIpldPut(dataSize int) int64

	// OnCreateActor returns the gas used for creating an actor
	OnCreateActor() int64
	// OnDeleteActor returns the gas used for deleting an actor
	OnDeleteActor() int64

	OnVerifySignature(sigType crypto.SigType, planTextSize int) (int64, error)
	OnHashing(dataSize int) int64
	OnComputeUnsealedSectorCid(proofType abi.RegisteredProof, pieces []abi.PieceInfo) int64
	OnVerifySeal(info abi.SealVerifyInfo) int64
	OnVerifyPost(info abi.WindowPoStVerifyInfo) int64
	OnVerifyConsensusFault() int64
}

Pricelist provides prices for operations in the VM.

Note: this interface should be APPEND ONLY since last chain checkpoint

func PricelistByEpoch added in v0.3.0

func PricelistByEpoch(epoch abi.ChainEpoch) Pricelist

PricelistByEpoch finds the latest prices for the given epoch

type Rand

type Rand interface {
	GetRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
}

type Runtime added in v0.3.0

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

func (*Runtime) AbortStateMsg added in v0.3.0

func (rs *Runtime) AbortStateMsg(msg string)

func (*Runtime) Abortf added in v0.3.0

func (rs *Runtime) Abortf(code exitcode.ExitCode, msg string, args ...interface{})

func (*Runtime) ChargeGas added in v0.3.0

func (rt *Runtime) ChargeGas(toUse int64)

func (*Runtime) Context added in v0.3.0

func (rt *Runtime) Context() context.Context

func (*Runtime) CreateActor added in v0.3.0

func (rt *Runtime) CreateActor(codeId cid.Cid, address address.Address)

func (*Runtime) CurrEpoch added in v0.3.0

func (rs *Runtime) CurrEpoch() abi.ChainEpoch

func (*Runtime) CurrentBalance added in v0.3.0

func (rs *Runtime) CurrentBalance() abi.TokenAmount

func (*Runtime) DeleteActor added in v0.3.0

func (rt *Runtime) DeleteActor(addr address.Address)

func (*Runtime) Get added in v0.3.0

func (rs *Runtime) Get(c cid.Cid, o vmr.CBORUnmarshaler) bool

func (*Runtime) GetActorCodeCID added in v0.3.0

func (rs *Runtime) GetActorCodeCID(addr address.Address) (ret cid.Cid, ok bool)

func (*Runtime) GetBalance added in v0.3.0

func (rt *Runtime) GetBalance(a address.Address) (types.BigInt, aerrors.ActorError)

func (*Runtime) GetRandomness added in v0.3.0

func (rt *Runtime) GetRandomness(personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) abi.Randomness

func (*Runtime) Message added in v0.3.0

func (rs *Runtime) Message() vmr.Message

func (*Runtime) NewActorAddress added in v0.3.0

func (rt *Runtime) NewActorAddress() address.Address

func (*Runtime) Pricelist added in v0.3.0

func (rt *Runtime) Pricelist() Pricelist

func (*Runtime) Put added in v0.3.0

func (rs *Runtime) Put(x vmr.CBORMarshaler) cid.Cid

func (*Runtime) ResolveAddress added in v0.3.0

func (rt *Runtime) ResolveAddress(addr address.Address) (ret address.Address, ok bool)

func (*Runtime) Send added in v0.3.0

func (rs *Runtime) Send(to address.Address, method abi.MethodNum, m vmr.CBORMarshaler, value abi.TokenAmount) (vmr.SendReturn, exitcode.ExitCode)

func (*Runtime) StartSpan added in v0.3.0

func (rs *Runtime) StartSpan(name string) vmr.TraceSpan

func (*Runtime) State added in v0.3.0

func (rs *Runtime) State() vmr.StateHandle

func (*Runtime) Store added in v0.3.0

func (rs *Runtime) Store() vmr.Store

func (*Runtime) Syscalls added in v0.3.0

func (rs *Runtime) Syscalls() vmr.Syscalls

func (*Runtime) TotalFilCircSupply added in v0.3.0

func (rt *Runtime) TotalFilCircSupply() abi.TokenAmount

func (*Runtime) ValidateImmediateCallerAcceptAny added in v0.3.0

func (rs *Runtime) ValidateImmediateCallerAcceptAny()

func (*Runtime) ValidateImmediateCallerIs added in v0.3.0

func (rt *Runtime) ValidateImmediateCallerIs(as ...address.Address)

func (*Runtime) ValidateImmediateCallerType added in v0.3.0

func (rt *Runtime) ValidateImmediateCallerType(ts ...cid.Cid)

type VM

type VM struct {
	Syscalls runtime.Syscalls
	// contains filtered or unexported fields
}

func NewVM

func NewVM(base cid.Cid, height abi.ChainEpoch, r Rand, cbs blockstore.Blockstore, syscalls runtime.Syscalls) (*VM, error)

func (*VM) ActorBalance

func (vm *VM) ActorBalance(addr address.Address) (types.BigInt, aerrors.ActorError)

func (*VM) ApplyImplicitMessage added in v0.3.0

func (vm *VM) ApplyImplicitMessage(ctx context.Context, msg *types.Message) (*ApplyRet, error)

func (*VM) ApplyMessage

func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error)

func (*VM) Flush

func (vm *VM) Flush(ctx context.Context) (cid.Cid, error)

func (*VM) Invoke

func (vm *VM) Invoke(act *types.Actor, rt *Runtime, method abi.MethodNum, params []byte) ([]byte, aerrors.ActorError)

func (*VM) MutateState added in v0.3.0

func (vm *VM) MutateState(ctx context.Context, addr address.Address, fn interface{}) error

vm.MutateState(idAddr, func(cst cbor.IpldStore, st *ActorStateType) error {...})

func (*VM) SetBlockHeight

func (vm *VM) SetBlockHeight(h abi.ChainEpoch)

func (*VM) SetInvoker added in v0.2.8

func (vm *VM) SetInvoker(i *invoker)

func (*VM) StateTree

func (vm *VM) StateTree() types.StateTree

Jump to

Keyboard shortcuts

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