Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
CLEANUP
Forked at: 606c56d
Parent branch: origin/master
  • Loading branch information
cecton committed Jun 26, 2020
commit c20a5e3f34893a1a406ff48da1e9771fe02c583f
2 changes: 1 addition & 1 deletion bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ fn should_import_block_with_test_client() {
sp_consensus::BlockOrigin,
};

let mut client = TestClientBuilder::new().build();
let client = TestClientBuilder::new().build();
let block1 = changes_trie_block();
let block_data = block1.0;
let block = node_primitives::Block::decode(&mut &block_data[..]).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion client/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ mod tests {
#[test]
fn should_not_remove_invalid_transactions_when_skipping() {
// given
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let txpool = Arc::new(
BasicPool::new(
Default::default(),
Expand Down
6 changes: 3 additions & 3 deletions client/finality-grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ fn allows_reimporting_change_blocks() {
let mut net = GrandpaTestNet::new(api.clone(), 3);

let client = net.peer(0).client().clone();
let (mut block_import, ..) = net.make_block_import::<
let (block_import, ..) = net.make_block_import::<
TransactionFor<substrate_test_runtime_client::Backend, Block>
>(
client.clone(),
Expand Down Expand Up @@ -963,7 +963,7 @@ fn test_bad_justification() {
let mut net = GrandpaTestNet::new(api.clone(), 3);

let client = net.peer(0).client().clone();
let (mut block_import, ..) = net.make_block_import::<
let (block_import, ..) = net.make_block_import::<
TransactionFor<substrate_test_runtime_client::Backend, Block>
>(
client.clone(),
Expand Down Expand Up @@ -1660,7 +1660,7 @@ fn imports_justification_for_regular_blocks_on_import() {
let mut net = GrandpaTestNet::new(api.clone(), 1);

let client = net.peer(0).client().clone();
let (mut block_import, ..) = net.make_block_import::<
let (block_import, ..) = net.make_block_import::<
TransactionFor<substrate_test_runtime_client::Backend, Block>
>(client.clone());

Expand Down
2 changes: 1 addition & 1 deletion client/network/test/src/block_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use sc_block_builder::BlockBuilderProvider;
use super::*;

fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>) {
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();
let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
client.import(BlockOrigin::File, block).unwrap();

Expand Down
12 changes: 6 additions & 6 deletions client/rpc/src/chain/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn should_return_header() {

#[test]
fn should_return_a_block() {
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand Down Expand Up @@ -113,7 +113,7 @@ fn should_return_a_block() {

#[test]
fn should_return_block_hash() {
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

assert_matches!(
Expand Down Expand Up @@ -157,7 +157,7 @@ fn should_return_block_hash() {

#[test]
fn should_return_finalized_hash() {
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

assert_matches!(
Expand Down Expand Up @@ -187,7 +187,7 @@ fn should_notify_about_latest_block() {
let (subscriber, id, transport) = Subscriber::new_test("test");

{
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

api.subscribe_all_heads(Default::default(), subscriber);
Expand Down Expand Up @@ -217,7 +217,7 @@ fn should_notify_about_best_block() {
let (subscriber, id, transport) = Subscriber::new_test("test");

{
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

api.subscribe_new_heads(Default::default(), subscriber);
Expand Down Expand Up @@ -247,7 +247,7 @@ fn should_notify_about_finalized_block() {
let (subscriber, id, transport) = Subscriber::new_test("test");

{
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let api = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

api.subscribe_finalized_heads(Default::default(), subscriber);
Expand Down
6 changes: 3 additions & 3 deletions client/rpc/src/state/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn should_notify_about_storage_changes() {
let (subscriber, id, transport) = Subscriber::new_test("test");

{
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

api.subscribe_storage(Default::default(), subscriber, None.into());
Expand Down Expand Up @@ -172,7 +172,7 @@ fn should_send_initial_storage_changes_and_notifications() {
let (subscriber, id, transport) = Subscriber::new_test("test");

{
let mut client = Arc::new(substrate_test_runtime_client::new());
let client = Arc::new(substrate_test_runtime_client::new());
let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

let alice_balance_key = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into()));
Expand Down Expand Up @@ -210,7 +210,7 @@ fn should_send_initial_storage_changes_and_notifications() {

#[test]
fn should_query_storage() {
fn run_tests(mut client: Arc<TestClient>, has_changes_trie_config: bool) {
fn run_tests(client: Arc<TestClient>, has_changes_trie_config: bool) {
let (api, _child) = new_full(client.clone(), SubscriptionManager::new(Arc::new(TaskExecutor)));

let mut add_block = |nonce| {
Expand Down
4 changes: 2 additions & 2 deletions client/service/test/src/client/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ fn execution_proof_is_generated_and_checked() {
}

// prepare remote client
let mut remote_client = substrate_test_runtime_client::new();
let remote_client = substrate_test_runtime_client::new();
for i in 1u32..3u32 {
let mut digest = Digest::default();
digest.push(sp_runtime::generic::DigestItem::Other::<H256>(i.to_le_bytes().to_vec()));
Expand Down Expand Up @@ -528,7 +528,7 @@ fn prepare_for_read_child_proof_check() -> (TestChecker, Header, StorageProof, V

fn prepare_for_header_proof_check(insert_cht: bool) -> (TestChecker, Hash, Header, StorageProof) {
// prepare remote client
let mut remote_client = substrate_test_runtime_client::new();
let remote_client = substrate_test_runtime_client::new();
let mut local_headers_hashes = Vec::new();
for i in 0..4 {
let block = remote_client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand Down
34 changes: 17 additions & 17 deletions client/service/test/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn prepare_client_with_key_changes() -> (
// prepare client ang import blocks
let mut local_roots = Vec::new();
let config = Some(ChangesTrieConfiguration::new(4, 2));
let mut remote_client = TestClientBuilder::new().changes_trie_config(config).build();
let remote_client = TestClientBuilder::new().changes_trie_config(config).build();
let mut nonces: HashMap<_, u64> = Default::default();
for (i, block_transfers) in blocks_transfers.into_iter().enumerate() {
let mut builder = remote_client.new_block(Default::default()).unwrap();
Expand Down Expand Up @@ -364,7 +364,7 @@ fn client_initializes_from_genesis_ok() {

#[test]
fn block_builder_works_with_no_transactions() {
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

let block = client.new_block(Default::default()).unwrap().build().unwrap().block;

Expand All @@ -375,7 +375,7 @@ fn block_builder_works_with_no_transactions() {

#[test]
fn block_builder_works_with_transactions() {
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

let mut builder = client.new_block(Default::default()).unwrap();

Expand Down Expand Up @@ -412,7 +412,7 @@ fn block_builder_works_with_transactions() {

#[test]
fn block_builder_does_not_include_invalid() {
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

let mut builder = client.new_block(Default::default()).unwrap();

Expand Down Expand Up @@ -477,7 +477,7 @@ fn best_containing_with_hash_not_found() {
fn uncles_with_only_ancestors() {
// block tree:
// G -> A1 -> A2
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

// G -> A1
let a1 = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand All @@ -497,7 +497,7 @@ fn uncles_with_multiple_forks() {
// A1 -> B2 -> B3 -> B4
// B2 -> C3
// A1 -> D2
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

// G -> A1
let a1 = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand Down Expand Up @@ -625,7 +625,7 @@ fn best_containing_on_longest_chain_with_single_chain_3_blocks() {
// block tree:
// G -> A1 -> A2

let (mut client, longest_chain_select) = TestClientBuilder::new().build_with_longest_chain();
let (client, longest_chain_select) = TestClientBuilder::new().build_with_longest_chain();

// G -> A1
let a1 = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand All @@ -649,7 +649,7 @@ fn best_containing_on_longest_chain_with_multiple_forks() {
// A1 -> B2 -> B3 -> B4
// B2 -> C3
// A1 -> D2
let (mut client, longest_chain_select) = TestClientBuilder::new().build_with_longest_chain();
let (client, longest_chain_select) = TestClientBuilder::new().build_with_longest_chain();

// G -> A1
let a1 = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand Down Expand Up @@ -969,7 +969,7 @@ fn best_containing_on_longest_chain_with_max_depth_higher_than_best() {
// block tree:
// G -> A1 -> A2

let (mut client, longest_chain_select) = TestClientBuilder::new().build_with_longest_chain();
let (client, longest_chain_select) = TestClientBuilder::new().build_with_longest_chain();

// G -> A1
let a1 = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand Down Expand Up @@ -1006,7 +1006,7 @@ fn key_changes_works() {

#[test]
fn import_with_justification() {
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

// G -> A1
let a1 = client.new_block(Default::default()).unwrap().build().unwrap().block;
Expand Down Expand Up @@ -1052,7 +1052,7 @@ fn import_with_justification() {

#[test]
fn importing_diverged_finalized_block_should_trigger_reorg() {
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

// G -> A1 -> A2
// \
Expand Down Expand Up @@ -1109,7 +1109,7 @@ fn importing_diverged_finalized_block_should_trigger_reorg() {

#[test]
fn finalizing_diverged_block_should_trigger_reorg() {
let (mut client, select_chain) = TestClientBuilder::new().build_with_longest_chain();
let (client, select_chain) = TestClientBuilder::new().build_with_longest_chain();

// G -> A1 -> A2
// \
Expand Down Expand Up @@ -1207,7 +1207,7 @@ fn get_header_by_block_number_doesnt_panic() {
#[test]
fn state_reverted_on_reorg() {
let _ = env_logger::try_init();
let mut client = substrate_test_runtime_client::new();
let client = substrate_test_runtime_client::new();

let current_balance = |client: &substrate_test_runtime_client::TestClient|
client.runtime_api().balance_of(
Expand Down Expand Up @@ -1284,7 +1284,7 @@ fn doesnt_import_blocks_that_revert_finality() {
u64::max_value(),
).unwrap());

let mut client = TestClientBuilder::with_backend(backend).build();
let client = TestClientBuilder::with_backend(backend).build();

// -> C1
// /
Expand Down Expand Up @@ -1373,7 +1373,7 @@ fn respects_block_rules() {
known_bad: &mut HashSet<H256>,
fork_rules: &mut Vec<(u64, H256)>,
) {
let mut client = if record_only {
let client = if record_only {
TestClientBuilder::new().build()
} else {
TestClientBuilder::new()
Expand Down Expand Up @@ -1485,7 +1485,7 @@ fn returns_status_for_pruned_blocks() {
u64::max_value(),
).unwrap());

let mut client = TestClientBuilder::with_backend(backend).build();
let client = TestClientBuilder::with_backend(backend).build();

let a1 = client.new_block_at(&BlockId::Number(0), Default::default(), false)
.unwrap().build().unwrap().block;
Expand Down Expand Up @@ -1571,7 +1571,7 @@ fn returns_status_for_pruned_blocks() {
#[test]
fn imports_blocks_with_changes_tries_config_change() {
// create client with initial 4^2 configuration
let mut client = TestClientBuilder::with_default_backend()
let client = TestClientBuilder::with_default_backend()
.changes_trie_config(Some(ChangesTrieConfiguration {
digest_interval: 4,
digest_levels: 2,
Expand Down
2 changes: 1 addition & 1 deletion test-utils/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ mod tests {
// This tests that the on-chain HEAP_PAGES parameter is respected.

// Create a client devoting only 8 pages of wasm memory. This gives us ~512k of heap memory.
let mut client = TestClientBuilder::new()
let client = TestClientBuilder::new()
.set_execution_strategy(ExecutionStrategy::AlwaysWasm)
.set_heap_pages(8)
.build();
Expand Down