From 1254510b9ad984f535683691e33a637e6b4acd1b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 24 Nov 2022 21:45:42 +0100 Subject: [PATCH 1/8] Fix table formatting Signed-off-by: Oliver Tale-Yazdi --- primitives/runtime-interface/src/lib.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/primitives/runtime-interface/src/lib.rs b/primitives/runtime-interface/src/lib.rs index 6ebcb7482a779..aad112b340678 100644 --- a/primitives/runtime-interface/src/lib.rs +++ b/primitives/runtime-interface/src/lib.rs @@ -94,14 +94,13 @@ //! | `&str` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | //! | `&[u8]` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | //! | `Vec` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | -//! | `Vec where T: Encode` | `u64` | `let e = v.encode();`

e.len() 32bit << 32 -//! | e.as_ptr() 32bit | | `&[T] where T: Encode` | `u64` | `let e = -//! v.encode();`

e.len() 32bit << 32 | e.as_ptr() 32bit | | `[u8; N]` | -//! `u32` | `v.as_ptr()` | | `*const T` | `u32` | `Identity` | -//! | `Option` | `u64` | `let e = v.encode();`

e.len() 32bit << 32 | e.as_ptr() -//! 32bit | | [`T where T: PassBy`](./pass_by#Inner) | Depends on inner | -//! Depends on inner | | [`T where T: PassBy`](./pass_by#Codec)|`u64`|v.len() -//! 32bit << 32 |v.as_ptr() 32bit| +//! | `Vec where T: Encode`|`u64`|`let e = v.encode();`
e.len() 32bit << 32 | e.as_ptr() 32bit| +//! | `&[T] where T: Encode`|`u64`|`let e = v.encode();`
e.len() 32bit << 32 | e.as_ptr() 32bit| +//! | `[u8; N]` | `u32` | `v.as_ptr()` | +//! | `*const T` | `u32` | `Identity` | +//! | `Option` | `u64` | `let e = v.encode();`
e.len() 32bit << 32 | e.as_ptr() 32bit | +//! | [`T where T: PassBy`](pass_by#Inner) | Depends on inner | Depends on inner | +//! | [`T where T: PassBy`](pass_by#Codec)|`u64`|v.len() 32bit << 32 | v.as_ptr() 32bit| //! //! `Identity` means that the value is converted directly into the corresponding FFI type. From c7121abf31d7182804684e2fb9bd7b8669a1019b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 24 Nov 2022 22:18:59 +0100 Subject: [PATCH 2/8] Fix sp-runtime-interface table Using HTML now since multi-line tables are not a thing and fmt destroys them. Signed-off-by: Oliver Tale-Yazdi --- primitives/runtime-interface/src/lib.rs | 142 ++++++++++++++++++++---- 1 file changed, 119 insertions(+), 23 deletions(-) diff --git a/primitives/runtime-interface/src/lib.rs b/primitives/runtime-interface/src/lib.rs index aad112b340678..6b7a9e218852d 100644 --- a/primitives/runtime-interface/src/lib.rs +++ b/primitives/runtime-interface/src/lib.rs @@ -78,29 +78,125 @@ //! The following table documents how values of types are passed between the wasm and //! the host side and how they are converted into the corresponding type. //! -//! | Type | FFI type | Conversion | -//! |----|----|----| -//! | `u8` | `u32` | zero-extended to 32-bits | -//! | `u16` | `u32` | zero-extended to 32-bits | -//! | `u32` | `u32` | `Identity` | -//! | `u64` | `u64` | `Identity` | -//! | `i128` | `u32` | `v.as_ptr()` (pointer to a 16 byte array) | -//! | `i8` | `i32` | sign-extended to 32-bits | -//! | `i16` | `i32` | sign-extended to 32-bits | -//! | `i32` | `i32` | `Identity` | -//! | `i64` | `i64` | `Identity` | -//! | `u128` | `u32` | `v.as_ptr()` (pointer to a 16 byte array) | -//! | `bool` | `u32` | `if v { 1 } else { 0 }` | -//! | `&str` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | -//! | `&[u8]` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | -//! | `Vec` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | -//! | `Vec where T: Encode`|`u64`|`let e = v.encode();`
e.len() 32bit << 32 | e.as_ptr() 32bit| -//! | `&[T] where T: Encode`|`u64`|`let e = v.encode();`
e.len() 32bit << 32 | e.as_ptr() 32bit| -//! | `[u8; N]` | `u32` | `v.as_ptr()` | -//! | `*const T` | `u32` | `Identity` | -//! | `Option` | `u64` | `let e = v.encode();`
e.len() 32bit << 32 | e.as_ptr() 32bit | -//! | [`T where T: PassBy`](pass_by#Inner) | Depends on inner | Depends on inner | -//! | [`T where T: PassBy`](pass_by#Codec)|`u64`|v.len() 32bit << 32 | v.as_ptr() 32bit| +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//! +//!
TypeFFI TypeConversion
u8u32zero-extended to 32-bits
u16u32zero-extended to 32-bits
u32u32Identity
u64u64Identity
i128u32v.as_ptr()(pointer to a 16 byte array)
i8i32sign-extended to 32-bits
i16i32sign-extended to 32-bits
i32i32Identity
i64i64Identity
u128u32v.as_ptr()(pointer to a 16 byte array)
boolu32if v { 1 } else { 0 }
&stru64v.len() 32bit<< 32 | v.as_ptr() 32bit
&[u8]u64v.len() 32bit<< 32 | v.as_ptr() 32bit
Vecu64v.len() 32bit<< 32 | v.as_ptr() 32bit
Vecwhere T: Encodeu64let e = v.encode();
+//! e.len() 32bit<< 32 | e.as_ptr() 32bit
&[T] where T: Encodeu64let e = v.encode();
+//! e.len() 32bit<< 32 | e.as_ptr() 32bit
[u8; N]u32v.as_ptr()
*const Tu32Identity
Optionu64let e = v.encode();
+//! e.len() 32bit<< 32 | e.as_ptr() 32bit
T where T: PassByDepends on innerDepends on inner
T where T: PassByu64v.len() 32bit<< 32 | v.as_ptr() 32bit
//! //! `Identity` means that the value is converted directly into the corresponding FFI type. From bb1d33fe6e613e8e800543222af6899477424b0b Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 24 Nov 2022 22:20:59 +0100 Subject: [PATCH 3/8] More rustdoc fixes Signed-off-by: Oliver Tale-Yazdi --- client/cli/src/params/shared_params.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/cli/src/params/shared_params.rs b/client/cli/src/params/shared_params.rs index 6c03ac2c4ec23..5cbb6dbad54a3 100644 --- a/client/cli/src/params/shared_params.rs +++ b/client/cli/src/params/shared_params.rs @@ -42,10 +42,10 @@ pub struct SharedParams { #[arg(long, short = 'd', value_name = "PATH")] pub base_path: Option, - /// Sets a custom logging filter. Syntax is =, e.g. -lsync=debug. + /// Sets a custom logging filter. Syntax is `=`, e.g. -lsync=debug. /// /// Log levels (least to most verbose) are error, warn, info, debug, and trace. - /// By default, all targets log `info`. The global log level can be set with -l. + /// By default, all targets log `info`. The global log level can be set with `-l`. #[arg(short = 'l', long, value_name = "LOG_PATTERN", num_args = 1..)] pub log: Vec, @@ -71,7 +71,7 @@ pub struct SharedParams { #[arg(long)] pub enable_log_reloading: bool, - /// Sets a custom profiling filter. Syntax is the same as for logging: = + /// Sets a custom profiling filter. Syntax is the same as for logging: `=`. #[arg(long, value_name = "TARGETS")] pub tracing_targets: Option, From 695c72aa823f319a18744515a2d3afc67693fbbb Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 24 Nov 2022 22:30:47 +0100 Subject: [PATCH 4/8] Fix tags Signed-off-by: Oliver Tale-Yazdi --- primitives/runtime-interface/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/primitives/runtime-interface/src/lib.rs b/primitives/runtime-interface/src/lib.rs index 6b7a9e218852d..96384449bcfa2 100644 --- a/primitives/runtime-interface/src/lib.rs +++ b/primitives/runtime-interface/src/lib.rs @@ -153,7 +153,7 @@ //! v.len() 32bit<< 32 | v.as_ptr() 32bit //! //! -//! Vec +//! Vec //! u64 //! v.len() 32bit<< 32 | v.as_ptr() 32bit //! @@ -186,12 +186,12 @@ //! e.len() 32bit<< 32 | e.as_ptr() 32bit //! //! -//! T where T: PassBy +//! T where T: PassBy //! Depends on inner //! Depends on inner //! //! -//! T where T: PassBy +//! T where T: PassBy //! u64 //! v.len() 32bit<< 32 | v.as_ptr() 32bit //! @@ -201,6 +201,9 @@ //! `Identity` means that the value is converted directly into the corresponding FFI type. #![cfg_attr(not(feature = "std"), no_std)] +// `cargo doc` doc thinks that `Vec` has an invalid `u8` HTML tag which cannot be fixed by +// backticks... +#![allow(rustdoc::invalid_html_tags)] extern crate self as sp_runtime_interface; From 9c9d653afe696ecbac4670787dbb72517c5e50a8 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 24 Nov 2022 22:46:15 +0100 Subject: [PATCH 5/8] More fixes... Signed-off-by: Oliver Tale-Yazdi --- primitives/runtime-interface/test-wasm/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/runtime-interface/test-wasm/src/lib.rs b/primitives/runtime-interface/test-wasm/src/lib.rs index 1305aef66cacc..3720735ac773b 100644 --- a/primitives/runtime-interface/test-wasm/src/lib.rs +++ b/primitives/runtime-interface/test-wasm/src/lib.rs @@ -54,7 +54,7 @@ pub trait TestApi { /// # Note /// /// We return a `Vec` because this will use the code path that uses SCALE - /// to pass the data between native/wasm. (Vec is passed without encoding the + /// to pass the data between native/wasm. (`Vec` is passed without encoding the /// data) fn return_16kb() -> Vec { vec![0; 4 * 1024] From d7ed76c2c017c8654eefb0d3aae360e0bc0ee834 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 25 Nov 2022 12:15:02 +0100 Subject: [PATCH 6/8] Use Bastis patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher Signed-off-by: Oliver Tale-Yazdi --- primitives/runtime-interface/src/lib.rs | 148 +++++------------------- 1 file changed, 26 insertions(+), 122 deletions(-) diff --git a/primitives/runtime-interface/src/lib.rs b/primitives/runtime-interface/src/lib.rs index 96384449bcfa2..975d7158b8dcd 100644 --- a/primitives/runtime-interface/src/lib.rs +++ b/primitives/runtime-interface/src/lib.rs @@ -15,6 +15,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Custom inner attributes are unstable, so we need to faky disable the attribute. +// rustfmt still honors the attribute to not format the rustdocs below. +#![cfg_attr(feature = "never", rustfmt::skip)] //! Substrate runtime interface //! //! This crate provides types, traits and macros around runtime interfaces. A runtime interface is @@ -78,132 +81,33 @@ //! The following table documents how values of types are passed between the wasm and //! the host side and how they are converted into the corresponding type. //! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//! -//!
TypeFFI TypeConversion
u8u32zero-extended to 32-bits
u16u32zero-extended to 32-bits
u32u32Identity
u64u64Identity
i128u32v.as_ptr()(pointer to a 16 byte array)
i8i32sign-extended to 32-bits
i16i32sign-extended to 32-bits
i32i32Identity
i64i64Identity
u128u32v.as_ptr()(pointer to a 16 byte array)
boolu32if v { 1 } else { 0 }
&stru64v.len() 32bit<< 32 | v.as_ptr() 32bit
&[u8]u64v.len() 32bit<< 32 | v.as_ptr() 32bit
Vecu64v.len() 32bit<< 32 | v.as_ptr() 32bit
Vecwhere T: Encodeu64let e = v.encode();
-//! e.len() 32bit<< 32 | e.as_ptr() 32bit
&[T] where T: Encodeu64let e = v.encode();
-//! e.len() 32bit<< 32 | e.as_ptr() 32bit
[u8; N]u32v.as_ptr()
*const Tu32Identity
Optionu64let e = v.encode();
-//! e.len() 32bit<< 32 | e.as_ptr() 32bit
T where T: PassByDepends on innerDepends on inner
T where T: PassByu64v.len() 32bit<< 32 | v.as_ptr() 32bit
+//! | Type | FFI type | Conversion | +//! |----|----|----| +//! | `u8` | `u32` | zero-extended to 32-bits | +//! | `u16` | `u32` | zero-extended to 32-bits | +//! | `u32` | `u32` | `Identity` | +//! | `u64` | `u64` | `Identity` | +//! | `i128` | `u32` | `v.as_ptr()` (pointer to a 16 byte array) | +//! | `i8` | `i32` | sign-extended to 32-bits | +//! | `i16` | `i32` | sign-extended to 32-bits | +//! | `i32` | `i32` | `Identity` | +//! | `i64` | `i64` | `Identity` | +//! | `u128` | `u32` | `v.as_ptr()` (pointer to a 16 byte array) | +//! | `bool` | `u32` | `if v { 1 } else { 0 }` | +//! | `&str` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | +//! | `&[u8]` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | +//! | `Vec` | `u64` | v.len() 32bit << 32 | v.as_ptr() 32bit | +//! | `Vec where T: Encode` | `u64` | `let e = v.encode();`

e.len() 32bit << 32 | e.as_ptr() 32bit | +//! | `&[T] where T: Encode` | `u64` | `let e = v.encode();`

e.len() 32bit << 32 | e.as_ptr() 32bit | +//! | `[u8; N]` | `u32` | `v.as_ptr()` | +//! | `*const T` | `u32` | `Identity` | +//! | `Option` | `u64` | `let e = v.encode();`

e.len() 32bit << 32 | e.as_ptr() 32bit | +//! | [`T where T: PassBy`](./pass_by#Inner) | Depends on inner | Depends on inner | +//! | [`T where T: PassBy`](./pass_by#Codec)|`u64`|v.len() 32bit << 32 |v.as_ptr() 32bit| //! //! `Identity` means that the value is converted directly into the corresponding FFI type. #![cfg_attr(not(feature = "std"), no_std)] -// `cargo doc` doc thinks that `Vec` has an invalid `u8` HTML tag which cannot be fixed by -// backticks... -#![allow(rustdoc::invalid_html_tags)] extern crate self as sp_runtime_interface; From a52273e8e83d5ea189312444dfc315de2c1ad0be Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 25 Nov 2022 12:50:08 +0100 Subject: [PATCH 7/8] Add more backticks Signed-off-by: Oliver Tale-Yazdi --- frame/node-authorization/src/lib.rs | 2 +- utils/frame/rpc/support/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/node-authorization/src/lib.rs b/frame/node-authorization/src/lib.rs index 638a96eb3321a..bd1b14d10b013 100644 --- a/frame/node-authorization/src/lib.rs +++ b/frame/node-authorization/src/lib.rs @@ -18,7 +18,7 @@ //! # Node authorization pallet //! //! This pallet manages a configurable set of nodes for a permissioned network. -//! Each node is dentified by a PeerId (i.e. Vec). It provides two ways to +//! Each node is dentified by a PeerId (i.e. `Vec`). It provides two ways to //! authorize a node, //! //! - a set of well known nodes across different organizations in which the diff --git a/utils/frame/rpc/support/src/lib.rs b/utils/frame/rpc/support/src/lib.rs index fdf6fe0be8172..a13d4f707797d 100644 --- a/utils/frame/rpc/support/src/lib.rs +++ b/utils/frame/rpc/support/src/lib.rs @@ -164,7 +164,7 @@ impl StorageQuery { /// Send this query over RPC, await the typed result. /// - /// Hash should be ::Hash. + /// Hash should be `::Hash`. /// /// # Arguments /// From 03ac418684b69959b0e55e42ac0cd99f1decbb4c Mon Sep 17 00:00:00 2001 From: alvicsam Date: Fri, 25 Nov 2022 14:33:23 +0100 Subject: [PATCH 8/8] change ci image --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8519d0f88fc7c..d5b8cc89037a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,8 @@ variables: CARGO_INCREMENTAL: 0 DOCKER_OS: "debian:stretch" ARCH: "x86_64" - CI_IMAGE: "paritytech/ci-linux:production" + # staging image with rust 1.65 and nightly-2022-11-16 + CI_IMAGE: "paritytech/ci-linux@sha256:786869e731963b3cc0a4aa9deb83367ed9e87a6ae48b6eb029d62b0cab4d87c1" BUILDAH_IMAGE: "quay.io/buildah/stable:v1.27" RUSTY_CACHIER_SINGLE_BRANCH: master RUSTY_CACHIER_DONT_OPERATE_ON_MAIN_BRANCH: "true"