From a6176a0da27e6687ee3853f08dfe0c86185bc002 Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 11 Feb 2026 09:46:59 +0100 Subject: [PATCH 1/6] Naive test with just updating the version without any changes. --- api-client/Cargo.toml | 2 +- compose-macros/Cargo.toml | 2 +- examples/async/Cargo.toml | 2 +- examples/sync/Cargo.toml | 2 +- examples/wasm/Cargo.toml | 2 +- keystore/Cargo.toml | 2 +- node-api/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- test-no-std/Cargo.toml | 2 +- testing/async/Cargo.toml | 2 +- testing/sync/Cargo.toml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api-client/Cargo.toml b/api-client/Cargo.toml index cbd44f97a..3ef9808fd 100644 --- a/api-client/Cargo.toml +++ b/api-client/Cargo.toml @@ -3,7 +3,7 @@ name = "substrate-api-client" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" repository = "https://github.com/scs/substrate-api-client" description = "Json-rpc client with helper functions compatible with any Substrate node" readme = "../README.md" diff --git a/compose-macros/Cargo.toml b/compose-macros/Cargo.toml index 1812e39f4..72520abe8 100644 --- a/compose-macros/Cargo.toml +++ b/compose-macros/Cargo.toml @@ -3,7 +3,7 @@ name = "ac-compose-macros" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" repository = "https://github.com/scs/substrate-api-client" description = "Macros for creating Substrate extrinsics and rpc calls" readme = "README.md" diff --git a/examples/async/Cargo.toml b/examples/async/Cargo.toml index 32cabf3c0..0ad015feb 100644 --- a/examples/async/Cargo.toml +++ b/examples/async/Cargo.toml @@ -2,7 +2,7 @@ name = "ac-examples-async" version = "1.22.0" license = "Apache-2.0" -edition = "2021" +edition = "2024" [dev-dependencies] codec = { workspace = true, features = ["std"] } diff --git a/examples/sync/Cargo.toml b/examples/sync/Cargo.toml index 6275e9c7d..aa8c93c3b 100644 --- a/examples/sync/Cargo.toml +++ b/examples/sync/Cargo.toml @@ -2,7 +2,7 @@ name = "ac-examples-sync" version = "1.22.0" license = "Apache-2.0" -edition = "2021" +edition = "2024" [dev-dependencies] env_logger = "0.11" diff --git a/examples/wasm/Cargo.toml b/examples/wasm/Cargo.toml index f689fc404..09a042c08 100644 --- a/examples/wasm/Cargo.toml +++ b/examples/wasm/Cargo.toml @@ -2,7 +2,7 @@ name = "ac-examples-wasm" version = "1.22.0" license = "Apache-2.0" -edition = "2021" +edition = "2024" [dev-dependencies] pallet-balances = { workspace = true } diff --git a/keystore/Cargo.toml b/keystore/Cargo.toml index d8d5917e1..66a88a451 100644 --- a/keystore/Cargo.toml +++ b/keystore/Cargo.toml @@ -3,7 +3,7 @@ name = "ac-keystore" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" repository = "https://github.com/scs/substrate-api-client" description = "Keystore (and session key management) for ed25519 based chains like Polkadot. (fork of sc-keystore)" readme = "README.md" diff --git a/node-api/Cargo.toml b/node-api/Cargo.toml index 41792f328..5a89ad6b0 100644 --- a/node-api/Cargo.toml +++ b/node-api/Cargo.toml @@ -3,7 +3,7 @@ name = "ac-node-api" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" repository = "https://github.com/scs/substrate-api-client" description = "Substrate node type definitions and helpers for the substrate-api-client" readme = "README.md" diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index bc4dc2361..a84049b2e 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -3,7 +3,7 @@ name = "ac-primitives" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" repository = "https://github.com/scs/substrate-api-client" description = "Substrate-api-client primitive types" readme = "README.md" diff --git a/test-no-std/Cargo.toml b/test-no-std/Cargo.toml index f967ba7f9..236d8fe51 100644 --- a/test-no-std/Cargo.toml +++ b/test-no-std/Cargo.toml @@ -3,7 +3,7 @@ name = "test-no-std" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" [dependencies] libc = { version = "0.2", default-features = false } diff --git a/testing/async/Cargo.toml b/testing/async/Cargo.toml index 0a51a7556..fde607551 100644 --- a/testing/async/Cargo.toml +++ b/testing/async/Cargo.toml @@ -3,7 +3,7 @@ name = "ac-testing-async" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" [dev-dependencies] codec = { workspace = true, features = ["std"] } diff --git a/testing/sync/Cargo.toml b/testing/sync/Cargo.toml index f94dbfd33..b03fdd624 100644 --- a/testing/sync/Cargo.toml +++ b/testing/sync/Cargo.toml @@ -3,7 +3,7 @@ name = "ac-testing-sync" version = "1.22.0" authors = ["Supercomputing Systems AG "] license = "Apache-2.0" -edition = "2021" +edition = "2024" [dev-dependencies] # Substrate dependencies From 020f923fd8036f88dc1dea5a59159ee9e9db02ee Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 11 Feb 2026 13:41:22 +0100 Subject: [PATCH 2/6] Mark extern and no_mangle as unsafe --- test-no-std/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test-no-std/src/main.rs b/test-no-std/src/main.rs index 80073cedd..180a4c6bf 100644 --- a/test-no-std/src/main.rs +++ b/test-no-std/src/main.rs @@ -38,11 +38,11 @@ use core::{ }; // A list of C functions that are being imported -extern "C" { +unsafe extern "C" { pub fn printf(format: *const u8, ...) -> i32; } -#[no_mangle] +#[unsafe(no_mangle)] // The main function, with its input arguments ignored, and an exit status is returned pub extern "C" fn main(_nargs: i32, _args: *const *const u8) -> i32 { // Print "Hello, World" to stdout using printf @@ -55,7 +55,7 @@ pub extern "C" fn main(_nargs: i32, _args: *const *const u8) -> i32 { } #[lang = "eh_personality"] -extern "C" fn eh_personality() {} +unsafe extern "C" fn eh_personality() {} #[panic_handler] fn panic(_panic: &PanicInfo<'_>) -> ! { @@ -64,7 +64,7 @@ fn panic(_panic: &PanicInfo<'_>) -> ! { #[alloc_error_handler] fn foo(_: core::alloc::Layout) -> ! { - extern "C" { + unsafe extern "C" { fn abort() -> !; } unsafe { abort() } From fd3373ae7b7ce405a0395e3c469896267bb09ead Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Wed, 11 Feb 2026 13:48:15 +0100 Subject: [PATCH 3/6] Apply new formatting rules --- api-client/src/api/api_client.rs | 4 ++-- api-client/src/api/error.rs | 2 +- api-client/src/api/mod.rs | 2 +- api-client/src/api/rpc_api/author.rs | 6 +++--- api-client/src/api/rpc_api/chain.rs | 4 ++-- api-client/src/api/rpc_api/events.rs | 8 ++++---- api-client/src/api/rpc_api/frame_system.rs | 2 +- .../src/api/rpc_api/pallet_transaction_payment.rs | 2 +- api-client/src/api/rpc_api/runtime_update.rs | 2 +- api-client/src/api/rpc_api/state.rs | 2 +- api-client/src/api/runtime_api/api_core.rs | 2 +- api-client/src/api/runtime_api/block_builder.rs | 2 +- api-client/src/api/runtime_api/metadata.rs | 2 +- api-client/src/api/runtime_api/mmr.rs | 2 +- api-client/src/api/runtime_api/session_keys.rs | 2 +- api-client/src/api/runtime_api/transaction_payment.rs | 2 +- .../src/api/runtime_api/transaction_payment_call.rs | 2 +- api-client/src/extrinsic/balances.rs | 4 ++-- api-client/src/extrinsic/contracts.rs | 4 ++-- api-client/src/extrinsic/offline_extrinsic.rs | 2 +- api-client/src/extrinsic/staking.rs | 6 +++--- api-client/src/extrinsic/utility.rs | 6 +++--- api-client/src/rpc/tungstenite_client/client.rs | 10 +++++----- examples/async/examples/benchmark_bulk_xt.rs | 2 +- examples/async/examples/check_extrinsic_events.rs | 2 +- examples/async/examples/compose_extrinsic.rs | 8 ++++---- examples/async/examples/custom_nonce.rs | 4 ++-- examples/async/examples/get_blocks.rs | 2 +- examples/async/examples/get_storage.rs | 2 +- examples/async/examples/new_json_rpc_api_calls.rs | 2 +- examples/async/examples/print_metadata.rs | 2 +- examples/async/examples/query_runtime_api.rs | 2 +- examples/async/examples/runtime_update_async.rs | 2 +- .../async/examples/staking_batch_payout_untested.rs | 4 ++-- examples/async/examples/subscribe_events.rs | 2 +- examples/async/examples/sudo.rs | 2 +- examples/sync/examples/runtime_update_sync.rs | 2 +- .../sync/examples/transfer_with_tungstenite_client.rs | 4 ++-- examples/wasm/examples/wasm_example.rs | 3 ++- keystore/src/lib.rs | 10 +++------- node-api/src/error/dispatch_error.rs | 6 ++++-- node-api/src/error/mod.rs | 2 +- node-api/src/events/event_details.rs | 2 +- node-api/src/events/mod.rs | 6 +++--- node-api/src/events/raw_event_details.rs | 10 +++++----- node-api/src/metadata/from_v14_to_v15.rs | 4 ++-- node-api/src/metadata/metadata_types.rs | 6 +++--- node-api/src/metadata/variant_index.rs | 2 +- node-api/src/test_utils.rs | 4 ++-- primitives/src/config/asset_runtime_config.rs | 2 +- primitives/src/config/default_runtime_config.rs | 5 +++-- primitives/src/config/mod.rs | 4 ++-- primitives/src/config/rococo_runtime_config.rs | 2 +- primitives/src/extrinsics/extrinsic_params.rs | 10 ++-------- .../extrinsics/extrinsic_params_without_hash_check.rs | 4 +--- primitives/src/extrinsics/extrinsic_v4.rs | 4 ++-- primitives/src/extrinsics/signer.rs | 2 +- primitives/src/lib.rs | 5 ++--- rustfmt.toml | 2 +- testing/async/examples/author_tests.rs | 2 +- testing/async/examples/chain_tests.rs | 2 +- testing/async/examples/dispatch_errors_tests.rs | 4 ++-- testing/async/examples/events_tests.rs | 2 +- testing/async/examples/frame_system_tests.rs | 4 ++-- testing/async/examples/pallet_balances_tests.rs | 4 ++-- .../async/examples/pallet_transaction_payment_tests.rs | 4 ++-- testing/async/examples/runtime_api_tests.rs | 4 ++-- testing/async/examples/state_tests.rs | 2 +- testing/sync/examples/tungstenite_client_test.rs | 4 ++-- 69 files changed, 120 insertions(+), 129 deletions(-) diff --git a/api-client/src/api/api_client.rs b/api-client/src/api/api_client.rs index af8e3bcf3..e69d8e7ea 100644 --- a/api-client/src/api/api_client.rs +++ b/api-client/src/api/api_client.rs @@ -12,10 +12,10 @@ */ use crate::{ + GetAccountInformation, api::error::{Error, Result}, rpc::Request, runtime_api::RuntimeApiClient, - GetAccountInformation, }; use ac_compose_macros::rpc_params; use ac_node_api::metadata::Metadata; @@ -272,7 +272,7 @@ mod tests { use ac_primitives::{ DefaultRuntimeConfig, GenericAdditionalParams, GenericExtrinsicParams, PlainTip, }; - use frame_metadata::{v14::ExtrinsicMetadata, RuntimeMetadata}; + use frame_metadata::{RuntimeMetadata, v14::ExtrinsicMetadata}; use scale_info::form::PortableForm; use sp_core::H256; use std::{collections::HashMap, fs}; diff --git a/api-client/src/api/error.rs b/api-client/src/api/error.rs index ea4f92397..eea1c4ef0 100644 --- a/api-client/src/api/error.rs +++ b/api-client/src/api/error.rs @@ -15,7 +15,7 @@ */ -use crate::{api::UnexpectedTxStatus, rpc::Error as RpcClientError, ExtrinsicReport}; +use crate::{ExtrinsicReport, api::UnexpectedTxStatus, rpc::Error as RpcClientError}; use ac_node_api::{ error::DispatchError, metadata::{MetadataConversionError, MetadataError}, diff --git a/api-client/src/api/mod.rs b/api-client/src/api/mod.rs index 74aa3bc38..aca0200cd 100644 --- a/api-client/src/api/mod.rs +++ b/api-client/src/api/mod.rs @@ -16,7 +16,7 @@ */ use crate::error::FailedExtrinsicError; -use ac_node_api::{events::RawEventDetails, EventDetails, Metadata}; +use ac_node_api::{EventDetails, Metadata, events::RawEventDetails}; use alloc::{string::String, vec::Vec}; use codec::{Decode, Encode}; use serde::{Deserialize, Serialize}; diff --git a/api-client/src/api/rpc_api/author.rs b/api-client/src/api/rpc_api/author.rs index 793b00ce3..dba1bac6f 100644 --- a/api-client/src/api/rpc_api/author.rs +++ b/api-client/src/api/rpc_api/author.rs @@ -14,12 +14,12 @@ //! Interface to common author rpc functions and helpers thereof. use crate::{ - api::{rpc_api::events::FetchEvents, Error, Result}, - rpc::{HandleSubscription, Request, Subscribe}, Api, ExtrinsicReport, TransactionStatus, XtStatus, + api::{Error, Result, rpc_api::events::FetchEvents}, + rpc::{HandleSubscription, Request, Subscribe}, }; use ac_compose_macros::rpc_params; -use ac_primitives::{config::Config, UncheckedExtrinsic}; +use ac_primitives::{UncheckedExtrinsic, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use codec::{Decode, Encode}; diff --git a/api-client/src/api/rpc_api/chain.rs b/api-client/src/api/rpc_api/chain.rs index 1f5d0bec8..a9bed6f3f 100644 --- a/api-client/src/api/rpc_api/chain.rs +++ b/api-client/src/api/rpc_api/chain.rs @@ -12,9 +12,9 @@ */ use crate::{ + Error, api::{Api, Result}, rpc::{Request, Subscribe}, - Error, }; use ac_compose_macros::rpc_params; use ac_primitives::config::Config; @@ -37,7 +37,7 @@ pub trait GetChainInfo { async fn get_header(&self, hash: Option) -> Result>; async fn get_block_hash(&self, number: Option) - -> Result>; + -> Result>; /// Returns the genesis block async fn get_genesis_block(&self) -> Result; diff --git a/api-client/src/api/rpc_api/events.rs b/api-client/src/api/rpc_api/events.rs index 676c3de3d..aa337ac98 100644 --- a/api-client/src/api/rpc_api/events.rs +++ b/api-client/src/api/rpc_api/events.rs @@ -12,12 +12,12 @@ */ use crate::{ + GetChainInfo, GetStorage, api::{Api, Error, Result}, rpc::{HandleSubscription, Request, Subscribe}, - GetChainInfo, GetStorage, }; use ac_compose_macros::rpc_params; -use ac_node_api::{metadata::Metadata, EventDetails, EventRecord, Events, Phase}; +use ac_node_api::{EventDetails, EventRecord, Events, Phase, metadata::Metadata}; use ac_primitives::config::Config; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; @@ -238,10 +238,10 @@ mod tests { use frame_metadata::RuntimeMetadataPrefixed; use rococo_runtime::{BalancesCall, RuntimeCall, UncheckedExtrinsic}; use scale_info::TypeInfo; - use sp_core::{crypto::Ss58Codec, sr25519, Bytes, H256}; + use sp_core::{Bytes, H256, crypto::Ss58Codec, sr25519}; use sp_runtime::{ - generic::{Block, SignedBlock}, AccountId32, MultiAddress, + generic::{Block, SignedBlock}, }; use sp_storage::StorageData; use sp_version::RuntimeVersion; diff --git a/api-client/src/api/rpc_api/frame_system.rs b/api-client/src/api/rpc_api/frame_system.rs index 74b12a152..73e0cf2b2 100644 --- a/api-client/src/api/rpc_api/frame_system.rs +++ b/api-client/src/api/rpc_api/frame_system.rs @@ -18,7 +18,7 @@ use crate::{ rpc::Request, }; use ac_compose_macros::rpc_params; -use ac_primitives::{config::Config, AccountInfo}; +use ac_primitives::{AccountInfo, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use alloc::{string::String, vec::Vec}; diff --git a/api-client/src/api/rpc_api/pallet_transaction_payment.rs b/api-client/src/api/rpc_api/pallet_transaction_payment.rs index c4d9ffa01..6fc55f361 100644 --- a/api-client/src/api/rpc_api/pallet_transaction_payment.rs +++ b/api-client/src/api/rpc_api/pallet_transaction_payment.rs @@ -15,7 +15,7 @@ use crate::{ rpc::Request, }; use ac_compose_macros::rpc_params; -use ac_primitives::{config::Config, FeeDetails, InclusionFee, NumberOrHex, RuntimeDispatchInfo}; +use ac_primitives::{FeeDetails, InclusionFee, NumberOrHex, RuntimeDispatchInfo, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use core::str::FromStr; diff --git a/api-client/src/api/rpc_api/runtime_update.rs b/api-client/src/api/rpc_api/runtime_update.rs index 10d516515..55795d935 100644 --- a/api-client/src/api/rpc_api/runtime_update.rs +++ b/api-client/src/api/rpc_api/runtime_update.rs @@ -10,7 +10,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -use crate::{api::Error, rpc::Subscribe, rpc_api::EventSubscriptionFor, Result}; +use crate::{Result, api::Error, rpc::Subscribe, rpc_api::EventSubscriptionFor}; use alloc::sync::Arc; use codec::{Decode, Encode}; use core::sync::atomic::{AtomicBool, Ordering}; diff --git a/api-client/src/api/rpc_api/state.rs b/api-client/src/api/rpc_api/state.rs index 9587fffc5..7beaa2043 100644 --- a/api-client/src/api/rpc_api/state.rs +++ b/api-client/src/api/rpc_api/state.rs @@ -11,9 +11,9 @@ limitations under the License. */ use crate::{ + Api, ReadProof, api::Result, rpc::{Request, Subscribe}, - Api, ReadProof, }; use ac_compose_macros::rpc_params; use ac_node_api::MetadataError; diff --git a/api-client/src/api/runtime_api/api_core.rs b/api-client/src/api/runtime_api/api_core.rs index 683628e11..d32a2456f 100644 --- a/api-client/src/api/runtime_api/api_core.rs +++ b/api-client/src/api/runtime_api/api_core.rs @@ -13,7 +13,7 @@ use super::{RuntimeApi, RuntimeApiClient}; use crate::{api::Result, rpc::Request}; -use ac_primitives::{config::Config, RuntimeVersion}; +use ac_primitives::{RuntimeVersion, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use alloc::vec; diff --git a/api-client/src/api/runtime_api/block_builder.rs b/api-client/src/api/runtime_api/block_builder.rs index 26bc54e7e..58cee85ec 100644 --- a/api-client/src/api/runtime_api/block_builder.rs +++ b/api-client/src/api/runtime_api/block_builder.rs @@ -13,7 +13,7 @@ use super::{RuntimeApi, RuntimeApiClient}; use crate::{api::Result, rpc::Request}; -use ac_primitives::{config::Config, UncheckedExtrinsic}; +use ac_primitives::{UncheckedExtrinsic, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use alloc::{vec, vec::Vec}; diff --git a/api-client/src/api/runtime_api/metadata.rs b/api-client/src/api/runtime_api/metadata.rs index 4fb9c6966..be0e05462 100644 --- a/api-client/src/api/runtime_api/metadata.rs +++ b/api-client/src/api/runtime_api/metadata.rs @@ -13,7 +13,7 @@ use super::{RuntimeApi, RuntimeApiClient}; use crate::{api::Result, rpc::Request}; -use ac_node_api::{error::MetadataError, Metadata}; +use ac_node_api::{Metadata, error::MetadataError}; use ac_primitives::config::Config; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; diff --git a/api-client/src/api/runtime_api/mmr.rs b/api-client/src/api/runtime_api/mmr.rs index bed8131b1..a88714d9e 100644 --- a/api-client/src/api/runtime_api/mmr.rs +++ b/api-client/src/api/runtime_api/mmr.rs @@ -13,7 +13,7 @@ use super::{RuntimeApi, RuntimeApiClient}; use crate::{api::Result, rpc::Request}; -use ac_primitives::{config::Config, EncodableOpaqueLeaf, MmrError, Proof}; +use ac_primitives::{EncodableOpaqueLeaf, MmrError, Proof, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use alloc::{vec, vec::Vec}; diff --git a/api-client/src/api/runtime_api/session_keys.rs b/api-client/src/api/runtime_api/session_keys.rs index fe422c0f4..97f742aa1 100644 --- a/api-client/src/api/runtime_api/session_keys.rs +++ b/api-client/src/api/runtime_api/session_keys.rs @@ -18,7 +18,7 @@ use ac_primitives::config::Config; use alloc::boxed::Box; use alloc::{vec, vec::Vec}; use codec::Encode; -use sp_core::{crypto::KeyTypeId, Bytes}; +use sp_core::{Bytes, crypto::KeyTypeId}; #[maybe_async::maybe_async(?Send)] pub trait SessionKeysApi: RuntimeApi { diff --git a/api-client/src/api/runtime_api/transaction_payment.rs b/api-client/src/api/runtime_api/transaction_payment.rs index c786390ef..5a2fab078 100644 --- a/api-client/src/api/runtime_api/transaction_payment.rs +++ b/api-client/src/api/runtime_api/transaction_payment.rs @@ -13,7 +13,7 @@ use super::{RuntimeApi, RuntimeApiClient}; use crate::{api::Result, rpc::Request}; -use ac_primitives::{config::Config, FeeDetails, RuntimeDispatchInfo, UncheckedExtrinsic, Weight}; +use ac_primitives::{FeeDetails, RuntimeDispatchInfo, UncheckedExtrinsic, Weight, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use alloc::{vec, vec::Vec}; diff --git a/api-client/src/api/runtime_api/transaction_payment_call.rs b/api-client/src/api/runtime_api/transaction_payment_call.rs index 546f86afc..d854045db 100644 --- a/api-client/src/api/runtime_api/transaction_payment_call.rs +++ b/api-client/src/api/runtime_api/transaction_payment_call.rs @@ -13,7 +13,7 @@ use super::{RuntimeApi, RuntimeApiClient}; use crate::{api::Result, rpc::Request}; -use ac_primitives::{config::Config, FeeDetails, RuntimeDispatchInfo, Weight}; +use ac_primitives::{FeeDetails, RuntimeDispatchInfo, Weight, config::Config}; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; use alloc::vec; diff --git a/api-client/src/extrinsic/balances.rs b/api-client/src/extrinsic/balances.rs index 30d3e9b81..98e6ffa0d 100644 --- a/api-client/src/extrinsic/balances.rs +++ b/api-client/src/extrinsic/balances.rs @@ -21,8 +21,8 @@ use crate::{api::Api, rpc::Request}; use ac_compose_macros::compose_extrinsic; use ac_primitives::{ - config::Config, extrinsic_params::ExtrinsicParams, extrinsics::CallIndex, SignExtrinsic, - UncheckedExtrinsic, + SignExtrinsic, UncheckedExtrinsic, config::Config, extrinsic_params::ExtrinsicParams, + extrinsics::CallIndex, }; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; diff --git a/api-client/src/extrinsic/contracts.rs b/api-client/src/extrinsic/contracts.rs index a358da0a5..1f93c31e3 100644 --- a/api-client/src/extrinsic/contracts.rs +++ b/api-client/src/extrinsic/contracts.rs @@ -22,8 +22,8 @@ use crate::{api::Api, rpc::Request}; use ac_compose_macros::compose_extrinsic; use ac_primitives::{ - config::Config, extrinsic_params::ExtrinsicParams, extrinsics::CallIndex, Determinism, - SignExtrinsic, UncheckedExtrinsic, Weight, + Determinism, SignExtrinsic, UncheckedExtrinsic, Weight, config::Config, + extrinsic_params::ExtrinsicParams, extrinsics::CallIndex, }; use codec::{Compact, Encode}; use sp_core::Bytes; diff --git a/api-client/src/extrinsic/offline_extrinsic.rs b/api-client/src/extrinsic/offline_extrinsic.rs index 0e68009d9..a42cd4acf 100644 --- a/api-client/src/extrinsic/offline_extrinsic.rs +++ b/api-client/src/extrinsic/offline_extrinsic.rs @@ -20,7 +20,7 @@ use crate::Api; use ac_compose_macros::compose_extrinsic_offline; use ac_primitives::{ - config::Config, extrinsic_params::ExtrinsicParams, Preamble, SignExtrinsic, UncheckedExtrinsic, + Preamble, SignExtrinsic, UncheckedExtrinsic, config::Config, extrinsic_params::ExtrinsicParams, }; use codec::Encode; diff --git a/api-client/src/extrinsic/staking.rs b/api-client/src/extrinsic/staking.rs index fa4855f4f..8f3c4b427 100644 --- a/api-client/src/extrinsic/staking.rs +++ b/api-client/src/extrinsic/staking.rs @@ -18,11 +18,11 @@ //! Extrinsics for `pallet-staking`. //! https://polkadot.js.org/docs/substrate/extrinsics#staking -use crate::{rpc::Request, Api}; +use crate::{Api, rpc::Request}; use ac_compose_macros::compose_extrinsic; use ac_primitives::{ - config::Config, CallIndex, ExtrinsicParams, RewardDestination, SignExtrinsic, - UncheckedExtrinsic, + CallIndex, ExtrinsicParams, RewardDestination, SignExtrinsic, UncheckedExtrinsic, + config::Config, }; use codec::{Compact, Decode, Encode}; diff --git a/api-client/src/extrinsic/utility.rs b/api-client/src/extrinsic/utility.rs index 721a17e61..837d3570d 100644 --- a/api-client/src/extrinsic/utility.rs +++ b/api-client/src/extrinsic/utility.rs @@ -18,11 +18,11 @@ //! Extrinsics for `pallet-utility`. //! https://polkadot.js.org/docs/substrate/extrinsics/#utility -use crate::{rpc::Request, Api}; +use crate::{Api, rpc::Request}; use ac_compose_macros::compose_extrinsic; use ac_primitives::{ - config::Config, extrinsic_params::ExtrinsicParams, extrinsics::CallIndex, SignExtrinsic, - UncheckedExtrinsic, + SignExtrinsic, UncheckedExtrinsic, config::Config, extrinsic_params::ExtrinsicParams, + extrinsics::CallIndex, }; #[cfg(all(not(feature = "sync-api"), not(feature = "std")))] use alloc::boxed::Box; diff --git a/api-client/src/rpc/tungstenite_client/client.rs b/api-client/src/rpc/tungstenite_client/client.rs index 5302105ab..de8d5e7ea 100644 --- a/api-client/src/rpc/tungstenite_client/client.rs +++ b/api-client/src/rpc/tungstenite_client/client.rs @@ -15,8 +15,8 @@ */ use crate::rpc::{ - helpers, to_json_req, tungstenite_client::subscription::TungsteniteSubscriptionWrapper, - Error as RpcClientError, Request, Result, Subscribe, + Error as RpcClientError, Request, Result, Subscribe, helpers, to_json_req, + tungstenite_client::subscription::TungsteniteSubscriptionWrapper, }; use ac_primitives::RpcParams; use log::*; @@ -25,14 +25,14 @@ use serde_json::Value; use std::{ fmt::Debug, net::TcpStream, - sync::mpsc::{channel, Sender as ThreadOut}, + sync::mpsc::{Sender as ThreadOut, channel}, thread, thread::sleep, time::Duration, }; use tungstenite::{ - client::connect_with_config, handshake::client::Response, stream::MaybeTlsStream, Message, - WebSocket, + Message, WebSocket, client::connect_with_config, handshake::client::Response, + stream::MaybeTlsStream, }; use url::Url; diff --git a/examples/async/examples/benchmark_bulk_xt.rs b/examples/async/examples/benchmark_bulk_xt.rs index adbf31844..84623776f 100644 --- a/examples/async/examples/benchmark_bulk_xt.rs +++ b/examples/async/examples/benchmark_bulk_xt.rs @@ -18,11 +18,11 @@ use rococo_runtime::{BalancesCall, RuntimeCall}; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, SubmitExtrinsic, ac_primitives::{ Config, ExtrinsicSigner as GenericExtrinsicSigner, RococoRuntimeConfig, SignExtrinsic, }, rpc::JsonrpseeClient, - Api, SubmitExtrinsic, }; // Define an extrinsic signer type which sets the generic types of the `GenericExtrinsicSigner`. diff --git a/examples/async/examples/check_extrinsic_events.rs b/examples/async/examples/check_extrinsic_events.rs index d90996f1c..8e5a37842 100644 --- a/examples/async/examples/check_extrinsic_events.rs +++ b/examples/async/examples/check_extrinsic_events.rs @@ -15,11 +15,11 @@ use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetAccountInformation, SubmitAndWatch, TransactionStatus, XtStatus, ac_node_api::RawEventDetails, ac_primitives::{Config, RococoRuntimeConfig}, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, - Api, GetAccountInformation, SubmitAndWatch, TransactionStatus, XtStatus, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/compose_extrinsic.rs b/examples/async/examples/compose_extrinsic.rs index b43fd343d..3a0527c74 100644 --- a/examples/async/examples/compose_extrinsic.rs +++ b/examples/async/examples/compose_extrinsic.rs @@ -20,15 +20,15 @@ use codec::Compact; use rococo_runtime::{Address, BalancesCall, RuntimeCall}; use sp_keyring::Sr25519Keyring; -use sp_runtime::{generic::Era, MultiAddress}; +use sp_runtime::{MultiAddress, generic::Era}; use substrate_api_client::{ + Api, GetChainInfo, SubmitAndWatch, XtStatus, ac_compose_macros::{compose_call, compose_extrinsic_offline}, ac_primitives::{ - config::Config, ExtrinsicParams, ExtrinsicSigner, GenericAdditionalParams, PlainTip, - RococoRuntimeConfig, SignExtrinsic, + ExtrinsicParams, ExtrinsicSigner, GenericAdditionalParams, PlainTip, RococoRuntimeConfig, + SignExtrinsic, config::Config, }, rpc::JsonrpseeClient, - Api, GetChainInfo, SubmitAndWatch, XtStatus, }; type DefaultExtrinsicSigner = ::ExtrinsicSigner; diff --git a/examples/async/examples/custom_nonce.rs b/examples/async/examples/custom_nonce.rs index 3f9894227..749c8fb67 100644 --- a/examples/async/examples/custom_nonce.rs +++ b/examples/async/examples/custom_nonce.rs @@ -18,11 +18,11 @@ use rococo_runtime::{BalancesCall, RuntimeCall}; use sp_keyring::Sr25519Keyring; -use sp_runtime::{generic::Era, MultiAddress}; +use sp_runtime::{MultiAddress, generic::Era}; use substrate_api_client::{ + Api, Error, GetChainInfo, SubmitAndWatch, UnexpectedTxStatus, XtStatus, ac_primitives::{GenericAdditionalParams, RococoRuntimeConfig}, rpc::JsonrpseeClient, - Api, Error, GetChainInfo, SubmitAndWatch, UnexpectedTxStatus, XtStatus, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/get_blocks.rs b/examples/async/examples/get_blocks.rs index 312ba3edc..c081551ff 100644 --- a/examples/async/examples/get_blocks.rs +++ b/examples/async/examples/get_blocks.rs @@ -17,9 +17,9 @@ //! To compile this example for async you need to set the `--no-default-features` flag use substrate_api_client::{ + Api, GetChainInfo, SubscribeChain, ac_primitives::RococoRuntimeConfig, rpc::{HandleSubscription, JsonrpseeClient}, - Api, GetChainInfo, SubscribeChain, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/get_storage.rs b/examples/async/examples/get_storage.rs index b8e929cca..a5ccd51ba 100644 --- a/examples/async/examples/get_storage.rs +++ b/examples/async/examples/get_storage.rs @@ -20,10 +20,10 @@ use frame_system::AccountInfo as GenericAccountInfo; use pallet_recovery::ActiveRecovery; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetAccountInformation, GetStorage, SubmitAndWatch, XtStatus, ac_compose_macros::compose_extrinsic, ac_primitives::{Config, RococoRuntimeConfig}, rpc::JsonrpseeClient, - Api, GetAccountInformation, GetStorage, SubmitAndWatch, XtStatus, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/new_json_rpc_api_calls.rs b/examples/async/examples/new_json_rpc_api_calls.rs index 0306d20a9..07e8ea152 100644 --- a/examples/async/examples/new_json_rpc_api_calls.rs +++ b/examples/async/examples/new_json_rpc_api_calls.rs @@ -21,11 +21,11 @@ use serde_json::Value; use sp_core::Bytes; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, ac_compose_macros::rpc_params, ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::{HandleSubscription, JsonrpseeClient, Request, Subscribe}, - Api, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/print_metadata.rs b/examples/async/examples/print_metadata.rs index 233e40bbf..e76742b3e 100644 --- a/examples/async/examples/print_metadata.rs +++ b/examples/async/examples/print_metadata.rs @@ -17,7 +17,7 @@ //! debugging tool. use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, api_client::UpdateRuntime, rpc::JsonrpseeClient, Api, + Api, ac_primitives::RococoRuntimeConfig, api_client::UpdateRuntime, rpc::JsonrpseeClient, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/query_runtime_api.rs b/examples/async/examples/query_runtime_api.rs index 39da1b59a..b383b02bf 100644 --- a/examples/async/examples/query_runtime_api.rs +++ b/examples/async/examples/query_runtime_api.rs @@ -19,11 +19,11 @@ use codec::Encode; use sp_core::sr25519; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetChainInfo, ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, runtime_api::{AuthorityDiscoveryApi, CoreApi, MetadataApi, RuntimeApi, TransactionPaymentApi}, - Api, GetChainInfo, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/async/examples/runtime_update_async.rs b/examples/async/examples/runtime_update_async.rs index f3d74b617..ab8668898 100644 --- a/examples/async/examples/runtime_update_async.rs +++ b/examples/async/examples/runtime_update_async.rs @@ -19,12 +19,12 @@ use sp_keyring::Sr25519Keyring; use sp_weights::Weight; use substrate_api_client::{ + Api, SubmitAndWatch, SubscribeEvents, XtStatus, ac_compose_macros::{compose_call, compose_extrinsic}, ac_primitives::{Config, RococoRuntimeConfig}, api_client::UpdateRuntime, rpc::JsonrpseeClient, rpc_api::RuntimeUpdateDetector, - Api, SubmitAndWatch, SubscribeEvents, XtStatus, }; use tokio::select; use tokio_util::sync::CancellationToken; diff --git a/examples/async/examples/staking_batch_payout_untested.rs b/examples/async/examples/staking_batch_payout_untested.rs index a572e956a..2c31dae58 100644 --- a/examples/async/examples/staking_batch_payout_untested.rs +++ b/examples/async/examples/staking_batch_payout_untested.rs @@ -14,12 +14,12 @@ use codec::{Decode, Encode}; use pallet_staking::{ActiveEraInfo, Exposure}; use sp_keyring::Sr25519Keyring; -use sp_runtime::{app_crypto::Ss58Codec, AccountId32}; +use sp_runtime::{AccountId32, app_crypto::Ss58Codec}; use substrate_api_client::{ + Api, GetStorage, SubmitAndWatch, XtStatus, ac_primitives::RococoRuntimeConfig, extrinsic::{StakingExtrinsics, UtilityExtrinsics}, rpc::JsonrpseeClient, - Api, GetStorage, SubmitAndWatch, XtStatus, }; const MAX_BATCHED_TRANSACTION: u32 = 9; diff --git a/examples/async/examples/subscribe_events.rs b/examples/async/examples/subscribe_events.rs index 14c25f7d8..61566dde5 100644 --- a/examples/async/examples/subscribe_events.rs +++ b/examples/async/examples/subscribe_events.rs @@ -19,7 +19,7 @@ use log::debug; use sp_core::H256 as Hash; use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, rpc::JsonrpseeClient, Api, SubscribeEvents, + Api, SubscribeEvents, ac_primitives::RococoRuntimeConfig, rpc::JsonrpseeClient, }; // This module depends on the specific node runtime. diff --git a/examples/async/examples/sudo.rs b/examples/async/examples/sudo.rs index 96510206d..cf1305c22 100644 --- a/examples/async/examples/sudo.rs +++ b/examples/async/examples/sudo.rs @@ -19,13 +19,13 @@ use codec::Compact; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetAccountInformation, SubmitAndWatch, XtStatus, ac_compose_macros::{compose_call, compose_extrinsic}, ac_primitives::{ Config, ExtrinsicSigner as GenericExtrinsicSigner, RococoRuntimeConfig, SignExtrinsic, UncheckedExtrinsic, }, rpc::JsonrpseeClient, - Api, GetAccountInformation, SubmitAndWatch, XtStatus, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/sync/examples/runtime_update_sync.rs b/examples/sync/examples/runtime_update_sync.rs index 2f672a957..b5c0c8295 100644 --- a/examples/sync/examples/runtime_update_sync.rs +++ b/examples/sync/examples/runtime_update_sync.rs @@ -24,12 +24,12 @@ use sp_keyring::Sr25519Keyring; use sp_weights::Weight; use std::{sync::Arc, thread}; use substrate_api_client::{ + Api, SubmitAndWatch, SubscribeEvents, XtStatus, ac_compose_macros::{compose_call, compose_extrinsic}, ac_primitives::{Config, RococoRuntimeConfig}, api_client::UpdateRuntime, rpc::TungsteniteRpcClient, rpc_api::RuntimeUpdateDetector, - Api, SubmitAndWatch, SubscribeEvents, XtStatus, }; type Hash = ::Hash; diff --git a/examples/sync/examples/transfer_with_tungstenite_client.rs b/examples/sync/examples/transfer_with_tungstenite_client.rs index 2edf4f96a..a3eab0573 100755 --- a/examples/sync/examples/transfer_with_tungstenite_client.rs +++ b/examples/sync/examples/transfer_with_tungstenite_client.rs @@ -21,8 +21,8 @@ use sp_core::{ }; use sp_runtime::MultiAddress; use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::TungsteniteRpcClient, - Api, GetAccountInformation, SubmitAndWatch, XtStatus, + Api, GetAccountInformation, SubmitAndWatch, XtStatus, ac_primitives::RococoRuntimeConfig, + extrinsic::BalancesExtrinsics, rpc::TungsteniteRpcClient, }; // To test this example with CI we run it against the Polkadot Rococo node. Remember to switch the Config to match your diff --git a/examples/wasm/examples/wasm_example.rs b/examples/wasm/examples/wasm_example.rs index 039c0ce20..7c051f865 100644 --- a/examples/wasm/examples/wasm_example.rs +++ b/examples/wasm/examples/wasm_example.rs @@ -15,8 +15,9 @@ pub use pallet_balances::Call as BalancesCall; use sp_core::{ + Pair, crypto::{AccountId32, Ss58Codec}, - sr25519, Pair, + sr25519, }; use sp_runtime::MultiAddress; pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; diff --git a/keystore/src/lib.rs b/keystore/src/lib.rs index 87f03ac56..cfc653411 100644 --- a/keystore/src/lib.rs +++ b/keystore/src/lib.rs @@ -548,11 +548,7 @@ impl KeystoreInner { let pair = Pair::from_string(&phrase, self.password()).map_err(|_| Error::InvalidPhrase)?; - if &pair.public() == public { - Ok(Some(pair)) - } else { - Err(Error::PublicKeyMismatch) - } + if &pair.public() == public { Ok(Some(pair)) } else { Err(Error::PublicKeyMismatch) } } /// Get the file path for the given public key and key type. @@ -614,8 +610,8 @@ impl KeystoreInner { #[cfg(test)] mod tests { use super::*; - use sp_application_crypto::{ed25519, sr25519, AppPublic}; - use sp_core::{crypto::Ss58Codec, testing::SR25519, Pair}; + use sp_application_crypto::{AppPublic, ed25519, sr25519}; + use sp_core::{Pair, crypto::Ss58Codec, testing::SR25519}; use std::{fs, str::FromStr}; use tempfile::TempDir; diff --git a/node-api/src/error/dispatch_error.rs b/node-api/src/error/dispatch_error.rs index 6ad4627d7..89c909b25 100644 --- a/node-api/src/error/dispatch_error.rs +++ b/node-api/src/error/dispatch_error.rs @@ -19,7 +19,7 @@ use codec::{Decode, Encode}; use core::{fmt::Debug, marker::PhantomData}; use derive_more::From; use log::*; -use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType, TypeResolver}; +use scale_decode::{DecodeAsType, TypeResolver, visitor::DecodeAsTypeResult}; /// An error dispatching a transaction. See Substrate DispatchError // https://github.com/paritytech/polkadot-sdk/blob/0c5dcca9e3cef6b2f456fccefd9f6c5e43444053/substrate/primitives/runtime/src/lib.rs#L561-L598 @@ -154,7 +154,9 @@ impl DispatchError { error: [module_bytes[1], module_bytes[2], module_bytes[3], module_bytes[4]], } } else { - warn!("Can't decode error sp_runtime::DispatchError: bytes do not match known shapes"); + warn!( + "Can't decode error sp_runtime::DispatchError: bytes do not match known shapes" + ); // Return _all_ of the bytes; every "unknown" return should be consistent. return Err(Error::Unknown(bytes.to_vec())) }; diff --git a/node-api/src/error/mod.rs b/node-api/src/error/mod.rs index a501d5187..cacf4c911 100644 --- a/node-api/src/error/mod.rs +++ b/node-api/src/error/mod.rs @@ -14,7 +14,7 @@ use derive_more::From; // Re-expose the errors we use from other crates here: pub use crate::metadata::{MetadataConversionError, MetadataError}; -pub use scale_decode::{visitor::DecodeError as VisitorDecodeError, Error as DecodeError}; +pub use scale_decode::{Error as DecodeError, visitor::DecodeError as VisitorDecodeError}; pub use scale_encode::Error as EncodeError; pub use sp_core::crypto::SecretStringError; pub use sp_runtime::transaction_validity::TransactionValidityError; diff --git a/node-api/src/events/event_details.rs b/node-api/src/events/event_details.rs index f9aa8cd30..e9062f932 100644 --- a/node-api/src/events/event_details.rs +++ b/node-api/src/events/event_details.rs @@ -9,9 +9,9 @@ //! A representation of a block of events. use crate::{ + Metadata, Phase, StaticEvent, error::{DispatchError, Error}, events::{EventMetadataDetails, RawEventDetails, RootEvent}, - Metadata, Phase, StaticEvent, }; use alloc::sync::Arc; use codec::{Decode, Encode}; diff --git a/node-api/src/events/mod.rs b/node-api/src/events/mod.rs index 3c6cd651b..eafa2a671 100644 --- a/node-api/src/events/mod.rs +++ b/node-api/src/events/mod.rs @@ -9,7 +9,7 @@ //! A representation of a block of events. //! This file bases on https://github.com/paritytech/subxt/blob/8413c4d2dd625335b9200dc2289670accdf3391a/subxt/src/events/events_type.rs#L19-L196 -use crate::{error::Error, metadata::PalletMetadata, Metadata, StaticEvent}; +use crate::{Metadata, StaticEvent, error::Error, metadata::PalletMetadata}; use alloc::{sync::Arc, vec::Vec}; use codec::{Compact, Decode, Encode}; @@ -177,10 +177,10 @@ pub struct EventMetadataDetails<'a> { mod tests { use super::*; use crate::{ + Phase, test_utils::{ - event_record, events, events_raw, metadata_with_version, SupportedMetadataVersions, + SupportedMetadataVersions, event_record, events, events_raw, metadata_with_version, }, - Phase, }; use codec::Encode; use scale_info::TypeInfo; diff --git a/node-api/src/events/raw_event_details.rs b/node-api/src/events/raw_event_details.rs index 804bc560c..f91211d8a 100644 --- a/node-api/src/events/raw_event_details.rs +++ b/node-api/src/events/raw_event_details.rs @@ -9,10 +9,10 @@ //! A representation of a block of events. use crate::{ + EventDetails, Metadata, Phase, StaticEvent, error::{DispatchError, Error}, events::{EventMetadataDetails, RootEvent}, metadata::MetadataError, - EventDetails, Metadata, Phase, StaticEvent, }; use alloc::{ string::{String, ToString}, @@ -330,16 +330,16 @@ impl RawEventDetails { #[cfg(test)] pub(crate) mod test_utils { use super::*; - use crate::{events::Compact, Events}; + use crate::{Events, events::Compact}; use codec::Encode; use frame_metadata::{ + RuntimeMetadataPrefixed, v15::{ CustomMetadata, ExtrinsicMetadata, OuterEnums, PalletEventMetadata, PalletMetadata, RuntimeMetadataV15, }, - RuntimeMetadataPrefixed, }; - use scale_info::{meta_type, TypeInfo}; + use scale_info::{TypeInfo, meta_type}; use sp_core::H256; /// An "outer" events enum containing exactly one event. @@ -470,7 +470,7 @@ pub(crate) mod test_utils { #[cfg(test)] mod tests { use super::{ - test_utils::{event_record, events, events_raw, EventRecord}, + test_utils::{EventRecord, event_record, events, events_raw}, *, }; use codec::Encode; diff --git a/node-api/src/metadata/from_v14_to_v15.rs b/node-api/src/metadata/from_v14_to_v15.rs index 9cad7ee24..1934aab19 100644 --- a/node-api/src/metadata/from_v14_to_v15.rs +++ b/node-api/src/metadata/from_v14_to_v15.rs @@ -269,10 +269,10 @@ mod tests { use super::*; use codec::Decode; use frame_metadata::{ - v14::{ExtrinsicMetadata, RuntimeMetadataV14}, RuntimeMetadata, RuntimeMetadataPrefixed, + v14::{ExtrinsicMetadata, RuntimeMetadataV14}, }; - use scale_info::{meta_type, IntoPortable, TypeInfo}; + use scale_info::{IntoPortable, TypeInfo, meta_type}; use sp_core::Bytes; use std::{fs, marker::PhantomData}; diff --git a/node-api/src/metadata/metadata_types.rs b/node-api/src/metadata/metadata_types.rs index 1416f1c07..efae3e793 100644 --- a/node-api/src/metadata/metadata_types.rs +++ b/node-api/src/metadata/metadata_types.rs @@ -9,7 +9,7 @@ //! Handle substrate chain metadata. use crate::{ - metadata::{v14_to_v15, variant_index::VariantIndex, MetadataConversionError, MetadataError}, + metadata::{MetadataConversionError, MetadataError, v14_to_v15, variant_index::VariantIndex}, storage::GetStorageTypes, }; use alloc::{ @@ -19,15 +19,15 @@ use alloc::{ }; use codec::{Decode, Encode}; use frame_metadata::{ + META_RESERVED, RuntimeMetadata, RuntimeMetadataPrefixed, v15::{ CustomMetadata, ExtrinsicMetadata, OuterEnums, PalletConstantMetadata, RuntimeApiMethodMetadata, RuntimeMetadataLastVersion, StorageEntryMetadata, }, - RuntimeMetadata, RuntimeMetadataPrefixed, META_RESERVED, }; use scale_info::{ - form::{Form, PortableForm}, PortableRegistry, Type, Variant, + form::{Form, PortableForm}, }; use sp_storage::StorageKey; diff --git a/node-api/src/metadata/variant_index.rs b/node-api/src/metadata/variant_index.rs index fc861ea5d..5afa34de6 100644 --- a/node-api/src/metadata/variant_index.rs +++ b/node-api/src/metadata/variant_index.rs @@ -6,7 +6,7 @@ //! https://github.com/paritytech/subxt/blob/8413c4d2dd625335b9200dc2289670accdf3391a/metadata/src/utils/variant_index.rs use alloc::{borrow::ToOwned, collections::BTreeMap, string::String}; -use scale_info::{form::PortableForm, PortableRegistry, TypeDef, Variant}; +use scale_info::{PortableRegistry, TypeDef, Variant, form::PortableForm}; /// Given some type ID and type registry, build a couple of /// indexes to look up variants by index or name. If the ID provided diff --git a/node-api/src/test_utils.rs b/node-api/src/test_utils.rs index 40173373a..1143b1a88 100644 --- a/node-api/src/test_utils.rs +++ b/node-api/src/test_utils.rs @@ -11,6 +11,7 @@ use crate::{Events, Metadata, Phase}; use codec::{Compact, Decode, Encode}; use frame_metadata::{ + RuntimeMetadataPrefixed, v14::{ ExtrinsicMetadata as ExtrinsicMetadataV14, PalletEventMetadata as PalletEventMetadataV14, PalletMetadata as PalletMetadataV14, RuntimeMetadataV14, @@ -20,9 +21,8 @@ use frame_metadata::{ PalletEventMetadata as PalletEventMetadataV15, PalletMetadata as PalletMetadataV15, RuntimeMetadataV15, }, - RuntimeMetadataPrefixed, }; -use scale_info::{meta_type, TypeInfo}; +use scale_info::{TypeInfo, meta_type}; use sp_core::H256; /// An "outer" events enum containing exactly one event. diff --git a/primitives/src/config/asset_runtime_config.rs b/primitives/src/config/asset_runtime_config.rs index 6d8b87eee..2a920fe1f 100644 --- a/primitives/src/config/asset_runtime_config.rs +++ b/primitives/src/config/asset_runtime_config.rs @@ -8,7 +8,7 @@ //! https://github.com/paritytech/subxt/blob/ce0a82e3227efb0eae131f025da5f839d9623e15/subxt/src/config/substrate.rs use crate::{ - config::WithExtrinsicParams, AssetTip, Config, DefaultRuntimeConfig, GenericExtrinsicParams, + AssetTip, Config, DefaultRuntimeConfig, GenericExtrinsicParams, config::WithExtrinsicParams, }; /// Standard runtime config for Substrate and Polkadot nodes that use the asset pallet. pub type AssetRuntimeConfig = diff --git a/primitives/src/config/default_runtime_config.rs b/primitives/src/config/default_runtime_config.rs index 7aa7d54bc..5874bd232 100644 --- a/primitives/src/config/default_runtime_config.rs +++ b/primitives/src/config/default_runtime_config.rs @@ -8,8 +8,9 @@ //! https://github.com/paritytech/subxt/blob/ce0a82e3227efb0eae131f025da5f839d9623e15/subxt/src/config/polkadot.rs use crate::{ - config::Config, sr25519, types::AccountData, AccountId32, BlakeTwo256, Block, ExtrinsicSigner, - GenericExtrinsicParams, Header, MultiAddress, MultiSignature, OpaqueExtrinsic, PlainTip, H256, + AccountId32, BlakeTwo256, Block, ExtrinsicSigner, GenericExtrinsicParams, H256, Header, + MultiAddress, MultiSignature, OpaqueExtrinsic, PlainTip, config::Config, sr25519, + types::AccountData, }; use codec::{Decode, Encode}; use core::fmt::Debug; diff --git a/primitives/src/config/mod.rs b/primitives/src/config/mod.rs index 09d3514ff..25c98ab32 100644 --- a/primitives/src/config/mod.rs +++ b/primitives/src/config/mod.rs @@ -13,14 +13,14 @@ use codec::{Decode, Encode, FullCodec}; use core::{fmt::Debug, marker::PhantomData}; -use serde::{de::DeserializeOwned, Serialize}; +use serde::{Serialize, de::DeserializeOwned}; use sp_core::Pair; use sp_runtime::traits::{ AtLeast32Bit, AtLeast32BitUnsigned, Block, Hash as HashTrait, Header as HeaderTrait, MaybeSerializeDeserialize, }; -use crate::{extrinsic_params, ExtrinsicSigner, SignExtrinsic}; +use crate::{ExtrinsicSigner, SignExtrinsic, extrinsic_params}; pub use asset_runtime_config::*; pub use default_runtime_config::*; diff --git a/primitives/src/config/rococo_runtime_config.rs b/primitives/src/config/rococo_runtime_config.rs index c08245df7..0f239e6c5 100644 --- a/primitives/src/config/rococo_runtime_config.rs +++ b/primitives/src/config/rococo_runtime_config.rs @@ -15,6 +15,6 @@ */ -use crate::{config::WithAddress, AccountId32, DefaultRuntimeConfig, MultiAddress}; +use crate::{AccountId32, DefaultRuntimeConfig, MultiAddress, config::WithAddress}; pub type RococoRuntimeConfig = WithAddress>; diff --git a/primitives/src/extrinsics/extrinsic_params.rs b/primitives/src/extrinsics/extrinsic_params.rs index bd69c6797..6b1145c3a 100644 --- a/primitives/src/extrinsics/extrinsic_params.rs +++ b/primitives/src/extrinsics/extrinsic_params.rs @@ -46,9 +46,7 @@ pub struct GenericTxExtension { impl GenericTxExtension { pub fn new(era: Era, nonce: Index, tip: Tip) -> Self { - { - Self { era, nonce, tip, check_hash: 0 } - } + { Self { era, nonce, tip, check_hash: 0 } } } } @@ -281,11 +279,7 @@ where /// Payloads longer than 256 bytes are going to be `blake2_256`-hashed. pub fn using_encoded R>(&self, f: F) -> R { self.0.using_encoded(|payload| { - if payload.len() > 256 { - f(&BlakeTwo256::hash(payload)[..]) - } else { - f(payload) - } + if payload.len() > 256 { f(&BlakeTwo256::hash(payload)[..]) } else { f(payload) } }) } } diff --git a/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs b/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs index 4fbe62b62..062fb6e3b 100644 --- a/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs +++ b/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs @@ -51,9 +51,7 @@ pub struct TxExtensionWithoutHashCheck { impl TxExtensionWithoutHashCheck { pub fn new(era: Era, nonce: Index, tip: Tip) -> Self { - { - Self { era, nonce, tip } - } + { Self { era, nonce, tip } } } } diff --git a/primitives/src/extrinsics/extrinsic_v4.rs b/primitives/src/extrinsics/extrinsic_v4.rs index a30f8cee2..9edd931cc 100644 --- a/primitives/src/extrinsics/extrinsic_v4.rs +++ b/primitives/src/extrinsics/extrinsic_v4.rs @@ -210,9 +210,9 @@ pub mod deprecated { { fn from(extrinsic: UncheckedExtrinsicV4) -> Self { Self::from_bytes(extrinsic.encode().as_slice()).expect( - "both OpaqueExtrinsic and UncheckedExtrinsic have encoding that is compatible with \ + "both OpaqueExtrinsic and UncheckedExtrinsic have encoding that is compatible with \ raw Vec encoding; qed", - ) + ) } } diff --git a/primitives/src/extrinsics/signer.rs b/primitives/src/extrinsics/signer.rs index 9aec61733..baa231b55 100644 --- a/primitives/src/extrinsics/signer.rs +++ b/primitives/src/extrinsics/signer.rs @@ -20,7 +20,7 @@ use crate::config::Config; use codec::{Decode, Encode}; use core::marker::PhantomData; -use sp_core::{crypto::AccountId32, Pair}; +use sp_core::{Pair, crypto::AccountId32}; use sp_runtime::MultiAddress; pub trait SignExtrinsic { diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 42493e298..9d61ce21d 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -34,14 +34,13 @@ pub mod types; // Re-export substrate types for easy import on user side. pub use sp_core::{ - sr25519, + Bytes, H256, sr25519, storage::{StorageChangeSet, StorageData, StorageKey}, - Bytes, H256, }; pub use sp_runtime::{ + AccountId32, ConsensusEngineId, Justifications, MultiAddress, MultiSignature, OpaqueExtrinsic, generic::{Block, Digest, DigestItem, Header, SignedBlock}, traits::{BlakeTwo256, Block as BlockTrait, Hash as HashTrait, Header as HeaderTrait}, - AccountId32, ConsensusEngineId, Justifications, MultiAddress, MultiSignature, OpaqueExtrinsic, }; pub use sp_version::RuntimeVersion; pub use sp_weights::Weight; diff --git a/rustfmt.toml b/rustfmt.toml index 01db06166..171a62a9a 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,5 @@ # Basic -edition = "2021" +edition = "2024" hard_tabs = true max_width = 100 use_small_heuristics = "Max" diff --git a/testing/async/examples/author_tests.rs b/testing/async/examples/author_tests.rs index b15cbe1dd..48cc25f55 100644 --- a/testing/async/examples/author_tests.rs +++ b/testing/async/examples/author_tests.rs @@ -19,12 +19,12 @@ use rococo_runtime::{BalancesCall, RuntimeCall}; use sp_core::{Encode, H256}; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, SubmitAndWatch, SubmitExtrinsic, TransactionStatus, XtStatus, ac_node_api::RawEventDetails, ac_primitives::{ Config, ExtrinsicSigner as GenericExtrinsicSigner, RococoRuntimeConfig, SignExtrinsic, }, rpc::{HandleSubscription, JsonrpseeClient}, - Api, SubmitAndWatch, SubmitExtrinsic, TransactionStatus, XtStatus, }; type ExtrinsicSigner = GenericExtrinsicSigner; diff --git a/testing/async/examples/chain_tests.rs b/testing/async/examples/chain_tests.rs index 36b81de70..9b58e40f2 100644 --- a/testing/async/examples/chain_tests.rs +++ b/testing/async/examples/chain_tests.rs @@ -18,9 +18,9 @@ use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetChainInfo, SubscribeChain, ac_primitives::RococoRuntimeConfig, rpc::{HandleSubscription, JsonrpseeClient}, - Api, GetChainInfo, SubscribeChain, }; #[tokio::main] diff --git a/testing/async/examples/dispatch_errors_tests.rs b/testing/async/examples/dispatch_errors_tests.rs index 6dbbfa1e9..02f77737a 100644 --- a/testing/async/examples/dispatch_errors_tests.rs +++ b/testing/async/examples/dispatch_errors_tests.rs @@ -19,8 +19,8 @@ use sp_core::H256; use sp_keyring::Sr25519Keyring; use sp_runtime::MultiAddress; use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, Api, - Error, GetAccountInformation, GetBalance, SubmitAndWatch, XtStatus, + Api, Error, GetAccountInformation, GetBalance, SubmitAndWatch, XtStatus, + ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, }; #[tokio::main] diff --git a/testing/async/examples/events_tests.rs b/testing/async/examples/events_tests.rs index 94783480b..c6c70f027 100644 --- a/testing/async/examples/events_tests.rs +++ b/testing/async/examples/events_tests.rs @@ -20,11 +20,11 @@ use frame_support::dispatch::DispatchInfo; use rococo_runtime::RuntimeEvent; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, FetchEvents, GetChainInfo, SubmitAndWatch, SubscribeEvents, XtStatus, ac_node_api::{EventDetails, StaticEvent}, ac_primitives::{Config, RococoRuntimeConfig}, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, - Api, FetchEvents, GetChainInfo, SubmitAndWatch, SubscribeEvents, XtStatus, }; type Hash = ::Hash; diff --git a/testing/async/examples/frame_system_tests.rs b/testing/async/examples/frame_system_tests.rs index 96ec6fae5..1e2d6a73e 100644 --- a/testing/async/examples/frame_system_tests.rs +++ b/testing/async/examples/frame_system_tests.rs @@ -19,8 +19,8 @@ use codec::Decode; use frame_support::dispatch::DispatchInfo; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ - ac_node_api::StaticEvent, ac_primitives::RococoRuntimeConfig, rpc::JsonrpseeClient, Api, - GetAccountInformation, SystemApi, + Api, GetAccountInformation, SystemApi, ac_node_api::StaticEvent, + ac_primitives::RococoRuntimeConfig, rpc::JsonrpseeClient, }; /// Check out frame_system::Event::ExtrinsicSuccess: diff --git a/testing/async/examples/pallet_balances_tests.rs b/testing/async/examples/pallet_balances_tests.rs index c851a7292..d88ea7126 100644 --- a/testing/async/examples/pallet_balances_tests.rs +++ b/testing/async/examples/pallet_balances_tests.rs @@ -18,8 +18,8 @@ use codec::Encode; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, Api, - GetAccountInformation, GetBalance, GetTransactionPayment, SubmitAndWatch, XtStatus, + Api, GetAccountInformation, GetBalance, GetTransactionPayment, SubmitAndWatch, XtStatus, + ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, }; #[tokio::main] diff --git a/testing/async/examples/pallet_transaction_payment_tests.rs b/testing/async/examples/pallet_transaction_payment_tests.rs index 51a309b56..785655ac9 100644 --- a/testing/async/examples/pallet_transaction_payment_tests.rs +++ b/testing/async/examples/pallet_transaction_payment_tests.rs @@ -18,8 +18,8 @@ use codec::Encode; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, Api, - GetChainInfo, GetTransactionPayment, + Api, GetChainInfo, GetTransactionPayment, ac_primitives::RococoRuntimeConfig, + extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, }; #[tokio::main] diff --git a/testing/async/examples/runtime_api_tests.rs b/testing/async/examples/runtime_api_tests.rs index a9b94fcbc..36dde9dcc 100644 --- a/testing/async/examples/runtime_api_tests.rs +++ b/testing/async/examples/runtime_api_tests.rs @@ -15,9 +15,10 @@ //! Tests for the runtime api. -use sp_core::{sr25519, Decode}; +use sp_core::{Decode, sr25519}; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetChainInfo, ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::JsonrpseeClient, @@ -25,7 +26,6 @@ use substrate_api_client::{ AccountNonceApi, AuthorityDiscoveryApi, BlockBuilderApi, CoreApi, MetadataApi, RuntimeApi, TransactionPaymentApi, }, - Api, GetChainInfo, }; #[tokio::main] diff --git a/testing/async/examples/state_tests.rs b/testing/async/examples/state_tests.rs index 4a709280a..bf01b4c0f 100644 --- a/testing/async/examples/state_tests.rs +++ b/testing/async/examples/state_tests.rs @@ -21,9 +21,9 @@ use pallet_society::Vote; use sp_core::{crypto::Ss58Codec, sr25519}; use sp_keyring::Sr25519Keyring; use substrate_api_client::{ + Api, GetChainInfo, GetStorage, ac_primitives::{Config, RococoRuntimeConfig}, rpc::JsonrpseeClient, - Api, GetChainInfo, GetStorage, }; type KitchensinkConfig = RococoRuntimeConfig; diff --git a/testing/sync/examples/tungstenite_client_test.rs b/testing/sync/examples/tungstenite_client_test.rs index 97b937cbf..6b05ebef8 100755 --- a/testing/sync/examples/tungstenite_client_test.rs +++ b/testing/sync/examples/tungstenite_client_test.rs @@ -19,8 +19,8 @@ use sp_core::{ }; use sp_runtime::MultiAddress; use substrate_api_client::{ - ac_primitives::RococoRuntimeConfig, extrinsic::BalancesExtrinsics, rpc::TungsteniteRpcClient, - Api, GetAccountInformation, SubmitAndWatch, XtStatus, + Api, GetAccountInformation, SubmitAndWatch, XtStatus, ac_primitives::RococoRuntimeConfig, + extrinsic::BalancesExtrinsics, rpc::TungsteniteRpcClient, }; fn main() { From 5d9791b0e39665cc0b447f877c83fbddca861506 Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Thu, 12 Feb 2026 06:57:13 +0100 Subject: [PATCH 4/6] Remove redundant parenthesis --- primitives/src/extrinsics/extrinsic_params.rs | 2 +- .../src/extrinsics/extrinsic_params_without_hash_check.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/primitives/src/extrinsics/extrinsic_params.rs b/primitives/src/extrinsics/extrinsic_params.rs index 6b1145c3a..c9878865f 100644 --- a/primitives/src/extrinsics/extrinsic_params.rs +++ b/primitives/src/extrinsics/extrinsic_params.rs @@ -46,7 +46,7 @@ pub struct GenericTxExtension { impl GenericTxExtension { pub fn new(era: Era, nonce: Index, tip: Tip) -> Self { - { Self { era, nonce, tip, check_hash: 0 } } + Self { era, nonce, tip, check_hash: 0 } } } diff --git a/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs b/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs index 062fb6e3b..95a852f1c 100644 --- a/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs +++ b/primitives/src/extrinsics/extrinsic_params_without_hash_check.rs @@ -51,7 +51,7 @@ pub struct TxExtensionWithoutHashCheck { impl TxExtensionWithoutHashCheck { pub fn new(era: Era, nonce: Index, tip: Tip) -> Self { - { Self { era, nonce, tip } } + Self { era, nonce, tip } } } From 85d53242d0d2259107149c87cfa2171d4442b79b Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Thu, 12 Feb 2026 07:12:46 +0100 Subject: [PATCH 5/6] Simplify if --- api-client/src/api/rpc_api/runtime_update.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api-client/src/api/rpc_api/runtime_update.rs b/api-client/src/api/rpc_api/runtime_update.rs index 55795d935..c099188c9 100644 --- a/api-client/src/api/rpc_api/runtime_update.rs +++ b/api-client/src/api/rpc_api/runtime_update.rs @@ -49,10 +49,10 @@ where #[maybe_async::maybe_async(?Send)] pub async fn detect_runtime_update(&mut self) -> Result { 'outer: loop { - if let Some(canceled) = &self.external_cancellation { - if canceled.load(Ordering::SeqCst) { - return Ok(false) - } + if let Some(canceled) = &self.external_cancellation + && canceled.load(Ordering::SeqCst) + { + return Ok(false) } let event_records = self .subscription From 253b14954a54452a5f01ad9a68da3382ec4e5070 Mon Sep 17 00:00:00 2001 From: Thomas Niederberger Date: Thu, 12 Feb 2026 08:45:45 +0100 Subject: [PATCH 6/6] Simplify if-structure --- api-client/src/rpc/tungstenite_client/client.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api-client/src/rpc/tungstenite_client/client.rs b/api-client/src/rpc/tungstenite_client/client.rs index de8d5e7ea..1000719f3 100644 --- a/api-client/src/rpc/tungstenite_client/client.rs +++ b/api-client/src/rpc/tungstenite_client/client.rs @@ -127,10 +127,9 @@ impl TungsteniteRpcClient { while current_attempt <= max_attempts { if let Err(error) = subscribe_to_server(&url, max_attempts, json_req.clone(), result_in.clone()) + && !do_reconnect(&error) { - if !do_reconnect(&error) { - break - } + break } current_attempt += 1; }