diff --git a/client/api/src/backend.rs b/client/api/src/backend.rs index 166e47417564d..c3e56e7f8b216 100644 --- a/client/api/src/backend.rs +++ b/client/api/src/backend.rs @@ -169,8 +169,8 @@ pub trait BlockImportOperation { fn mark_head(&mut self, id: BlockId) -> sp_blockchain::Result<()>; } -/// trait for performing operations on the backend -pub trait ClientBackend> { +/// Interface for performing operations on the backend. +pub trait LockImportRun> { /// Lock the import lock, and run operations inside. fn lock_import_and_run(&self, f: F) -> Result where diff --git a/client/finality-grandpa/src/lib.rs b/client/finality-grandpa/src/lib.rs index 49188277a7737..887d30a70cdc0 100644 --- a/client/finality-grandpa/src/lib.rs +++ b/client/finality-grandpa/src/lib.rs @@ -56,7 +56,10 @@ use futures::prelude::*; use futures::StreamExt; use log::{debug, info}; use futures::channel::mpsc; -use sc_client_api::{ClientBackend, BlockchainEvents, CallExecutor, backend::{AuxStore, Backend}, ExecutionStrategy, Finalizer, TransactionFor}; +use sc_client_api::{ + LockImportRun, BlockchainEvents, CallExecutor, + backend::{AuxStore, Backend}, ExecutionStrategy, Finalizer, TransactionFor, +}; use sp_blockchain::{HeaderBackend, Error as ClientError, HeaderMetadata}; use sc_client::Client; use parity_scale_codec::{Decode, Encode}; @@ -259,8 +262,9 @@ impl BlockStatus for Arc where /// A trait that includes all the client functionalities grandpa requires. /// Ideally this would be a trait alias, we're not there yet. +/// tracking issue https://github.com/rust-lang/rust/issues/41517 pub trait ClientForGrandpa: - ClientBackend + Finalizer + AuxStore + LockImportRun + Finalizer + AuxStore + HeaderMetadata + HeaderBackend + BlockchainEvents + ProvideRuntimeApi + BlockImport, Error = sp_consensus::Error> @@ -273,7 +277,7 @@ impl ClientForGrandpa for T where BE: Backend, Block: BlockT, - T: ClientBackend + Finalizer + AuxStore + T: LockImportRun + Finalizer + AuxStore + HeaderMetadata + HeaderBackend + BlockchainEvents + ProvideRuntimeApi + BlockImport, Error = sp_consensus::Error>, diff --git a/client/finality-grandpa/src/tests.rs b/client/finality-grandpa/src/tests.rs index df7204f8ce109..23c7ec9ba8777 100644 --- a/client/finality-grandpa/src/tests.rs +++ b/client/finality-grandpa/src/tests.rs @@ -18,7 +18,10 @@ use super::*; use environment::HasVoted; -use sc_network_test::{Block, Hash, TestNetFactory, BlockImportAdapter, Peer, PeersClient, PassThroughVerifier, PeersFullClient}; +use sc_network_test::{ + Block, Hash, TestNetFactory, BlockImportAdapter, Peer, + PeersClient, PassThroughVerifier, PeersFullClient, +}; use sc_network::config::{ProtocolConfig, Roles, BoxFinalityProofRequestBuilder}; use parking_lot::Mutex; use futures_timer::Delay; diff --git a/client/src/client.rs b/client/src/client.rs index 37dec491f1295..babbaaf7ef74d 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -66,7 +66,7 @@ pub use sc_client_api::{ backend::{ self, BlockImportOperation, PrunableStateChangesTrieStorage, ClientImportOperation, Finalizer, ImportSummary, NewBlockState, - ClientBackend, changes_tries_state_at_block, + LockImportRun, changes_tries_state_at_block, }, client::{ ImportNotifications, FinalityNotification, FinalityNotifications, BlockImportNotification, @@ -218,7 +218,7 @@ impl BlockOf for Client where type Type = Block; } -impl ClientBackend for Client +impl LockImportRun for Client where B: backend::Backend, E: CallExecutor, @@ -258,7 +258,7 @@ impl ClientBackend for Client } } -impl ClientBackend for &Client +impl LockImportRun for &Client where Block: BlockT, B: backend::Backend, diff --git a/client/src/lib.rs b/client/src/lib.rs index a661f45166341..1d279cabad499 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -98,7 +98,7 @@ pub use crate::{ client::{ new_with_backend, new_in_mem, - BlockBody, ImportNotifications, FinalityNotifications, BlockchainEvents, ClientBackend, + BlockBody, ImportNotifications, FinalityNotifications, BlockchainEvents, LockImportRun, BlockImportNotification, Client, ClientInfo, ExecutionStrategies, FinalityNotification, LongestChain, BlockOf, ProvideUncles, BadBlocks, ForkBlocks, apply_aux, },