mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Make use of NLL in client crate (#1436)
* fix: set edition to 2018 in Cargo.toml. * fix: refactor function to make use of NLL. * fix: result of applying 'cargo fix --edition' command. * fix: removes extern crate * fix: remove module uses from lib.rs * fix: tests imports
This commit is contained in:
committed by
Bastian Köcher
parent
f0b4c87eb5
commit
9151349b2d
@@ -25,12 +25,12 @@ use runtime_primitives::{generic::BlockId, Justification, StorageMap, ChildrenSt
|
||||
use state_machine::{Backend as StateBackend, InMemoryChangesTrieStorage, TrieBackend};
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor, AuthorityIdFor};
|
||||
|
||||
use in_mem;
|
||||
use backend::{AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState};
|
||||
use blockchain::HeaderBackend as BlockchainHeaderBackend;
|
||||
use error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use light::blockchain::{Blockchain, Storage as BlockchainStorage};
|
||||
use light::fetcher::{Fetcher, RemoteReadRequest};
|
||||
use crate::in_mem;
|
||||
use crate::backend::{AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState};
|
||||
use crate::blockchain::HeaderBackend as BlockchainHeaderBackend;
|
||||
use crate::error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use crate::light::blockchain::{Blockchain, Storage as BlockchainStorage};
|
||||
use crate::light::fetcher::{Fetcher, RemoteReadRequest};
|
||||
use hash_db::Hasher;
|
||||
use trie::MemoryDB;
|
||||
use heapsize::HeapSizeOf;
|
||||
|
||||
@@ -24,12 +24,12 @@ use parking_lot::Mutex;
|
||||
use runtime_primitives::{Justification, generic::BlockId};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero, AuthorityIdFor};
|
||||
|
||||
use backend::{AuxStore, NewBlockState};
|
||||
use blockchain::{Backend as BlockchainBackend, BlockStatus, Cache as BlockchainCache,
|
||||
use crate::backend::{AuxStore, NewBlockState};
|
||||
use crate::blockchain::{Backend as BlockchainBackend, BlockStatus, Cache as BlockchainCache,
|
||||
HeaderBackend as BlockchainHeaderBackend, Info as BlockchainInfo};
|
||||
use cht;
|
||||
use error::{ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use light::fetcher::{Fetcher, RemoteHeaderRequest};
|
||||
use crate::cht;
|
||||
use crate::error::{ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use crate::light::fetcher::{Fetcher, RemoteHeaderRequest};
|
||||
|
||||
/// Light client blockchain storage.
|
||||
pub trait Storage<Block: BlockT>: AuxStore + BlockchainHeaderBackend<Block> {
|
||||
@@ -166,8 +166,8 @@ impl<S, F, Block> BlockchainBackend<Block> for Blockchain<S, F> where Block: Blo
|
||||
pub mod tests {
|
||||
use std::collections::HashMap;
|
||||
use test_client::runtime::{Hash, Block, Header};
|
||||
use blockchain::Info;
|
||||
use light::fetcher::tests::OkCallFetcher;
|
||||
use crate::blockchain::Info;
|
||||
use crate::light::fetcher::tests::OkCallFetcher;
|
||||
use super::*;
|
||||
|
||||
pub type DummyBlockchain = Blockchain<DummyStorage, OkCallFetcher>;
|
||||
|
||||
@@ -22,7 +22,7 @@ use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
use futures::{IntoFuture, Future};
|
||||
|
||||
use codec::Encode;
|
||||
use codec::{Encode, Decode};
|
||||
use primitives::{H256, Blake2Hasher, convert_hash};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{As, Block as BlockT, Header as HeaderT};
|
||||
@@ -30,12 +30,11 @@ use state_machine::{self, Backend as StateBackend, CodeExecutor, OverlayedChange
|
||||
create_proof_check_backend, execution_proof_check_on_trie_backend, ExecutionManager};
|
||||
use hash_db::Hasher;
|
||||
|
||||
use blockchain::Backend as ChainBackend;
|
||||
use call_executor::CallExecutor;
|
||||
use error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use light::fetcher::{Fetcher, RemoteCallRequest};
|
||||
use crate::blockchain::Backend as ChainBackend;
|
||||
use crate::call_executor::CallExecutor;
|
||||
use crate::error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use crate::light::fetcher::{Fetcher, RemoteCallRequest};
|
||||
use executor::{RuntimeVersion, NativeVersion};
|
||||
use codec::Decode;
|
||||
use heapsize::HeapSizeOf;
|
||||
use trie::MemoryDB;
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ use runtime_primitives::traits::{As, Block as BlockT, Header as HeaderT, NumberF
|
||||
use state_machine::{CodeExecutor, ChangesTrieRootsStorage, ChangesTrieAnchorBlockId,
|
||||
TrieBackend, read_proof_check, key_changes_proof_check, create_proof_check_backend_storage};
|
||||
|
||||
use cht;
|
||||
use error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use light::blockchain::{Blockchain, Storage as BlockchainStorage};
|
||||
use light::call_executor::check_execution_proof;
|
||||
use crate::cht;
|
||||
use crate::error::{Error as ClientError, ErrorKind as ClientErrorKind, Result as ClientResult};
|
||||
use crate::light::blockchain::{Blockchain, Storage as BlockchainStorage};
|
||||
use crate::light::call_executor::check_execution_proof;
|
||||
|
||||
/// Remote call request.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
@@ -391,17 +391,17 @@ pub mod tests {
|
||||
use futures::future::{ok, err, FutureResult};
|
||||
use parking_lot::Mutex;
|
||||
use keyring::Keyring;
|
||||
use client::tests::prepare_client_with_key_changes;
|
||||
use crate::client::tests::prepare_client_with_key_changes;
|
||||
use executor::{self, NativeExecutionDispatch};
|
||||
use error::Error as ClientError;
|
||||
use crate::error::Error as ClientError;
|
||||
use test_client::{self, TestClient, blockchain::HeaderBackend};
|
||||
use test_client::runtime::{self, Hash, Block, Header};
|
||||
use consensus::BlockOrigin;
|
||||
|
||||
use in_mem::{Blockchain as InMemoryBlockchain};
|
||||
use light::fetcher::{Fetcher, FetchChecker, LightDataChecker,
|
||||
use crate::in_mem::{Blockchain as InMemoryBlockchain};
|
||||
use crate::light::fetcher::{Fetcher, FetchChecker, LightDataChecker,
|
||||
RemoteCallRequest, RemoteHeaderRequest};
|
||||
use light::blockchain::tests::{DummyStorage, DummyBlockchain};
|
||||
use crate::light::blockchain::tests::{DummyStorage, DummyBlockchain};
|
||||
use primitives::{twox_128, Blake2Hasher};
|
||||
use primitives::storage::well_known_keys;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
@@ -454,7 +454,7 @@ pub mod tests {
|
||||
remote_block_header.clone(),
|
||||
None,
|
||||
None,
|
||||
::backend::NewBlockState::Final,
|
||||
crate::backend::NewBlockState::Final,
|
||||
).unwrap();
|
||||
let local_executor = test_client::LocalExecutor::new();
|
||||
let local_checker = LightDataChecker::new(Arc::new(DummyBlockchain::new(DummyStorage::new())), local_executor);
|
||||
|
||||
@@ -28,12 +28,12 @@ use runtime_primitives::BuildStorage;
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use state_machine::{CodeExecutor, ExecutionStrategy};
|
||||
|
||||
use client::Client;
|
||||
use error::Result as ClientResult;
|
||||
use light::backend::Backend;
|
||||
use light::blockchain::{Blockchain, Storage as BlockchainStorage};
|
||||
use light::call_executor::RemoteCallExecutor;
|
||||
use light::fetcher::{Fetcher, LightDataChecker};
|
||||
use crate::client::Client;
|
||||
use crate::error::Result as ClientResult;
|
||||
use crate::light::backend::Backend;
|
||||
use crate::light::blockchain::{Blockchain, Storage as BlockchainStorage};
|
||||
use crate::light::call_executor::RemoteCallExecutor;
|
||||
use crate::light::fetcher::{Fetcher, LightDataChecker};
|
||||
use hash_db::Hasher;
|
||||
|
||||
/// Create an instance of light client blockchain backend.
|
||||
|
||||
Reference in New Issue
Block a user