life

package
v0.0.0-...-c69f244 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "life"

Name represents the name of the interpreter

Variables

This section is empty.

Functions

func NewRuntimeFromGenesis

func NewRuntimeFromGenesis(cfg *Config) (runtime.Instance, error)

NewRuntimeFromGenesis creates a runtime instance from the genesis data

Types

type Config

type Config struct {
	runtime.InstanceConfig
	Resolver exec.ImportResolver
}

Config represents a life configuration

type Instance

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

Instance is a runtime life instance

func NewInstance

func NewInstance(code []byte, cfg *Config) (*Instance, error)

NewInstance ...

func NewInstanceFromFile

func NewInstanceFromFile(fp string, cfg *Config) (*Instance, error)

NewInstanceFromFile instantiates a runtime from a .wasm file

func (*Instance) ApplyExtrinsic

func (in *Instance) ApplyExtrinsic(data types.Extrinsic) ([]byte, error)

ApplyExtrinsic calls runtime API function BlockBuilder_apply_extrinsic

func (*Instance) BabeConfiguration

func (in *Instance) BabeConfiguration() (*types.BabeConfiguration, error)

BabeConfiguration gets the configuration data for BABE from the runtime

func (*Instance) CheckInherents

func (in *Instance) CheckInherents()

func (*Instance) CheckRuntimeVersion

func (*Instance) CheckRuntimeVersion(_ []byte) (runtime.Version, error)

CheckRuntimeVersion ...

func (*Instance) DecodeSessionKeys

func (in *Instance) DecodeSessionKeys(enc []byte) ([]byte, error)

DecodeSessionKeys decodes the given public session keys. Returns a list of raw public keys including their key type.

func (*Instance) Exec

func (in *Instance) Exec(function string, data []byte) ([]byte, error)

Exec calls the given function with the given data

func (*Instance) ExecuteBlock

func (in *Instance) ExecuteBlock(block *types.Block) ([]byte, error)

ExecuteBlock calls runtime function Core_execute_block

func (*Instance) FinalizeBlock

func (in *Instance) FinalizeBlock() (*types.Header, error)

FinalizeBlock calls runtime API function BlockBuilder_finalize_block

func (*Instance) GenerateSessionKeys

func (in *Instance) GenerateSessionKeys()

func (*Instance) GetCodeHash

func (*Instance) GetCodeHash() common.Hash

GetCodeHash returns code hash of the runtime

func (*Instance) GrandpaAuthorities

func (in *Instance) GrandpaAuthorities() ([]types.Authority, error)

GrandpaAuthorities returns the genesis authorities from the runtime

func (*Instance) InherentExtrinsics

func (in *Instance) InherentExtrinsics(data []byte) ([]byte, error)

InherentExtrinsics calls runtime API function BlockBuilder_inherent_extrinsics

func (*Instance) InitializeBlock

func (in *Instance) InitializeBlock(header *types.Header) error

InitializeBlock calls runtime API function Core_initialise_block

func (*Instance) Keystore

func (*Instance) Keystore() *keystore.GlobalKeystore

Keystore to get reference to runtime keystore

func (*Instance) Metadata

func (in *Instance) Metadata() ([]byte, error)

Metadata calls runtime function Metadata_metadata

func (*Instance) NetworkService

func (*Instance) NetworkService() runtime.BasicNetwork

NetworkService to get referernce to runtime network service

func (*Instance) NodeStorage

func (*Instance) NodeStorage() runtime.NodeStorage

NodeStorage to get reference to runtime node service

func (*Instance) OffchainWorker

func (in *Instance) OffchainWorker()

func (*Instance) PaymentQueryInfo

func (*Instance) PaymentQueryInfo([]byte) (*types.TransactionPaymentQueryInfo, error)

PaymentQueryInfo returns information of a given extrinsic

func (*Instance) RandomSeed

func (in *Instance) RandomSeed()

func (*Instance) SetContextStorage

func (*Instance) SetContextStorage(s runtime.Storage)

SetContextStorage sets the runtime's storage. It should be set before calls to the below functions.

func (*Instance) Stop

func (*Instance) Stop()

Stop ...

func (*Instance) UpdateRuntimeCode

func (*Instance) UpdateRuntimeCode(_ []byte) error

UpdateRuntimeCode ...

func (*Instance) ValidateTransaction

func (in *Instance) ValidateTransaction(e types.Extrinsic) (*transaction.Validity, error)

ValidateTransaction runs the extrinsic through runtime function TaggedTransactionQueue_validate_transaction and returns *Validity

func (*Instance) Validator

func (*Instance) Validator() bool

Validator returns the context's Validator

func (*Instance) Version

func (in *Instance) Version() (runtime.Version, error)

Version calls runtime function Core_Version

type Memory

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

Memory is a thin wrapper around life's memory to support Gossamer runtime.Memory interface

func (*Memory) Data

func (m *Memory) Data() []byte

Data returns the memory's data

func (*Memory) Grow

func (m *Memory) Grow(numPages uint32) error

Grow ...

func (*Memory) Length

func (m *Memory) Length() uint32

Length returns the memory's length

type Resolver

type Resolver struct{} // TODO: move context inside resolver (#1875)

Resolver resolves the imports for life

func (*Resolver) ResolveFunc

func (*Resolver) ResolveFunc(module, field string) exec.FunctionImport

ResolveFunc ...

func (*Resolver) ResolveGlobal

func (*Resolver) ResolveGlobal(_, _ string) int64

ResolveGlobal ...

Jump to

Keyboard shortcuts

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