wasmhost

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OBJTYPE_ARRAY int32 = 0x20

	OBJTYPE_ADDRESS     int32 = 1
	OBJTYPE_AGENT_ID    int32 = 2
	OBJTYPE_BYTES       int32 = 3
	OBJTYPE_CHAIN_ID    int32 = 4
	OBJTYPE_COLOR       int32 = 5
	OBJTYPE_CONTRACT_ID int32 = 6
	OBJTYPE_HASH        int32 = 7
	OBJTYPE_HNAME       int32 = 8
	OBJTYPE_INT64       int32 = 9
	OBJTYPE_MAP         int32 = 10
	OBJTYPE_REQUEST_ID  int32 = 11
	OBJTYPE_STRING      int32 = 12
)
View Source
const (
	KeyAddress         = int32(-1)
	KeyBalances        = int32(-2)
	KeyBase58Bytes     = int32(-3)
	KeyBase58String    = int32(-4)
	KeyBlsAddress      = int32(-5)
	KeyBlsAggregate    = int32(-6)
	KeyBlsValid        = int32(-7)
	KeyCall            = int32(-8)
	KeyCaller          = int32(-9)
	KeyChainOwnerId    = int32(-10)
	KeyColor           = int32(-11)
	KeyContractCreator = int32(-12)
	KeyContractId      = int32(-13)
	KeyDeploy          = int32(-14)
	KeyEd25519Address  = int32(-15)
	KeyEd25519Valid    = int32(-16)
	KeyEvent           = int32(-17)
	KeyExports         = int32(-18)
	KeyHashBlake2b     = int32(-19)
	KeyHashSha3        = int32(-20)
	KeyHname           = int32(-21)
	KeyIncoming        = int32(-22)
	KeyLength          = int32(-23)
	KeyLog             = int32(-24)
	KeyMaps            = int32(-25)
	KeyMinted          = int32(-26)
	KeyName            = int32(-27)
	KeyPanic           = int32(-28)
	KeyParams          = int32(-29)
	KeyPost            = int32(-30)
	KeyRandom          = int32(-31)
	KeyRequestId       = int32(-32)
	KeyResults         = int32(-33)
	KeyReturn          = int32(-34)
	KeyState           = int32(-35)
	KeyTimestamp       = int32(-36)
	KeyTrace           = int32(-37)
	KeyTransfers       = int32(-38)
	KeyUtility         = int32(-39)
	KeyValid           = int32(-40)

	// Treat this one like a version number. When anything changes
	// to the keys give this one a different value and make sure
	// the client side in wasplib is updated accordingly
	KeyZzzzzzz = int32(-41)
)
View Source
const KeyFromString int32 = 0x4000

Variables

View Source
var ExtendedHostTracing = false
View Source
var HostTracing = false

Functions

This section is empty.

Types

type HostObject

type HostObject interface {
	Exists(keyId int32, typeId int32) bool
	GetBytes(keyId int32, typeId int32) []byte
	GetObjectId(keyId int32, typeId int32) int32
	GetTypeId(keyId int32) int32
	SetBytes(keyId int32, typeId int32, bytes []byte)
}

type KvStoreHost

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

KvStoreHost implements WaspLib.client.ScHost interface it allows wasplib/govm to bypass Wasm and access the sandbox directly so that it is possible to debug into SC code

func (*KvStoreHost) Exists

func (host *KvStoreHost) Exists(objId int32, keyId int32, typeId int32) bool

func (*KvStoreHost) FindObject

func (host *KvStoreHost) FindObject(objId int32) HostObject

func (*KvStoreHost) FindSubObject

func (host *KvStoreHost) FindSubObject(obj HostObject, keyId int32, typeId int32) HostObject

func (*KvStoreHost) GetBytes

func (host *KvStoreHost) GetBytes(objId int32, keyId int32, typeId int32) []byte

func (*KvStoreHost) GetKeyFromId

func (host *KvStoreHost) GetKeyFromId(keyId int32) []byte

func (*KvStoreHost) GetKeyIdFromBytes

func (host *KvStoreHost) GetKeyIdFromBytes(bytes []byte) int32

func (*KvStoreHost) GetKeyIdFromString

func (host *KvStoreHost) GetKeyIdFromString(key string) int32

func (*KvStoreHost) GetKeyStringFromId

func (host *KvStoreHost) GetKeyStringFromId(keyId int32) string

func (*KvStoreHost) GetObjectId

func (host *KvStoreHost) GetObjectId(objId int32, keyId int32, typeId int32) int32

func (*KvStoreHost) Init

func (host *KvStoreHost) Init(null HostObject, root HostObject, log *logger.Logger)

func (*KvStoreHost) PopFrame

func (host *KvStoreHost) PopFrame(frame []HostObject)

func (*KvStoreHost) PushFrame

func (host *KvStoreHost) PushFrame() []HostObject

func (*KvStoreHost) SetBytes

func (host *KvStoreHost) SetBytes(objId int32, keyId int32, typeId int32, bytes []byte)

func (*KvStoreHost) Trace

func (host *KvStoreHost) Trace(format string, a ...interface{})

func (*KvStoreHost) TraceAll

func (host *KvStoreHost) TraceAll(format string, a ...interface{})

func (*KvStoreHost) TrackObject

func (host *KvStoreHost) TrackObject(obj HostObject) int32

type WasmHost

type WasmHost struct {
	KvStoreHost
	// contains filtered or unexported fields
}

func (*WasmHost) FunctionFromCode

func (host *WasmHost) FunctionFromCode(code uint32) string

func (*WasmHost) Init

func (host *WasmHost) Init(null HostObject, root HostObject, log *logger.Logger)

func (*WasmHost) InitVM

func (host *WasmHost) InitVM(vm WasmVM, useBase58Keys bool) error

func (*WasmHost) IsView

func (host *WasmHost) IsView(function string) bool

func (*WasmHost) LoadWasm

func (host *WasmHost) LoadWasm(wasmData []byte) error

func (*WasmHost) RunFunction

func (host *WasmHost) RunFunction(functionName string) (err error)

func (*WasmHost) RunScFunction

func (host *WasmHost) RunScFunction(functionName string) (err error)

func (*WasmHost) SetExport

func (host *WasmHost) SetExport(index int32, functionName string)

type WasmTimeVM

type WasmTimeVM struct {
	WasmVmBase
	// contains filtered or unexported fields
}

func NewWasmTimeVM

func NewWasmTimeVM() *WasmTimeVM

func (*WasmTimeVM) LinkHost

func (vm *WasmTimeVM) LinkHost(impl WasmVM, host *WasmHost) error

func (*WasmTimeVM) LoadWasm

func (vm *WasmTimeVM) LoadWasm(wasmData []byte) error

func (*WasmTimeVM) RunFunction

func (vm *WasmTimeVM) RunFunction(functionName string) error

func (*WasmTimeVM) RunScFunction

func (vm *WasmTimeVM) RunScFunction(index int32) error

func (*WasmTimeVM) UnsafeMemory

func (vm *WasmTimeVM) UnsafeMemory() []byte

type WasmVM

type WasmVM interface {
	LinkHost(impl WasmVM, host *WasmHost) error
	LoadWasm(wasmData []byte) error
	RunFunction(functionName string) error
	RunScFunction(index int32) error
	UnsafeMemory() []byte
	SaveMemory()
}

type WasmVmBase

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

func (*WasmVmBase) HostFdWrite

func (vm *WasmVmBase) HostFdWrite(fd int32, iovs int32, size int32, written int32) int32

func (*WasmVmBase) HostGetBytes

func (vm *WasmVmBase) HostGetBytes(objId int32, keyId int32, typeId int32, stringRef int32, size int32) int32

func (*WasmVmBase) HostGetKeyId

func (vm *WasmVmBase) HostGetKeyId(keyRef int32, size int32) int32

func (*WasmVmBase) HostGetObjectId

func (vm *WasmVmBase) HostGetObjectId(objId int32, keyId int32, typeId int32) int32

func (*WasmVmBase) HostSetBytes

func (vm *WasmVmBase) HostSetBytes(objId int32, keyId int32, typeId int32, stringRef int32, size int32)

func (*WasmVmBase) LinkHost

func (vm *WasmVmBase) LinkHost(impl WasmVM, host *WasmHost) error

func (*WasmVmBase) PostCall

func (vm *WasmVmBase) PostCall(frame []byte)

func (*WasmVmBase) PreCall

func (vm *WasmVmBase) PreCall() []byte

func (*WasmVmBase) SaveMemory

func (vm *WasmVmBase) SaveMemory()

Jump to

Keyboard shortcuts

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