mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
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:
@@ -80,6 +80,12 @@ pub trait BlockBuilderProvider<B, Block, RA>
|
||||
inherent_digests: DigestFor<Block>,
|
||||
record_proof: R,
|
||||
) -> sp_blockchain::Result<BlockBuilder<Block, RA, B>>;
|
||||
|
||||
/// Create a new block, built on the head of the chain.
|
||||
fn new_block(
|
||||
&self,
|
||||
inherent_digests: DigestFor<Block>,
|
||||
) -> sp_blockchain::Result<BlockBuilder<Block, RA, B>>;
|
||||
}
|
||||
|
||||
/// Utility for building new (valid) blocks from a stream of extrinsics.
|
||||
|
||||
@@ -12,6 +12,7 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
sp-application-crypto = { version = "2.0.0-alpha.2", path = "../../../primitives/application-crypto" }
|
||||
sp-consensus-aura = { version = "0.8.0-alpha.2", path = "../../../primitives/consensus/aura" }
|
||||
sp-block-builder = { version = "2.0.0-alpha.2", path = "../../../primitives/block-builder" }
|
||||
sc-block-builder = { version = "0.8.0-alpha.3", path = "../../../client/block-builder" }
|
||||
sc-client = { version = "0.8.0-alpha.2", path = "../../" }
|
||||
sc-client-api = { version = "2.0.0-alpha.2", path = "../../api" }
|
||||
codec = { package = "parity-scale-codec", version = "1.2.0" }
|
||||
|
||||
@@ -833,6 +833,7 @@ mod tests {
|
||||
use sc_client::BlockchainEvents;
|
||||
use sp_consensus_aura::sr25519::AuthorityPair;
|
||||
use std::task::Poll;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
|
||||
type Error = sp_blockchain::Error;
|
||||
|
||||
|
||||
@@ -1407,6 +1407,7 @@ mod test {
|
||||
DefaultTestClientBuilderExt, TestClientBuilder, TestClientBuilderExt,
|
||||
};
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
use sp_consensus::block_validation::DefaultBlockAnnounceValidator;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -23,6 +23,7 @@ use sp_consensus::import_queue::{
|
||||
use substrate_test_runtime_client::{self, prelude::*};
|
||||
use substrate_test_runtime_client::runtime::{Block, Hash};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
use super::*;
|
||||
|
||||
fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>) {
|
||||
|
||||
@@ -27,6 +27,7 @@ sp-runtime = { version = "2.0.0-alpha.2", path = "../../primitives/runtime" }
|
||||
sp-rpc = { version = "2.0.0-alpha.2", path = "../../primitives/rpc" }
|
||||
sp-state-machine = { version = "0.8.0-alpha.2", path = "../../primitives/state-machine" }
|
||||
sc-executor = { version = "0.8.0-alpha.2", path = "../executor" }
|
||||
sc-block-builder = { version = "0.8.0-alpha.2", path = "../../client/block-builder" }
|
||||
sc-keystore = { version = "2.0.0-alpha.2", path = "../keystore" }
|
||||
sp-transaction-pool = { version = "2.0.0-alpha.2", path = "../../primitives/transaction-pool" }
|
||||
sp-blockchain = { version = "2.0.0-alpha.2", path = "../../primitives/blockchain" }
|
||||
|
||||
@@ -22,6 +22,7 @@ use substrate_test_runtime_client::{
|
||||
runtime::{H256, Block, Header},
|
||||
};
|
||||
use sp_rpc::list::ListOrValue;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
|
||||
#[test]
|
||||
fn should_return_header() {
|
||||
|
||||
@@ -23,6 +23,7 @@ use assert_matches::assert_matches;
|
||||
use futures01::stream::Stream;
|
||||
use sp_core::{storage::{well_known_keys, ChildInfo}, ChangesTrieConfiguration};
|
||||
use sp_core::hash::H256;
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use substrate_test_runtime_client::{
|
||||
prelude::*,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user