Crate sc_executor

Source
Expand description

A crate that provides means of executing/dispatching calls into the runtime.

There are a few responsibilities of this crate at the moment:

  • It provides an implementation of a common entrypoint for calling into the runtime, both wasm and compiled.
  • It defines the environment for the wasm execution, namely the host functions that are to be provided into the wasm runtime module.
  • It also provides the required infrastructure for executing the current wasm runtime (specified by the current value of :code in the provided externalities), i.e. interfacing with wasm engine used, instance cache.

Modules§

error
Rust executor possible errors.

Structs§

NativeElseWasmExecutorDeprecated
A generic CodeExecutor implementation that uses a delegate to determine wasm code equivalence and dispatch to native code when possible, falling back on WasmExecutor when not.
NativeVersion
The version of the native runtime.
RuntimeVersion
Runtime version. This should not be thought of as classic Semver (major/minor/tiny). This triplet have different semantics and mis-interpretation could cause problems. In particular: bug fixes should result in an increment of spec_version and possibly authoring_version, absolutely not impl_version since they change the semantics of the runtime.
WasmExecutor
An abstraction over Wasm code executor. Supports selecting execution backend and manages runtime cache.

Enums§

HeapAllocStrategy
Defines the heap pages allocation strategy the wasm runtime should use.
WasmExecutionMethod
Specification of different methods of executing the runtime Wasm code.
WasmtimeInstantiationStrategy
The instantiation strategy to use for the WASM executor.

Constants§

DEFAULT_HEAP_ALLOC_PAGES
Default heap allocation pages.
DEFAULT_HEAP_ALLOC_STRATEGY
Default heap allocation strategy.

Traits§

Codec
Trait that allows zero-copy read/write of value-references to/from slices in LE format.
HostFunctions
Something that provides implementations for host functions.
NativeExecutionDispatch
Delegate for dispatching a CodeExecutor call.
RuntimeVersionOf
Extracts the runtime version of a given runtime code.

Functions§

read_embedded_version
Take the runtime blob and scan it for the custom wasm sections containing the version information and construct the RuntimeVersion from them.
with_externalities_safe
Set up the externalities and safe calling environment to execute runtime calls.