Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABTypesFactory ¶
type ABTypesFactory struct{}
AB "common types", ie not tx system specific stuff
type Encoder ¶
type Encoder interface {
Encode(obj any, ver uint32, getHandle func(obj any) uint32) ([]byte, error)
TxAttributes(txo *types.TransactionOrder, ver uint32) ([]byte, error)
UnitData(unit state.Unit, ver uint32) ([]byte, error)
AuthProof(txo *types.TransactionOrder) ([]byte, error)
}
translates AB types to WASM consumable representation
type EvalEnvironment ¶
type EvalResult ¶
type EvalResult int
const ( EvalResultTrue EvalResult = 1 EvalResultFalse EvalResult = 2 EvalResultError EvalResult = 3 )
func PredicateEvalResult ¶
func PredicateEvalResult(code uint64) (EvalResult, uint64)
type Observability ¶
type Option ¶
type Option func(*Options)
func WithRuntimeConfig ¶
func WithRuntimeConfig(cfg wazero.RuntimeConfig) Option
type Orchestration ¶
type Orchestration interface {
TrustBase(epoch uint64) (types.RootTrustBase, error)
}
type WasmVM ¶
type WasmVM struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, enc Encoder, engines predicates.PredicateExecutor, orc Orchestration, observe Observability, opts ...Option) (*WasmVM, error)
New - creates new wazero based wasm vm
func (*WasmVM) Exec ¶
func (vm *WasmVM) Exec(ctx context.Context, predicate, args []byte, conf wasm.PredicateParams, txo *types.TransactionOrder, env EvalEnvironment) (uint64, error)
Exec loads the WASM module passed in as "predicate" argument and calls the "conf.Entrypoint" function in it.
- The entrypoint function signature must be "no parameters and single i64 return value" where zero means "true" and non-zero is "false" (ie the returned number is error code);
Source Files
¶
Click to show internal directories.
Click to hide internal directories.