wasmpoc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0, BSD-2-Clause Imports: 15 Imported by: 0

README

Skeleton of the processor implementation for Wasp VM PoC

It consists of directory /packages/vm/examples/wasmpoc with a skeleton of empty SC program and a test in /tools/cluster/wasptest/wasp_wasm_vm_test.go.

Under Windows, run the test in the current directory /tools/cluster/wasptest:

start /max t.bat TestWasmVMSend5Requests1Sec

Documentation

Overview

nil processor takes any request and dos nothing, i.e. produces empty state update it is useful for testing

Index

Constants

View Source
const (
	KeyBalance     = interfaces.KeyUserDefined
	KeyConfig      = KeyBalance - 1
	KeyOwner       = KeyConfig - 1
	KeyParams      = KeyOwner - 1
	KeyRandom      = KeyParams - 1
	KeyReqAddress  = KeyRandom - 1
	KeyReqBalance  = KeyReqAddress - 1
	KeyReqCode     = KeyReqBalance - 1
	KeyReqDelay    = KeyReqCode - 1
	KeyReqHash     = KeyReqDelay - 1
	KeyRequests    = KeyReqHash - 1
	KeyScAddress   = KeyRequests - 1
	KeySender      = KeyScAddress - 1
	KeyState       = KeySender - 1
	KeyTimestamp   = KeyState - 1
	KeyTransfers   = KeyTimestamp - 1
	KeyXferAddress = KeyTransfers - 1
	KeyXferAmount  = KeyXferAddress - 1
	KeyXferColor   = KeyXferAmount - 1
)
View Source
const (
	ProgramHash = "BDREf2rz36AvboHYWfWXgEUG5K8iynLDZAZwKnPBmKM9"

	RequestNop           = sctransaction.RequestCode(uint16(1))
	RequestInc           = sctransaction.RequestCode(uint16(2))
	RequestIncRepeat1    = sctransaction.RequestCode(uint16(3))
	RequestIncRepeatMany = sctransaction.RequestCode(uint16(4))
	RequestPlaceBet      = sctransaction.RequestCode(uint16(5))
	RequestLockBets      = sctransaction.RequestCode(uint16(6))
	RequestPayWinners    = sctransaction.RequestCode(uint16(7))
	RequestPlayPeriod    = sctransaction.RequestCode(uint16(8) | sctransaction.RequestCodeProtected)
	RequestTokenMint     = sctransaction.RequestCode(uint16(9))
)

Variables

This section is empty.

Functions

func GetProcessor

func GetProcessor() vmtypes.Processor

Types

type BalanceObject

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

func NewBalanceObject

func NewBalanceObject(h *wasmVMPocProcessor, reqOnly bool) *BalanceObject

func (*BalanceObject) GetInt

func (o *BalanceObject) GetInt(keyId int32) int64

func (*BalanceObject) GetObjectId

func (o *BalanceObject) GetObjectId(keyId int32, typeId int32) int32

func (*BalanceObject) GetString

func (o *BalanceObject) GetString(keyId int32) string

func (*BalanceObject) SetInt

func (o *BalanceObject) SetInt(keyId int32, value int64)

func (*BalanceObject) SetString

func (o *BalanceObject) SetString(keyId int32, value string)

type ConfigObject

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

func NewConfigObject

func NewConfigObject(h *wasmVMPocProcessor) *ConfigObject

func (*ConfigObject) GetInt

func (o *ConfigObject) GetInt(keyId int32) int64

func (*ConfigObject) GetObjectId

func (o *ConfigObject) GetObjectId(keyId int32, typeId int32) int32

func (*ConfigObject) GetString

func (o *ConfigObject) GetString(keyId int32) string

func (*ConfigObject) SetInt

func (o *ConfigObject) SetInt(keyId int32, value int64)

func (*ConfigObject) SetString

func (o *ConfigObject) SetString(keyId int32, value string)

type ParamsObject

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

func NewParamsObject

func NewParamsObject(h *wasmVMPocProcessor) *ParamsObject

func (*ParamsObject) GetInt

func (o *ParamsObject) GetInt(keyId int32) int64

func (*ParamsObject) GetObjectId

func (o *ParamsObject) GetObjectId(keyId int32, typeId int32) int32

func (*ParamsObject) GetString

func (o *ParamsObject) GetString(keyId int32) string

func (*ParamsObject) SetInt

func (o *ParamsObject) SetInt(keyId int32, value int64)

func (*ParamsObject) SetString

func (o *ParamsObject) SetString(keyId int32, value string)

type RequestObject

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

func NewRequestObject

func NewRequestObject(h *wasmVMPocProcessor) *RequestObject

func (*RequestObject) GetInt

func (o *RequestObject) GetInt(keyId int32) int64

func (*RequestObject) GetObjectId

func (o *RequestObject) GetObjectId(keyId int32, typeId int32) int32

func (*RequestObject) GetString

func (o *RequestObject) GetString(keyId int32) string

func (*RequestObject) Send

func (o *RequestObject) Send(ctx interfaces.HostInterface)

func (*RequestObject) SetInt

func (o *RequestObject) SetInt(keyId int32, value int64)

func (*RequestObject) SetString

func (o *RequestObject) SetString(keyId int32, value string)

type RequestsArray

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

func NewRequestsArray

func NewRequestsArray(h *wasmVMPocProcessor) *RequestsArray

func (*RequestsArray) GetInt

func (a *RequestsArray) GetInt(keyId int32) int64

func (*RequestsArray) GetLength

func (a *RequestsArray) GetLength() int32

func (*RequestsArray) GetObjectId

func (a *RequestsArray) GetObjectId(keyId int32, typeId int32) int32

func (*RequestsArray) GetString

func (a *RequestsArray) GetString(keyId int32) string

func (*RequestsArray) SetInt

func (a *RequestsArray) SetInt(keyId int32, value int64)

func (*RequestsArray) SetString

func (a *RequestsArray) SetString(keyId int32, value string)

type RootObject

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

func NewRootObject

func NewRootObject(h *wasmVMPocProcessor, ctx vmtypes.Sandbox) *RootObject

func (*RootObject) GetInt

func (o *RootObject) GetInt(keyId int32) int64

func (*RootObject) GetObjectId

func (o *RootObject) GetObjectId(keyId int32, typeId int32) int32

func (*RootObject) GetString

func (o *RootObject) GetString(keyId int32) string

func (*RootObject) SetInt

func (o *RootObject) SetInt(keyId int32, value int64)

func (*RootObject) SetString

func (o *RootObject) SetString(keyId int32, value string)

type StateArray

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

func NewStateArray

func NewStateArray(h *wasmVMPocProcessor, items *kv.MustArray, typeId int32) *StateArray

func (*StateArray) GetInt

func (a *StateArray) GetInt(keyId int32) int64

func (*StateArray) GetLength

func (a *StateArray) GetLength() int32

func (*StateArray) GetObjectId

func (a *StateArray) GetObjectId(keyId int32, typeId int32) int32

func (*StateArray) GetString

func (a *StateArray) GetString(keyId int32) string

func (*StateArray) SetInt

func (a *StateArray) SetInt(keyId int32, value int64)

func (*StateArray) SetString

func (a *StateArray) SetString(keyId int32, value string)

type StateMap

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

func NewStateMap

func NewStateMap(h *wasmVMPocProcessor, items *kv.MustDictionary) *StateMap

func (*StateMap) GetInt

func (m *StateMap) GetInt(keyId int32) int64

func (*StateMap) GetLength

func (m *StateMap) GetLength() int32

func (*StateMap) GetObjectId

func (m *StateMap) GetObjectId(keyId int32, typeId int32) int32

func (*StateMap) GetString

func (m *StateMap) GetString(keyId int32) string

func (*StateMap) SetInt

func (m *StateMap) SetInt(keyId int32, value int64)

func (*StateMap) SetString

func (m *StateMap) SetString(keyId int32, value string)

type StateObject

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

func NewStateObject

func NewStateObject(h *wasmVMPocProcessor) *StateObject

func (*StateObject) GetInt

func (o *StateObject) GetInt(keyId int32) int64

func (*StateObject) GetObjectId

func (o *StateObject) GetObjectId(keyId int32, typeId int32) int32

func (*StateObject) GetString

func (o *StateObject) GetString(keyId int32) string

func (*StateObject) SetInt

func (o *StateObject) SetInt(keyId int32, value int64)

func (*StateObject) SetString

func (o *StateObject) SetString(keyId int32, value string)

type TransferObject

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

func NewTransferObject

func NewTransferObject(h *wasmVMPocProcessor) *TransferObject

func (*TransferObject) GetInt

func (o *TransferObject) GetInt(keyId int32) int64

func (*TransferObject) GetObjectId

func (o *TransferObject) GetObjectId(keyId int32, typeId int32) int32

func (*TransferObject) GetString

func (o *TransferObject) GetString(keyId int32) string

func (*TransferObject) Send

func (*TransferObject) SetInt

func (o *TransferObject) SetInt(keyId int32, value int64)

func (*TransferObject) SetString

func (o *TransferObject) SetString(keyId int32, value string)

type TransfersArray

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

func NewTransfersArray

func NewTransfersArray(h *wasmVMPocProcessor) *TransfersArray

func (*TransfersArray) GetInt

func (a *TransfersArray) GetInt(keyId int32) int64

func (*TransfersArray) GetLength

func (a *TransfersArray) GetLength() int32

func (*TransfersArray) GetObjectId

func (a *TransfersArray) GetObjectId(keyId int32, typeId int32) int32

func (*TransfersArray) GetString

func (a *TransfersArray) GetString(keyId int32) string

func (*TransfersArray) SetInt

func (a *TransfersArray) SetInt(keyId int32, value int64)

func (*TransfersArray) SetString

func (a *TransfersArray) SetString(keyId int32, value string)

Jump to

Keyboard shortcuts

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