mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +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
@@ -21,16 +21,16 @@ use std::{
|
||||
thread::sleep,
|
||||
};
|
||||
|
||||
use primitives::offchain::OffchainStorage;
|
||||
use sp_core::offchain::OffchainStorage;
|
||||
use futures::Future;
|
||||
use log::error;
|
||||
use network::{PeerId, Multiaddr, NetworkStateInfo};
|
||||
use sc_network::{PeerId, Multiaddr, NetworkStateInfo};
|
||||
use codec::{Encode, Decode};
|
||||
use primitives::offchain::{
|
||||
use sp_core::offchain::{
|
||||
Externalities as OffchainExt, HttpRequestId, Timestamp, HttpRequestStatus, HttpError,
|
||||
OpaqueNetworkState, OpaquePeerId, OpaqueMultiaddr, StorageKind,
|
||||
};
|
||||
pub use offchain_primitives::STORAGE_PREFIX;
|
||||
pub use sp_offchain::STORAGE_PREFIX;
|
||||
|
||||
#[cfg(not(target_os = "unknown"))]
|
||||
mod http;
|
||||
@@ -282,8 +282,8 @@ impl AsyncApi {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::{convert::{TryFrom, TryInto}, time::SystemTime};
|
||||
use client_db::offchain::LocalStorage;
|
||||
use network::PeerId;
|
||||
use sc_client_db::offchain::LocalStorage;
|
||||
use sc_network::PeerId;
|
||||
|
||||
struct MockNetworkStateInfo();
|
||||
|
||||
@@ -331,7 +331,7 @@ mod tests {
|
||||
|
||||
// Arrange.
|
||||
let now = api.timestamp();
|
||||
let delta = primitives::offchain::Duration::from_millis(100);
|
||||
let delta = sp_core::offchain::Duration::from_millis(100);
|
||||
let deadline = now.add(delta);
|
||||
|
||||
// Act.
|
||||
|
||||
@@ -30,7 +30,7 @@ use bytes::Buf as _;
|
||||
use fnv::FnvHashMap;
|
||||
use futures::{prelude::*, channel::mpsc, compat::Compat01As03};
|
||||
use log::error;
|
||||
use primitives::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError};
|
||||
use sp_core::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError};
|
||||
use std::{fmt, io::Read as _, mem, pin::Pin, task::Context, task::Poll};
|
||||
|
||||
/// Creates a pair of [`HttpApi`] and [`HttpWorker`].
|
||||
@@ -696,7 +696,7 @@ mod tests {
|
||||
use super::http;
|
||||
use futures::prelude::*;
|
||||
use futures01::Future as _;
|
||||
use primitives::offchain::{HttpError, HttpRequestId, HttpRequestStatus, Duration};
|
||||
use sp_core::offchain::{HttpError, HttpRequestId, HttpRequestStatus, Duration};
|
||||
|
||||
// Returns an `HttpApi` whose worker is ran in the background, and a `SocketAddr` to an HTTP
|
||||
// server that runs in the background as well.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Contains the same API as the `http` module, except that everything returns an error.
|
||||
|
||||
use primitives::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError};
|
||||
use sp_core::offchain::{HttpRequestId, Timestamp, HttpRequestStatus, HttpError};
|
||||
use std::{future::Future, pin::Pin, task::Context, task::Poll};
|
||||
|
||||
/// Creates a pair of [`HttpApi`] and [`HttpWorker`].
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Helper methods dedicated to timestamps.
|
||||
|
||||
use primitives::offchain::Timestamp;
|
||||
use sp_core::offchain::Timestamp;
|
||||
use std::convert::TryInto;
|
||||
use std::time::{SystemTime, Duration};
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ use threadpool::ThreadPool;
|
||||
use sp_api::ApiExt;
|
||||
use futures::future::Future;
|
||||
use log::{debug, warn};
|
||||
use network::NetworkStateInfo;
|
||||
use primitives::{offchain::{self, OffchainStorage}, ExecutionContext};
|
||||
use sc_network::NetworkStateInfo;
|
||||
use sp_core::{offchain::{self, OffchainStorage}, ExecutionContext};
|
||||
use sp_runtime::{generic::BlockId, traits::{self, ProvideRuntimeApi}};
|
||||
|
||||
mod api;
|
||||
|
||||
pub use offchain_primitives::{OffchainWorkerApi, STORAGE_PREFIX};
|
||||
pub use sp_offchain::{OffchainWorkerApi, STORAGE_PREFIX};
|
||||
|
||||
/// An offchain workers manager.
|
||||
pub struct OffchainWorkers<Client, Storage, Block: traits::Block> {
|
||||
@@ -146,10 +146,10 @@ impl<Client, Storage, Block> OffchainWorkers<
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::sync::Arc;
|
||||
use network::{Multiaddr, PeerId};
|
||||
use test_client::runtime::Block;
|
||||
use txpool::{BasicPool, FullChainApi};
|
||||
use txpool_api::{TransactionPool, InPoolTransaction};
|
||||
use sc_network::{Multiaddr, PeerId};
|
||||
use substrate_test_runtime_client::runtime::Block;
|
||||
use sc_transaction_pool::{BasicPool, FullChainApi};
|
||||
use sp_transaction_pool::{TransactionPool, InPoolTransaction};
|
||||
|
||||
struct MockNetworkStateInfo();
|
||||
|
||||
@@ -163,9 +163,9 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
struct TestPool(BasicPool<FullChainApi<test_client::TestClient, Block>, Block>);
|
||||
struct TestPool(BasicPool<FullChainApi<substrate_test_runtime_client::TestClient, Block>, Block>);
|
||||
|
||||
impl txpool_api::OffchainSubmitTransaction<Block> for TestPool {
|
||||
impl sp_transaction_pool::OffchainSubmitTransaction<Block> for TestPool {
|
||||
fn submit_at(
|
||||
&self,
|
||||
at: &BlockId<Block>,
|
||||
@@ -181,11 +181,11 @@ mod tests {
|
||||
fn should_call_into_runtime_and_produce_extrinsic() {
|
||||
// given
|
||||
let _ = env_logger::try_init();
|
||||
let client = Arc::new(test_client::new());
|
||||
let client = Arc::new(substrate_test_runtime_client::new());
|
||||
let pool = Arc::new(TestPool(BasicPool::new(Default::default(), FullChainApi::new(client.clone()))));
|
||||
client.execution_extensions()
|
||||
.register_transaction_pool(Arc::downgrade(&pool.clone()) as _);
|
||||
let db = client_db::offchain::LocalStorage::new_test();
|
||||
let db = sc_client_db::offchain::LocalStorage::new_test();
|
||||
let network_state = Arc::new(MockNetworkStateInfo());
|
||||
|
||||
// when
|
||||
|
||||
Reference in New Issue
Block a user