Module radix_engine::vm::wasm

source ·
Expand description

Wasm validation, instrumentation and execution.



  • This is to construct a stub Store<FakeWasmiInstanceEnv>, which is a part of WasmiModule struct and serves as a placeholder for the real Store<WasmiInstanceEnv>. The real store is set (prior being transumted) when the WasmiModule is being instantiated. In fact the only difference between a stub and real Store is the Send + Sync manually implemented for the former one, which is required by WasmiModule cache (for std configuration) but shall not be implemented for the latter one to prevent sharing it between the threads since pointer might point to volatile data.
  • Describes the weight for all categories of supported wasm instructions.
  • This is to construct a real `Store
  • A WasmiModule defines a parsed WASM module “template” Instance (with imports already defined) and Store, which keeps user data. “Template” (Store, Instance) tuple are cached together, and never to be invoked. Upon instantiation Instance and Store are cloned, so the state is not shared between instances. It is safe to clone an Instance and a Store, since they don’t use pointers, but Arena allocator. Instance is owned by Store, it is basically some offset within Store’s vector of Instances. So after clone we receive the same Store, where we are able to set different data, more specifically a runtime_ptr. Also, it is correctly Send + Sync (under the assumption that the data in the Store is set to a valid value upon invocation , because this is the thing which is cached in the ScryptoInterpreter caches.




  • A Scrypto WASM engine validates, instruments and runs Scrypto modules.
  • Represents an instantiated, invocable Scrypto module.
  • Represents the runtime that can be invoked by Scrypto modules.
  • Weight functions needed for pallet_contracts.

Type Aliases§