From 22d30439179f7844d7b89bbd395d490d30086b6a Mon Sep 17 00:00:00 2001
From: Benjamin Kampmann <ben.kampmann@googlemail.com>
Date: Tue, 28 May 2019 10:35:00 +0200
Subject: [PATCH] Silence known deprecation warnings (#2651)

* Silence known deprecation warnings

1. Prefixes known instances of usages of client.backend and client.import_lock with `#[allow(deprecated)]` to silence the warnings. 2. Remove file-global `#![allow(deprecated)]` used in these cases. Both to prevent us overlooking externally caused deprecation messages.

* fixing missing ;

* fix missing test cases

* move deprecated markers to make CI happy

* move deprecated markers to make CI happy

* attempt to fix the test

* bumping impl_version of node runtime

* Minor cleanup
---
 substrate/core/cli/src/informant.rs           |  2 +
 substrate/core/client/src/client.rs           | 18 ++++--
 substrate/core/consensus/aura/src/lib.rs      |  1 +
 substrate/core/consensus/babe/src/lib.rs      |  6 +-
 .../core/finality-grandpa/src/environment.rs  | 12 +++-
 .../finality-grandpa/src/finality_proof.rs    |  1 +
 substrate/core/finality-grandpa/src/import.rs |  4 ++
 .../finality-grandpa/src/justification.rs     |  1 +
 substrate/core/finality-grandpa/src/lib.rs    |  6 +-
 .../core/finality-grandpa/src/light_import.rs |  4 ++
 .../core/finality-grandpa/src/observer.rs     |  2 +
 substrate/core/finality-grandpa/src/tests.rs  |  5 ++
 substrate/core/network/src/chain.rs           |  1 +
 substrate/core/network/src/test/mod.rs        |  2 +
 substrate/core/service/src/components.rs      |  1 +
 .../core/sr-api-macros/tests/runtime_calls.rs |  1 +
 substrate/core/test-client/src/trait_tests.rs | 61 ++++++++++---------
 substrate/node-template/src/service.rs        |  1 +
 substrate/node/cli/src/service.rs             |  2 +
 substrate/node/runtime/src/lib.rs             |  2 +-
 20 files changed, 95 insertions(+), 38 deletions(-)

diff --git a/substrate/core/cli/src/informant.rs b/substrate/core/cli/src/informant.rs
index 5c60229fab1..6149d6c95bf 100644
--- a/substrate/core/cli/src/informant.rs
+++ b/substrate/core/cli/src/informant.rs
@@ -83,6 +83,7 @@ where C: Components {
 				TransferRateFormat(bandwidth_upload),
 			);
 
+			#[allow(deprecated)]
 			let backend = (*client).backend();
 			let used_state_cache_size = match backend.used_state_cache_size(){
 				Some(size) => size,
@@ -132,6 +133,7 @@ where C: Components {
 		if let Some((ref last_num, ref last_hash)) = last {
 			if n.header.parent_hash() != last_hash {
 				let tree_route = ::client::blockchain::tree_route(
+					#[allow(deprecated)]
 					client.backend().blockchain(),
 					BlockId::Hash(last_hash.clone()),
 					BlockId::Hash(n.hash),
diff --git a/substrate/core/client/src/client.rs b/substrate/core/client/src/client.rs
index c9f70039eaf..a7e1e18847c 100644
--- a/substrate/core/client/src/client.rs
+++ b/substrate/core/client/src/client.rs
@@ -1884,6 +1884,7 @@ pub(crate) mod tests {
 		let client = test_client::new();
 
 		let genesis_hash = client.info().unwrap().chain.genesis_hash;
+		#[allow(deprecated)]
 		let longest_chain_select = test_client::client::LongestChain::new(
 			client.backend().clone(),
 			client.import_lock()
@@ -1902,7 +1903,9 @@ pub(crate) mod tests {
 		let client = test_client::new();
 
 		let uninserted_block = client.new_block().unwrap().bake().unwrap();
+		#[allow(deprecated)]
 		let backend = client.backend().as_in_memory();
+		#[allow(deprecated)]
 		let longest_chain_select = test_client::client::LongestChain::new(
 				Arc::new(backend),
 				client.import_lock());
@@ -2038,7 +2041,7 @@ pub(crate) mod tests {
 		client.import(BlockOrigin::Own, a2.clone()).unwrap();
 
 		let genesis_hash = client.info().unwrap().chain.genesis_hash;
-
+		#[allow(deprecated)]
 		let longest_chain_select = test_client::client::LongestChain::new(
 				Arc::new(client.backend().as_in_memory()),
 				client.import_lock());
@@ -2127,6 +2130,7 @@ pub(crate) mod tests {
 		assert_eq!(client.info().unwrap().chain.best_hash, a5.hash());
 
 		let genesis_hash = client.info().unwrap().chain.genesis_hash;
+		#[allow(deprecated)]
 		let longest_chain_select = test_client::client::LongestChain::new(
 				Arc::new(client.backend().as_in_memory()),
 				client.import_lock());
@@ -2357,6 +2361,7 @@ pub(crate) mod tests {
 		client.import(BlockOrigin::Own, a2.clone()).unwrap();
 
 		let genesis_hash = client.info().unwrap().chain.genesis_hash;
+		#[allow(deprecated)]
 		let longest_chain_select = test_client::client::LongestChain::new(
 			Arc::new(client.backend().as_in_memory()),
 			client.import_lock()
@@ -2400,23 +2405,26 @@ pub(crate) mod tests {
 		let a3 = client.new_block_at(&BlockId::Hash(a2.hash())).unwrap().bake().unwrap();
 		client.import_justified(BlockOrigin::Own, a3.clone(), justification.clone()).unwrap();
 
+		#[allow(deprecated)]
+		let blockchain = client.backend().blockchain();
+
 		assert_eq!(
-			client.backend().blockchain().last_finalized().unwrap(),
+			blockchain.last_finalized().unwrap(),
 			a3.hash(),
 		);
 
 		assert_eq!(
-			client.backend().blockchain().justification(BlockId::Hash(a3.hash())).unwrap(),
+			blockchain.justification(BlockId::Hash(a3.hash())).unwrap(),
 			Some(justification),
 		);
 
 		assert_eq!(
-			client.backend().blockchain().justification(BlockId::Hash(a1.hash())).unwrap(),
+			blockchain.justification(BlockId::Hash(a1.hash())).unwrap(),
 			None,
 		);
 
 		assert_eq!(
-			client.backend().blockchain().justification(BlockId::Hash(a2.hash())).unwrap(),
+			blockchain.justification(BlockId::Hash(a2.hash())).unwrap(),
 			None,
 		);
 	}
diff --git a/substrate/core/consensus/aura/src/lib.rs b/substrate/core/consensus/aura/src/lib.rs
index 59483a5688d..554a63de940 100644
--- a/substrate/core/consensus/aura/src/lib.rs
+++ b/substrate/core/consensus/aura/src/lib.rs
@@ -1026,6 +1026,7 @@ mod tests {
 		let mut runtime = current_thread::Runtime::new().unwrap();
 		for (peer_id, key) in peers {
 			let client = net.lock().peer(*peer_id).client().as_full().expect("full clients are created").clone();
+			#[allow(deprecated)]
 			let select_chain = LongestChain::new(
 				client.backend().clone(),
 				client.import_lock().clone(),
diff --git a/substrate/core/consensus/babe/src/lib.rs b/substrate/core/consensus/babe/src/lib.rs
index cccbc160c61..72a4e55a304 100644
--- a/substrate/core/consensus/babe/src/lib.rs
+++ b/substrate/core/consensus/babe/src/lib.rs
@@ -1079,11 +1079,15 @@ mod tests {
 				&inherent_data_providers, config.get()
 			).expect("Registers babe inherent data provider");
 
+
+			#[allow(deprecated)]
+			let select_chain = LongestChain::new(client.backend().clone(), client.import_lock().clone());
+
 			let babe = start_babe(BabeParams {
 				config,
 				local_key: Arc::new(key.clone().into()),
 				block_import: client.clone(),
-				select_chain: LongestChain::new(client.backend().clone(), client.import_lock().clone()),
+				select_chain,
 				client,
 				env: environ.clone(),
 				sync_oracle: DummyOracle,
diff --git a/substrate/core/finality-grandpa/src/environment.rs b/substrate/core/finality-grandpa/src/environment.rs
index 1f3bcbca960..ed50629f471 100644
--- a/substrate/core/finality-grandpa/src/environment.rs
+++ b/substrate/core/finality-grandpa/src/environment.rs
@@ -399,6 +399,7 @@ pub(crate) fn ancestry<B, Block: BlockT<Hash=H256>, E, RA>(
 	if base == block { return Err(GrandpaError::NotDescendent) }
 
 	let tree_route_res = ::client::blockchain::tree_route(
+		#[allow(deprecated)]
 		client.backend().blockchain(),
 		BlockId::Hash(block),
 		BlockId::Hash(base),
@@ -521,6 +522,7 @@ where
 				current_round: HasVoted::Yes(local_id, Vote::Propose(propose)),
 			};
 
+			#[allow(deprecated)]
 			crate::aux_schema::write_voter_set_state(&**self.inner.backend(), &set_state)?;
 
 			Ok(Some(set_state))
@@ -562,6 +564,7 @@ where
 				current_round: HasVoted::Yes(local_id, Vote::Prevote(propose.cloned(), prevote)),
 			};
 
+			#[allow(deprecated)]
 			crate::aux_schema::write_voter_set_state(&**self.inner.backend(), &set_state)?;
 
 			Ok(Some(set_state))
@@ -601,6 +604,7 @@ where
 				current_round: HasVoted::Yes(local_id, Vote::Precommit(propose.clone(), prevote.clone(), precommit)),
 			};
 
+			#[allow(deprecated)]
 			crate::aux_schema::write_voter_set_state(&**self.inner.backend(), &set_state)?;
 
 			Ok(Some(set_state))
@@ -644,6 +648,7 @@ where
 				current_round: HasVoted::No,
 			};
 
+			#[allow(deprecated)]
 			crate::aux_schema::write_voter_set_state(&**self.inner.backend(), &set_state)?;
 
 			Ok(Some(set_state))
@@ -655,8 +660,10 @@ where
 	fn finalize_block(&self, hash: Block::Hash, number: NumberFor<Block>, round: u64, commit: Commit<Block>) -> Result<(), Self::Error> {
 		use client::blockchain::HeaderBackend;
 
-		let status = self.inner.backend().blockchain().info()?;
-		if number <= status.finalized_number && self.inner.backend().blockchain().hash(number)? == Some(hash) {
+		#[allow(deprecated)]
+		let blockchain = self.inner.backend().blockchain();
+		let status = blockchain.info()?;
+		if number <= status.finalized_number && blockchain.hash(number)? == Some(hash) {
 			// This can happen after a forced change (triggered by the finality tracker when finality is stalled), since
 			// the voter will be restarted at the median last finalized block, which can be lower than the local best
 			// finalized block.
@@ -974,6 +981,7 @@ where B: Backend<Block, Blake2Hasher>,
 		}
 
 		let tree_route = client::blockchain::tree_route(
+			#[allow(deprecated)]
 			client.backend().blockchain(),
 			BlockId::Hash(*hash),
 			BlockId::Hash(*base),
diff --git a/substrate/core/finality-grandpa/src/finality_proof.rs b/substrate/core/finality-grandpa/src/finality_proof.rs
index 4cffe0dd981..c80b65741b1 100644
--- a/substrate/core/finality-grandpa/src/finality_proof.rs
+++ b/substrate/core/finality-grandpa/src/finality_proof.rs
@@ -173,6 +173,7 @@ impl<B, E, Block, RA> network::FinalityProofProvider<Block> for FinalityProofPro
 			})?;
 		match request {
 			FinalityProofRequest::Original(request) => prove_finality::<_, _, GrandpaJustification<Block>>(
+				#[allow(deprecated)]
 				&*self.client.backend().blockchain(),
 				&*self.authority_provider,
 				request.authorities_set_id,
diff --git a/substrate/core/finality-grandpa/src/import.rs b/substrate/core/finality-grandpa/src/import.rs
index 1966913c725..6d64ad67784 100644
--- a/substrate/core/finality-grandpa/src/import.rs
+++ b/substrate/core/finality-grandpa/src/import.rs
@@ -317,12 +317,15 @@ where
 					// for the canon block the new authority set should start
 					// with. we use the minimum between the median and the local
 					// best finalized block.
+					
+					#[allow(deprecated)]
 					let best_finalized_number = self.inner.backend().blockchain().info()
 						.map_err(|e| ConsensusError::ClientImport(e.to_string()))?
 						.finalized_number;
 
 					let canon_number = best_finalized_number.min(median_last_finalized_number);
 
+					#[allow(deprecated)]
 					let canon_hash =
 						self.inner.backend().blockchain().header(BlockId::Number(canon_number))
 							.map_err(|e| ConsensusError::ClientImport(e.to_string()))?
@@ -396,6 +399,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA, PRA, SC> BlockImport<Block>
 
 		// early exit if block already in chain, otherwise the check for
 		// authority changes will error when trying to re-import a change block
+		#[allow(deprecated)]
 		match self.inner.backend().blockchain().status(BlockId::Hash(hash)) {
 			Ok(blockchain::BlockStatus::InChain) => return Ok(ImportResult::AlreadyInChain),
 			Ok(blockchain::BlockStatus::Unknown) => {},
diff --git a/substrate/core/finality-grandpa/src/justification.rs b/substrate/core/finality-grandpa/src/justification.rs
index f16824f9246..fc7f833c750 100644
--- a/substrate/core/finality-grandpa/src/justification.rs
+++ b/substrate/core/finality-grandpa/src/justification.rs
@@ -72,6 +72,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
 			loop {
 				if current_hash == commit.target_hash { break; }
 
+				#[allow(deprecated)]
 				match client.backend().blockchain().header(BlockId::Hash(current_hash))? {
 					Some(current_header) => {
 						if *current_header.number() <= commit.target_number {
diff --git a/substrate/core/finality-grandpa/src/lib.rs b/substrate/core/finality-grandpa/src/lib.rs
index 2d08bdc04ea..aee6c16d131 100644
--- a/substrate/core/finality-grandpa/src/lib.rs
+++ b/substrate/core/finality-grandpa/src/lib.rs
@@ -52,7 +52,6 @@
 //! or prune any signaled changes based on whether the signaling block is
 //! included in the newly-finalized chain.
 #![forbid(warnings)]
-#![allow(deprecated)] // FIXME #2532: remove once the refactor is done https://github.com/paritytech/substrate/issues/2532
 
 use futures::prelude::*;
 use log::{debug, info, warn};
@@ -321,6 +320,7 @@ where
 	let genesis_hash = chain_info.chain.genesis_hash;
 
 	let persistent_data = aux_schema::load_persistent(
+		#[allow(deprecated)]
 		&**client.backend(),
 		genesis_hash,
 		<NumberFor<Block>>::zero(),
@@ -430,6 +430,7 @@ fn register_finality_tracker_inherent_data_provider<B, E, Block: BlockT<Hash=H25
 	if !inherent_data_providers.has_provider(&srml_finality_tracker::INHERENT_IDENTIFIER) {
 		inherent_data_providers
 			.register_provider(srml_finality_tracker::InherentDataProvider::new(move || {
+				#[allow(deprecated)]
 				match client.backend().blockchain().info() {
 					Err(e) => Err(std::borrow::Cow::Owned(e.to_string())),
 					Ok(info) => {
@@ -653,6 +654,7 @@ pub fn run_grandpa_voter<B, E, Block: BlockT<Hash=H256>, N, RA, SC, X>(
 						current_round: HasVoted::No,
 					};
 
+					#[allow(deprecated)]
 					aux_schema::write_voter_set_state(&**client.backend(), &set_state)?;
 
 					let set_state: SharedVoterSetState<_> = set_state.into();
@@ -678,6 +680,8 @@ pub fn run_grandpa_voter<B, E, Block: BlockT<Hash=H256>, N, RA, SC, X>(
 					env.update_voter_set_state(|voter_set_state| {
 						let completed_rounds = voter_set_state.completed_rounds();
 						let set_state = VoterSetState::Paused { completed_rounds };
+
+						#[allow(deprecated)]
 						aux_schema::write_voter_set_state(&**client.backend(), &set_state)?;
 						Ok(Some(set_state))
 					})?;
diff --git a/substrate/core/finality-grandpa/src/light_import.rs b/substrate/core/finality-grandpa/src/light_import.rs
index 10143154f9e..9e257e9cccc 100644
--- a/substrate/core/finality-grandpa/src/light_import.rs
+++ b/substrate/core/finality-grandpa/src/light_import.rs
@@ -64,6 +64,7 @@ pub fn light_block_import<B, E, Block: BlockT<Hash=H256>, RA, PRA>(
 		PRA::Api: GrandpaApi<Block>,
 {
 	let info = client.info()?;
+	#[allow(deprecated)]
 	let import_data = load_aux_import_data(info.chain.finalized_hash, &**client.backend(), api)?;
 	Ok(GrandpaLightBlockImport {
 		client,
@@ -291,6 +292,7 @@ fn do_import_finality_proof<B, E, Block: BlockT<Hash=H256>, RA, J>(
 	let authority_set_id = data.authority_set.set_id();
 	let authorities = data.authority_set.authorities();
 	let finality_effects = crate::finality_proof::check_finality_proof(
+		#[allow(deprecated)]
 		&*client.backend().blockchain(),
 		authority_set_id,
 		authorities,
@@ -314,6 +316,7 @@ fn do_import_finality_proof<B, E, Block: BlockT<Hash=H256>, RA, J>(
 
 	// try to import latest justification
 	let finalized_block_hash = finality_effects.block;
+	#[allow(deprecated)]
 	let finalized_block_number = client.backend().blockchain()
 		.expect_block_number_from_id(&BlockId::Hash(finality_effects.block))
 		.map_err(|e| ConsensusError::ClientImport(e.to_string()))?;
@@ -502,6 +505,7 @@ fn require_insert_aux<T: Encode, B, E, Block: BlockT<Hash=H256>, RA>(
 		B: Backend<Block, Blake2Hasher> + 'static,
 		E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
 {
+	#[allow(deprecated)]
 	let backend = &**client.backend();
 	let encoded = value.encode();
 	let update_res = Backend::insert_aux(backend, &[(key, &encoded[..])], &[]);
diff --git a/substrate/core/finality-grandpa/src/observer.rs b/substrate/core/finality-grandpa/src/observer.rs
index 9f6f87f8c40..3fc9665a8df 100644
--- a/substrate/core/finality-grandpa/src/observer.rs
+++ b/substrate/core/finality-grandpa/src/observer.rs
@@ -218,6 +218,7 @@ pub fn run_grandpa_observer<B, E, Block: BlockT<Hash=H256>, N, RA, SC>(
 					let completed_rounds = set_state.read().completed_rounds();
 					let set_state = VoterSetState::Paused { completed_rounds };
 
+					#[allow(deprecated)]
 					crate::aux_schema::write_voter_set_state(&**client.backend(), &set_state)?;
 
 					set_state
@@ -238,6 +239,7 @@ pub fn run_grandpa_observer<B, E, Block: BlockT<Hash=H256>, N, RA, SC>(
 						current_round: HasVoted::No,
 					};
 
+					#[allow(deprecated)]
 					crate::aux_schema::write_voter_set_state(&**client.backend(), &set_state)?;
 
 					set_state
diff --git a/substrate/core/finality-grandpa/src/tests.rs b/substrate/core/finality-grandpa/src/tests.rs
index a64060d01fb..455afb865a1 100644
--- a/substrate/core/finality-grandpa/src/tests.rs
+++ b/substrate/core/finality-grandpa/src/tests.rs
@@ -119,6 +119,7 @@ impl TestNetFactory for GrandpaTestNet {
 	{
 		match client {
 			PeersClient::Full(ref client) => {
+				#[allow(deprecated)]
 				let select_chain = LongestChain::new(
 					client.backend().clone(),
 					client.import_lock().clone()
@@ -676,6 +677,7 @@ fn transition_3_voters_twice_1_full_observer() {
 					"Peer #{} failed to sync", i);
 
 		let set: AuthoritySet<Hash, BlockNumber> = crate::aux_schema::load_authorities(
+			#[allow(deprecated)]
 			&**full_client.backend()
 		).unwrap();
 
@@ -765,6 +767,7 @@ fn transition_3_voters_twice_1_full_observer() {
 				.map(move |()| {
 					let full_client = client.as_full().expect("only full clients are used in test");
 					let set: AuthoritySet<Hash, BlockNumber> = crate::aux_schema::load_authorities(
+						#[allow(deprecated)]
 						&**full_client.backend()
 					).unwrap();
 
@@ -1035,6 +1038,7 @@ fn force_change_to_new_set() {
 
 			let full_client = peer.client().as_full().expect("only full clients are used in test");
 			let set: AuthoritySet<Hash, BlockNumber> = crate::aux_schema::load_authorities(
+				#[allow(deprecated)]
 				&**full_client.backend()
 			).unwrap();
 
@@ -1288,6 +1292,7 @@ fn voter_persists_its_votes() {
 				assert_eq!(net.lock().peer(0).client().info().unwrap().chain.best_number, 40,
 						   "Peer #{} failed to sync", 0);
 
+				#[allow(deprecated)]
 				let block_30_hash =
 					net.lock().peer(0).client().as_full().unwrap().backend().blockchain().hash(30).unwrap().unwrap();
 
diff --git a/substrate/core/network/src/chain.rs b/substrate/core/network/src/chain.rs
index 9548afc9d1a..f7ce4f9d5c1 100644
--- a/substrate/core/network/src/chain.rs
+++ b/substrate/core/network/src/chain.rs
@@ -134,6 +134,7 @@ impl<B, E, Block, RA> Client<Block> for SubstrateClient<B, E, Block, RA> where
 		}
 
 		let tree_route = ::client::blockchain::tree_route(
+			#[allow(deprecated)]
 			self.backend().blockchain(),
 			BlockId::Hash(*block),
 			BlockId::Hash(*base),
diff --git a/substrate/core/network/src/test/mod.rs b/substrate/core/network/src/test/mod.rs
index ac9e9a98eb3..301f5653f14 100644
--- a/substrate/core/network/src/test/mod.rs
+++ b/substrate/core/network/src/test/mod.rs
@@ -143,6 +143,7 @@ impl PeersClient {
 	}
 
 	pub fn as_in_memory_backend(&self) -> InMemoryBackend<Block, Blake2Hasher> {
+		#[allow(deprecated)]
 		match *self {
 			PeersClient::Full(ref client) => client.backend().as_in_memory(),
 			PeersClient::Light(_) => unimplemented!("TODO"),
@@ -150,6 +151,7 @@ impl PeersClient {
 	}
 
 	pub fn get_aux(&self, key: &[u8]) -> ClientResult<Option<Vec<u8>>> {
+		#[allow(deprecated)]
 		match *self {
 			PeersClient::Full(ref client) => client.backend().get_aux(key),
 			PeersClient::Light(ref client) => client.backend().get_aux(key),
diff --git a/substrate/core/service/src/components.rs b/substrate/core/service/src/components.rs
index 6e6503fc3df..202bd15b2a6 100644
--- a/substrate/core/service/src/components.rs
+++ b/substrate/core/service/src/components.rs
@@ -646,6 +646,7 @@ mod tests {
 			from: AccountKeyring::Alice.into(),
 			to: Default::default(),
 		}.into_signed_tx();
+		#[allow(deprecated)]
 		let best = LongestChain::new(client.backend().clone(), client.import_lock())
 			.best_chain().unwrap();
 
diff --git a/substrate/core/sr-api-macros/tests/runtime_calls.rs b/substrate/core/sr-api-macros/tests/runtime_calls.rs
index fb3cad3238e..ca008444e18 100644
--- a/substrate/core/sr-api-macros/tests/runtime_calls.rs
+++ b/substrate/core/sr-api-macros/tests/runtime_calls.rs
@@ -158,6 +158,7 @@ fn record_proof_works() {
 	let client = test_client::new_with_execution_strategy(ExecutionStrategy::Both);
 
 	let block_id = BlockId::Number(client.info().unwrap().chain.best_number);
+	#[allow(deprecated)]
 	let storage_root = LongestChain::new(client.backend().clone(), client.import_lock())
 		.best_chain().unwrap().state_root().clone();
 
diff --git a/substrate/core/test-client/src/trait_tests.rs b/substrate/core/test-client/src/trait_tests.rs
index aa51f7d8bf9..a6da3b206b1 100644
--- a/substrate/core/test-client/src/trait_tests.rs
+++ b/substrate/core/test-client/src/trait_tests.rs
@@ -41,46 +41,49 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
 	//		A1 -> D2
 
 	let client = new_with_backend(backend.clone(), false);
+	let blockchain = backend.blockchain();
 
 	let genesis_hash = client.info().unwrap().chain.genesis_hash;
 
 	assert_eq!(
-		client.backend().blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![genesis_hash]);
 
 	// G -> A1
 	let a1 = client.new_block().unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, a1.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a1.hash()]);
 
 	// A1 -> A2
 	let a2 = client.new_block_at(&BlockId::Hash(a1.hash())).unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, a2.clone()).unwrap();
+
+	#[allow(deprecated)]
 	assert_eq!(
-		client.backend().blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a2.hash()]);
 
 	// A2 -> A3
 	let a3 = client.new_block_at(&BlockId::Hash(a2.hash())).unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, a3.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a3.hash()]);
 
 	// A3 -> A4
 	let a4 = client.new_block_at(&BlockId::Hash(a3.hash())).unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, a4.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a4.hash()]);
 
 	// A4 -> A5
 	let a5 = client.new_block_at(&BlockId::Hash(a4.hash())).unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, a5.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a5.hash()]);
 
 	// A1 -> B2
@@ -95,21 +98,21 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
 	let b2 = builder.bake().unwrap();
 	client.import(BlockOrigin::Own, b2.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a5.hash(), b2.hash()]);
 
 	// B2 -> B3
 	let b3 = client.new_block_at(&BlockId::Hash(b2.hash())).unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, b3.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a5.hash(), b3.hash()]);
 
 	// B3 -> B4
 	let b4 = client.new_block_at(&BlockId::Hash(b3.hash())).unwrap().bake().unwrap();
 	client.import(BlockOrigin::Own, b4.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a5.hash(), b4.hash()]);
 
 	// // B2 -> C3
@@ -124,7 +127,7 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
 	let c3 = builder.bake().unwrap();
 	client.import(BlockOrigin::Own, c3.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a5.hash(), b4.hash(), c3.hash()]);
 
 	// A1 -> D2
@@ -139,7 +142,7 @@ pub fn test_leaves_for_backend<B: 'static>(backend: Arc<B>) where
 	let d2 = builder.bake().unwrap();
 	client.import(BlockOrigin::Own, d2.clone()).unwrap();
 	assert_eq!(
-		backend.blockchain().leaves().unwrap(),
+		blockchain.leaves().unwrap(),
 		vec![a5.hash(), b4.hash(), c3.hash(), d2.hash()]);
 }
 
@@ -154,6 +157,7 @@ pub fn test_children_for_backend<B: 'static>(backend: Arc<B>) where
 	//		A1 -> D2
 
 	let client = new_with_backend(backend.clone(), false);
+	let blockchain = backend.blockchain();
 
 	// G -> A1
 	let a1 = client.new_block().unwrap().bake().unwrap();
@@ -221,16 +225,16 @@ pub fn test_children_for_backend<B: 'static>(backend: Arc<B>) where
 
 	let genesis_hash = client.info().unwrap().chain.genesis_hash;
 
-	let children1 = backend.blockchain().children(a4.hash()).unwrap();
+	let children1 = blockchain.children(a4.hash()).unwrap();
 	assert_eq!(vec![a5.hash()], children1);
 
-	let children2 = backend.blockchain().children(a1.hash()).unwrap();
+	let children2 = blockchain.children(a1.hash()).unwrap();
 	assert_eq!(vec![a2.hash(), b2.hash(), d2.hash()], children2);
 
-	let children3 = backend.blockchain().children(genesis_hash).unwrap();
+	let children3 = blockchain.children(genesis_hash).unwrap();
 	assert_eq!(vec![a1.hash()], children3);
 
-	let children4 = backend.blockchain().children(b2.hash()).unwrap();
+	let children4 = blockchain.children(b2.hash()).unwrap();
 	assert_eq!(vec![b3.hash(), c3.hash()], children4);
 }
 
@@ -242,7 +246,8 @@ pub fn test_blockchain_query_by_number_gets_canonical<B: 'static>(backend: Arc<B
 	//		A1 -> B2 -> B3 -> B4
 	//			  B2 -> C3
 	//		A1 -> D2
-	let client = new_with_backend(backend, false);
+	let client = new_with_backend(backend.clone(), false);
+	let blockchain = backend.blockchain();
 
 	// G -> A1
 	let a1 = client.new_block().unwrap().bake().unwrap();
@@ -310,21 +315,21 @@ pub fn test_blockchain_query_by_number_gets_canonical<B: 'static>(backend: Arc<B
 
 	let genesis_hash = client.info().unwrap().chain.genesis_hash;
 
-	assert_eq!(client.backend().blockchain().header(BlockId::Number(0)).unwrap().unwrap().hash(), genesis_hash);
-	assert_eq!(client.backend().blockchain().hash(0).unwrap().unwrap(), genesis_hash);
+	assert_eq!(blockchain.header(BlockId::Number(0)).unwrap().unwrap().hash(), genesis_hash);
+	assert_eq!(blockchain.hash(0).unwrap().unwrap(), genesis_hash);
 
-	assert_eq!(client.backend().blockchain().header(BlockId::Number(1)).unwrap().unwrap().hash(), a1.hash());
-	assert_eq!(client.backend().blockchain().hash(1).unwrap().unwrap(), a1.hash());
+	assert_eq!(blockchain.header(BlockId::Number(1)).unwrap().unwrap().hash(), a1.hash());
+	assert_eq!(blockchain.hash(1).unwrap().unwrap(), a1.hash());
 
-	assert_eq!(client.backend().blockchain().header(BlockId::Number(2)).unwrap().unwrap().hash(), a2.hash());
-	assert_eq!(client.backend().blockchain().hash(2).unwrap().unwrap(), a2.hash());
+	assert_eq!(blockchain.header(BlockId::Number(2)).unwrap().unwrap().hash(), a2.hash());
+	assert_eq!(blockchain.hash(2).unwrap().unwrap(), a2.hash());
 
-	assert_eq!(client.backend().blockchain().header(BlockId::Number(3)).unwrap().unwrap().hash(), a3.hash());
-	assert_eq!(client.backend().blockchain().hash(3).unwrap().unwrap(), a3.hash());
+	assert_eq!(blockchain.header(BlockId::Number(3)).unwrap().unwrap().hash(), a3.hash());
+	assert_eq!(blockchain.hash(3).unwrap().unwrap(), a3.hash());
 
-	assert_eq!(client.backend().blockchain().header(BlockId::Number(4)).unwrap().unwrap().hash(), a4.hash());
-	assert_eq!(client.backend().blockchain().hash(4).unwrap().unwrap(), a4.hash());
+	assert_eq!(blockchain.header(BlockId::Number(4)).unwrap().unwrap().hash(), a4.hash());
+	assert_eq!(blockchain.hash(4).unwrap().unwrap(), a4.hash());
 
-	assert_eq!(client.backend().blockchain().header(BlockId::Number(5)).unwrap().unwrap().hash(), a5.hash());
-	assert_eq!(client.backend().blockchain().hash(5).unwrap().unwrap(), a5.hash());
+	assert_eq!(blockchain.header(BlockId::Number(5)).unwrap().unwrap().hash(), a5.hash());
+	assert_eq!(blockchain.hash(5).unwrap().unwrap(), a5.hash());
 }
diff --git a/substrate/node-template/src/service.rs b/substrate/node-template/src/service.rs
index 3725833e3db..48e26d1ca5f 100644
--- a/substrate/node-template/src/service.rs
+++ b/substrate/node-template/src/service.rs
@@ -129,6 +129,7 @@ construct_service_factory! {
 			},
 		SelectChain = LongestChain<FullBackend<Self>, Self::Block>
 			{ |config: &FactoryFullConfiguration<Self>, client: Arc<FullClient<Self>>| {
+				#[allow(deprecated)]
 				Ok(LongestChain::new(
 					client.backend().clone(),
 					client.import_lock()
diff --git a/substrate/node/cli/src/service.rs b/substrate/node/cli/src/service.rs
index a4ac1b0660a..bb1c2571556 100644
--- a/substrate/node/cli/src/service.rs
+++ b/substrate/node/cli/src/service.rs
@@ -180,6 +180,7 @@ construct_service_factory! {
 			}},
 		LightImportQueue = AuraImportQueue<Self::Block>
 			{ |config: &FactoryFullConfiguration<Self>, client: Arc<LightClient<Self>>| {
+				#[allow(deprecated)]
 				let fetch_checker = client.backend().blockchain().fetcher()
 					.upgrade()
 					.map(|fetcher| fetcher.checker().clone())
@@ -204,6 +205,7 @@ construct_service_factory! {
 			}},
 		SelectChain = LongestChain<FullBackend<Self>, Self::Block>
 			{ |config: &FactoryFullConfiguration<Self>, client: Arc<FullClient<Self>>| {
+				#[allow(deprecated)]
 				Ok(LongestChain::new(
 					client.backend().clone(),
 					client.import_lock()
diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs
index e2bd3369165..0ec44093b4b 100644
--- a/substrate/node/runtime/src/lib.rs
+++ b/substrate/node/runtime/src/lib.rs
@@ -59,7 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
 	impl_name: create_runtime_str!("substrate-node"),
 	authoring_version: 10,
 	spec_version: 81,
-	impl_version: 82,
+	impl_version: 83,
 	apis: RUNTIME_API_VERSIONS,
 };
 
-- 
GitLab