mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 06:35:45 +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
@@ -18,21 +18,21 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use log::{info, trace, warn};
|
||||
use parking_lot::RwLock;
|
||||
use client::Client;
|
||||
use client_api::{CallExecutor, backend::{AuxStore, Backend, Finalizer}};
|
||||
use sc_client::Client;
|
||||
use sc_client_api::{CallExecutor, backend::{AuxStore, Backend, Finalizer}};
|
||||
use sp_blockchain::{HeaderBackend, Error as ClientError, well_known_cache_keys};
|
||||
use codec::{Encode, Decode};
|
||||
use consensus_common::{
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use sp_consensus::{
|
||||
import_queue::Verifier,
|
||||
BlockOrigin, BlockImport, FinalityProofImport, BlockImportParams, ImportResult, ImportedAux,
|
||||
BlockCheckParams, Error as ConsensusError,
|
||||
};
|
||||
use network::config::{BoxFinalityProofRequestBuilder, FinalityProofRequestBuilder};
|
||||
use sc_network::config::{BoxFinalityProofRequestBuilder, FinalityProofRequestBuilder};
|
||||
use sp_runtime::Justification;
|
||||
use sp_runtime::traits::{NumberFor, Block as BlockT, Header as HeaderT, DigestFor};
|
||||
use fg_primitives::{self, AuthorityList};
|
||||
use sp_finality_grandpa::{self, AuthorityList};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use sp_core::{H256, Blake2Hasher};
|
||||
|
||||
use crate::GenesisAuthoritySetProvider;
|
||||
use crate::aux_schema::load_decode;
|
||||
@@ -120,7 +120,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA> GrandpaLightBlockImport<B, E, Block, RA
|
||||
|
||||
impl<B, E, Block: BlockT<Hash=H256>, RA> BlockImport<Block>
|
||||
for GrandpaLightBlockImport<B, E, Block, RA> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
@@ -148,7 +148,7 @@ impl<B, E, Block: BlockT<Hash=H256>, RA> BlockImport<Block>
|
||||
|
||||
impl<B, E, Block: BlockT<Hash=H256>, RA> FinalityProofImport<Block>
|
||||
for GrandpaLightBlockImport<B, E, Block, RA> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
@@ -194,7 +194,7 @@ impl LightAuthoritySet {
|
||||
/// Get a genesis set with given authorities.
|
||||
pub fn genesis(initial: AuthorityList) -> Self {
|
||||
LightAuthoritySet {
|
||||
set_id: fg_primitives::SetId::default(),
|
||||
set_id: sp_finality_grandpa::SetId::default(),
|
||||
authorities: initial,
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ fn do_import_block<B, C, Block: BlockT<Hash=H256>, J>(
|
||||
+ BlockImport<Block>
|
||||
+ Clone,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
DigestFor<Block>: Encode,
|
||||
J: ProvableJustification<Block::Header>,
|
||||
{
|
||||
@@ -306,7 +306,7 @@ fn do_import_finality_proof<B, C, Block: BlockT<Hash=H256>, J>(
|
||||
+ Clone,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
DigestFor<Block>: Encode,
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
J: ProvableJustification<Block::Header>,
|
||||
{
|
||||
let authority_set_id = data.authority_set.set_id();
|
||||
@@ -369,7 +369,7 @@ fn do_import_justification<B, C, Block: BlockT<Hash=H256>, J>(
|
||||
+ Finalizer<Block, Blake2Hasher, B>
|
||||
+ Clone,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
J: ProvableJustification<Block::Header>,
|
||||
{
|
||||
// with justification, we have two cases
|
||||
@@ -440,7 +440,7 @@ fn do_finalize_block<B, C, Block: BlockT<Hash=H256>>(
|
||||
+ Finalizer<Block, Blake2Hasher, B>
|
||||
+ Clone,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
{
|
||||
// finalize the block
|
||||
client.finalize_block(BlockId::Hash(hash), Some(justification), true).map_err(|e| {
|
||||
@@ -540,11 +540,11 @@ fn on_post_finalization_error(error: ClientError, value_type: &str) -> Consensus
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use consensus_common::ForkChoiceStrategy;
|
||||
use fg_primitives::AuthorityId;
|
||||
use primitives::{H256, crypto::Public};
|
||||
use test_client::client::in_mem::Blockchain as InMemoryAuxStore;
|
||||
use test_client::runtime::{Block, Header};
|
||||
use sp_consensus::ForkChoiceStrategy;
|
||||
use sp_finality_grandpa::AuthorityId;
|
||||
use sp_core::{H256, crypto::Public};
|
||||
use substrate_test_runtime_client::sc_client::in_mem::Blockchain as InMemoryAuxStore;
|
||||
use substrate_test_runtime_client::runtime::{Block, Header};
|
||||
use crate::tests::TestApi;
|
||||
use crate::finality_proof::tests::TestJustification;
|
||||
|
||||
@@ -554,7 +554,7 @@ pub mod tests {
|
||||
|
||||
impl<B, E, Block: BlockT<Hash=H256>, RA> Clone
|
||||
for NoJustificationsImport<B, E, Block, RA> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
@@ -567,7 +567,7 @@ pub mod tests {
|
||||
|
||||
impl<B, E, Block: BlockT<Hash=H256>, RA> BlockImport<Block>
|
||||
for NoJustificationsImport<B, E, Block, RA> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
@@ -594,7 +594,7 @@ pub mod tests {
|
||||
|
||||
impl<B, E, Block: BlockT<Hash=H256>, RA> FinalityProofImport<Block>
|
||||
for NoJustificationsImport<B, E, Block, RA> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
B: Backend<Block, Blake2Hasher> + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + 'static + Clone + Send + Sync,
|
||||
DigestFor<Block>: Encode,
|
||||
@@ -637,7 +637,7 @@ pub mod tests {
|
||||
new_cache: HashMap<well_known_cache_keys::Id, Vec<u8>>,
|
||||
justification: Option<Justification>,
|
||||
) -> ImportResult {
|
||||
let (client, _backend) = test_client::new_light();
|
||||
let (client, _backend) = substrate_test_runtime_client::new_light();
|
||||
let mut import_data = LightImportData {
|
||||
last_finalized: Default::default(),
|
||||
authority_set: LightAuthoritySet::genesis(vec![(AuthorityId::from_slice(&[1; 32]), 1)]),
|
||||
|
||||
Reference in New Issue
Block a user