cargo +nightly fmt

This commit is contained in:
Tadeo hepperle
2023-05-10 14:26:10 +02:00
parent 213bc4c47a
commit a3419a6f44
94 changed files with 326 additions and 259 deletions
+2 -1
View File
@@ -2,13 +2,14 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{pair_signer, test_context, utils::node_runtime};
use codec::Compact;
use frame_metadata::RuntimeMetadataPrefixed;
use futures::StreamExt;
use sp_keyring::AccountKeyring;
use subxt::blocks::BlocksClient;
use crate::{pair_signer, test_context, utils::node_runtime};
// Check that we can subscribe to non-finalized blocks.
#[tokio::test]
async fn non_finalized_headers_subscription() -> Result<(), subxt::Error> {
+6 -6
View File
@@ -2,15 +2,10 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{
pair_signer, test_context, test_context_with,
utils::{node_runtime, wait_for_blocks},
};
use assert_matches::assert_matches;
use codec::{Compact, Decode, Encode};
use frame_metadata::RuntimeMetadataPrefixed;
use sp_core::storage::well_known_keys;
use sp_core::{sr25519::Pair as Sr25519Pair, Pair};
use sp_core::{sr25519::Pair as Sr25519Pair, storage::well_known_keys, Pair};
use sp_keyring::AccountKeyring;
use subxt::{
error::{DispatchError, Error, TokenError},
@@ -22,6 +17,11 @@ use subxt::{
utils::AccountId32,
};
use crate::{
pair_signer, test_context, test_context_with,
utils::{node_runtime, wait_for_blocks},
};
#[tokio::test]
async fn insert_key() {
let ctx = test_context_with(AccountKeyring::Bob).await;
@@ -2,10 +2,6 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{
node_runtime::{self, balances, runtime_types, system},
pair_signer, test_context,
};
use codec::Decode;
use sp_core::Pair;
use sp_keyring::AccountKeyring;
@@ -14,6 +10,11 @@ use subxt::{
utils::{AccountId32, MultiAddress},
};
use crate::{
node_runtime::{self, balances, runtime_types, system},
pair_signer, test_context,
};
#[tokio::test]
async fn tx_basic_transfer() -> Result<(), subxt::Error> {
let alice = pair_signer(AccountKeyring::Alice.pair());
@@ -2,7 +2,13 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use sp_core::sr25519::Pair;
use sp_keyring::AccountKeyring;
use subxt::{
tx::{PairSigner, TxProgress},
utils::MultiAddress,
Config, Error, OnlineClient, SubstrateConfig,
};
use crate::{
node_runtime::{
@@ -13,12 +19,6 @@ use crate::{
},
test_context, TestContext,
};
use sp_core::sr25519::Pair;
use subxt::{
tx::{PairSigner, TxProgress},
utils::MultiAddress,
Config, Error, OnlineClient, SubstrateConfig,
};
struct ContractsTestContext {
cxt: TestContext,
@@ -2,6 +2,11 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use assert_matches::assert_matches;
use sp_core::{sr25519, Pair};
use sp_keyring::AccountKeyring;
use subxt::error::{DispatchError, Error};
use crate::{
node_runtime::{
self,
@@ -13,10 +18,6 @@ use crate::{
},
pair_signer, test_context,
};
use assert_matches::assert_matches;
use sp_core::{sr25519, Pair};
use sp_keyring::AccountKeyring;
use subxt::error::{DispatchError, Error};
/// Helper function to generate a crypto pair from seed
fn get_from_seed(seed: &str) -> sr25519::Pair {
+2 -1
View File
@@ -2,6 +2,8 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use sp_keyring::AccountKeyring;
use crate::{
node_runtime::{
self,
@@ -10,7 +12,6 @@ use crate::{
},
pair_signer, test_context,
};
use sp_keyring::AccountKeyring;
type Call = runtime_types::kitchensink_runtime::RuntimeCall;
type BalancesCall = runtime_types::pallet_balances::pallet::Call;
@@ -2,12 +2,13 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use assert_matches::assert_matches;
use sp_keyring::AccountKeyring;
use crate::{
node_runtime::{self, system},
pair_signer, test_context,
};
use assert_matches::assert_matches;
use sp_keyring::AccountKeyring;
#[tokio::test]
async fn storage_account() -> Result<(), subxt::Error> {
+2 -3
View File
@@ -24,9 +24,6 @@ mod storage;
#[cfg(test)]
use test_runtime::node_runtime;
#[cfg(test)]
use utils::*;
// We don't use this dependency, but it's here so that we
// can enable logging easily if need be. Add this to a test
// to enable tracing for it:
@@ -34,3 +31,5 @@ use utils::*;
// tracing_subscriber::fmt::init();
#[cfg(test)]
use tracing_subscriber as _;
#[cfg(test)]
use utils::*;
@@ -2,7 +2,6 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{node_runtime, test_context, TestContext};
use frame_metadata::{
v15::{
ExtrinsicMetadata, PalletCallMetadata, PalletMetadata, PalletStorageMetadata,
@@ -16,6 +15,8 @@ use scale_info::{
};
use subxt::{Metadata, OfflineClient, SubstrateConfig};
use crate::{node_runtime, test_context, TestContext};
async fn metadata_to_api(
metadata: RuntimeMetadataV15,
ctx: &TestContext,
@@ -2,10 +2,11 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{node_runtime, pair_signer, test_context};
use sp_keyring::AccountKeyring;
use subxt::utils::AccountId32;
use crate::{node_runtime, pair_signer, test_context};
#[tokio::test]
async fn account_nonce() -> Result<(), subxt::Error> {
let ctx = test_context().await;
+2 -1
View File
@@ -2,10 +2,11 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{node_runtime, pair_signer, test_context, utils::wait_for_blocks};
use sp_keyring::AccountKeyring;
use subxt::utils::AccountId32;
use crate::{node_runtime, pair_signer, test_context, utils::wait_for_blocks};
#[tokio::test]
async fn storage_plain_lookup() -> Result<(), subxt::Error> {
let ctx = test_context().await;
@@ -2,12 +2,12 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
pub(crate) use crate::{node_runtime, TestNodeProcess};
use sp_core::sr25519::Pair;
use sp_keyring::AccountKeyring;
use subxt::{tx::PairSigner, SubstrateConfig};
pub(crate) use crate::{node_runtime, TestNodeProcess};
/// substrate node should be installed on the $PATH
const SUBSTRATE_NODE_PATH: &str = "substrate";
@@ -2,8 +2,9 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use sp_keyring::AccountKeyring;
use std::ffi::{OsStr, OsString};
use sp_keyring::AccountKeyring;
use substrate_runner::SubstrateNode;
use subxt::{Config, OnlineClient};
+7 -5
View File
@@ -4,11 +4,13 @@
mod error;
use std::borrow::Cow;
use std::collections::HashMap;
use std::ffi::OsString;
use std::io::{BufRead, BufReader, Read};
use std::process::{self, Command};
use std::{
borrow::Cow,
collections::HashMap,
ffi::OsString,
io::{BufRead, BufReader, Read},
process::{self, Command},
};
pub use error::Error;
+4 -5
View File
@@ -2,8 +2,9 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use codec::{Decode, Encode};
use std::{env, fs, path::Path};
use codec::{Decode, Encode};
use substrate_runner::{Error as SubstrateNodeError, SubstrateNode};
static SUBSTRATE_BIN_ENV_VAR: &str = "SUBSTRATE_NODE_PATH";
@@ -100,13 +101,11 @@ mod client {
pub use jsonrpsee::{
client_transport::ws::{InvalidUri, Receiver, Sender, Uri, WsTransportClientBuilder},
core::{
client::{Client, ClientBuilder},
Error,
client::{Client, ClientBuilder, ClientT},
rpc_params, Error,
},
};
pub use jsonrpsee::core::{client::ClientT, rpc_params};
/// Build WS RPC client from URL
pub async fn build(url: &str) -> Result<Client, Error> {
let (sender, receiver) = ws_transport(url).await?;
+2 -1
View File
@@ -2,11 +2,12 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use frame_metadata::RuntimeMetadataPrefixed;
use crate::utils::{
dispatch_error::{ArrayDispatchError, LegacyDispatchError, NamedFieldDispatchError},
generate_metadata_from_pallets_custom_dispatch_error,
};
use frame_metadata::RuntimeMetadataPrefixed;
pub fn metadata_array_dispatch_error() -> RuntimeMetadataPrefixed {
generate_metadata_from_pallets_custom_dispatch_error::<ArrayDispatchError>(vec![])
+1 -2
View File
@@ -13,10 +13,9 @@ use frame_metadata::{
},
RuntimeMetadataPrefixed,
};
use scale_info::{meta_type, IntoPortable, TypeInfo};
pub use metadata_test_runner::MetadataTestRunner;
pub use pallet_metadata_test_runner::PalletMetadataTestRunner;
use scale_info::{meta_type, IntoPortable, TypeInfo};
/// Given some pallet metadata, generate a [`RuntimeMetadataPrefixed`] struct.
/// We default to a useless extrinsic type, and register a fake `DispatchError`
@@ -2,9 +2,10 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use std::io::Read;
use codec::{Decode, Encode};
use frame_metadata::{v15::RuntimeMetadataV15, RuntimeMetadataPrefixed};
use std::io::Read;
use subxt_metadata::{metadata_v14_to_latest, retain_metadata_pallets};
static TEST_DIR_PREFIX: &str = "subxt_generated_pallets_ui_tests_";