vm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0, MIT Imports: 22 Imported by: 43

Documentation

Index

Constants

View Source
const GasVerifySignature = 50

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 DefaultSyscalls

func DefaultSyscalls() *types.VMSyscalls

func DumpActorState

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

func MiningReward

func MiningReward(remainingReward types.BigInt) types.BigInt

MiningReward returns correct mining reward

coffer is amount of FIL in NetworkAddress

func NewBLSAccountActor

func NewBLSAccountActor(st *state.StateTree, addr address.Address) (*types.Actor, aerrors.ActorError)

func NewSecp256k1AccountActor

func NewSecp256k1AccountActor(st *state.StateTree, addr address.Address) (*types.Actor, aerrors.ActorError)

func Transfer

func Transfer(from, to *types.Actor, amt types.BigInt) error

func TryCreateAccountActor

func TryCreateAccountActor(st *state.StateTree, addr address.Address) (*types.Actor, aerrors.ActorError)

Types

type ApplyRet

type ApplyRet struct {
	types.MessageReceipt
	ActorErr aerrors.ActorError
}

type Invokee

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

type Rand

type Rand interface {
	GetRandomness(ctx context.Context, h int64) ([]byte, error)
}

type VM

type VM struct {
	Syscalls *types.VMSyscalls
	// contains filtered or unexported fields
}

func NewVM

func NewVM(base cid.Cid, height uint64, r Rand, maddr address.Address, cbs blockstore.Blockstore) (*VM, error)

func (*VM) ActorBalance

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

func (*VM) ApplyMessage

func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*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, vmctx *VMContext, method uint64, params []byte) ([]byte, aerrors.ActorError)

func (*VM) SetBlockHeight

func (vm *VM) SetBlockHeight(h uint64)

func (*VM) SetBlockMiner

func (vm *VM) SetBlockMiner(m address.Address)

func (*VM) StateTree

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

type VMContext

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

func (*VMContext) BlockHeight

func (vmc *VMContext) BlockHeight() uint64

BlockHeight returns the height of the block this message was added to the chain in

func (*VMContext) ChargeGas

func (vmc *VMContext) ChargeGas(amount uint64) aerrors.ActorError

func (*VMContext) Commit

func (vmc *VMContext) Commit(oldh, newh cid.Cid) aerrors.ActorError

func (*VMContext) Context

func (vmctx *VMContext) Context() context.Context

func (*VMContext) GasUsed

func (vmc *VMContext) GasUsed() types.BigInt

func (*VMContext) Get

func (*VMContext) GetBalance

func (vmctx *VMContext) GetBalance(a address.Address) (types.BigInt, aerrors.ActorError)

func (*VMContext) GetHead

func (vmc *VMContext) GetHead() cid.Cid

func (*VMContext) GetRandomness

func (vmc *VMContext) GetRandomness(height uint64) ([]byte, aerrors.ActorError)

func (*VMContext) Ipld

func (vmc *VMContext) Ipld() *hamt.CborIpldStore

func (*VMContext) Message

func (vmc *VMContext) Message() *types.Message

Message is the message that kicked off the current invocation

func (*VMContext) Origin

func (vmc *VMContext) Origin() address.Address

func (*VMContext) Put

func (*VMContext) Send

func (vmc *VMContext) Send(to address.Address, method uint64, value types.BigInt, params []byte) ([]byte, aerrors.ActorError)

Send allows the current execution context to invoke methods on other actors in the system

func (*VMContext) StateTree

func (vmc *VMContext) StateTree() (types.StateTree, aerrors.ActorError)

func (*VMContext) Storage

func (vmc *VMContext) Storage() types.Storage

Storage provides access to the VM storage layer

func (*VMContext) Sys

func (vmc *VMContext) Sys() *types.VMSyscalls

func (*VMContext) VerifySignature

func (vmctx *VMContext) VerifySignature(sig *types.Signature, act address.Address, data []byte) aerrors.ActorError

Jump to

Keyboard shortcuts

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