From bf694d3c0ee336b2e848e05ec3f5f6d55da525f9 Mon Sep 17 00:00:00 2001 From: yjh Date: Mon, 16 May 2022 16:25:34 +0800 Subject: [PATCH] remove unused error InvalidCode and improve docs (#11383) --- substrate/client/executor/common/src/error.rs | 3 --- substrate/client/executor/src/wasm_runtime.rs | 6 +----- substrate/frame/executive/src/lib.rs | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/substrate/client/executor/common/src/error.rs b/substrate/client/executor/common/src/error.rs index 5ffcafd7e9..09e070bb3b 100644 --- a/substrate/client/executor/common/src/error.rs +++ b/substrate/client/executor/common/src/error.rs @@ -43,9 +43,6 @@ pub enum Error { #[error("Method not found: '{0}'")] MethodNotFound(String), - #[error("Invalid Code (expected single byte): '{0}'")] - InvalidCode(String), - #[error("On-chain runtime does not specify version")] VersionInvalid, diff --git a/substrate/client/executor/src/wasm_runtime.rs b/substrate/client/executor/src/wasm_runtime.rs index 9c07dd7abf..85c33ecacf 100644 --- a/substrate/client/executor/src/wasm_runtime.rs +++ b/substrate/client/executor/src/wasm_runtime.rs @@ -191,8 +191,6 @@ impl RuntimeCache { /// This uses internal cache to find available instance or create a new one. /// # Parameters /// - /// `code` - Provides external code or tells the executor to fetch it from storage. - /// /// `runtime_code` - The runtime wasm code used setup the runtime. /// /// `default_heap_pages` - Number of 64KB pages to allocate for Wasm execution. @@ -201,8 +199,6 @@ impl RuntimeCache { /// /// `allow_missing_func_imports` - Ignore missing function imports. /// - /// `max_runtime_instances` - The size of the instances cache. - /// /// `f` - Function to execute. /// /// `H` - A compile-time list of host functions to expose to the runtime. @@ -210,7 +206,7 @@ impl RuntimeCache { /// # Returns result of `f` wrapped in an additional result. /// In case of failure one of two errors can be returned: /// - /// `Err::InvalidCode` is returned for runtime code issues. + /// `Err::RuntimeConstruction` is returned for runtime construction issues. /// /// `Error::InvalidMemoryReference` is returned if no memory export with the /// identifier `memory` can be found in the runtime. diff --git a/substrate/frame/executive/src/lib.rs b/substrate/frame/executive/src/lib.rs index f1e7485d74..4affc26f83 100644 --- a/substrate/frame/executive/src/lib.rs +++ b/substrate/frame/executive/src/lib.rs @@ -1299,7 +1299,7 @@ mod tests { sp_version::RuntimeVersion { spec_version: 1, ..Default::default() } }); - // set block number to non zero so events are not exlcuded + // set block number to non zero so events are not excluded System::set_block_number(1); Executive::initialize_block(&Header::new(