Skip to content

Commit

Permalink
cargo-fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-gadelshin committed Apr 30, 2024
1 parent 1456f84 commit c24e822
Showing 1 changed file with 90 additions and 27 deletions.
117 changes: 90 additions & 27 deletions substrate/client/network/sync/src/strategy/chain_sync/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ fn processes_empty_response_on_justification_request_for_unknown_block() {
let client = Arc::new(TestClientBuilder::new().build());
let peer_id = PeerId::random();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let (a1_hash, a1_number) = {
let a1 = BlockBuilderBuilder::new(&*client)
Expand Down Expand Up @@ -95,9 +102,16 @@ fn restart_doesnt_affect_peers_downloading_finality_data() {

// we request max 8 blocks to always initiate block requests to both peers for the test to be
// deterministic
let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 8, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
8,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let peer_id2 = PeerId::random();
Expand Down Expand Up @@ -292,9 +306,16 @@ fn do_ancestor_search_when_common_block_to_best_queued_gap_is_to_big() {
let mut client = Arc::new(TestClientBuilder::new().build());
let info = client.info();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let peer_id2 = PeerId::random();
Expand Down Expand Up @@ -440,9 +461,16 @@ fn can_sync_huge_fork() {

let info = client.info();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

let finalized_block = blocks[MAX_BLOCKS_TO_LOOK_BACKWARDS as usize * 2 - 1].clone();
let just = (*b"TEST", Vec::new());
Expand Down Expand Up @@ -575,9 +603,16 @@ fn syncs_fork_without_duplicate_requests() {

let info = client.info();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

let finalized_block = blocks[MAX_BLOCKS_TO_LOOK_BACKWARDS as usize * 2 - 1].clone();
let just = (*b"TEST", Vec::new());
Expand Down Expand Up @@ -712,9 +747,16 @@ fn removes_target_fork_on_disconnect() {
let mut client = Arc::new(TestClientBuilder::new().build());
let blocks = (0..3).map(|_| build_block(&mut client, None, false)).collect::<Vec<_>>();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let common_block = blocks[1].clone();
Expand All @@ -739,9 +781,16 @@ fn can_import_response_with_missing_blocks() {

let empty_client = Arc::new(TestClientBuilder::new().build());

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), empty_client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
empty_client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let best_block = blocks[3].clone();
Expand Down Expand Up @@ -772,9 +821,16 @@ fn ancestor_search_repeat() {
#[test]
fn sync_restart_removes_block_but_not_justification_requests() {
let mut client = Arc::new(TestClientBuilder::new().build());
let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let peers = vec![PeerId::random(), PeerId::random()];

Expand Down Expand Up @@ -916,9 +972,16 @@ fn request_across_forks() {
fork_blocks
};

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

// Add the peers, all at the common ancestor 100.
let common_block = blocks.last().unwrap();
Expand Down

0 comments on commit c24e822

Please sign in to comment.