diff --git a/client/executor/README.md b/client/executor/README.md
index ab7b3d45206f9..24ff4eddca8b2 100644
--- a/client/executor/README.md
+++ b/client/executor/README.md
@@ -1,13 +1,43 @@
-A crate that provides means of executing/dispatching calls into the runtime.
+sp_executor provides means of executing/dispatching calls into the runtime.
+
+The executor is responsible for executing the runtime's state transition function (which could be native or an on-chain wasm blob).
+For wasm, while executing the state transition function the executor facilitates the [thunking](https://en.wikipedia.org/wiki/Thunk)
+of calls between wasm pallets and native pallets.
+
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.
+ - It provides a common entrypoint for calling into the runtime whether the
+ runtime is wasm, native or a mix of wasm and native pallets.
+
+ - It defines the guest environment for the wasm execution ( `EnvironmentDefinition` ), namely the host functions that are to be
+ exposed to 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.
+
+## Execution Strategies
+Several different implementations are available for executing runtimes:
+
+ * [`sc_executor_wasmtime`] - Wasmtime compiles wasm to native machine code before executing the code so is faster,
+ but only certain platforms are supported. (This is enabled by compiling with the `wasmtime` feature)
+
+ * [`sc_executor_wasmi`] - Wasmi is a wasm interpreter and thus slower but it is cross-platform.
+ It supports sandboxing execution of untrusted code.
+
+ * [`native_executor_instance`] - Fastest, but not on-chain so harder to automatically upgrade.
+
+A combination of the above strategies can be used - this is controlled by the `ExecutionStrategy` enum.
+
+## Other
+
+ * [`sc_executor_common`] details sandboxing and how to do wasm instrumentation.
+
+## References
+
+See [`sp_runtime_interface`] for an example of how to export a host function to the runtime.
+
+See also the substrate docs on [executor](https://substrate.dev/docs/en/knowledgebase/advanced/executor)
-License: GPL-3.0-or-later WITH Classpath-exception-2.0
\ No newline at end of file
+License: GPL-3.0-or-later WITH Classpath-exception-2.0
diff --git a/client/executor/common/README.md b/client/executor/common/README.md
index 0c0d3bf08bcb2..e1ca489187a04 100644
--- a/client/executor/common/README.md
+++ b/client/executor/common/README.md
@@ -1,3 +1,11 @@
A set of common definitions that are needed for defining execution engines.
-License: GPL-3.0-or-later WITH Classpath-exception-2.0
\ No newline at end of file
+Notably:
+
+ * [`runtime_blob`] module allows for inspection and instrumentation of wasm code.
+
+ * [`sandbox::SandboxInstance`] struct allows safe execution of untrusted wasm.
+
+ * [`wasm_runtime::WasmInstance`] trait for defining the interface of a deserialised wasm module.
+
+ License: GPL-3.0-or-later WITH Classpath-exception-2.0
\ No newline at end of file
diff --git a/client/executor/common/src/lib.rs b/client/executor/common/src/lib.rs
index ef73ecd90e285..9c3542f549256 100644
--- a/client/executor/common/src/lib.rs
+++ b/client/executor/common/src/lib.rs
@@ -16,8 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-//! A set of common definitions that are needed for defining execution engines.
-
+#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
#![deny(unused_crate_dependencies)]
diff --git a/client/executor/common/src/runtime_blob/data_segments_snapshot.rs b/client/executor/common/src/runtime_blob/data_segments_snapshot.rs
index 5c3fedbdc963e..91fc5eb7d4f8d 100644
--- a/client/executor/common/src/runtime_blob/data_segments_snapshot.rs
+++ b/client/executor/common/src/runtime_blob/data_segments_snapshot.rs
@@ -21,7 +21,7 @@ use crate::error::{self, Error};
use pwasm_utils::parity_wasm::elements::Instruction;
use std::mem;
-/// This is a snapshot of data segments specialzied for a particular instantiation.
+/// This is a snapshot of data segments specialized for a particular instantiation.
///
/// Note that this assumes that no mutable globals are used.
#[derive(Clone)]
diff --git a/client/executor/common/src/runtime_blob/globals_snapshot.rs b/client/executor/common/src/runtime_blob/globals_snapshot.rs
index 6a29ff8bae365..b934d7d4c6cff 100644
--- a/client/executor/common/src/runtime_blob/globals_snapshot.rs
+++ b/client/executor/common/src/runtime_blob/globals_snapshot.rs
@@ -31,12 +31,15 @@ pub trait InstanceGlobals {
/// A handle to a global which can be used to get or set a global variable. This is supposed to
/// be a lightweight handle, like an index or an Rc-like smart-pointer, which is cheap to clone.
type Global: Clone;
+
/// Get a handle to a global by it's export name.
///
/// The requested export is must exist in the exported list, and it should be a mutable global.
fn get_global(&self, export_name: &str) -> Self::Global;
+
/// Get the current value of the global.
fn get_global_value(&self, global: &Self::Global) -> sp_wasm_interface::Value;
+
/// Update the current value of the global.
///
/// The global behind the handle is guaranteed to be mutable and the value to be the same type
@@ -49,7 +52,7 @@ pub trait InstanceGlobals {
/// This is set of globals required to create a [`GlobalsSnapshot`] and that are collected from
/// a runtime blob that was instrumented by
/// [`RuntimeBlob::expose_mutable_globals`](super::RuntimeBlob::expose_mutable_globals`).
-
+///
/// If the code wasn't instrumented then it would be empty and snapshot would do nothing.
pub struct ExposedMutableGlobalsSet(Vec);
diff --git a/client/executor/common/src/sandbox.rs b/client/executor/common/src/sandbox.rs
index 63f9cc4f258e8..d142d6730ca33 100644
--- a/client/executor/common/src/sandbox.rs
+++ b/client/executor/common/src/sandbox.rs
@@ -71,6 +71,7 @@ impl GuestToSupervisorFunctionMapping {
}
}
+/// External functions and memories that a particular wasm module depends upon.
struct Imports {
func_map: HashMap<(Vec, Vec), GuestFuncIndex>,
memories_map: HashMap<(Vec, Vec), MemoryRef>,
@@ -131,7 +132,7 @@ impl ImportResolver for Imports {
/// This trait encapsulates sandboxing capabilities.
///
-/// Note that this functions are only called in the `supervisor` context.
+/// Note that these functions are only called in the `supervisor` context.
pub trait SandboxCapabilities: FunctionContext {
/// Represents a function reference into the supervisor environment.
type SupervisorFuncRef;
@@ -159,7 +160,7 @@ pub trait SandboxCapabilities: FunctionContext {
) -> Result;
}
-/// Implementation of [`Externals`] that allows execution of guest module with
+/// Implementation of [`Externals`] that allows execution of a guest (wasm) module with
/// [externals][`Externals`] that might refer functions defined by supervisor.
///
/// [`Externals`]: ../wasmi/trait.Externals.html
@@ -173,6 +174,7 @@ fn trap(msg: &'static str) -> Trap {
TrapKind::Host(Box::new(Error::Other(msg.into()))).into()
}
+/// Transforms the result of an external function (from the host) into a format understood by the runtime.
fn deserialize_result(
mut serialized_result: &[u8],
) -> std::result::Result