From 69b4d76ca4d60f88268a8f642202cc39e8590cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bigna=20H=C3=A4rdi?= Date: Tue, 17 Sep 2024 08:54:03 +0200 Subject: [PATCH] Update rust toolchain (#803) * switch to stable release * udpate to stable 1.81 * switch back to nightly toolchain * fix clippy --- compose-macros/src/lib.rs | 12 +++++++----- node-api/src/lib.rs | 1 - primitives/src/config/mod.rs | 2 ++ primitives/src/types.rs | 5 ++--- rust-toolchain.toml | 2 +- src/api/error.rs | 4 ---- src/lib.rs | 1 - src/rpc/error.rs | 3 --- test-no-std/src/main.rs | 6 +++--- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/compose-macros/src/lib.rs b/compose-macros/src/lib.rs index c1f0107e0..54dccabce 100644 --- a/compose-macros/src/lib.rs +++ b/compose-macros/src/lib.rs @@ -56,7 +56,7 @@ macro_rules! compose_call { /// * 'pallet_metadata' - This crate's parsed pallet metadata as field of the API. /// * 'call_name' - Call name as &str /// * 'args' - Optional sequence of arguments of the call. They are not checked against the metadata. -/// As of now the user needs to check himself that the correct arguments are supplied. +/// As of now the user needs to check himself that the correct arguments are supplied. #[macro_export] macro_rules! compose_call_for_pallet_metadata { ($pallet_metadata: expr, $call_name: expr $(, $args: expr) *) => { @@ -145,8 +145,9 @@ macro_rules! compose_extrinsic_with_nonce { }; } -/// Generates an UncheckedExtrinsic for the given pallet and call, if they are found within the metadata. -/// Otherwise None is returned. +/// Generates an UncheckedExtrinsic for the given pallet and call from the metadata. +/// +/// Returns None if call is not found within metadata. /// Fetches the nonce from the given `api` instance. If this fails, zero is taken as default nonce. /// See also compose_extrinsic_with_nonce #[macro_export] @@ -164,8 +165,9 @@ macro_rules! compose_extrinsic { }; } -/// Generates an UncheckedExtrinsic for the given pallet and call, if they are found within the metadata. -/// Otherwise None is returned. +/// Generates an UncheckedExtrinsic for the given pallet and call from the metadata. +/// +/// Returns None if call is not found within metadata. /// Fetches the nonce from the given `api` instance. If this fails, zero is taken as default nonce. /// See also compose_extrinsic_with_nonce #[macro_export] diff --git a/node-api/src/lib.rs b/node-api/src/lib.rs index 7d9f16e63..f05258d69 100644 --- a/node-api/src/lib.rs +++ b/node-api/src/lib.rs @@ -14,7 +14,6 @@ //! Contains stuff to instantiate communication with a substrate node. #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(not(feature = "std"), feature(error_in_core))] extern crate alloc; diff --git a/primitives/src/config/mod.rs b/primitives/src/config/mod.rs index c630c6766..6de5c64a1 100644 --- a/primitives/src/config/mod.rs +++ b/primitives/src/config/mod.rs @@ -129,6 +129,8 @@ pub trait Config { + DeserializeOwned; } +/// Helper struct for fast Config creation with different Extrinsic Params than the original Config. +/// /// Take a type implementing [`Config`] (eg [`AssetRuntimeConfig`]), and some type which describes the /// additional and extra parameters to pass to an extrinsic (see [`ExtrinsicParams`]), /// and returns a type implementing [`Config`] with those new [`ExtrinsicParams`]. diff --git a/primitives/src/types.rs b/primitives/src/types.rs index ad3170fec..68d8b3557 100644 --- a/primitives/src/types.rs +++ b/primitives/src/types.rs @@ -105,9 +105,8 @@ pub struct InclusionFee { /// - `targeted_fee_adjustment`: This is a multiplier that can tune the final fee based on the /// congestion of the network. /// - `weight_fee`: This amount is computed based on the weight of the transaction. Weight - /// accounts for the execution time of a transaction. - /// - /// adjusted_weight_fee = targeted_fee_adjustment * weight_fee + /// accounts for the execution time of a transaction. + /// - `adjusted_weight_fee`` = targeted_fee_adjustment * weight_fee pub adjusted_weight_fee: Balance, } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 137d5f3fc..a03a5c66d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2024-04-25" +channel = "nightly-2024-09-01" targets = ["wasm32-unknown-unknown", "wasm32-wasip1"] profile = "default" # include rustfmt, clippy diff --git a/src/api/error.rs b/src/api/error.rs index e398d40cf..b738d3bc1 100644 --- a/src/api/error.rs +++ b/src/api/error.rs @@ -22,11 +22,7 @@ use ac_node_api::{ }; use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode}; - -#[cfg(not(feature = "std"))] use core::error::Error as ErrorT; -#[cfg(feature = "std")] -use std::error::Error as ErrorT; pub type Result = core::result::Result; diff --git a/src/lib.rs b/src/lib.rs index dcd705d06..96c97e6b4 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,6 @@ */ #![cfg_attr(not(feature = "std"), no_std)] -#![cfg_attr(not(feature = "std"), feature(error_in_core))] extern crate alloc; diff --git a/src/rpc/error.rs b/src/rpc/error.rs index 14245e5e8..e17dbada1 100644 --- a/src/rpc/error.rs +++ b/src/rpc/error.rs @@ -16,10 +16,7 @@ */ use alloc::{boxed::Box, string::String}; -#[cfg(not(feature = "std"))] use core::error::Error as ErrorT; -#[cfg(feature = "std")] -use std::error::Error as ErrorT; pub type Result = core::result::Result; diff --git a/test-no-std/src/main.rs b/test-no-std/src/main.rs index e20bc919f..6495ecff2 100644 --- a/test-no-std/src/main.rs +++ b/test-no-std/src/main.rs @@ -95,7 +95,7 @@ unsafe impl GlobalAlloc for SimpleAllocator { let align_mask_to_round_down = !(align - 1); if align > MAX_SUPPORTED_ALIGN { - return null_mut() + return null_mut(); } let mut allocated = 0; @@ -103,7 +103,7 @@ unsafe impl GlobalAlloc for SimpleAllocator { .remaining .fetch_update(SeqCst, SeqCst, |mut remaining| { if size > remaining { - return None + return None; } remaining -= size; remaining &= align_mask_to_round_down; @@ -112,7 +112,7 @@ unsafe impl GlobalAlloc for SimpleAllocator { }) .is_err() { - return null_mut() + return null_mut(); }; (self.arena.get() as *mut u8).add(allocated) }