removes use of sc_client::Client from node-transaction-factory (#5158)

* removes use of sc_client::Client from node-transaction-factory

* move sc-block-builder to [dev-dependencies] in substrate-test-runtime
This commit is contained in:
Seun Lanlege
2020-03-12 19:19:38 +01:00
committed by GitHub
parent 6f2aaf9d11
commit 3193b0d4aa
19 changed files with 60 additions and 43 deletions
+15 -22
View File
@@ -544,28 +544,6 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
Ok((storage, configs))
}
/// Create a new block, built on the head of the chain.
pub fn new_block(
&self,
inherent_digests: DigestFor<Block>,
) -> sp_blockchain::Result<sc_block_builder::BlockBuilder<Block, Self, B>> where
E: Clone + Send + Sync,
RA: Send + Sync,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: BlockBuilderApi<Block, Error = Error> +
ApiExt<Block, StateBackend = backend::StateBackendFor<B, Block>>
{
let info = self.chain_info();
sc_block_builder::BlockBuilder::new(
self,
info.best_hash,
info.best_number,
RecordProof::No,
inherent_digests,
&self.backend,
)
}
/// Apply a checked and validated block to an operation. If a justification is provided
/// then `finalized` *must* be true.
fn apply_block(
@@ -1201,6 +1179,21 @@ impl<B, E, Block, RA> BlockBuilderProvider<B, Block, Self> for Client<B, E, Bloc
&self.backend
)
}
fn new_block(
&self,
inherent_digests: DigestFor<Block>,
) -> sp_blockchain::Result<sc_block_builder::BlockBuilder<Block, Self, B>> {
let info = self.chain_info();
sc_block_builder::BlockBuilder::new(
self,
info.best_hash,
info.best_number,
RecordProof::No,
inherent_digests,
&self.backend,
)
}
}
impl<B, E, Block, RA> ExecutorProvider<Block> for Client<B, E, Block, RA> where
@@ -297,6 +297,7 @@ mod tests {
use crate::in_mem::Backend as InMemBackend;
use sc_client_api::ProofProvider;
use sp_runtime::traits::BlakeTwo256;
use sc_block_builder::BlockBuilderProvider;
struct DummyCallExecutor;
+1
View File
@@ -351,6 +351,7 @@ pub mod tests {
use sp_state_machine::Backend;
use super::*;
use sc_client_api::{StorageProvider, ProofProvider};
use sc_block_builder::BlockBuilderProvider;
const CHILD_INFO_1: ChildInfo<'static> = ChildInfo::new_default(b"unique_id_1");