mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 12:48:00 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -18,16 +18,21 @@
|
||||
|
||||
//! Testing block import logic.
|
||||
|
||||
use sp_consensus::ImportedAux;
|
||||
use sp_consensus::import_queue::{
|
||||
import_single_block, BasicQueue, BlockImportError, BlockImportResult, IncomingBlock,
|
||||
};
|
||||
use substrate_test_runtime_client::{self, prelude::*};
|
||||
use substrate_test_runtime_client::runtime::{Block, Hash};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
use futures::executor::block_on;
|
||||
use super::*;
|
||||
use futures::executor::block_on;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
use sp_consensus::{
|
||||
import_queue::{
|
||||
import_single_block, BasicQueue, BlockImportError, BlockImportResult, IncomingBlock,
|
||||
},
|
||||
ImportedAux,
|
||||
};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use substrate_test_runtime_client::{
|
||||
self,
|
||||
prelude::*,
|
||||
runtime::{Block, Hash},
|
||||
};
|
||||
|
||||
fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>) {
|
||||
let mut client = substrate_test_runtime_client::new();
|
||||
@@ -38,18 +43,24 @@ fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>)
|
||||
let header = client.header(&BlockId::Number(1)).unwrap();
|
||||
let justifications = client.justifications(&BlockId::Number(1)).unwrap();
|
||||
let peer_id = PeerId::random();
|
||||
(client, hash, number, peer_id.clone(), IncomingBlock {
|
||||
(
|
||||
client,
|
||||
hash,
|
||||
header,
|
||||
body: Some(Vec::new()),
|
||||
indexed_body: None,
|
||||
justifications,
|
||||
origin: Some(peer_id.clone()),
|
||||
allow_missing_state: false,
|
||||
import_existing: false,
|
||||
state: None,
|
||||
skip_execution: false,
|
||||
})
|
||||
number,
|
||||
peer_id.clone(),
|
||||
IncomingBlock {
|
||||
hash,
|
||||
header,
|
||||
body: Some(Vec::new()),
|
||||
indexed_body: None,
|
||||
justifications,
|
||||
origin: Some(peer_id.clone()),
|
||||
allow_missing_state: false,
|
||||
import_existing: false,
|
||||
state: None,
|
||||
skip_execution: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -63,11 +74,11 @@ fn import_single_good_block_works() {
|
||||
&mut substrate_test_runtime_client::new(),
|
||||
BlockOrigin::File,
|
||||
block,
|
||||
&mut PassThroughVerifier::new(true)
|
||||
&mut PassThroughVerifier::new(true),
|
||||
)) {
|
||||
Ok(BlockImportResult::ImportedUnknown(ref num, ref aux, ref org))
|
||||
if *num == number && *aux == expected_aux && *org == Some(peer_id) => {}
|
||||
r @ _ => panic!("{:?}", r)
|
||||
if *num == number && *aux == expected_aux && *org == Some(peer_id) => {},
|
||||
r @ _ => panic!("{:?}", r),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,10 +89,10 @@ fn import_single_good_known_block_is_ignored() {
|
||||
&mut client,
|
||||
BlockOrigin::File,
|
||||
block,
|
||||
&mut PassThroughVerifier::new(true)
|
||||
&mut PassThroughVerifier::new(true),
|
||||
)) {
|
||||
Ok(BlockImportResult::ImportedKnown(ref n, _)) if *n == number => {}
|
||||
_ => panic!()
|
||||
Ok(BlockImportResult::ImportedKnown(ref n, _)) if *n == number => {},
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +104,10 @@ fn import_single_good_block_without_header_fails() {
|
||||
&mut substrate_test_runtime_client::new(),
|
||||
BlockOrigin::File,
|
||||
block,
|
||||
&mut PassThroughVerifier::new(true)
|
||||
&mut PassThroughVerifier::new(true),
|
||||
)) {
|
||||
Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {}
|
||||
_ => panic!()
|
||||
Err(BlockImportError::IncompleteHeader(ref org)) if *org == Some(peer_id) => {},
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user