Documentation
¶
Index ¶
- Constants
- Variables
- type HostObject
- type KvStoreHost
- func (h *KvStoreHost) CallFunc(objID, keyID int32, params []byte) []byte
- func (h *KvStoreHost) Exists(objID, keyID, typeID int32) bool
- func (h *KvStoreHost) FindObject(objID int32) HostObject
- func (h *KvStoreHost) GetBytes(objID, keyID, typeID int32) []byte
- func (h *KvStoreHost) GetKeyFromID(keyID int32) []byte
- func (h *KvStoreHost) GetKeyIDFromBytes(bytes []byte) int32
- func (h *KvStoreHost) GetKeyIDFromString(key string) int32
- func (h *KvStoreHost) GetKeyStringFromID(keyID int32) string
- func (h *KvStoreHost) GetObjectID(objID, keyID, typeID int32) int32
- func (h *KvStoreHost) Init(scKeys *KvStoreHost)
- func (h *KvStoreHost) SetBytes(objID, keyID, typeID int32, bytes []byte)
- func (h *KvStoreHost) TraceAllf(format string, a ...interface{})
- func (h *KvStoreHost) Tracef(format string, a ...interface{})
- func (h *KvStoreHost) TrackObject(obj HostObject) int32
- type WasmGoVM
- type WasmHost
- func (host *WasmHost) AddFunc(f func(ctx wasmlib.ScFuncContext)) []func(ctx wasmlib.ScFuncContext)
- func (host *WasmHost) AddView(v func(ctx wasmlib.ScViewContext)) []func(ctx wasmlib.ScViewContext)
- func (host *WasmHost) FunctionFromCode(code uint32) string
- func (host *WasmHost) Init()
- func (host *WasmHost) InitVM(vm WasmVM, store WasmStore) error
- func (host *WasmHost) IsView(function string) bool
- func (host *WasmHost) LoadWasm(wasmData []byte) error
- func (host *WasmHost) RunFunction(functionName string, args ...interface{}) (err error)
- func (host *WasmHost) RunScFunction(functionName string) (err error)
- func (host *WasmHost) SetExport(index int32, functionName string)
- type WasmStore
- type WasmTimeVM
- func (vm *WasmTimeVM) Interrupt()
- func (vm *WasmTimeVM) LinkHost(impl WasmVM, host *WasmHost) error
- func (vm *WasmTimeVM) LoadWasm(wasmData []byte) error
- func (vm *WasmTimeVM) RunFunction(functionName string, args ...interface{}) error
- func (vm *WasmTimeVM) RunScFunction(index int32) error
- func (vm *WasmTimeVM) UnsafeMemory() []byte
- type WasmVM
- type WasmVMBase
- func (vm *WasmVMBase) HostFdWrite(fd, iovs, size, written int32) int32
- func (vm *WasmVMBase) HostGetBytes(objID, keyID, typeID, stringRef, size int32) int32
- func (vm *WasmVMBase) HostGetKeyID(keyRef, size int32) int32
- func (vm *WasmVMBase) HostGetObjectID(objID, keyID, typeID int32) int32
- func (vm *WasmVMBase) HostSetBytes(objID, keyID, typeID, stringRef, size int32)
- func (vm *WasmVMBase) LinkHost(impl WasmVM, host *WasmHost) error
- func (vm *WasmVMBase) PostCall(frame []byte)
- func (vm *WasmVMBase) PreCall() []byte
- func (vm *WasmVMBase) Run(runner func() error) (err error)
- func (vm *WasmVMBase) SaveMemory()
- func (vm *WasmVMBase) VMGetBytes(offset, size int32) []byte
- func (vm *WasmVMBase) VMSetBytes(offset, size int32, bytes []byte) int32
Constants ¶
View Source
const ( OBJTYPE_ARRAY int32 = 0x20 OBJTYPE_ARRAY16 int32 = 0x30 OBJTYPE_CALL int32 = 0x40 OBJTYPE_TYPEMASK int32 = 0x0f OBJTYPE_ADDRESS int32 = 1 OBJTYPE_AGENT_ID int32 = 2 OBJTYPE_BYTES int32 = 3 OBJTYPE_CHAIN_ID int32 = 4 OBJTYPE_COLOR int32 = 5 OBJTYPE_HASH int32 = 6 OBJTYPE_HNAME int32 = 7 OBJTYPE_INT16 int32 = 8 OBJTYPE_INT32 int32 = 9 OBJTYPE_INT64 int32 = 10 OBJTYPE_MAP int32 = 11 OBJTYPE_REQUEST_ID int32 = 12 OBJTYPE_STRING int32 = 13 )
View Source
const ( KeyAccountID = int32(-1) KeyAddress = int32(-2) KeyBalances = int32(-3) KeyBase58Decode = int32(-4) KeyBase58Encode = int32(-5) KeyBlsAddress = int32(-6) KeyBlsAggregate = int32(-7) KeyBlsValid = int32(-8) KeyCall = int32(-9) KeyCaller = int32(-10) KeyChainID = int32(-11) KeyChainOwnerID = int32(-12) KeyColor = int32(-13) KeyContract = int32(-14) KeyContractCreator = int32(-15) KeyDeploy = int32(-16) KeyEd25519Address = int32(-17) KeyEd25519Valid = int32(-18) KeyEvent = int32(-19) KeyExports = int32(-20) KeyHashBlake2b = int32(-21) KeyHashSha3 = int32(-22) KeyHname = int32(-23) KeyIncoming = int32(-24) KeyLength = int32(-25) KeyLog = int32(-26) KeyMaps = int32(-27) KeyMinted = int32(-28) KeyName = int32(-29) KeyPanic = int32(-30) KeyParams = int32(-31) KeyPost = int32(-32) KeyRandom = int32(-33) KeyRequestID = int32(-34) KeyResults = int32(-35) KeyReturn = int32(-36) KeyState = int32(-37) KeyTimestamp = int32(-38) KeyTrace = int32(-39) KeyTransfers = int32(-40) KeyUtility = int32(-41) KeyValid = int32(-42) // KeyZzzzzzz is treated like a version number. // When anything changes to the keys give this one a different value // and make sure that the client side is updated accordingly KeyZzzzzzz = int32(-43) )
View Source
const KeyFromBytes int32 = 0x4000
flag to indicate that this key id originally comes from a bytes key this allows us to display better readable tracing information
Variables ¶
View Source
var ( // DisableWasmTimeout can be used to disable the annoying timeout during debugging DisableWasmTimeout = false // HostTracing turns on debug tracing for ScHost calls HostTracing = false // HostTracingAll turns on *all* debug tracing for ScHost calls HostTracingAll = false // WasmTimeout set this to non-zero for a one-time override of the defaultTimeout WasmTimeout = 0 * time.Second )
Functions ¶
This section is empty.
Types ¶
type HostObject ¶
type KvStoreHost ¶
type KvStoreHost struct {
// contains filtered or unexported fields
}
KvStoreHost implements WaspLib.client.ScHost interface it allows WasmGoVM to bypass Wasm and access the sandbox directly so that it is possible to debug into SC code that was written in Go
func (*KvStoreHost) CallFunc ¶ added in v0.2.0
func (h *KvStoreHost) CallFunc(objID, keyID int32, params []byte) []byte
func (*KvStoreHost) Exists ¶
func (h *KvStoreHost) Exists(objID, keyID, typeID int32) bool
func (*KvStoreHost) FindObject ¶
func (h *KvStoreHost) FindObject(objID int32) HostObject
func (*KvStoreHost) GetBytes ¶
func (h *KvStoreHost) GetBytes(objID, keyID, typeID int32) []byte
func (*KvStoreHost) GetKeyFromID ¶ added in v0.2.0
func (h *KvStoreHost) GetKeyFromID(keyID int32) []byte
func (*KvStoreHost) GetKeyIDFromBytes ¶ added in v0.2.0
func (h *KvStoreHost) GetKeyIDFromBytes(bytes []byte) int32
func (*KvStoreHost) GetKeyIDFromString ¶ added in v0.2.0
func (h *KvStoreHost) GetKeyIDFromString(key string) int32
func (*KvStoreHost) GetKeyStringFromID ¶ added in v0.2.0
func (h *KvStoreHost) GetKeyStringFromID(keyID int32) string
func (*KvStoreHost) GetObjectID ¶ added in v0.2.0
func (h *KvStoreHost) GetObjectID(objID, keyID, typeID int32) int32
func (*KvStoreHost) Init ¶
func (h *KvStoreHost) Init(scKeys *KvStoreHost)
func (*KvStoreHost) SetBytes ¶
func (h *KvStoreHost) SetBytes(objID, keyID, typeID int32, bytes []byte)
func (*KvStoreHost) TraceAllf ¶ added in v0.2.0
func (h *KvStoreHost) TraceAllf(format string, a ...interface{})
func (*KvStoreHost) Tracef ¶ added in v0.2.0
func (h *KvStoreHost) Tracef(format string, a ...interface{})
func (*KvStoreHost) TrackObject ¶
func (h *KvStoreHost) TrackObject(obj HostObject) int32
type WasmGoVM ¶ added in v0.2.0
type WasmGoVM struct {
WasmVMBase
// contains filtered or unexported fields
}
func NewWasmGoVM ¶ added in v0.2.0
func (*WasmGoVM) RunFunction ¶ added in v0.2.0
func (*WasmGoVM) RunScFunction ¶ added in v0.2.0
func (*WasmGoVM) UnsafeMemory ¶ added in v0.2.0
type WasmHost ¶
type WasmHost struct {
// contains filtered or unexported fields
}
func (*WasmHost) AddFunc ¶ added in v0.2.0
func (host *WasmHost) AddFunc(f func(ctx wasmlib.ScFuncContext)) []func(ctx wasmlib.ScFuncContext)
func (*WasmHost) AddView ¶ added in v0.2.0
func (host *WasmHost) AddView(v func(ctx wasmlib.ScViewContext)) []func(ctx wasmlib.ScViewContext)
func (*WasmHost) FunctionFromCode ¶
func (*WasmHost) RunFunction ¶
func (*WasmHost) RunScFunction ¶
type WasmStore ¶ added in v0.2.0
type WasmStore interface {
GetKvStore(id int32) *KvStoreHost
}
type WasmTimeVM ¶
type WasmTimeVM struct {
WasmVMBase
// contains filtered or unexported fields
}
func NewWasmTimeVM ¶
func NewWasmTimeVM() *WasmTimeVM
func (*WasmTimeVM) Interrupt ¶ added in v0.2.0
func (vm *WasmTimeVM) Interrupt()
func (*WasmTimeVM) LoadWasm ¶
func (vm *WasmTimeVM) LoadWasm(wasmData []byte) error
func (*WasmTimeVM) RunFunction ¶
func (vm *WasmTimeVM) RunFunction(functionName string, args ...interface{}) error
func (*WasmTimeVM) RunScFunction ¶
func (vm *WasmTimeVM) RunScFunction(index int32) error
func (*WasmTimeVM) UnsafeMemory ¶
func (vm *WasmTimeVM) UnsafeMemory() []byte
type WasmVM ¶
type WasmVM interface {
Interrupt()
LinkHost(impl WasmVM, host *WasmHost) error
LoadWasm(wasmData []byte) error
RunFunction(functionName string, args ...interface{}) error
RunScFunction(index int32) error
SaveMemory()
UnsafeMemory() []byte
VMGetBytes(offset int32, size int32) []byte
VMSetBytes(offset int32, size int32, bytes []byte) int32
}
type WasmVMBase ¶ added in v0.2.0
type WasmVMBase struct {
// contains filtered or unexported fields
}
func (*WasmVMBase) HostFdWrite ¶ added in v0.2.0
func (vm *WasmVMBase) HostFdWrite(fd, iovs, size, written int32) int32
func (*WasmVMBase) HostGetBytes ¶ added in v0.2.0
func (vm *WasmVMBase) HostGetBytes(objID, keyID, typeID, stringRef, size int32) int32
func (*WasmVMBase) HostGetKeyID ¶ added in v0.2.0
func (vm *WasmVMBase) HostGetKeyID(keyRef, size int32) int32
func (*WasmVMBase) HostGetObjectID ¶ added in v0.2.0
func (vm *WasmVMBase) HostGetObjectID(objID, keyID, typeID int32) int32
func (*WasmVMBase) HostSetBytes ¶ added in v0.2.0
func (vm *WasmVMBase) HostSetBytes(objID, keyID, typeID, stringRef, size int32)
func (*WasmVMBase) LinkHost ¶ added in v0.2.0
func (vm *WasmVMBase) LinkHost(impl WasmVM, host *WasmHost) error
func (*WasmVMBase) PostCall ¶ added in v0.2.0
func (vm *WasmVMBase) PostCall(frame []byte)
func (*WasmVMBase) PreCall ¶ added in v0.2.0
func (vm *WasmVMBase) PreCall() []byte
func (*WasmVMBase) Run ¶ added in v0.2.0
func (vm *WasmVMBase) Run(runner func() error) (err error)
func (*WasmVMBase) SaveMemory ¶ added in v0.2.0
func (vm *WasmVMBase) SaveMemory()
func (*WasmVMBase) VMGetBytes ¶ added in v0.2.0
func (vm *WasmVMBase) VMGetBytes(offset, size int32) []byte
func (*WasmVMBase) VMSetBytes ¶ added in v0.2.0
func (vm *WasmVMBase) VMSetBytes(offset, size int32, bytes []byte) int32
Click to show internal directories.
Click to hide internal directories.