Skip to main content

soil_client/executor/common/runtime_blob/
mod.rs

1// This file is part of Soil.
2
3// Copyright (C) Soil contributors.
4// Copyright (C) Parity Technologies (UK) Ltd.
5// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
6
7//! This module allows for inspection and instrumentation, i.e. modifying the module to alter it's
8//! structure or behavior, of a wasm module.
9//!
10//! ## Instrumentation
11//!
12//! In ideal world, there would be no instrumentation. However, in the real world the execution
13//! engines we use are somewhat limited in their APIs or abilities.
14//!
15//! To give you some examples:
16//!
17//!   We need to reset the globals because when we
18//!   execute the Substrate Runtime, we do not drop and create the instance anew, instead
19//!   we restore some selected parts of the state.
20//!
21//! - stack depth metering can be performed via instrumentation or deferred to the engine and say be
22//!   added directly in machine code. Implementing this in machine code is rather cumbersome so
23//!   instrumentation looks like a good solution.
24//!
25//!   Stack depth metering is needed to make a wasm blob
26//!   execution deterministic, which in turn is needed by the Parachain Validation Function in
27//! Polkadot.
28//!
29//! ## Inspection
30//!
31//! Inspection of a wasm module may be needed to extract some useful information, such as to extract
32//! data segment snapshot, which is helpful for quickly restoring the initial state of instances.
33//! Inspection can be also useful to prove that a wasm module possesses some properties, such as,
34//! is free of any floating point operations, which is a useful step towards making instances
35//! produced from such a module deterministic.
36
37mod runtime_blob;
38
39pub use runtime_blob::RuntimeBlob;