mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 03:21: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
@@ -16,16 +16,16 @@
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use client::Client;
|
||||
use client_api::{CallExecutor, backend::Backend};
|
||||
use sc_client::Client;
|
||||
use sc_client_api::{CallExecutor, backend::Backend};
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use codec::{Encode, Decode};
|
||||
use grandpa::voter_set::VoterSet;
|
||||
use grandpa::{Error as GrandpaError};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use finality_grandpa::{Error as GrandpaError};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_runtime::traits::{NumberFor, Block as BlockT, Header as HeaderT};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use fg_primitives::AuthorityId;
|
||||
use sp_core::{H256, Blake2Hasher};
|
||||
use sp_finality_grandpa::AuthorityId;
|
||||
|
||||
use crate::{Commit, Error};
|
||||
use crate::communication;
|
||||
@@ -98,7 +98,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
set_id: u64,
|
||||
voters: &VoterSet<AuthorityId>,
|
||||
) -> Result<GrandpaJustification<Block>, ClientError> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
{
|
||||
|
||||
let justification = GrandpaJustification::<Block>::decode(&mut &*encoded)
|
||||
@@ -115,13 +115,13 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
/// Validate the commit and the votes' ancestry proofs.
|
||||
pub(crate) fn verify(&self, set_id: u64, voters: &VoterSet<AuthorityId>) -> Result<(), ClientError>
|
||||
where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps,
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps,
|
||||
{
|
||||
use grandpa::Chain;
|
||||
use finality_grandpa::Chain;
|
||||
|
||||
let ancestry_chain = AncestryChain::<Block>::new(&self.votes_ancestries);
|
||||
|
||||
match grandpa::validate_commit(
|
||||
match finality_grandpa::validate_commit(
|
||||
&self.commit,
|
||||
voters,
|
||||
&ancestry_chain,
|
||||
@@ -136,7 +136,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
let mut visited_hashes = HashSet::new();
|
||||
for signed in self.commit.precommits.iter() {
|
||||
if let Err(_) = communication::check_message_sig::<Block>(
|
||||
&grandpa::Message::Precommit(signed.precommit.clone()),
|
||||
&finality_grandpa::Message::Precommit(signed.precommit.clone()),
|
||||
&signed.id,
|
||||
&signed.signature,
|
||||
self.round,
|
||||
@@ -179,7 +179,7 @@ impl<Block: BlockT<Hash=H256>> GrandpaJustification<Block> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A utility trait implementing `grandpa::Chain` using a given set of headers.
|
||||
/// A utility trait implementing `finality_grandpa::Chain` using a given set of headers.
|
||||
/// This is useful when validating commits, using the given set of headers to
|
||||
/// verify a valid ancestry route to the target commit block.
|
||||
struct AncestryChain<Block: BlockT> {
|
||||
@@ -198,8 +198,8 @@ impl<Block: BlockT> AncestryChain<Block> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<Block: BlockT> grandpa::Chain<Block::Hash, NumberFor<Block>> for AncestryChain<Block> where
|
||||
NumberFor<Block>: grandpa::BlockNumberOps
|
||||
impl<Block: BlockT> finality_grandpa::Chain<Block::Hash, NumberFor<Block>> for AncestryChain<Block> where
|
||||
NumberFor<Block>: finality_grandpa::BlockNumberOps
|
||||
{
|
||||
fn ancestry(&self, base: Block::Hash, block: Block::Hash) -> Result<Vec<Block::Hash>, GrandpaError> {
|
||||
let mut route = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user