[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:
Tomasz Drwięga
2019-12-16 13:36:49 +01:00
committed by Gavin Wood
parent f14d98a439
commit 8778ca7dc8
485 changed files with 4023 additions and 4005 deletions
+4 -4
View File
@@ -7,11 +7,11 @@ edition = "2018"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
sp-api-proc-macro = { path = "proc-macro" }
primitives = { package = "sp-core", path = "../core", default-features = false }
sp-core = { path = "../core", default-features = false }
sp-std = { path = "../std", default-features = false }
sp-runtime = { path = "../runtime", default-features = false }
sp-version = { path = "../version", default-features = false }
state-machine = { package = "sp-state-machine", path = "../../primitives/state-machine", optional = true }
sp-state-machine = { path = "../../primitives/state-machine", optional = true }
[dev-dependencies]
sp-test-primitives = { path = "../test-primitives" }
@@ -20,9 +20,9 @@ sp-test-primitives = { path = "../test-primitives" }
default = [ "std" ]
std = [
"codec/std",
"primitives/std",
"sp-core/std",
"sp-std/std",
"sp-runtime/std",
"state-machine",
"sp-state-machine",
"sp-version/std",
]
+6 -6
View File
@@ -35,13 +35,13 @@ extern crate self as sp_api;
#[doc(hidden)]
#[cfg(feature = "std")]
pub use state_machine::{OverlayedChanges, StorageProof};
pub use sp_state_machine::{OverlayedChanges, StorageProof};
#[doc(hidden)]
#[cfg(feature = "std")]
pub use primitives::NativeOrEncoded;
pub use sp_core::NativeOrEncoded;
#[doc(hidden)]
#[cfg(not(feature = "std"))]
pub use primitives::to_substrate_wasm_fn_return_value;
pub use sp_core::to_substrate_wasm_fn_return_value;
#[doc(hidden)]
pub use sp_runtime::{
traits::{
@@ -51,7 +51,7 @@ pub use sp_runtime::{
generic::BlockId, transaction_validity::TransactionValidity,
};
#[doc(hidden)]
pub use primitives::{offchain, ExecutionContext};
pub use sp_core::{offchain, ExecutionContext};
#[doc(hidden)]
pub use sp_version::{ApiId, RuntimeVersion, ApisVec, create_apis_vec};
#[doc(hidden)]
@@ -60,7 +60,7 @@ pub use sp_std::{slice, mem};
use sp_std::result;
#[doc(hidden)]
pub use codec::{Encode, Decode};
use primitives::OpaqueMetadata;
use sp_core::OpaqueMetadata;
#[cfg(feature = "std")]
use std::{panic::UnwindSafe, cell::RefCell};
@@ -223,7 +223,7 @@ pub use sp_api_proc_macro::impl_runtime_apis;
#[cfg(feature = "std")]
/// A type that records all accessed trie nodes and generates a proof out of it.
pub type ProofRecorder<B> = state_machine::ProofRecorder<
pub type ProofRecorder<B> = sp_state_machine::ProofRecorder<
<<<B as BlockT>::Header as HeaderT>::Hashing as HashT>::Hasher
>;
+4 -4
View File
@@ -6,19 +6,19 @@ edition = "2018"
[dependencies]
sp-api = { path = "../" }
test-client = { package = "substrate-test-runtime-client", path = "../../../test-utils/runtime/client" }
substrate-test-runtime-client = { path = "../../../test-utils/runtime/client" }
sp-version = { path = "../../version" }
sp-runtime = { path = "../../runtime" }
sp-blockchain = { path = "../../blockchain" }
consensus_common = { package = "sp-consensus", path = "../../../primitives/consensus/common" }
sp-consensus = { path = "../../../primitives/consensus/common" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
state-machine = { package = "sp-state-machine", path = "../../../primitives/state-machine" }
sp-state-machine = { path = "../../../primitives/state-machine" }
trybuild = "1.0.17"
rustversion = "1.0.0"
[dev-dependencies]
criterion = "0.3.0"
test-client = { package = "substrate-test-runtime-client", path = "../../../test-utils/runtime/client" }
substrate-test-runtime-client = { path = "../../../test-utils/runtime/client" }
[[bench]]
name = "bench"
@@ -15,16 +15,16 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use criterion::{Criterion, criterion_group, criterion_main};
use test_client::{
use substrate_test_runtime_client::{
DefaultTestClientBuilderExt, TestClientBuilder,
TestClientBuilderExt, runtime::TestAPI,
};
use sp_runtime::{generic::BlockId, traits::ProvideRuntimeApi};
use state_machine::ExecutionStrategy;
use sp_state_machine::ExecutionStrategy;
fn sp_api_benchmark(c: &mut Criterion) {
c.bench_function("add one with same runtime api", |b| {
let client = test_client::new();
let client = substrate_test_runtime_client::new();
let runtime_api = client.runtime_api();
let block_id = BlockId::Number(client.info().chain.best_number);
@@ -32,14 +32,14 @@ fn sp_api_benchmark(c: &mut Criterion) {
});
c.bench_function("add one with recreating runtime api", |b| {
let client = test_client::new();
let client = substrate_test_runtime_client::new();
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| client.runtime_api().benchmark_add_one(&block_id, &1))
});
c.bench_function("vector add one with same runtime api", |b| {
let client = test_client::new();
let client = substrate_test_runtime_client::new();
let runtime_api = client.runtime_api();
let block_id = BlockId::Number(client.info().chain.best_number);
let data = vec![0; 1000];
@@ -48,7 +48,7 @@ fn sp_api_benchmark(c: &mut Criterion) {
});
c.bench_function("vector add one with recreating runtime api", |b| {
let client = test_client::new();
let client = substrate_test_runtime_client::new();
let block_id = BlockId::Number(client.info().chain.best_number);
let data = vec![0; 1000];
@@ -18,7 +18,7 @@ use sp_api::{RuntimeApiInfo, decl_runtime_apis, impl_runtime_apis};
use sp_runtime::{traits::{GetNodeBlockType, Block as BlockT}, generic::BlockId};
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
use sp_blockchain::Result;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
@@ -81,8 +81,11 @@ impl_runtime_apis! {
}
}
type TestClient = test_client::client::Client<
test_client::Backend, test_client::Executor, Block, RuntimeApi
type TestClient = substrate_test_runtime_client::sc_client::Client<
substrate_test_runtime_client::Backend,
substrate_test_runtime_client::Executor,
Block,
RuntimeApi,
>;
#[test]
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use test_client::{
use substrate_test_runtime_client::{
prelude::*,
DefaultTestClientBuilderExt, TestClientBuilder,
runtime::{TestAPI, DecodeFails, Transfer, Header},
@@ -23,12 +23,12 @@ use sp_runtime::{
generic::BlockId,
traits::{ProvideRuntimeApi, Header as HeaderT, Hash as HashT},
};
use state_machine::{
use sp_state_machine::{
ExecutionStrategy, create_proof_check_backend,
execution_proof_check_on_trie_backend,
};
use consensus_common::SelectChain;
use sp_consensus::SelectChain;
use codec::Encode;
fn calling_function_with_strat(strat: ExecutionStrategy) {
@@ -1,5 +1,5 @@
use sp_runtime::traits::GetNodeBlockType;
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.
@@ -1,5 +1,5 @@
use sp_runtime::traits::GetNodeBlockType;
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.
@@ -1,5 +1,5 @@
use sp_runtime::traits::{GetNodeBlockType, Block as BlockT};
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.
@@ -1,5 +1,5 @@
use sp_runtime::traits::GetNodeBlockType;
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.
@@ -1,5 +1,5 @@
use sp_runtime::traits::GetNodeBlockType;
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.
@@ -1,5 +1,5 @@
use sp_runtime::traits::GetNodeBlockType;
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.
@@ -1,5 +1,5 @@
use sp_runtime::traits::{GetNodeBlockType, Block as BlockT};
use test_client::runtime::Block;
use substrate_test_runtime_client::runtime::Block;
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
/// trait are done by the `construct_runtime!` macro in a real runtime.