cargo fmt with stable defaults (#876)

This commit is contained in:
James Wilson
2023-03-21 16:53:47 +00:00
committed by GitHub
parent c63ff6ec6d
commit 7c252fccf7
110 changed files with 663 additions and 1949 deletions
@@ -3,21 +3,12 @@
// see LICENSE for license details.
use crate::{
node_runtime::{
self,
balances,
runtime_types,
system,
},
pair_signer,
test_context,
node_runtime::{self, balances, runtime_types, system},
pair_signer, test_context,
};
use codec::Decode;
use sp_keyring::AccountKeyring;
use subxt::utils::{
AccountId32,
MultiAddress,
};
use subxt::utils::{AccountId32, MultiAddress};
#[tokio::test]
async fn tx_basic_transfer() -> Result<(), subxt::Error> {
@@ -87,11 +78,7 @@ async fn tx_basic_transfer() -> Result<(), subxt::Error> {
#[tokio::test]
async fn tx_dynamic_transfer() -> Result<(), subxt::Error> {
use subxt::ext::scale_value::{
At,
Composite,
Value,
};
use subxt::ext::scale_value::{At, Composite, Value};
let alice = pair_signer(AccountKeyring::Alice.pair());
let bob = pair_signer(AccountKeyring::Bob.pair());
@@ -229,8 +216,7 @@ async fn multiple_transfers_work_nonce_incremented() -> Result<(), subxt::Error>
.balances()
.transfer(bob_address.clone(), 10_000);
for _ in 0..3 {
api
.tx()
api.tx()
.sign_and_submit_then_watch_default(&tx, &alice)
.await?
.wait_for_in_block() // Don't need to wait for finalization; this is quicker.
@@ -8,26 +8,16 @@ use crate::{
node_runtime::{
self,
contracts::events,
runtime_types::{
pallet_contracts::wasm::Determinism,
sp_weights::weight_v2::Weight,
},
runtime_types::{pallet_contracts::wasm::Determinism, sp_weights::weight_v2::Weight},
system,
},
test_context,
TestContext,
test_context, TestContext,
};
use sp_core::sr25519::Pair;
use subxt::{
tx::{
PairSigner,
TxProgress,
},
tx::{PairSigner, TxProgress},
utils::MultiAddress,
Config,
Error,
OnlineClient,
SubstrateConfig,
Config, Error, OnlineClient, SubstrateConfig,
};
struct ContractsTestContext {
@@ -113,9 +103,7 @@ impl ContractsTestContext {
.ok_or_else(|| Error::Other("Failed to find a Instantiated event".into()))?;
let _extrinsic_success = events
.find_first::<system::events::ExtrinsicSuccess>()?
.ok_or_else(|| {
Error::Other("Failed to find a ExtrinsicSuccess event".into())
})?;
.ok_or_else(|| Error::Other("Failed to find a ExtrinsicSuccess event".into()))?;
tracing::info!(" Block hash: {:?}", events.block_hash());
tracing::info!(" Code hash: {:?}", code_stored.code_hash);
+5 -16
View File
@@ -6,32 +6,21 @@ use crate::{
node_runtime::{
self,
runtime_types::{
pallet_staking::{
RewardDestination,
ValidatorPrefs,
},
pallet_staking::{RewardDestination, ValidatorPrefs},
sp_arithmetic::per_things::Perbill,
},
staking,
},
pair_signer,
test_context,
pair_signer, test_context,
};
use assert_matches::assert_matches;
use sp_core::{
sr25519,
Pair,
};
use sp_core::{sr25519, Pair};
use sp_keyring::AccountKeyring;
use subxt::error::{
DispatchError,
Error,
};
use subxt::error::{DispatchError, Error};
/// Helper function to generate a crypto pair from seed
fn get_from_seed(seed: &str) -> sr25519::Pair {
sr25519::Pair::from_string(&format!("//{seed}"), None)
.expect("static values are valid; qed")
sr25519::Pair::from_string(&format!("//{seed}"), None).expect("static values are valid; qed")
}
fn default_validator_prefs() -> ValidatorPrefs {
+2 -6
View File
@@ -5,14 +5,10 @@
use crate::{
node_runtime::{
self,
runtime_types::{
self,
sp_weights::weight_v2::Weight,
},
runtime_types::{self, sp_weights::weight_v2::Weight},
sudo,
},
pair_signer,
test_context,
pair_signer, test_context,
};
use sp_keyring::AccountKeyring;
@@ -3,12 +3,8 @@
// see LICENSE for license details.
use crate::{
node_runtime::{
self,
system,
},
pair_signer,
test_context,
node_runtime::{self, system},
pair_signer, test_context,
};
use assert_matches::assert_matches;
use sp_keyring::AccountKeyring;
@@ -2,10 +2,7 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::{
node_runtime,
test_context,
};
use crate::{node_runtime, test_context};
#[tokio::test]
async fn storage_get_current_timestamp() {