mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31: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
@@ -25,7 +25,7 @@ use futures::channel::mpsc;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use codec::{Encode, Decode};
|
||||
use hash_db::{Hasher, Prefix};
|
||||
use primitives::{
|
||||
use sp_core::{
|
||||
Blake2Hasher, H256, ChangesTrieConfiguration, convert_hash,
|
||||
NeverNativeValue, ExecutionContext, NativeOrEncoded,
|
||||
storage::{StorageKey, StorageData, well_known_keys, ChildInfo},
|
||||
@@ -40,14 +40,14 @@ use sp_runtime::{
|
||||
ApiRef, ProvideRuntimeApi, SaturatedConversion, One, DigestFor,
|
||||
},
|
||||
};
|
||||
use state_machine::{
|
||||
use sp_state_machine::{
|
||||
DBValue, Backend as StateBackend, ChangesTrieAnchorBlockId, ExecutionStrategy, ExecutionManager,
|
||||
prove_read, prove_child_read, ChangesTrieRootsStorage, ChangesTrieStorage,
|
||||
ChangesTrieTransaction, ChangesTrieConfigurationRange, key_changes, key_changes_proof,
|
||||
OverlayedChanges, BackendTrustLevel, StorageProof, merge_storage_proofs,
|
||||
};
|
||||
use executor::{RuntimeVersion, RuntimeInfo};
|
||||
use consensus::{
|
||||
use sc_executor::{RuntimeVersion, RuntimeInfo};
|
||||
use sp_consensus::{
|
||||
Error as ConsensusError, BlockStatus, BlockImportParams, BlockCheckParams,
|
||||
ImportResult, BlockOrigin, ForkChoiceStrategy,
|
||||
SelectChain, self,
|
||||
@@ -60,9 +60,9 @@ use sp_blockchain::{self as blockchain,
|
||||
};
|
||||
|
||||
use sp_api::{CallRuntimeAt, ConstructRuntimeApi, Core as CoreApi, ProofRecorder, InitializeBlock};
|
||||
use block_builder::BlockBuilderApi;
|
||||
use sc_block_builder::BlockBuilderApi;
|
||||
|
||||
pub use client_api::{
|
||||
pub use sc_client_api::{
|
||||
backend::{
|
||||
self, BlockImportOperation, PrunableStateChangesTrieStorage,
|
||||
ClientImportOperation, Finalizer, ImportSummary, NewBlockState,
|
||||
@@ -88,7 +88,7 @@ type StorageUpdate<B, Block> = <
|
||||
<
|
||||
<B as backend::Backend<Block, Blake2Hasher>>::BlockImportOperation
|
||||
as BlockImportOperation<Block, Blake2Hasher>
|
||||
>::State as state_machine::Backend<Blake2Hasher>>::Transaction;
|
||||
>::State as sp_state_machine::Backend<Blake2Hasher>>::Transaction;
|
||||
type ChangesUpdate<Block> = ChangesTrieTransaction<Blake2Hasher, NumberFor<Block>>;
|
||||
|
||||
/// Substrate Client
|
||||
@@ -144,7 +144,7 @@ impl<H> PrePostHeader<H> {
|
||||
pub fn new_in_mem<E, Block, S, RA>(
|
||||
executor: E,
|
||||
genesis_storage: S,
|
||||
keystore: Option<primitives::traits::BareCryptoStorePtr>,
|
||||
keystore: Option<sp_core::traits::BareCryptoStorePtr>,
|
||||
) -> sp_blockchain::Result<Client<
|
||||
in_mem::Backend<Block, Blake2Hasher>,
|
||||
LocalCallExecutor<in_mem::Backend<Block, Blake2Hasher>, E>,
|
||||
@@ -164,7 +164,7 @@ pub fn new_with_backend<B, E, Block, S, RA>(
|
||||
backend: Arc<B>,
|
||||
executor: E,
|
||||
build_genesis_storage: S,
|
||||
keystore: Option<primitives::traits::BareCryptoStorePtr>,
|
||||
keystore: Option<sp_core::traits::BareCryptoStorePtr>,
|
||||
) -> sp_blockchain::Result<Client<B, LocalCallExecutor<B, E>, Block, RA>>
|
||||
where
|
||||
E: CodeExecutor + RuntimeInfo,
|
||||
@@ -525,7 +525,7 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
}
|
||||
|
||||
impl<'a, Block: BlockT> ChangesTrieStorage<Blake2Hasher, NumberFor<Block>> for AccessedRootsRecorder<'a, Block> {
|
||||
fn as_roots_storage(&self) -> &dyn state_machine::ChangesTrieRootsStorage<Blake2Hasher, NumberFor<Block>> {
|
||||
fn as_roots_storage(&self) -> &dyn sp_state_machine::ChangesTrieRootsStorage<Blake2Hasher, NumberFor<Block>> {
|
||||
self
|
||||
}
|
||||
|
||||
@@ -649,14 +649,14 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
pub fn new_block(
|
||||
&self,
|
||||
inherent_digests: DigestFor<Block>,
|
||||
) -> sp_blockchain::Result<block_builder::BlockBuilder<Block, Self>> where
|
||||
) -> sp_blockchain::Result<sc_block_builder::BlockBuilder<Block, Self>> where
|
||||
E: Clone + Send + Sync,
|
||||
RA: Send + Sync,
|
||||
Self: ProvideRuntimeApi,
|
||||
<Self as ProvideRuntimeApi>::Api: BlockBuilderApi<Block, Error = Error>
|
||||
{
|
||||
let info = self.info();
|
||||
block_builder::BlockBuilder::new(
|
||||
sc_block_builder::BlockBuilder::new(
|
||||
self,
|
||||
info.chain.best_hash,
|
||||
info.chain.best_number,
|
||||
@@ -670,13 +670,13 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
&self,
|
||||
parent: &BlockId<Block>,
|
||||
inherent_digests: DigestFor<Block>,
|
||||
) -> sp_blockchain::Result<block_builder::BlockBuilder<Block, Self>> where
|
||||
) -> sp_blockchain::Result<sc_block_builder::BlockBuilder<Block, Self>> where
|
||||
E: Clone + Send + Sync,
|
||||
RA: Send + Sync,
|
||||
Self: ProvideRuntimeApi,
|
||||
<Self as ProvideRuntimeApi>::Api: BlockBuilderApi<Block, Error = Error>
|
||||
{
|
||||
block_builder::BlockBuilder::new(
|
||||
sc_block_builder::BlockBuilder::new(
|
||||
self,
|
||||
self.expect_block_hash_from_id(parent)?,
|
||||
self.expect_block_number_from_id(parent)?,
|
||||
@@ -694,13 +694,13 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
|
||||
&self,
|
||||
parent: &BlockId<Block>,
|
||||
inherent_digests: DigestFor<Block>,
|
||||
) -> sp_blockchain::Result<block_builder::BlockBuilder<Block, Self>> where
|
||||
) -> sp_blockchain::Result<sc_block_builder::BlockBuilder<Block, Self>> where
|
||||
E: Clone + Send + Sync,
|
||||
RA: Send + Sync,
|
||||
Self: ProvideRuntimeApi,
|
||||
<Self as ProvideRuntimeApi>::Api: BlockBuilderApi<Block, Error = Error>
|
||||
{
|
||||
block_builder::BlockBuilder::new(
|
||||
sc_block_builder::BlockBuilder::new(
|
||||
self,
|
||||
self.expect_block_hash_from_id(parent)?,
|
||||
self.expect_block_number_from_id(parent)?,
|
||||
@@ -1432,7 +1432,7 @@ impl<B, E, Block, RA> CallRuntimeAt<Block> for Client<B, E, Block, RA> where
|
||||
/// NOTE: only use this implementation when you are sure there are NO consensus-level BlockImport
|
||||
/// objects. Otherwise, importing blocks directly into the client would be bypassing
|
||||
/// important verification work.
|
||||
impl<'a, B, E, Block, RA> consensus::BlockImport<Block> for &'a Client<B, E, Block, RA> where
|
||||
impl<'a, B, E, Block, RA> sp_consensus::BlockImport<Block> for &'a Client<B, E, Block, RA> where
|
||||
B: backend::Backend<Block, Blake2Hasher>,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Clone + Send + Sync,
|
||||
Block: BlockT<Hash=H256>,
|
||||
@@ -1507,7 +1507,7 @@ impl<'a, B, E, Block, RA> consensus::BlockImport<Block> for &'a Client<B, E, Blo
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA> where
|
||||
impl<B, E, Block, RA> sp_consensus::BlockImport<Block> for Client<B, E, Block, RA> where
|
||||
B: backend::Backend<Block, Blake2Hasher>,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Clone + Send + Sync,
|
||||
Block: BlockT<Hash=H256>,
|
||||
@@ -1758,7 +1758,7 @@ where
|
||||
)
|
||||
}
|
||||
|
||||
impl<BE, E, B, RA> consensus::block_validation::Chain<B> for Client<BE, E, B, RA>
|
||||
impl<BE, E, B, RA> sp_consensus::block_validation::Chain<B> for Client<BE, E, B, RA>
|
||||
where
|
||||
BE: backend::Backend<B, Blake2Hasher>,
|
||||
E: CallExecutor<B, Blake2Hasher>,
|
||||
@@ -1773,13 +1773,13 @@ impl<BE, E, B, RA> consensus::block_validation::Chain<B> for Client<BE, E, B, RA
|
||||
pub(crate) mod tests {
|
||||
use std::collections::HashMap;
|
||||
use super::*;
|
||||
use primitives::blake2_256;
|
||||
use sp_core::blake2_256;
|
||||
use sp_runtime::DigestItem;
|
||||
use consensus::{BlockOrigin, SelectChain, BlockImport};
|
||||
use test_client::{
|
||||
use sp_consensus::{BlockOrigin, SelectChain, BlockImport};
|
||||
use substrate_test_runtime_client::{
|
||||
prelude::*,
|
||||
client_ext::ClientExt,
|
||||
client_db::{Backend, DatabaseSettings, DatabaseSettingsSrc, PruningMode},
|
||||
sc_client_db::{Backend, DatabaseSettings, DatabaseSettingsSrc, PruningMode},
|
||||
runtime::{self, Block, Transfer, RuntimeApi, TestAPI},
|
||||
};
|
||||
|
||||
@@ -1788,7 +1788,7 @@ pub(crate) mod tests {
|
||||
/// 2) roots of changes tries for these blocks
|
||||
/// 3) test cases in form (begin, end, key, vec![(block, extrinsic)]) that are required to pass
|
||||
pub fn prepare_client_with_key_changes() -> (
|
||||
test_client::client::Client<test_client::Backend, test_client::Executor, Block, RuntimeApi>,
|
||||
substrate_test_runtime_client::sc_client::Client<substrate_test_runtime_client::Backend, substrate_test_runtime_client::Executor, Block, RuntimeApi>,
|
||||
Vec<H256>,
|
||||
Vec<(u64, u64, Vec<u8>, Vec<(u64, u32)>)>,
|
||||
) {
|
||||
@@ -1858,7 +1858,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn client_initializes_from_genesis_ok() {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
assert_eq!(
|
||||
client.runtime_api().balance_of(
|
||||
@@ -1878,7 +1878,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn block_builder_works_with_no_transactions() {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
let builder = client.new_block(Default::default()).unwrap();
|
||||
|
||||
@@ -1889,7 +1889,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn block_builder_works_with_transactions() {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
let mut builder = client.new_block(Default::default()).unwrap();
|
||||
|
||||
@@ -1925,7 +1925,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn block_builder_does_not_include_invalid() {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
let mut builder = client.new_block(Default::default()).unwrap();
|
||||
|
||||
@@ -1987,7 +1987,7 @@ pub(crate) mod tests {
|
||||
fn uncles_with_only_ancestors() {
|
||||
// block tree:
|
||||
// G -> A1 -> A2
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
// G -> A1
|
||||
let a1 = client.new_block(Default::default()).unwrap().bake().unwrap();
|
||||
@@ -2007,7 +2007,7 @@ pub(crate) mod tests {
|
||||
// A1 -> B2 -> B3 -> B4
|
||||
// B2 -> C3
|
||||
// A1 -> D2
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
// G -> A1
|
||||
let a1 = client.new_block(Default::default()).unwrap().bake().unwrap();
|
||||
@@ -2444,7 +2444,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn import_with_justification() {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
// G -> A1
|
||||
let a1 = client.new_block(Default::default()).unwrap().bake().unwrap();
|
||||
@@ -2483,7 +2483,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn importing_diverged_finalized_block_should_trigger_reorg() {
|
||||
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
// G -> A1 -> A2
|
||||
// \
|
||||
@@ -2599,7 +2599,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn get_header_by_block_number_doesnt_panic() {
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
// backend uses u32 for block numbers, make sure we don't panic when
|
||||
// trying to convert
|
||||
@@ -2610,7 +2610,7 @@ pub(crate) mod tests {
|
||||
#[test]
|
||||
fn state_reverted_on_reorg() {
|
||||
let _ = env_logger::try_init();
|
||||
let client = test_client::new();
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
let current_balance = ||
|
||||
client.runtime_api().balance_of(
|
||||
|
||||
Reference in New Issue
Block a user