Expand description
This crate is intended for use by runtime code (e.g pallet-contracts) to spawn PolkaVM instances and execute calls into them. Its purpose is to add one layer of abstraction to that it works transparently from the actual runtime (via the host functions defined in this crate) but also from tests (which run natively).
Additionally, this crate is also used (by the executor) to implement the host functions that are defined in this crate. This allows us to encapsulate all the logic regarding PolkaVM setup in one place.
Please keep in mind that the interface is kept simple because it has to match the interface of the host function so that the abstraction works. It will never expose the whole PolkaVM interface.
§⚠️ Unstable API — Do Not Use in Production ⚠️
This crate’s API is unstable and subject to breaking changes without notice.
The virtualization host functions exposed by this crate have not been stabilized and are not available on Polkadot (or any other production relay/parachain) until they are. Using them in a production runtime will cause your runtime to break when the API changes.
This crate should only be used for:
- Local testing and development
- Experimentation on test networks
Do not ship runtimes that depend on this crate to any chain you care about. There is no stability guarantee and no deprecation period — the interface may change at any time.
Modules§
- host_fn
- Host functions used to spawn and call into PolkaVM instances.
Structs§
- Exec
Buffer - Buffer shared between runtime and executor for passing syscall data across the host function boundary.
- Virt
- Native implementation of
VirtT. - Virt
Manager - Manages virtualization instances and their lifecycle.
Enums§
- Destroy
Error - Errors that can be emitted when destroying a virtualization instance.
- Exec
Action - Specifies what action to take when running a virtualization instance.
- Exec
Error - Errors that can be emitted when executing a new virtualization instance.
- Exec
Outcome - The outcome of a single virtualization execution step.
- Exec
Status - Status returned by the
execute/resumehost functions. - Instantiate
Error - Errors that can be emitted when instantiating a new virtualization instance.
- Memory
Error - Errors that can be emitted when accessing a virtualization instance’s memory.
Constants§
- EXEC_
BUFFER_ SIZE - The size of
ExecBufferin bytes. - LOG_
TARGET - The target we use for all logging.
Traits§
- MemoryT
- Allows to access the memory of a
VirtT. - VirtT
- A virtualization instance that can be called into multiple times.
Functions§
- run_
tests - Run all tests.