Documentation
¶
Index ¶
- Constants
- Variables
- type AspectRuntime
- type BaseGasRule
- type Bool
- type ByteArray
- type DynamicGasRule
- type HostAPIRegistry
- func (h *HostAPIRegistry) AddAPI(module Module, ns NameSpace, method MethodName, hostFunc *HostFuncWithGasRule) error
- func (h *HostAPIRegistry) Context() VMContext
- func (h *HostAPIRegistry) Destroy()
- func (h *HostAPIRegistry) SetContext(ctx VMContext)
- func (h *HostAPIRegistry) WrapperFuncs() map[Module]map[NameSpace]map[MethodName]interface{}
- type HostContext
- type HostFuncGasRule
- type HostFuncWithGasRule
- type HostFuncWrapper
- type IType
- type Int32
- type Int64
- type Logger
- type MethodName
- type Module
- type NameSpace
- type StaticGasRule
- type String
- type TypeHeader
- type TypeIndex
- type Uint64
- type VMContext
Constants ¶
View Source
const ( HeaderDataType = 2 HeaderDataLen = 4 HeaderLen = 6 )
View Source
const ( EVMGasToWASMGasMultiplier = 100 MaxGas = math.MaxInt64 / EVMGasToWASMGasMultiplier )
Variables ¶
View Source
var (
OutOfGasError = errors.New("out of gas")
)
Functions ¶
This section is empty.
Types ¶
type AspectRuntime ¶
type BaseGasRule ¶
type BaseGasRule struct {
// contains filtered or unexported fields
}
func (*BaseGasRule) SetContext ¶
func (r *BaseGasRule) SetContext(ctx VMContext)
type ByteArray ¶
type ByteArray struct {
// contains filtered or unexported fields
}
ByteArray implements IType
func NewByteArrary ¶
func NewByteArrary() *ByteArray
type DynamicGasRule ¶
type DynamicGasRule struct { BaseGasRule // contains filtered or unexported fields }
func NewDynamicGasRule ¶
func NewDynamicGasRule(fixedCost int64, multiplier int64) *DynamicGasRule
func (*DynamicGasRule) ConsumeGas ¶
func (d *DynamicGasRule) ConsumeGas(dataSize int64) error
type HostAPIRegistry ¶
type HostAPIRegistry struct {
// contains filtered or unexported fields
}
func NewHostAPIRegistry ¶
func NewHostAPIRegistry(hostFuncWrapper HostFuncWrapper) *HostAPIRegistry
func (*HostAPIRegistry) AddAPI ¶
func (h *HostAPIRegistry) AddAPI(module Module, ns NameSpace, method MethodName, hostFunc *HostFuncWithGasRule) error
func (*HostAPIRegistry) Context ¶
func (h *HostAPIRegistry) Context() VMContext
func (*HostAPIRegistry) Destroy ¶
func (h *HostAPIRegistry) Destroy()
func (*HostAPIRegistry) SetContext ¶
func (h *HostAPIRegistry) SetContext(ctx VMContext)
func (*HostAPIRegistry) WrapperFuncs ¶
func (h *HostAPIRegistry) WrapperFuncs() map[Module]map[NameSpace]map[MethodName]interface{}
type HostContext ¶
type HostFuncGasRule ¶
type HostFuncWithGasRule ¶
type HostFuncWithGasRule struct { Func interface{} GasRule HostFuncGasRule HostContext HostContext }
type HostFuncWrapper ¶
type HostFuncWrapper func(api *HostAPIRegistry, module Module, ns NameSpace, method MethodName, hostFunc *HostFuncWithGasRule) (interface{}, error)
type IType ¶
type IType interface { // Marshal serialize the type to byte array Marshal(value interface{}) []byte // Unmarshal desialize the data to the type Unmarshal(data []byte) (interface{}, error) }
IType is the interface of all runtime types
func TypeObjectMapping ¶
type MethodName ¶
type MethodName string
type StaticGasRule ¶
type StaticGasRule struct { BaseGasRule // contains filtered or unexported fields }
func NewStaticGasRule ¶
func NewStaticGasRule(cost int64) *StaticGasRule
func (*StaticGasRule) ConsumeGas ¶
func (s *StaticGasRule) ConsumeGas(_ int64) error
type String ¶
type String struct {
// contains filtered or unexported fields
}
String implements IType
type TypeHeader ¶
type TypeHeader struct{}
type TypeIndex ¶
type TypeIndex int16
TypeIndex defines the index of runtime type
func AssertType ¶
func AssertType(v interface{}) TypeIndex
type VMContext ¶
type VMContext interface { context.Context WriteMemory(ptr int32, data []byte) error ReadMemory(ptr int32, size int32) ([]byte, error) AllocMemory(size int32) (int32, error) RemainingEVMGas() (int64, error) RemainingWASMGas() (int64, error) ConsumeWASMGas(gas int64) error AddEVMGas(gas int64) error SetWASMGas(gas int64) error Logger() Logger }
Click to show internal directories.
Click to hide internal directories.