Documentation ¶
Index ¶
- Constants
- Variables
- func GetRuntimeImports(targetRuntime string) func() (*wasm.Imports, error)
- func ImportsLegacyNodeRuntime() (*wasm.Imports, error)
- func ImportsNodeRuntime() (*wasm.Imports, error)
- func ImportsTestRuntime() (*wasm.Imports, error)
- func NewLegacyRuntimeFromGenesis(g *genesis.Genesis, cfg *Config) (runtime.LegacyInstance, error)
- func NewRuntimeFromGenesis(g *genesis.Genesis, cfg *Config) (runtime.Instance, error)
- type Config
- type Instance
- func NewInstance(code []byte, cfg *Config) (*Instance, error)
- func NewInstanceFromFile(fp string, cfg *Config) (*Instance, error)
- func NewInstanceFromLegacy(inst *LegacyInstance) *Instance
- func NewInstanceFromTrie(t *trie.Trie, cfg *Config) (*Instance, error)
- func NewTestInstance(t *testing.T, targetRuntime string) *Instance
- func NewTestInstanceWithRole(t *testing.T, targetRuntime string, role byte) *Instance
- func NewTestInstanceWithTrie(t *testing.T, targetRuntime string, tt *trie.Trie, lvl log.Lvl) *Instance
- func (in *Instance) ApplyExtrinsic(data types.Extrinsic) ([]byte, error)
- func (in *Instance) BabeConfiguration() (*types.BabeConfiguration, error)
- func (in *Instance) CheckInherents()
- func (in *Instance) Exec(function string, data []byte) ([]byte, error)
- func (in *Instance) ExecuteBlock(block *types.Block) ([]byte, error)
- func (in *Instance) FinalizeBlock() (*types.Header, error)
- func (in *Instance) GenerateSessionKeys()
- func (in *Instance) GrandpaAuthorities() ([]*types.Authority, error)
- func (in *Instance) InherentExtrinsics(data []byte) ([]byte, error)
- func (in *Instance) InitializeBlock(header *types.Header) error
- func (in *Instance) Legacy() *LegacyInstance
- func (in *Instance) Metadata() ([]byte, error)
- func (in *Instance) NetworkService() runtime.BasicNetwork
- func (in *Instance) NodeStorage() runtime.NodeStorage
- func (in *Instance) OffchainWorker()
- func (in *Instance) RandomSeed()
- func (in *Instance) SetContextStorage(s runtime.Storage)
- func (in *Instance) Stop()
- func (in *Instance) UpdateRuntimeCode(code []byte) error
- func (in *Instance) ValidateTransaction(e types.Extrinsic) (*transaction.Validity, error)
- func (in *Instance) Version() (runtime.Version, error)
- type LegacyInstance
- func NewLegacyInstance(code []byte, cfg *Config) (*LegacyInstance, error)
- func NewLegacyInstanceFromFile(fp string, cfg *Config) (*LegacyInstance, error)
- func NewTestLegacyInstance(t *testing.T, targetRuntime string) *LegacyInstance
- func NewTestLegacyInstanceWithRole(t *testing.T, targetRuntime string, role byte) *LegacyInstance
- func NewTestLegacyInstanceWithTrie(t *testing.T, targetRuntime string, tt *trie.Trie, lvl log.Lvl) *LegacyInstance
- func (in *LegacyInstance) ApplyExtrinsic(data types.Extrinsic) ([]byte, error)
- func (in *LegacyInstance) BabeConfiguration() (*types.BabeConfiguration, error)
- func (in *LegacyInstance) Exec(function string, data []byte) ([]byte, error)
- func (in *LegacyInstance) ExecuteBlock(block *types.Block) ([]byte, error)
- func (in *LegacyInstance) FinalizeBlock() (*types.Header, error)
- func (in *LegacyInstance) GrandpaAuthorities() ([]*types.Authority, error)
- func (in *LegacyInstance) InherentExtrinsics(data []byte) ([]byte, error)
- func (in *LegacyInstance) InitializeBlock(header *types.Header) error
- func (in *LegacyInstance) Metadata() ([]byte, error)
- func (in *LegacyInstance) NetworkService() runtime.BasicNetwork
- func (in *LegacyInstance) NodeStorage() runtime.NodeStorage
- func (in *LegacyInstance) SetContextStorage(s runtime.Storage)
- func (in *LegacyInstance) Stop()
- func (in *LegacyInstance) ValidateTransaction(e types.Extrinsic) (*transaction.Validity, error)
- func (in *LegacyInstance) Version() (runtime.Version, error)
Constants ¶
const Name = "wasmer"
Name represents the name of the interpreter
Variables ¶
var DefaultTestLogLvl = log.LvlDebug
DefaultTestLogLvl is the log level used for test runtime instances
Functions ¶
func GetRuntimeImports ¶
GetRuntimeImports ...
func ImportsLegacyNodeRuntime ¶
ImportsLegacyNodeRuntime returns the wasm imports for the substrate v0.6 node runtime
func ImportsNodeRuntime ¶
ImportsNodeRuntime returns the imports for the v0.8 runtime
func ImportsTestRuntime ¶
ImportsTestRuntime registers the wasm imports for the v0.6 substrate test runtime
func NewLegacyRuntimeFromGenesis ¶ added in v0.3.0
NewLegacyRuntimeFromGenesis creates a runtime instance from the genesis data
Types ¶
type Config ¶
type Config struct { runtime.InstanceConfig Imports func() (*wasm.Imports, error) }
Config represents a wasmer configuration
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance represents a v0.8 runtime go-wasmer instance
func NewInstance ¶
NewInstance instantiates a runtime from raw wasm bytecode
func NewInstanceFromFile ¶
NewInstanceFromFile instantiates a runtime from a .wasm file
func NewInstanceFromLegacy ¶ added in v0.3.0
func NewInstanceFromLegacy(inst *LegacyInstance) *Instance
NewInstanceFromLegacy instantiates a runtime from legacy runtime NOTE: this is unsafe and should be removed once all tests are upgraded to v0.8
func NewInstanceFromTrie ¶ added in v0.3.0
NewInstanceFromTrie returns a new runtime instance with the code provided in the given trie
func NewTestInstance ¶
NewTestInstance will create a new runtime instance using the given target runtime
func NewTestInstanceWithRole ¶
NewTestInstanceWithRole returns a test runtime with given role value
func NewTestInstanceWithTrie ¶
func NewTestInstanceWithTrie(t *testing.T, targetRuntime string, tt *trie.Trie, lvl log.Lvl) *Instance
NewTestInstanceWithTrie will create a new runtime (polkadot/test) with the supplied trie as the storage
func (*Instance) ApplyExtrinsic ¶
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) ExecuteBlock ¶
ExecuteBlock calls runtime function Core_execute_block
func (*Instance) FinalizeBlock ¶
FinalizeBlock calls runtime API function BlockBuilder_finalize_block
func (*Instance) GenerateSessionKeys ¶
func (in *Instance) GenerateSessionKeys()
func (*Instance) GrandpaAuthorities ¶
GrandpaAuthorities returns the genesis authorities from the runtime
func (*Instance) InherentExtrinsics ¶
InherentExtrinsics calls runtime API function BlockBuilder_inherent_extrinsics
func (*Instance) InitializeBlock ¶
InitializeBlock calls runtime API function Core_initialize_block
func (*Instance) Legacy ¶
func (in *Instance) Legacy() *LegacyInstance
Legacy returns the instance as a LegacyInstance
func (*Instance) NetworkService ¶
func (in *Instance) NetworkService() runtime.BasicNetwork
NetworkService to get referernce to runtime network service
func (*Instance) NodeStorage ¶
func (in *Instance) NodeStorage() runtime.NodeStorage
NodeStorage to get reference to runtime node service
func (*Instance) OffchainWorker ¶
func (in *Instance) OffchainWorker()
func (*Instance) RandomSeed ¶
func (in *Instance) RandomSeed()
func (*Instance) SetContextStorage ¶ added in v0.3.0
SetContextStorage sets the runtime's storage. It should be set before calls to the below functions.
func (*Instance) UpdateRuntimeCode ¶ added in v0.3.0
UpdateRuntimeCode updates the runtime instance to run the given code
func (*Instance) ValidateTransaction ¶
ValidateTransaction runs the extrinsic through runtime function TaggedTransactionQueue_validate_transaction and returns *Validity
type LegacyInstance ¶
type LegacyInstance struct {
// contains filtered or unexported fields
}
LegacyInstance represents a v0.6 runtime go-wasmer instance
func NewLegacyInstance ¶
func NewLegacyInstance(code []byte, cfg *Config) (*LegacyInstance, error)
NewLegacyInstance instantiates a legacy runtime from raw wasm bytecode
func NewLegacyInstanceFromFile ¶
func NewLegacyInstanceFromFile(fp string, cfg *Config) (*LegacyInstance, error)
NewLegacyInstanceFromFile instantiates a runtime from a .wasm file
func NewTestLegacyInstance ¶
func NewTestLegacyInstance(t *testing.T, targetRuntime string) *LegacyInstance
NewTestLegacyInstance will create a new runtime instance using the given target runtime
func NewTestLegacyInstanceWithRole ¶
func NewTestLegacyInstanceWithRole(t *testing.T, targetRuntime string, role byte) *LegacyInstance
NewTestLegacyInstanceWithRole returns a test runtime with given role value
func NewTestLegacyInstanceWithTrie ¶
func NewTestLegacyInstanceWithTrie(t *testing.T, targetRuntime string, tt *trie.Trie, lvl log.Lvl) *LegacyInstance
NewTestLegacyInstanceWithTrie will create a new runtime (polkadot/test) with the supplied trie as the storage
func (*LegacyInstance) ApplyExtrinsic ¶
func (in *LegacyInstance) ApplyExtrinsic(data types.Extrinsic) ([]byte, error)
ApplyExtrinsic calls runtime API function BlockBuilder_apply_extrinsic
func (*LegacyInstance) BabeConfiguration ¶
func (in *LegacyInstance) BabeConfiguration() (*types.BabeConfiguration, error)
BabeConfiguration gets the configuration data for BABE from the runtime
func (*LegacyInstance) Exec ¶
func (in *LegacyInstance) Exec(function string, data []byte) ([]byte, error)
Exec calls the given function with the given data
func (*LegacyInstance) ExecuteBlock ¶
func (in *LegacyInstance) ExecuteBlock(block *types.Block) ([]byte, error)
ExecuteBlock calls runtime function Core_execute_block
func (*LegacyInstance) FinalizeBlock ¶
func (in *LegacyInstance) FinalizeBlock() (*types.Header, error)
FinalizeBlock calls runtime API function BlockBuilder_finalize_block
func (*LegacyInstance) GrandpaAuthorities ¶
func (in *LegacyInstance) GrandpaAuthorities() ([]*types.Authority, error)
GrandpaAuthorities returns the genesis authorities from the runtime
func (*LegacyInstance) InherentExtrinsics ¶
func (in *LegacyInstance) InherentExtrinsics(data []byte) ([]byte, error)
InherentExtrinsics calls runtime API function BlockBuilder_inherent_extrinsics
func (*LegacyInstance) InitializeBlock ¶
func (in *LegacyInstance) InitializeBlock(header *types.Header) error
InitializeBlock calls runtime API function Core_initialize_block
func (*LegacyInstance) Metadata ¶
func (in *LegacyInstance) Metadata() ([]byte, error)
Metadata calls runtime function Metadata_metadata
func (*LegacyInstance) NetworkService ¶
func (in *LegacyInstance) NetworkService() runtime.BasicNetwork
NetworkService to get referernce to runtime network service
func (*LegacyInstance) NodeStorage ¶
func (in *LegacyInstance) NodeStorage() runtime.NodeStorage
NodeStorage to get reference to runtime node service
func (*LegacyInstance) SetContextStorage ¶ added in v0.3.0
func (in *LegacyInstance) SetContextStorage(s runtime.Storage)
SetContextStorage sets the runtime's storage. It should be set before calls to the below functions.
func (*LegacyInstance) ValidateTransaction ¶
func (in *LegacyInstance) ValidateTransaction(e types.Extrinsic) (*transaction.Validity, error)
ValidateTransaction runs the extrinsic through runtime function TaggedTransactionQueue_validate_transaction and returns *Validity