mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
[big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1. * Unify codec. * Fixing: Phase 2 * Fixing: Phase 3. * Fixing: Phase 4. * Fixing: Phase 5. * Fixing: Phase 6. * Fixing: Phase 7. * Fixing: Phase 8. Tests * Fixing: Phase 9. Tests!!! * Fixing: Phase 10. Moar tests! * Finally done! * More fixes. * Rename primitives:: to sp_core:: * Apply renames in finality-grandpa. * Fix benches. * Fix benches 2. * Revert node-template. * Fix frame-system in our modules.
This commit is contained in:
committed by
Gavin Wood
parent
f14d98a439
commit
8778ca7dc8
@@ -26,13 +26,13 @@ use std::sync::Arc;
|
||||
use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
|
||||
use rpc::{Result as RpcResult, futures::Future};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client::{Client, CallExecutor, light::{blockchain::RemoteBlockchain, fetcher::Fetcher}};
|
||||
use primitives::{
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client::{Client, CallExecutor, light::{blockchain::RemoteBlockchain, fetcher::Fetcher}};
|
||||
use sp_core::{
|
||||
Blake2Hasher, Bytes, H256,
|
||||
storage::{StorageKey, StorageData, StorageChangeSet},
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
use sp_runtime::{
|
||||
traits::{Block as BlockT, ProvideRuntimeApi},
|
||||
};
|
||||
@@ -41,14 +41,14 @@ use sp_api::Metadata;
|
||||
|
||||
use self::error::{Error, FutureResult};
|
||||
|
||||
pub use api::state::*;
|
||||
pub use sc_rpc_api::state::*;
|
||||
|
||||
/// State backend API.
|
||||
pub trait StateBackend<B, E, Block: BlockT, RA>: Send + Sync + 'static
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: sc_client::CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
/// Call runtime method at given block.
|
||||
@@ -187,7 +187,7 @@ pub fn new_full<B, E, Block: BlockT, RA>(
|
||||
) -> State<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
Client<B, E, Block, RA>: ProvideRuntimeApi,
|
||||
@@ -208,7 +208,7 @@ pub fn new_light<B, E, Block: BlockT, RA, F: Fetcher<Block>>(
|
||||
) -> State<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
F: Send + Sync + 'static,
|
||||
@@ -231,7 +231,7 @@ pub struct State<B, E, Block, RA> {
|
||||
impl<B, E, Block, RA> StateApi<Block::Hash> for State<B, E, Block, RA>
|
||||
where
|
||||
Block: BlockT<Hash=H256> + 'static,
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static + Clone,
|
||||
RA: Send + Sync + 'static,
|
||||
{
|
||||
|
||||
@@ -27,20 +27,20 @@ use rpc::{
|
||||
futures::{stream, Future, Sink, Stream, future::result},
|
||||
};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client_api::backend::Backend;
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client_api::backend::Backend;
|
||||
use sp_blockchain::{
|
||||
Result as ClientResult, Error as ClientError, HeaderMetadata, CachedHeaderMetadata
|
||||
};
|
||||
use client::{
|
||||
Client, CallExecutor, BlockchainEvents,
|
||||
use sc_client::{
|
||||
Client, CallExecutor, BlockchainEvents,
|
||||
};
|
||||
use primitives::{
|
||||
use sp_core::{
|
||||
H256, Blake2Hasher, Bytes,
|
||||
storage::{well_known_keys, StorageKey, StorageData, StorageChangeSet, ChildInfo},
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use state_machine::ExecutionStrategy;
|
||||
use sp_version::RuntimeVersion;
|
||||
use sp_state_machine::ExecutionStrategy;
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, NumberFor, ProvideRuntimeApi, SaturatedConversion},
|
||||
|
||||
@@ -38,21 +38,21 @@ use rpc::{
|
||||
futures::stream::Stream,
|
||||
};
|
||||
|
||||
use api::Subscriptions;
|
||||
use client_api::backend::Backend;
|
||||
use sc_rpc_api::Subscriptions;
|
||||
use sc_client_api::backend::Backend;
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use client::{
|
||||
use sc_client::{
|
||||
BlockchainEvents, Client, CallExecutor,
|
||||
light::{
|
||||
blockchain::{future_header, RemoteBlockchain},
|
||||
fetcher::{Fetcher, RemoteCallRequest, RemoteReadRequest, RemoteReadChildRequest},
|
||||
},
|
||||
};
|
||||
use primitives::{
|
||||
use sp_core::{
|
||||
H256, Blake2Hasher, Bytes, OpaqueMetadata,
|
||||
storage::{StorageKey, StorageData, StorageChangeSet},
|
||||
};
|
||||
use runtime_version::RuntimeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
use sp_runtime::{
|
||||
generic::BlockId,
|
||||
traits::Block as BlockT,
|
||||
@@ -711,7 +711,7 @@ fn ignore_error<F, T>(future: F) -> impl std::future::Future<Output=Result<Optio
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rpc::futures::stream::futures_ordered;
|
||||
use test_client::runtime::Block;
|
||||
use substrate_test_runtime_client::runtime::Block;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -21,12 +21,12 @@ use self::error::Error;
|
||||
use std::sync::Arc;
|
||||
use assert_matches::assert_matches;
|
||||
use futures01::stream::Stream;
|
||||
use primitives::storage::{well_known_keys, ChildInfo};
|
||||
use primitives::hash::H256;
|
||||
use sp_core::storage::{well_known_keys, ChildInfo};
|
||||
use sp_core::hash::H256;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use test_client::{
|
||||
use substrate_test_runtime_client::{
|
||||
prelude::*,
|
||||
consensus::BlockOrigin,
|
||||
sp_consensus::BlockOrigin,
|
||||
runtime,
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ fn should_return_child_storage() {
|
||||
let (child_info, child_type) = CHILD_INFO.info();
|
||||
let child_info = StorageKey(child_info.to_vec());
|
||||
let core = tokio::runtime::Runtime::new().unwrap();
|
||||
let client = Arc::new(test_client::TestClientBuilder::new()
|
||||
let client = Arc::new(substrate_test_runtime_client::TestClientBuilder::new()
|
||||
.add_child_storage("test", "key", CHILD_INFO, vec![42_u8])
|
||||
.build());
|
||||
let genesis_hash = client.genesis_hash();
|
||||
@@ -126,7 +126,7 @@ fn should_return_child_storage() {
|
||||
#[test]
|
||||
fn should_call_contract() {
|
||||
let core = tokio::runtime::Runtime::new().unwrap();
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let genesis_hash = client.genesis_hash();
|
||||
let client = new_full(client, Subscriptions::new(Arc::new(core.executor())));
|
||||
|
||||
@@ -143,7 +143,7 @@ fn should_notify_about_storage_changes() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
api.subscribe_storage(Default::default(), subscriber, None.into());
|
||||
@@ -175,7 +175,7 @@ fn should_send_initial_storage_changes_and_notifications() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(remote)));
|
||||
|
||||
let alice_balance_key = blake2_256(&runtime::system::balance_of_key(AccountKeyring::Alice.into()));
|
||||
@@ -360,7 +360,7 @@ fn should_query_storage() {
|
||||
|
||||
// Both hashes invalid.
|
||||
let result = api.query_storage(
|
||||
keys.clone(),
|
||||
keys.clone(),
|
||||
random_hash1,
|
||||
Some(random_hash2),
|
||||
);
|
||||
@@ -375,7 +375,7 @@ fn should_query_storage() {
|
||||
);
|
||||
}
|
||||
|
||||
run_tests(Arc::new(test_client::new()));
|
||||
run_tests(Arc::new(substrate_test_runtime_client::new()));
|
||||
run_tests(Arc::new(TestClientBuilder::new().set_support_changes_trie(true).build()));
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ fn should_split_ranges() {
|
||||
fn should_return_runtime_version() {
|
||||
let core = tokio::runtime::Runtime::new().unwrap();
|
||||
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(core.executor())));
|
||||
|
||||
let result = "{\"specName\":\"test\",\"implName\":\"parity-test\",\"authoringVersion\":1,\
|
||||
@@ -416,7 +416,7 @@ fn should_notify_on_runtime_version_initially() {
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
|
||||
{
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let api = new_full(client.clone(), Subscriptions::new(Arc::new(core.executor())));
|
||||
|
||||
api.subscribe_runtime_version(Default::default(), subscriber);
|
||||
|
||||
Reference in New Issue
Block a user